A class to check the existence of a new version of the application on the network. More...
Public Member Functions | |
QtlMovieNewVersion (bool silent, bool autoDelete, QtlMovieSettings *settings, QtlLogger *log, QObject *parent=0) | |
Constructor. More... | |
Private Slots | |
void | downloadLatestVersion () |
Invoked when the user wants to download the last version. More... | |
void | httpCompleted (bool success, const QUrl &url, const QString &response, const QString &mimeType) |
Invoked when the Web request is completed. More... | |
void | releaseNotesCompleted (bool success, const QUrl &url, const QString &response, const QString &mimeType) |
Invoked when the Web request for release notes is completed. More... | |
Private Member Functions | |
QtlMovieNewVersion () Q_DECL_EQ_DELETE | |
void | displayReleaseNotes () |
Display the new version message with release notes. More... | |
void | fail (const QString &message) |
Terminate the operation with error. More... | |
void | succeed () |
Terminate the operation with success. More... | |
Private Attributes | |
bool | _autoDelete |
Delete itself after completion of all requests. More... | |
QtlVersion | _currentVersion |
Current version of the application. More... | |
QString | _latestUrl |
Download URL of the latest available version. More... | |
QtlVersion | _latestVersion |
Latest available version of the application. More... | |
QtlLogger * | _log |
Message logger. More... | |
bool | _newerVersion |
Newer version found. More... | |
QtlSimpleWebRequest | _newVersionRequest |
Web request for new version. More... | |
QString | _releaseNotes |
Text of the release notes. More... | |
QtlSimpleWebRequest | _releaseNotesRequest |
Web request for the content of the release notes. More... | |
QtlMovieSettings * | _settings |
Application settings. More... | |
bool | _silent |
Do not report the errors or absence of new version. More... | |
QString | _statusMessage |
Message to display about the new version. More... | |
A class to check the existence of a new version of the application on the network.
This class requires the cooperation of a server. An instance of this class sends a Web request to a server using a cookie describing the current platform (a Base64-encoded JSON structure). The server is responsible for finding a new version for this platform, if available, and returns the response as a JSON structure.
For debug purpose, the environment variable QTLMOVIE_NEWVERSION_URL can be set to an alternate server. If this URL is defined, it overrides any application-defined URL.
QtlMovieNewVersion::QtlMovieNewVersion | ( | bool | silent, |
bool | autoDelete, | ||
QtlMovieSettings * | settings, | ||
QtlLogger * | log, | ||
QObject * | parent = 0 |
||
) |
Constructor.
The search for a new version is automatically started.
[in] | silent | If true, do not report the errors or absence of new version. |
[in] | autoDelete | If true, this object deletes itself after completion of all requests. |
[in] | settings | Application settings. |
[in] | log | Message logger. |
[in] | parent | Optional parent object. |
|
private |
|
privateslot |
Invoked when the Web request is completed.
[in] | success | True on success, false on error (network error for instance). |
[in] | url | URL of the returned content. May not be the same as the original URL is some redirection occured. |
[in] | response | If success is true, contains the text of the response. If status is false, contains an error message. |
[in] | mimeType | If success is true, contains the MIME type of the response. |
|
privateslot |
Invoked when the Web request for release notes is completed.
[in] | success | True on success, false on error (network error for instance). |
[in] | url | URL of the returned content. May not be the same as the original URL is some redirection occured. |
[in] | response | If success is true, contains the text of the response. If status is false, contains an error message. |
[in] | mimeType | If success is true, contains the MIME type of the response. |
|
privateslot |
Invoked when the user wants to download the last version.
|
private |
Terminate the operation with error.
[in] | message | Error message. |
|
private |
Terminate the operation with success.
|
private |
Display the new version message with release notes.
|
private |
Application settings.
|
private |
Message logger.
|
private |
Do not report the errors or absence of new version.
|
private |
Delete itself after completion of all requests.
|
private |
Current version of the application.
|
private |
Web request for new version.
|
private |
Web request for the content of the release notes.
|
private |
Latest available version of the application.
|
private |
Download URL of the latest available version.
|
private |
Newer version found.
|
private |
Message to display about the new version.
|
private |
Text of the release notes.