Debian Codegraph @

src/view/ChewingEditor.h

raw symbols SCIP
1 /*
2 * chewing-editor: Chewing userphrase editor
3 * Copyright (C) 2014 Chewing Development Team
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 2 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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include <memory>
23
24 #include <QShortcut>
25 #include <QFileDialog>
26 #include <QMainWindow>
27
28 #include "UserphraseDialog.h"
29 #include "Notification.h"
30 #include "UserphraseSortFilterProxyModel.h"
31
32 namespace Ui {
33 class ChewingEditor;
34 }
35
36 class ChewingEditor final: public QMainWindow
37 {
38 Q_OBJECT
39
40 public:
41 explicit ChewingEditor(QWidget *parent = 0);
42 ChewingEditor(const ChewingEditor&) = delete;
43 ChewingEditor& operator=(const ChewingEditor&) = delete;
44 ~ChewingEditor(); // = default;
45
46 public slots:
47 void selectImportFile();
48 void selectExportFile();
49 void finishFileSelection(const QString& file);
50 void showAbout();
51 void showDeleteConfirmWindow();
52
53 private:
54 enum DialogType {
55 DIALOG_IMPORT,
56 DIALOG_EXPORT,
57 };
58
59 void setupFileSelection();
60 void setupImport();
61 void setupExport();
62 void setupAdd();
63 void setupRemove();
64 void setupRefresh();
65 void setupUndo();
66 void setupFilter();
67 void setupAboutWidget();
68 void importUserphrase(const QString& file);
69 void exportUserphrase(const QString& file);
70
71 void execFileDialog(DialogType type);
72
73 std::unique_ptr<Ui::ChewingEditor> ui_;
74
75 UserphraseModel *model_;
76 UserphraseSortFilterProxyModel *proxyModel_;
77
78 QFileDialog *fileDialog_;
79 DialogType dialogType_;
80
81 QShortcut *shortcut_add_, *shortcut_modify_, *shortcut_remove_,
82 *shortcut_refresh_, *shortcut_import_, *shortcut_export_,
83 *shortcut_exit_;
84 };