+void DownloadView::on_timeout()
+{
+#ifdef QTRAPIDS_DEBUG
+ qDebug() << "DownloadView::on_timeout()";
+#endif
+ UpdateView();
+}
+
+
+
+QString DownloadView::GetStatusString(qtrapids::QTorrentHandle::State const& status) const
+{
+ switch (status) {
+ case qtrapids::QTorrentHandle::QUEUED_FOR_CHECKING :
+ return tr("Queued");
+ case qtrapids::QTorrentHandle::CHECKING_FILES :
+ return tr("Checking");
+ case qtrapids::QTorrentHandle::DOWNLOADING_METADATA :
+ return tr("DL meta");
+ case qtrapids::QTorrentHandle::DOWNLOADING :
+ return tr("Downloading");
+ case qtrapids::QTorrentHandle::FINISHED :
+ return tr("Finished");
+ case qtrapids::QTorrentHandle::SEEDING :
+ return tr("Seeding");
+ case qtrapids::QTorrentHandle::ALLOCATING :
+ return tr("Allocating");
+ default:
+ return tr("N/A");
+ }
+}
+
+
+QColor DownloadView::GetStatusColor(qtrapids::QTorrentHandle::State const& status) const
+{
+ QColor green(40,205,40);
+ QColor yellow(255,174,0);
+
+ switch (status) {
+ case qtrapids::QTorrentHandle::QUEUED_FOR_CHECKING :
+ case qtrapids::QTorrentHandle::CHECKING_FILES :
+ case qtrapids::QTorrentHandle::DOWNLOADING_METADATA :
+ case qtrapids::QTorrentHandle::ALLOCATING :
+ return yellow;
+ case qtrapids::QTorrentHandle::DOWNLOADING :
+ case qtrapids::QTorrentHandle::FINISHED :
+ case qtrapids::QTorrentHandle::SEEDING :
+ return green;
+ default:
+ return QColor();
+ }
+}
+
+void DownloadView::UpdateView()
+{
+ DownloadViewItem *item = dynamic_cast<DownloadViewItem*> (currentItem());
+
+ std::map<qtrapids::QTorrentHandle, DownloadViewItem*>::iterator listIter
+ = items_.begin();
+ std::map<qtrapids::QTorrentHandle, DownloadViewItem*>::iterator listEnd
+ = items_.end();
+
+ while (listIter != listEnd) {
+ updateItem(listIter->first);
+ ++listIter;
+ }
+}