#include <HttpDownloader.h>
Signals | |
void | downloadFinished (int errorID) |
Emitted when download is finished. | |
void | progressMaxValue (int value) |
Emitted from void DownloadProgress(int ready, int total) to update the download progressbar maximum value. | |
void | progressCurrentValue (int value) |
Emitted from void DownloadProgress(int ready, int total) to update the download progressbar value. | |
void | setFileLabelText (const QString &text) |
emitted from StartDownload(const QByteArray &encodedHost, const QByteArray &encodedPath, QIODevice *target, bool showProgressDialog) to show the name of the file being downloaded in the dialog. | |
void | setTitleLabelText (const QString &text) |
Emitted from void HandleUiLanguageChange() to update the title of the Dialog when language is changed. | |
Public Member Functions | |
HttpDownloader (QWidget *parent=0) | |
void | StartDownload (const QByteArray &encodedHost, const QByteArray &encodedPath, QIODevice *target, bool showProgressDialog) |
Start downloading a file. | |
int | getErrorID () |
Get ID of last error. | |
QString | getErrorString () |
Get description of last error. | |
void | HandleUiLanguageChange () |
Reload the texts in elemnets. | |
QString | getLastAttemptedDownloadAddress () |
Get the adress of last last attmepted download. | |
Protected Slots | |
void | DownloadProgress (int ready, int total) |
Keeps track of the download progress. | |
void | DownloadReady (bool error) |
Notified when download is finished and passes the notification to parent. | |
Protected Member Functions | |
void | changeEvent (QEvent *e) |
Private Attributes | |
Ui::HttpDownloader * | m_ui |
Pointer to ui of the download progress dialog. | |
QHttp * | httpEngine |
Pointer to QHttp object that handles the download. | |
QString | iFullDownloadAddress |
String containing the internet address and path/filename of the file being downloaded in case someone asks to know it. |
Implements http downloader with option to show dialog that will show the progress of the download and name of file being downloaded.
void HttpDownloader::downloadFinished | ( | int | errorID | ) | [signal] |
Emitted when download is finished.
errorID | ID of the error that occured during download. QHttp::NoError if download was succesfull. |
void HttpDownloader::DownloadProgress | ( | int | ready, | |
int | total | |||
) | [protected, slot] |
Keeps track of the download progress.
ready | Bytes downloaded so far. | |
total | Total size of the download. |
void HttpDownloader::DownloadReady | ( | bool | error | ) | [protected, slot] |
Notified when download is finished and passes the notification to parent.
error | False if download was succesfull |
int HttpDownloader::getErrorID | ( | ) |
Get ID of last error.
If download ended to an error, this function can be used to query for more specific information about what went wrong.
QString HttpDownloader::getErrorString | ( | ) |
Get description of last error.
If download ended to an error, this function can be used to query for more specific information about what went wrong.
QString HttpDownloader::getLastAttemptedDownloadAddress | ( | ) |
Get the adress of last last attmepted download.
void HttpDownloader::HandleUiLanguageChange | ( | ) |
Reload the texts in elemnets.
Called by Xiaoning's Diary when reload of UI language is required. This may be during start of the program or when user changes the UI language.
void HttpDownloader::progressCurrentValue | ( | int | value | ) | [signal] |
Emitted from void DownloadProgress(int ready, int total) to update the download progressbar value.
value | Current progress of the download. |
void HttpDownloader::progressMaxValue | ( | int | value | ) | [signal] |
Emitted from void DownloadProgress(int ready, int total) to update the download progressbar maximum value.
value | Size of the file being downloaded. |
void HttpDownloader::setFileLabelText | ( | const QString & | text | ) | [signal] |
emitted from StartDownload(const QByteArray &encodedHost, const QByteArray &encodedPath, QIODevice *target, bool showProgressDialog) to show the name of the file being downloaded in the dialog.
text | Name of the file being downloaded. |
void HttpDownloader::setTitleLabelText | ( | const QString & | text | ) | [signal] |
Emitted from void HandleUiLanguageChange() to update the title of the Dialog when language is changed.
text | New title for Dialog. |
void HttpDownloader::StartDownload | ( | const QByteArray & | encodedHost, | |
const QByteArray & | encodedPath, | |||
QIODevice * | target, | |||
bool | showProgressDialog | |||
) |
Start downloading a file.
encodedHost | Hostname of the server (xiaoningsdiary.sourceforge.net for example). | |
encodedPath | Path and name of the file in the server (/current_version.txt for example). | |
target | Pointer to QIODevice object that can store the downloaded data. | |
showProgressDialog |
|
QHttp* HttpDownloader::httpEngine [private] |
Pointer to QHttp object that handles the download.
QHttp *httpEngine
QString HttpDownloader::iFullDownloadAddress [private] |
String containing the internet address and path/filename of the file being downloaded in case someone asks to know it.
QString iFullDownloadAddress
Ui::HttpDownloader* HttpDownloader::m_ui [private] |
Pointer to ui of the download progress dialog.
Ui::HttpDownloader *m_ui