#ifndef GENERALPAGE_H
#define GENERALPAGE_H

#include <memory>
#include <QWidget>
#include <QLabel>
#include <QGSettings/QGSettings>
#include <QRadioButton>
#include <QPushButton>
#include <QScrollArea>
#include "libukcc/widgets/SettingWidget/settinggroup.h"

using namespace std;

class GeneralPage : public QWidget
{
    Q_OBJECT
public:
    explicit GeneralPage(QWidget *parent = nullptr);
    ~GeneralPage();
    void updateCloseMode(bool isHideToTray);
    void openUkuiControlCenter();
signals:
    void sigMinimizeToTrayChanged(bool isMinimizeToTray);

private slots:
    void onWindowActionChanged(int id);

private:
    void initLayout();
    void initConnection();
    void loadConfig();

private:
    // 模型选项
    QLabel *m_modelTitleLabel = nullptr;
    SettingGroup *m_modelGroup = nullptr;

    UkccFrame *m_modelFrame = nullptr;
    QLabel *m_modelLabel = nullptr;
    QPushButton *m_modelSettingButton = nullptr;

    // 窗口选项
    QLabel *m_titleLabel = nullptr;
    SettingGroup *m_pageGroup = nullptr;

    UkccFrame *m_windowFrame = nullptr;
    QLabel *m_windowLabel = nullptr;
    QRadioButton *m_minimizeToTrayRadio = nullptr;
    QRadioButton *m_directExitRadio = nullptr;
    QButtonGroup *m_windowActionGroup = nullptr;

    QWidget *m_scrollWidget = nullptr;
    QScrollArea *m_scrollArea = nullptr;

    bool isMinimizeToTray = true; // 默认最小化到托盘
};

#endif // GENERALPAGE_H
