/*
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
*
* 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 3, 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, see <http://www.gnu.org/licenses/&gt;.
*
*/
#ifndef SCROLLINGAREAWIDGETMAJOR_H
#define SCROLLINGAREAWIDGETMAJOR_H

#include <QObject>
#include <QWidget>
#include <QSlider>
#include <QHBoxLayout>
#include <QLabel>
#include <QIcon>
#include <QDebug>
#include <QGSettings>
#include <QEvent>
#include <QMouseEvent>
#include <QProcess>
#include "../commondata.h"

#define UKUI_QT_STYLE          "org.ukui.style"
#define UKUI_QT_STYLE_NAME_KEY "styleName"

#define UKUI_VOLUME_BRIGHTNESS_GSETTING_ID "org.ukui.quick-operation.panel"
#define UKUI_VOLUME_KEY "volumesize"
#define UKUI_MUTE_KEY   "soundstate"

#define KYLIN_POWER_MODE_GSETTING_VALUE        "org.ukui.power-manager"
#define UKUI_BRIGHTNESS_KEY                    "brightnessAc"

class SliderButtonMajor;

class ScrollingAreaWidgetMajor : public QWidget
{
    Q_OBJECT
public:
    ScrollingAreaWidgetMajor(QWidget *parent = nullptr);

private:
    void initMemberVariable();
    void initGsettingValue();
    void initSlideStatus();
    void initLayout();
    void setVolumeStatusIcon(int value);
    void setLightStatusIcon(int value);
    void initGsettingStyleValue();
    void setScrollWidget();

private:
    QVBoxLayout *m_pVMainLayout;
    QString m_bModelStatus;
    QWidget     *m_pVolumeWidget;
    QLabel      *m_pVolumeIconLabel;
    SliderButtonMajor     *m_pVolumeSlide;
    QHBoxLayout *m_pHVolumeLayout;

    QWidget     *m_pBrightNessWidget;
    QLabel      *m_pBrightIconLabel;
    SliderButtonMajor     *m_pBrightSlide;
    QHBoxLayout *m_pBrightLayout;

    QGSettings  *m_pVolumeLightSetting = nullptr;
    QGSettings  *m_pBrightNessSetting  = nullptr;
    QGSettings  *m_pTabletModeStyleGsetting;

    PictureToWhite *m_pPictureToWhite;
    bool            m_bBacklitFile;

private slots:
    void setSliderValue(QString key);
    void setVolumeSlideSlots(int value);
    void setBrightSlideSlots(int value);
    void setVoice(int num);
    void setBright(int num);
};


class SliderButtonMajor : public QSlider
{
    Q_OBJECT
public:
    explicit SliderButtonMajor(QWidget *parent = 0);

    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);

    QGSettings *m_pVolumeLightSetting;


    bool clickState = false;
    int i = 0;

Q_SIGNALS:
    void ycoordinate(int num);


};

#endif // SCROLLINGAREAWIDGETMAJOR_H
