| 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 FCITXQTCONFIGPLUGIN_H |
| 21 |
#define FCITXQTCONFIGPLUGIN_H |
| 22 |
|
| 23 |
#include "fcitxqtwidgetsaddons_export.h" |
| 24 |
#include <QtCore/QObject> |
| 25 |
#include <QtCore/QString> |
| 26 |
#include <QtCore/QStringList> |
| 27 |
|
| 28 |
class FcitxQtConfigUIWidget; |
| 29 |
|
| 30 |
/** |
| 31 |
* interface for qt config ui |
| 32 |
*/ |
| 33 |
struct FCITXQTWIDGETSADDONS_EXPORT FcitxQtConfigUIFactoryInterface { |
| 34 |
/** |
| 35 |
* return the name for plugin |
| 36 |
*/ |
| 37 |
virtual QString name() = 0; |
| 38 |
|
| 39 |
/** |
| 40 |
* create new widget based on key |
| 41 |
* |
| 42 |
* @see FcitxQtConfigUIPlugin::files |
| 43 |
* |
| 44 |
* @return plugin name |
| 45 |
*/ |
| 46 |
virtual FcitxQtConfigUIWidget *create(const QString &key) = 0; |
| 47 |
|
| 48 |
/** |
| 49 |
* return a list that this plugin will handle, need to be consist with |
| 50 |
* the file path in config file |
| 51 |
* |
| 52 |
* @return support file list |
| 53 |
*/ |
| 54 |
virtual QStringList files() = 0; |
| 55 |
|
| 56 |
/** |
| 57 |
* return gettext domain, due to some reason, fcitx doesn't use qt's i18n |
| 58 |
* feature |
| 59 |
* but gettext |
| 60 |
* |
| 61 |
* @return domain of gettext |
| 62 |
*/ |
| 63 |
virtual QString domain() = 0; |
| 64 |
}; |
| 65 |
|
| 66 |
#define FcitxQtConfigUIFactoryInterface_iid \ |
| 67 |
"org.fcitx.Fcitx.FcitxQtConfigUIFactoryInterface" |
| 68 |
Q_DECLARE_INTERFACE(FcitxQtConfigUIFactoryInterface, |
| 69 |
FcitxQtConfigUIFactoryInterface_iid) |
| 70 |
|
| 71 |
/** |
| 72 |
* base class for qt config ui |
| 73 |
*/ |
| 74 |
class FCITXQTWIDGETSADDONS_EXPORT FcitxQtConfigUIPlugin |
| 75 |
: public QObject, |
| 76 |
public FcitxQtConfigUIFactoryInterface { |
| 77 |
Q_OBJECT |
| 78 |
Q_INTERFACES(FcitxQtConfigUIFactoryInterface) |
| 79 |
public: |
| 80 |
explicit FcitxQtConfigUIPlugin(QObject *parent = 0); |
| 81 |
virtual ~FcitxQtConfigUIPlugin(); |
| 82 |
}; |
| 83 |
|
| 84 |
#endif // FCITXCONFIGPLUGIN_H |