/***************************************************************************
 *   Copyright (C) 2025 by David C. Rankin                                      *
 *   david@niflheim                                                               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#ifndef _KGENERICBACKLIGHTWIDGET_H_
#define _KGENERICBACKLIGHTWIDGET_H_

#include <kapplication.h>

#include "kgenericbacklightwidgetbase.h"
#include "sysfsblpath.h"

class kgenericbacklightWidget : public kgenericbacklightWidgetBase
{
    Q_OBJECT

    int brightness,             /* value read from ACPI_VIDEO/brightness */
        max_brightness,         /* value read from ACPI_VIDEO/max_brightness */
        start_brightness,       /* saved copy of initial brightness */
        tickinterval,           /* slider tickinterval */
        pagestep,               /* slider pagestep */
        linestep;               /* slider & spinbox linestep */
    QString sysclasspath,       /* holding ACPI_VIDEO */
            blpath,             /* holding ACPI_VIDEO/brightness */
            maxblpath,          /* holding ACPI_VIDEO/max_brightness */
            strmaxbrightness;   /* holding string for max_brightness */
    bool validbliface;          /* flag - valid backlight interfac found */
    sysfsBlPath *sysfsbl;       /* pointer to sysfs backlight */

    /* dbus calls to get username property and set backlight brightness */
    int dbusGetProperty (QString &result, const char *iface, const char *name);
    int dbusSetBrightness (int value);

    /* computer slider tick interval and pagestep, and widget linestep */
    int get_sliderTickInterval();
    int get_sliderPageStep();
    int get_lineStep();

    /* errror messagebox functions */
    void kmbx_noValidBacklight();

  public:
    kgenericbacklightWidget (QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
    ~kgenericbacklightWidget();

    /*$PUBLIC_FUNCTIONS$*/
    QString str_max_brightness();
    bool get_validBlIface();

  public slots:
    /*$PUBLIC_SLOTS$*/
    virtual void set_backlight (int b);
    // virtual void btnClose_clicked();


  protected:
    /*$PROTECTED_FUNCTIONS$*/
    virtual void btnClose_clicked();
    virtual bool queryClose();

  protected slots:
    /*$PROTECTED_SLOTS$*/
    virtual void languageChange();

};

#endif

