23 #ifndef __IP2CUPDATER_H__ 24 #define __IP2CUPDATER_H__ 28 #include <QNetworkReply> 30 class FixedNetworkAccessManager;
55 void downloadDatabase();
56 const QByteArray& downloadedData();
58 const QString& filePath()
const {
return pathToFile; }
73 bool hasDownloadedData()
const {
return !retrievedData.isEmpty(); }
74 bool hasRollbackData()
const {
return !rollbackData.isEmpty(); }
76 bool isWorking()
const;
115 void setFilePath(
const QString& filePath) { pathToFile = filePath; }
122 void downloadProgress(qint64 value, qint64 max);
129 static const QUrl dbChecksumUrl();
130 static const QUrl dbDownloadUrl();
132 FixedNetworkAccessManager* pNetworkAccessManager;
133 QNetworkReply* pCurrentNetworkReply;
144 QByteArray retrievedData;
145 QByteArray rollbackData;
148 void get(
const QUrl &url,
const char *finishedSlot);
149 bool handleRedirect(QNetworkReply &reply,
const char *finishedSlot);
150 bool save(
const QByteArray& saveWhat);
153 void checksumDownloadFinished();
154 void downloadFinished();
IP2CUpdater is responsible for downloading a new version of database from the site.
bool getRollbackData()
Obtains rollback data from pathToFile file.
void databaseDownloadFinished(const QByteArray &downloadedData)
In case of failure the downloadedData array will be empty.
bool rollback()
Saves data to the pathToFile file. This data must be first obtained through the rollback method...
void needsUpdate(const QString &filePath)
Checks if IP2C file must be updated.
bool saveDownloadedData()
Saves recently downloaded data to the pathToFile file.
void updateNeeded(int status)
Emitted status is one of UpdateStatus enum values.