2019-11-08 15:05:21 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QSplitter>
|
|
|
|
#include <QTreeWidgetItem>
|
2020-02-13 17:35:54 +01:00
|
|
|
|
2019-11-08 15:05:21 +01:00
|
|
|
#include "masterdialog.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class DictionaryManagerDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class DictionaryManagerDialog : public MasterDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
struct Dictionary {
|
|
|
|
QString name;
|
|
|
|
QString pathPart;
|
|
|
|
QString fileNamePart;
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DictionaryManagerDialog(QWidget *parent = nullptr);
|
|
|
|
~DictionaryManagerDialog();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotReplyFinished(QNetworkReply *);
|
|
|
|
|
|
|
|
void on_downloadButton_clicked();
|
|
|
|
|
|
|
|
void on_downloadCancelButton_clicked();
|
|
|
|
|
|
|
|
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
|
|
|
|
|
|
|
|
void on_deleteLocalDictionaryButton_clicked();
|
|
|
|
|
|
|
|
void on_remoteDictionaryTreeWidget_itemSelectionChanged();
|
|
|
|
|
|
|
|
void on_localDictionaryTreeWidget_itemSelectionChanged();
|
|
|
|
|
|
|
|
void on_searchDictionaryEdit_textChanged(const QString &arg1);
|
|
|
|
|
2023-01-26 16:58:47 +05:00
|
|
|
void on_remoteDictionaryTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column);
|
2019-11-08 15:05:21 +01:00
|
|
|
|
2019-11-12 17:39:53 +01:00
|
|
|
void on_disableExternalDictionariesCheckBox_toggled(bool checked);
|
|
|
|
|
2019-11-08 15:05:21 +01:00
|
|
|
private:
|
|
|
|
Ui::DictionaryManagerDialog *ui;
|
|
|
|
QNetworkAccessManager *_networkManager;
|
|
|
|
QSplitter *_mainSplitter;
|
|
|
|
QList<Dictionary> _dictionaryList;
|
|
|
|
|
|
|
|
void setupMainSplitter();
|
|
|
|
|
|
|
|
void storeSettings();
|
2019-12-13 13:07:18 +05:00
|
|
|
void addDictionaryItem(const QString &name, const QString &pathPart,
|
|
|
|
QString fileNamePart = QString());
|
2019-11-08 15:05:21 +01:00
|
|
|
void downloadFile(const QString &url);
|
|
|
|
void loadLocalDictionaries();
|
|
|
|
QString getDictionaryName(const QString &fileNamePart);
|
|
|
|
bool deleteLocalDictionaryFile(const QString &fileName);
|
|
|
|
};
|