*******************************************************************************/
-//Created by Mateusz Półrola
+/*!
+ \file XdxfDictDownloader.h
+ \author Mateusz Półrola <mateusz.polrola@comarch.pl>
+ */
#ifndef XDXFDICTDOWNLOADER_H
#define XDXFDICTDOWNLOADER_H
#include <QNetworkReply>
#include <DownloadDict.h>
#include "XdxfDictDownloadProgressDialog.h"
+#include "../../include/Notify.h"
+/** XdxfDictDownloader is responsible for getting dict list from XDXF website
+ and other actions necessary to download and add dictionary
+
+ When user want to add dictionary he may choose "browse" or "download",
+ after selecting "download" XDXFDictDownloader would present him list of
+ dictionaries and when he select one downloading would be started. Next
+ step is to extract archive and move file to ~/.mdictionary
+*/
class XdxfDictDownloader : public QObject {
Q_OBJECT
public:
XdxfDictDownloader(QObject *parent = 0);
+ //! \return name of downloaded file
QString downloadedFile();
public Q_SLOTS:
+ //! downloads dictionaries list from xdxf website
void download(QWidget* parent);
Q_SIGNALS:
+ //! emmited when file download precess is complete
void fileDownloaded(QString);
+ //! emitted to inform user about errors and warnings
+ void notify(Notify::NotifyType, QString);
private Q_SLOTS:
+ //! obtained list of dictionaries from website
void dictListReceived(QNetworkReply*);
+
+ //! one of system processes finished
void processFinished(int);
+ //! user cancel downloading
+ void breakDownloading();
+
private:
+ //! dict is downloaded and unpacked
void downloadComplete();
QList<DownloadDict> dicts;
QWidget* parentDialog;
int currentCommand;
QProcess* process;
QString _fileName;
+ bool downloadError;
+ bool aborted;
+ QNetworkAccessManager *manager;
};
#endif // XDXFDICTDOWNLOADER_H