Debian Codegraph @

qt5/quickphrase-editor/editor.h

raw
1 /***************************************************************************
2 * Copyright (C) 2012~2012 by CSSlayer *
3 * [email protected] *
4 * *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 * *
18 ***************************************************************************/
19
20 #ifndef FCITX_TOOLS_GUI_EDITOR_H
21 #define FCITX_TOOLS_GUI_EDITOR_H
22
23 #include "fcitxqtconfiguiwidget.h"
24 #include "model.h"
25 #include <QDir>
26 #include <QMainWindow>
27 #include <QMutex>
28
29 class QAbstractItemModel;
30 class CMacroTable;
31 namespace Ui {
32 class Editor;
33 }
34
35 namespace fcitx {
36
37 class FileListModel;
38
39 class ListEditor : public FcitxQtConfigUIWidget {
40 Q_OBJECT
41 public:
42 explicit ListEditor(QWidget *parent = 0);
43 virtual ~ListEditor();
44
45 virtual void load();
46 virtual void save();
47 virtual QString title();
48 virtual QString addon();
49 virtual bool asyncSave();
50
51 void loadFileList();
52
53 public Q_SLOTS:
54 void batchEditAccepted();
55 void removeFileTriggered();
56 void addFileTriggered();
57 void refreshListTriggered();
58 void changeFile(int);
59
60 private Q_SLOTS:
61 void addWord();
62 void batchEditWord();
63 void deleteWord();
64 void deleteAllWord();
65 void itemFocusChanged();
66 void addWordAccepted();
67 void importData();
68 void exportData();
69 void importFileSelected();
70 void exportFileSelected();
71
72 private:
73 void load(const QString &file);
74 void save(const QString &file);
75 QString currentFile();
76 QString currentName();
77 Ui::Editor *m_ui;
78 QuickPhraseModel *m_model;
79 FileListModel *m_fileListModel;
80 QMenu *m_operationMenu;
81 QString m_lastFile;
82 };
83 } // namespace fcitx
84
85 #endif // FCITX_TOOLS_GUI_EDITOR_H