Added build script of Debian
[qtrapids] / src / gui / DownloadView.h
index 5ab1442..4f6dc3e 100644 (file)
@@ -1,11 +1,9 @@
 /***************************************************************************
- *   Copyright (C) 2009 by Lassi Väätämöinen   *
- *   lassi.vaatamoinen@ixonos.com   *
+ *   Copyright (C) 2010 by Ixonos Plc   *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
+ *   the Free Software Foundation; version 2 of the License.               *
  *                                                                         *
  *   This program is distributed in the hope that it will be useful,       *
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
@@ -27,6 +25,7 @@
 #include "QBittorrentSession.h"
 
 class DownloadViewItem;
+class QTimer;
 
 /**
        @class DownloadView
@@ -35,28 +34,35 @@ class DownloadViewItem;
 */
 class DownloadView : public QTreeWidget
 {
-Q_OBJECT
-               
-       public:
-    DownloadView(QWidget* parent);
-
-    ~DownloadView();
-
-               void newItem(QTorrentHandle handle);
-               void updateItem(QTorrentHandle handle);
-               QTorrentHandle removeSelected();
-               void removeItem(QTorrentHandle handle);
-               
-       private slots:
-               void on_itemClicked(QTreeWidgetItem * item, int column);
-       private:
-               // Maps torrent to downloadview item.
-               // Key: SHA1 info hash of torrent. Data: View item corresponding to torrent.
-               std::map<QTorrentHandle, DownloadViewItem*> items_;
-               
-               // Private functions.
-               QString GetStatusString(QTorrentHandle::State const& status) const;
-               QColor GetStatusColor(QTorrentHandle::State const& status) const;
+       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();
+
+
 };
 
 
@@ -64,33 +70,33 @@ Q_OBJECT
        @class DownloadViewItem
        @brief Represents one item row of DownloadView
 */
-class DownloadViewItem : public QTreeWidgetItem {
-       
-       public: 
-               DownloadViewItem(QTreeWidget* parent, int type) : 
+class DownloadViewItem : public QTreeWidgetItem
+{
+
+public:
+       DownloadViewItem(QTreeWidget* parent, int type) :
                        QTreeWidgetItem(parent, type = QTreeWidgetItem::UserType) {};
-               
-               DownloadViewItem(const QStringList& strings, 
-                                                                               int 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
+
+
+       /// @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