Skip to content

Class summary: DownloadPanel

Henrik Lindberg edited this page Nov 9, 2017 · 1 revision

DownloadPanel

The DownloadPanel class is a top-level QWidget (a window) that is used to display the download progress of TMC exercises. Each of the TMC exercises is packed and transferred as a separate zip archive. It's therefore typical to have multiple concurrent downloads. The DownloadPanel displays a separate QProgressBar for each of them.

Screenshot of DownloadPanel in action (TODO: Get rid of the external link, add image to documentation)

Class DownloadPanel doesn't have any data transfer functionality of its own. It just gives a visual indication of the downloads initiated by TmcClient::getExerciseZip(). A slight problem with the progress bars is their inaccuracy. This is due to the signal QNetworkReply::downloadProgress( qint64 bytesReceived, qint64 bytesTotal ). Each time it is emitted for an incomplete download the value of bytesTotal is -1 rather than the true download size. Whenever bytesTotal is -1 a progress bar has to resort to using the crude approximation AVERAGE_DOWNLOAD_SIZE.

Relevant files:
src/downloadpanel.*
src/tmcclient.cpp
src/testmycode.cpp