IP2CUpdater is responsible for downloading a new version of database from the site. More...
#include <ip2cupdater.h>
Public Types | |
enum | UpdateStatus { UpToDate, UpdateNeeded, UpdateCheckError } |
Signals | |
void | databaseDownloadFinished (const QByteArray &downloadedData) |
In case of failure the downloadedData array will be empty. More... | |
void | downloadProgress (qint64 value, qint64 max) |
void | updateNeeded (int status) |
Emitted status is one of UpdateStatus enum values. More... | |
Public Member Functions | |
IP2CUpdater (QObject *parent=NULL) | |
void | downloadDatabase () |
const QByteArray & | downloadedData () |
const QString & | filePath () const |
bool | getRollbackData () |
Obtains rollback data from pathToFile file. More... | |
bool | hasDownloadedData () const |
bool | hasRollbackData () const |
bool | isWorking () const |
void | needsUpdate (const QString &filePath) |
Checks if IP2C file must be updated. More... | |
bool | rollback () |
Saves data to the pathToFile file. This data must be first obtained through the rollback method. More... | |
bool | saveDownloadedData () |
Saves recently downloaded data to the pathToFile file. More... | |
void | setFilePath (const QString &filePath) |
IP2CUpdater is responsible for downloading a new version of database from the site.
NetworkManager class from Wadseeker library is used to communicate with WWW site. As IP2C class remains the core of the whole system for more information refer to there.
Definition at line 40 of file ip2cupdater.h.
|
signal |
In case of failure the downloadedData array will be empty.
bool IP2CUpdater::getRollbackData | ( | ) |
Obtains rollback data from pathToFile file.
This will always clear previous rollback data. You can keep only one instance of rollback file at a time.
Definition at line 185 of file ip2cupdater.cpp.
void IP2CUpdater::needsUpdate | ( | const QString & | filePath | ) |
Checks if IP2C file must be updated.
The call is asynchronous as the locally stored database is compared against the one hosted online on Doomseeker's web page. Once it completes, an updateNeeded() signal is emitted.
filePath | - Path to the file. It is assumed that this is the IP2Country database file. |
Definition at line 211 of file ip2cupdater.cpp.
bool IP2CUpdater::rollback | ( | ) |
Saves data to the pathToFile file. This data must be first obtained through the rollback method.
If there is nothing to rollback this will do nothing. This will also clear previously obtained rollback data.
Definition at line 225 of file ip2cupdater.cpp.
bool IP2CUpdater::saveDownloadedData | ( | ) |
Saves recently downloaded data to the pathToFile file.
This will do nothing if there is no downloaded data.
Definition at line 252 of file ip2cupdater.cpp.
|
signal |
Emitted status is one of UpdateStatus enum values.