summaryrefslogtreecommitdiffstats
path: root/apps/ktorrent/ktorrentview.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 02:37:40 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 02:37:40 +0000
commit9ad5c7b5e23b4940e7a3ea3ca3a6fb77e6a8fab0 (patch)
treed088b5210e77d9fa91d954d8550e00e372b47378 /apps/ktorrent/ktorrentview.h
downloadktorrent-9ad5c7b5e23b4940e7a3ea3ca3a6fb77e6a8fab0.tar.gz
ktorrent-9ad5c7b5e23b4940e7a3ea3ca3a6fb77e6a8fab0.zip
Updated to final KDE3 ktorrent release (2.2.6)
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktorrent@1077377 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'apps/ktorrent/ktorrentview.h')
-rw-r--r--apps/ktorrent/ktorrentview.h216
1 files changed, 216 insertions, 0 deletions
diff --git a/apps/ktorrent/ktorrentview.h b/apps/ktorrent/ktorrentview.h
new file mode 100644
index 0000000..218b0b0
--- /dev/null
+++ b/apps/ktorrent/ktorrentview.h
@@ -0,0 +1,216 @@
+/***************************************************************************
+ * Copyright (C) 2005 by *
+ * Joris Guisson <joris.guisson@gmail.com> *
+ * Ivan Vasic <ivasic@gmail.com> *
+ * *
+ * 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. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+
+#ifndef _KTORRENTVIEW_H_
+#define _KTORRENTVIEW_H_
+
+#include <klistview.h>
+
+typedef QValueList<QCString> QCStringList;
+
+class KURL;
+class KTorrentViewItem;
+class KPopupMenu;
+class KTorrentCore;
+class KTorrentViewMenu;
+class KTorrentView;
+class ScanDialog;
+class QString;
+class FilterBar;
+
+namespace kt
+{
+ class TorrentInterface;
+ class Group;
+}
+
+using namespace bt;
+
+class TorrentView : public KListView
+{
+public:
+ TorrentView(KTorrentView* parent);
+ virtual ~TorrentView();
+
+ virtual bool eventFilter(QObject* watched, QEvent* e);
+
+private:
+ KTorrentView* ktview;
+};
+
+
+
+
+/**
+ * List view which shows information about torrents.
+ */
+class KTorrentView : public QWidget
+{
+ Q_OBJECT
+public:
+ enum ActionEnableFlags
+ {
+ START = 1,
+ STOP = 2,
+ START_ALL = 4,
+ STOP_ALL = 8,
+ REMOVE = 16,
+ SCAN = 32
+ };
+
+ /**
+ * Default constructor
+ */
+ KTorrentView(QWidget *parent);
+
+ /**
+ * Destructor
+ */
+ virtual ~KTorrentView();
+
+ /// Update the caption, so the correct number of running torrents is shown in the tab
+ void updateCaption();
+
+ /// Trigger an updateActions signal
+ void updateActions() {onSelectionChanged();}
+
+ /// Get the current group
+ const kt::Group* getCurrentGroup() const {return current_group;}
+
+ /// Get the current TorrentInterface object
+ kt::TorrentInterface* getCurrentTC();
+
+ /// Save the views settings
+ void saveSettings(KConfig* cfg,int idx);
+
+ /// Load the views settings
+ void loadSettings(KConfig* cfg,int idx);
+
+ /**
+ * Put the current selection in a list.
+ * @param sel The list to put it in
+ */
+ void getSelection(QValueList<kt::TorrentInterface*> & sel);
+
+ /**
+ * Add the current selection to a group.
+ * @param g The group
+ */
+ void addSelectionToGroup(kt::Group* g);
+
+ /**
+ * Is column visible?
+ */
+ bool columnVisible(int index);
+
+ /**
+ * Setup the view columns, based upon the current group
+ * This will hide some columns for uploads only groups.
+ */
+ void setupViewColumns();
+
+ QPtrList<QListViewItem> selectedItems() {return view->selectedItems();}
+
+ KListView* listView() {return view;}
+
+ /**
+ * Toggle the visibility of the filter bar
+ */
+ void toggleFilterBar();
+
+public slots:
+ void setCurrentGroup(kt::Group* group);
+ void addTorrent(kt::TorrentInterface* tc);
+ void removeTorrent(kt::TorrentInterface* tc);
+ void update();
+ void startDownloads();
+ void stopDownloads();
+ void startAllDownloads();
+ void stopAllDownloads();
+ void manualAnnounce();
+ void previewFiles();
+ void removeDownloads();
+ void removeDownloadsAndData();
+ void onSelectionChanged();
+ void queueSlot();
+ void checkDataIntegrity();
+ void removeFromGroup();
+ void showAddPeersWidget();
+ void openOutputDirectory();
+ void openTorXDirectory();
+ void setDownloadLocationSlot();
+ void dhtSlot();
+ void utPexSlot();
+ void speedLimits();
+
+private slots:
+ void onExecuted(QListViewItem* item);
+ void showContextMenu(KListView* ,QListViewItem* item,const QPoint & p);
+ void onColumnVisibilityChange(int);
+ void gsmItemActived(const QString & group);
+
+
+signals:
+ void torrentClicked(kt::TorrentInterface* tc);
+ void currentChanged(kt::TorrentInterface* tc);
+ void wantToRemove(kt::TorrentInterface* tc,bool data_to);
+ void wantToStop(kt::TorrentInterface* tc,bool user);
+ void wantToStart(kt::TorrentInterface* tc);
+ void viewChange(kt::TorrentInterface* tc);
+
+ /**
+ * Emit that actions need to be updated
+ * @param flags OR of ActionEnableFlags
+ */
+ void updateActions(int flags);
+ void queue(kt::TorrentInterface* tc);
+ void needsDataCheck(kt::TorrentInterface* tc);
+ void updateGroupsSubMenu(KPopupMenu* gsm);
+ void groupsSubMenuItemActivated(KTorrentView* v,const QString & group);
+
+private:
+ bool acceptDrag(QDropEvent* event) const;
+ int getNumRunning();
+ bool startDownload(kt::TorrentInterface* tc);
+ void stopDownload(kt::TorrentInterface* tc);
+ void showStartError();
+ virtual QDragObject* dragObject();
+ void setupColumns();
+ void insertColumn(QString label, Qt::AlignmentFlags);
+ void columnHide(int index);
+ void columnShow(int index);
+
+
+private:
+ QMap<kt::TorrentInterface*,KTorrentViewItem*> items;
+ KTorrentViewMenu* menu;
+ KPopupMenu* m_headerMenu;
+ kt::Group* current_group;
+ Uint32 running;
+ Uint32 total;
+ TorrentView* view;
+ FilterBar* filter_bar;
+
+ friend class TorrentView;
+};
+
+#endif // _KTORRENTVIEW_H_