X-Git-Url: http://git.maemo.org/git/?p=qtrapids;a=blobdiff_plain;f=src%2Fgui%2FDownloadView.h;h=1ffc529a4e186fea2c3be57c14dc6398ff75332e;hp=cb300ba4c63dfbe026513cbd5cb221163481cd01;hb=1ce7416c6679de54aaa60ba9c1c6f258577cc49e;hpb=d3d85653bf84dadcf6c2890cc2ddf9f629ee7619 diff --git a/src/gui/DownloadView.h b/src/gui/DownloadView.h index cb300ba..1ffc529 100644 --- a/src/gui/DownloadView.h +++ b/src/gui/DownloadView.h @@ -36,69 +36,70 @@ class QTimer; */ class DownloadView : public QTreeWidget { -Q_OBJECT - - public: + 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 items_; - QTimer *timer_; - - // Private functions. - QString GetStatusString(qtrapids::QTorrentHandle::State const& status) const; - QColor GetStatusColor(qtrapids::QTorrentHandle::State const& status) const; + 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 items_; + QTimer *timer_; + + // Private functions. + QString GetStatusString(qtrapids::QTorrentHandle::State const& status) const; + QColor GetStatusColor(qtrapids::QTorrentHandle::State const& status) const; void UpdateView(); - + }; /** - @class DownloadViewItem + @class DownloadViewItem @brief Represents one item row of DownloadView */ -class DownloadViewItem : public QTreeWidgetItem { - - public: - DownloadViewItem(QTreeWidget* parent, int type) : - QTreeWidgetItem(parent, type = QTreeWidgetItem::UserType) {}; - - DownloadViewItem(const QStringList& strings, - int type = QTreeWidgetItem::UserType) : - QTreeWidgetItem (strings, type = Type) {}; - - - /// @return An item comprising of string list, suitable for QTableView - /// header. - static DownloadViewItem *getHeaderItem() - { - DownloadViewItem *item - = new DownloadViewItem(QStringList() - << "Name" - << "Size" << "Status" - << "Progress" << "DL speed" - << "UL speed" << "Seeds/Leechers" - << "Ratio" << "ETA"); - - return item; - } - - /// @todo QTorrentHandle as one hidden column +class DownloadViewItem : public QTreeWidgetItem +{ + +public: + DownloadViewItem(QTreeWidget* parent, int type) : + QTreeWidgetItem(parent, type = QTreeWidgetItem::UserType) {}; + + DownloadViewItem(const QStringList& strings, + int type = QTreeWidgetItem::UserType) : + QTreeWidgetItem (strings, type = Type) {}; + + + /// @return An item comprising of string list, suitable for QTableView + /// header. + static DownloadViewItem *getHeaderItem() + { + DownloadViewItem *item + = new DownloadViewItem(QStringList() + << "Name" + << "Size" << "Status" + << "Progress" << "DL speed" + << "UL speed" << "Seeds/Leechers" + << "Ratio" << "ETA"); + + return item; + } + + /// @todo QTorrentHandle as one hidden column }; #endif