| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 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(); |
| 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 |
}; |