23 #ifndef __IP2CUPDATER_H__ 24 #define __IP2CUPDATER_H__ 28 #include <QNetworkReply> 52 void downloadDatabase(
const QString &savePath);
53 const QByteArray& downloadedData();
68 bool hasDownloadedData()
const {
return !retrievedData.isEmpty(); }
69 bool hasRollbackData()
const {
return !rollbackData.isEmpty(); }
71 bool isWorking()
const;
98 bool rollback(
const QString &savePath);
115 void downloadProgress(qint64 value, qint64 max);
122 static const QUrl dbChecksumUrl();
123 static const QUrl dbDownloadUrl();
125 QNetworkAccessManager* pNetworkAccessManager;
126 QNetworkReply* pCurrentNetworkReply;
128 QString lastAsyncCallPath;
129 QByteArray retrievedData;
130 QByteArray rollbackData;
133 void get(
const QUrl &url,
const char *finishedSlot);
134 bool handleRedirect(QNetworkReply &reply,
const char *finishedSlot);
135 bool save(
const QByteArray& saveWhat,
const QString &savePath);
138 void checksumDownloadFinished();
139 void downloadFinished();
IP2CUpdater is responsible for downloading a new version of database from the site.
void databaseDownloadFinished(const QByteArray &downloadedData)
In case of failure the downloadedData array will be empty.
bool saveDownloadedData(const QString &savePath)
Saves recently downloaded data to the specified file.
bool getRollbackData(const QString &databasePath)
Obtains rollback data from specified file.
void needsUpdate(const QString &filePath)
Checks if IP2C file must be updated.
bool rollback(const QString &savePath)
Saves rollback data to the specified file. This data must be first obtained through the getRollbackDa...
void updateNeeded(int status)
Emitted status is one of UpdateStatus enum values.