Home · All Namespaces · All Classes · Functions · Coding Style · Plugins · File Structure

StelDownloadMgr Class Reference

Used to download files from the Internet. More...

#include <StelDownloadMgr.hpp>

List of all members.


void finished ()
void error (QNetworkReply::NetworkError code, QString errorString)
void verifying ()
void badChecksum ()

Public Member Functions

void get (const QString &url, const QString &filePath, quint16 csum)
void get (const QString &url, const QString &filePath)
void abort ()
QString url ()
QString errorString ()
QString name ()
bool blockQuit ()
void setBlockQuit (bool b)
void setBarVisible (bool b)
void setBarFormat (const QString &format)
bool isDownloading ()

Detailed Description

Used to download files from the Internet.

QNetworkReply is used internally, although StelDownloadMgr's signal behavior is different (particularly in error handling). Settings are remembered between downloads.

Member Function Documentation

void StelDownloadMgr::get ( const QString &  url,
const QString &  filePath,
quint16  csum 

Fetch a remote URL into a local file.

url the URL of the remote file.
filePath the path of the local file name which is to be created. If a file already exists at filePath, it will be overwritten.
csum (optional) the expected checksum of the downloaded file, as returned by qChecksum(const char* data, uint len). If not provided, the downloaded file will not be verified.
See also:
qChecksum(const char* data, uint len) at http://doc.trolltech.com/4.4/qbytearray.html#qChecksum
error(QNetworkReply::NetworkError, QString)

void StelDownloadMgr::abort (  ) 

Abort the download and remove the partially downloaded file.

QString StelDownloadMgr::url (  )  [inline]

Get the URL of the remote file.

QString StelDownloadMgr::errorString (  )  [inline]

Get a description of the last error that occurred.

QString StelDownloadMgr::name (  ) 

Get the local file name.

bool StelDownloadMgr::blockQuit (  )  [inline]

Whether or not to pop up a warning box if the user tries to quit.

true if a download is in progress and setBlockQuit(true) was called. Otherwise, returns false.
See also:

void StelDownloadMgr::setBlockQuit ( bool  b  )  [inline]

If set to true and the user tries to quit Stellarium while downloading, a warning box will pop up.

Default is false.

Calling setBlockQuit(true) does not guarantee that blockQuit() will always return true.
See also:

void StelDownloadMgr::setBarVisible ( bool  b  )  [inline]

If set to true, a progress bar will appear in the lower right-hand corner of the screen.

Default is true.

void StelDownloadMgr::setBarFormat ( const QString &  format  )  [inline]

Set the text format of the progress bar.

Default is "%p%".

See also:
QProgressBar::setFormat(const QString& format) at http://doc.trolltech.com/4.4/qprogressbar.html#format-prop

bool StelDownloadMgr::isDownloading (  )  [inline]

Find out if the download is still in progress.

void StelDownloadMgr::finished (  )  [signal]

Emitted when the file is completely downloaded and successfully verified (this differs from QNetworkReply).

Do not try to open the destination file before this signal is emitted.

"Completely downloaded" depends on whatever the remote server reports the file size as. If QNetworkReply emits its finished() signal and we have no info about the total file size, it is assumed to be complete.

void StelDownloadMgr::error ( QNetworkReply::NetworkError  code,
QString  errorString 
) [signal]

Emitted whenever the internal QNetworkReply object emits an error, except that QNetworkReply::OperationCanceledError is ignored.

The partially downloaded file is removed before emitting this signal.

code the error code from QNetworkReply::error()
errorString the error string from QIODevice::errorString()
See also:
QNetworkReply::NetworkError at http://doc.trolltech.com/4.4/qnetworkreply.html#NetworkError-enum

void StelDownloadMgr::verifying (  )  [signal]

Emitted when verifying a checksum.

void StelDownloadMgr::badChecksum (  )  [signal]

Emitted if the provided checksum and downloaded file checksum do not match.

Generated on Mon Mar 9 16:16:16 2009 for Stellarium by  doxygen 1.5.5