| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef OPTIONSDIALOG_H |
| 6 | #define OPTIONSDIALOG_H |
| 7 | |
| 8 | #include <QtWidgets/QDialog> |
| 9 | #include <QMap> |
| 10 | |
| 11 | class QHBoxLayout; |
| 12 | class QVBoxLayout; |
| 13 | class QLineEdit; |
| 14 | class QListView; |
| 15 | class QLabel; |
| 16 | class QSpacerItem; |
| 17 | class QStringListModel; |
| 18 | class QStackedWidget; |
| 19 | class PageWidget; |
| 20 | |
| 21 | class OptionsDialog : public QDialog |
| 22 | { |
| 23 | Q_OBJECT |
| 24 | public: |
| 25 | explicit OptionsDialog(QWidget *parent = nullptr); |
| 26 | bool insertOptionPanel(const QString &itemName, PageWidget *panel); |
| 27 | |
| 28 | public slots: |
| 29 | void slotLeftBarClicked(const QModelIndex &index); |
| 30 | void saveSingleConfig(); |
| 31 | void saveAllConfig(); |
| 32 | |
| 33 | private: |
| 34 | void setupUi(QDialog *Dialog); |
| 35 | void readConfig(); |
| 36 | void findOption(const QString &filter); |
| 37 | |
| 38 | protected: |
| 39 | virtual void showEvent(QShowEvent *e) override; |
| 40 | QLineEdit *filterEdit = nullptr; |
| 41 | QListView * = nullptr; |
| 42 | QLabel *headTitle = nullptr; |
| 43 | QString activeOptName {}; |
| 44 | QMap<QString, PageWidget *> widgts{}; |
| 45 | QStringListModel *leftBarModel = nullptr; |
| 46 | QStackedWidget *stackWidget = nullptr; |
| 47 | }; |
| 48 | |
| 49 | #endif // OPTIONSDIALOG_H |
| 50 | |