-Q_OBJECT
-
- public:
- DownloadView(QWidget* parent);
-
- ~DownloadView();
-
- void newItem(QTorrentHandle const* handle);
- void updateItem(QTorrentHandle const* handle);
-
- private:
- // Maps torrent to downloadview item.
- // Key: SHA1 info hash of torrent. Data: View item corresponding to torrent.
- std::map<Sha1Hash, DownloadViewItem*> items_;
-
+ Q_OBJECT
+
+public:
+ DownloadView(QWidget* parent);
+
+ ~DownloadView();
+
+ void newItem(qtrapids::QTorrentHandle handle);
+ void updateItem(qtrapids::QTorrentHandle handle);
+ qtrapids::QTorrentHandle removeSelected();
+ void removeItem(qtrapids::QTorrentHandle handle);
+ void setRefreshInterval(int msec);
+
+private slots:
+ void on_itemClicked(QTreeWidgetItem * item, int column);
+ void on_timeout();
+
+private:
+ // Maps torrent to downloadview item.
+ // Key: SHA1 info hash of torrent. Data: View item corresponding to torrent.
+ std::map<qtrapids::QTorrentHandle, DownloadViewItem*> items_;
+ QTimer *timer_;
+
+ // Private functions.
+ QString GetStatusString(qtrapids::QTorrentHandle::State const& status) const;
+ QColor GetStatusColor(qtrapids::QTorrentHandle::State const& status) const;
+ void UpdateView();
+
+