| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2018-2018 CSSlayer <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
* |
| 6 |
*/ |
| 7 |
#ifndef _PINYINDICTMANAGER_PINYINDICTMANAGER_H_ |
| 8 |
#define _PINYINDICTMANAGER_PINYINDICTMANAGER_H_ |
| 9 |
|
| 10 |
#include "filelistmodel.h" |
| 11 |
#include "pipeline.h" |
| 12 |
#include "ui_pinyindictmanager.h" |
| 13 |
#include <fcitxqtconfiguiwidget.h> |
| 14 |
|
| 15 |
namespace fcitx { |
| 16 |
|
| 17 |
class PinyinDictManager : public FcitxQtConfigUIWidget, |
| 18 |
public Ui::PinyinDictManager { |
| 19 |
Q_OBJECT |
| 20 |
public: |
| 21 |
PinyinDictManager(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 importFromFile(); |
| 31 |
void importFromSogou(); |
| 32 |
void importFromSogouOnline(); |
| 33 |
void removeDict(); |
| 34 |
void removeAllDict(); |
| 35 |
void clearUserDict(); |
| 36 |
void clearAllDict(); |
| 37 |
void openUserDirectory(); |
| 38 |
|
| 39 |
private: |
| 40 |
QString confirmImportFileName(const QString &defaultName); |
| 41 |
QString prepareDirectory(); |
| 42 |
QString prepareTempFile(const QString &tempFileTemplate); |
| 43 |
QString checkOverwriteFile(const QString &dirName, |
| 44 |
const QString &importName); |
| 45 |
void reload(); |
| 46 |
|
| 47 |
QAction *importFromFileAction_; |
| 48 |
QAction *importFromSogou_; |
| 49 |
QAction *importFromSogouOnline_; |
| 50 |
QAction *clearUserDictAction_; |
| 51 |
QAction *clearAllDataAction_; |
| 52 |
|
| 53 |
FileListModel *model_; |
| 54 |
|
| 55 |
Pipeline *pipeline_; |
| 56 |
}; |
| 57 |
|
| 58 |
} // namespace fcitx |
| 59 |
|
| 60 |
#endif // _PINYINDICTMANAGER_PINYINDICTMANAGER_H_ |