Debian Codegraph @

gui/customphraseeditor/customphraseeditor.h

raw
1 /*
2 * SPDX-FileCopyrightText: 2023~2023 CSSlayer <[email protected]>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-or-later
5 *
6 */
7 #ifndef _CUSTOMPHRASEEDITOR_CUSTOMPHRASEEDITOR_H_
8 #define _CUSTOMPHRASEEDITOR_CUSTOMPHRASEEDITOR_H_
9
10 #include "customphrasemodel.h"
11 #include "ui_customphraseeditor.h"
12 #include <QFileSystemWatcher>
13 #include <fcitxqtconfiguiwidget.h>
14
15 namespace fcitx {
16
17 class CustomPhraseEditor : public FcitxQtConfigUIWidget,
18 public Ui::CustomPhraseEditor {
19 Q_OBJECT
20 public:
21 CustomPhraseEditor(QWidget *parent);
22
23 void load() override;
24 void save() override;
25 QString title() override;
26 bool asyncSave() override;
27 QString icon() override { return "fcitx-pinyin"; }
28
29 private Q_SLOTS:
30 void addPhrase();
31 void addPhraseAccepted();
32 void removePhrase();
33 void clear();
34 void openExternal();
35
36 private:
37 void updated();
38 void connectFileWatcher();
39 void disconnectFileWatcher();
40
41 CustomPhraseModel *model_;
42 QFileSystemWatcher watcher_;
43 QString userFile_;
44 };
45
46 } // namespace fcitx
47
48 #endif // _CUSTOMPHRASEEDITOR_CUSTOMPHRASEEDITOR_H_