| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2012~2017 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
*/ |
| 6 |
#ifndef _WIDGETSADDONS_FCITXQTCONFIGUIWIDGET_H_ |
| 7 |
#define _WIDGETSADDONS_FCITXQTCONFIGUIWIDGET_H_ |
| 8 |
|
| 9 |
#include "fcitx5qt5widgetsaddons_export.h" |
| 10 |
#include <QtWidgets/QWidget> |
| 11 |
|
| 12 |
namespace fcitx { |
| 13 |
|
| 14 |
/** |
| 15 |
* embedded gui for custom configuration |
| 16 |
**/ |
| 17 |
class FCITX5QT5WIDGETSADDONS_EXPORT FcitxQtConfigUIWidget : public QWidget { |
| 18 |
Q_OBJECT |
| 19 |
public: |
| 20 |
explicit FcitxQtConfigUIWidget(QWidget *parent = 0); |
| 21 |
|
| 22 |
/** |
| 23 |
* load the configuration, usually, this is being called upon a "reset" |
| 24 |
*button clicked |
| 25 |
* the outer gui will not call it for you for the first time, your |
| 26 |
*initialization might |
| 27 |
* want to call it by yourself. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
**/ |
| 31 |
virtual void load() = 0; |
| 32 |
|
| 33 |
/** |
| 34 |
* save the configuration |
| 35 |
* |
| 36 |
* @see asyncSave saveFinished |
| 37 |
**/ |
| 38 |
virtual void save() = 0; |
| 39 |
|
| 40 |
/** |
| 41 |
* window title |
| 42 |
* |
| 43 |
* @return window title |
| 44 |
**/ |
| 45 |
virtual QString title() = 0; |
| 46 |
|
| 47 |
/** |
| 48 |
* return the icon name of the window, see QIcon::fromTheme |
| 49 |
* |
| 50 |
* @return icon name |
| 51 |
**/ |
| 52 |
virtual QString icon(); |
| 53 |
|
| 54 |
/** |
| 55 |
* return the save function is async or not, default implementation is false |
| 56 |
* |
| 57 |
* @return bool |
| 58 |
**/ |
| 59 |
virtual bool asyncSave(); |
| 60 |
|
| 61 |
Q_SIGNALS: |
| 62 |
/** |
| 63 |
* the configuration is changed or not, used to indicate parent gui |
| 64 |
* |
| 65 |
* @param changed is config changed |
| 66 |
**/ |
| 67 |
void changed(bool changed); |
| 68 |
|
| 69 |
/** |
| 70 |
* if asyncSave return true, be sure to Q_EMIT this signal on all case |
| 71 |
* |
| 72 |
* @see asyncSave |
| 73 |
**/ |
| 74 |
void saveFinished(); |
| 75 |
|
| 76 |
/// Save config for a specified path. |
| 77 |
void saveSubConfig(const QString &path); |
| 78 |
}; |
| 79 |
} // namespace fcitx |
| 80 |
|
| 81 |
#endif // _WIDGETSADDONS_FCITXQTCONFIGUIWIDGET_H_ |