| 1 |
/*************************************************************************** |
| 2 |
* Copyright (C) 2012~2012 by CSSlayer * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify * |
| 5 |
* it under the terms of the GNU General Public License as published by * |
| 6 |
* the Free Software Foundation; either version 2 of the License, or * |
| 7 |
* (at your option) any later version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, * |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 12 |
* GNU General Public License for more details. * |
| 13 |
* * |
| 14 |
* You should have received a copy of the GNU General Public License * |
| 15 |
* along with this program; if not, write to the * |
| 16 |
* Free Software Foundation, Inc., * |
| 17 |
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * |
| 18 |
***************************************************************************/ |
| 19 |
|
| 20 |
#ifndef FCITXQTCONFIGUIWIDGET_H |
| 21 |
#define FCITXQTCONFIGUIWIDGET_H |
| 22 |
#include "fcitxqtwidgetsaddons_export.h" |
| 23 |
#include <QtWidgets/QWidget> |
| 24 |
|
| 25 |
/** |
| 26 |
* embedded gui for custom configuration |
| 27 |
**/ |
| 28 |
class FCITXQTWIDGETSADDONS_EXPORT FcitxQtConfigUIWidget : public QWidget { |
| 29 |
Q_OBJECT |
| 30 |
public: |
| 31 |
explicit FcitxQtConfigUIWidget(QWidget *parent = 0); |
| 32 |
|
| 33 |
/** |
| 34 |
* load the configuration, usually, this is being called upon a "reset" |
| 35 |
*button clicked |
| 36 |
* the outer gui will not call it for you for the first time, your |
| 37 |
*initialization might |
| 38 |
* want to call it by yourself. |
| 39 |
* |
| 40 |
* @return void |
| 41 |
**/ |
| 42 |
virtual void load() = 0; |
| 43 |
|
| 44 |
/** |
| 45 |
* save the configuration |
| 46 |
* |
| 47 |
* @see asyncSave saveFinished |
| 48 |
**/ |
| 49 |
virtual void save() = 0; |
| 50 |
|
| 51 |
/** |
| 52 |
* window title |
| 53 |
* |
| 54 |
* @return window title |
| 55 |
**/ |
| 56 |
virtual QString title() = 0; |
| 57 |
|
| 58 |
/** |
| 59 |
* return the addon name it belongs to |
| 60 |
* |
| 61 |
* @return addon name |
| 62 |
**/ |
| 63 |
virtual QString addon() = 0; |
| 64 |
|
| 65 |
/** |
| 66 |
* return the icon name of the window, see QIcon::fromTheme |
| 67 |
* |
| 68 |
* @return icon name |
| 69 |
**/ |
| 70 |
virtual QString icon(); |
| 71 |
|
| 72 |
/** |
| 73 |
* return the save function is async or not, default implementation is false |
| 74 |
* |
| 75 |
* @return bool |
| 76 |
**/ |
| 77 |
virtual bool asyncSave(); |
| 78 |
|
| 79 |
Q_SIGNALS: |
| 80 |
/** |
| 81 |
* the configuration is changed or not, used to indicate parent gui |
| 82 |
* |
| 83 |
* @param changed is config changed |
| 84 |
**/ |
| 85 |
void changed(bool changed); |
| 86 |
|
| 87 |
/** |
| 88 |
* if asyncSave return true, be sure to emit this signal on all case |
| 89 |
* |
| 90 |
* @see asyncSave |
| 91 |
**/ |
| 92 |
void saveFinished(); |
| 93 |
}; |
| 94 |
|
| 95 |
#endif // FCITXCONFIGUIWIDGET_H |