Revert "transmission: update from 2.13 to 2.22"
[tomato.git] / release / src / router / transmission / qt / mainwin.h
blobbc4f93e97d760ce78d0d09eea5ae25aaaefcf39d
1 /*
2 * This file Copyright (C) Mnemosyne LLC
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10 * $Id: mainwin.h 11196 2010-09-06 00:19:37Z charles $
13 #ifndef MAIN_WINDOW_H
14 #define MAIN_WINDOW_H
16 #include <ctime>
17 #include <QCheckBox>
18 #include <QLineEdit>
19 #include <QIcon>
20 #include <QMainWindow>
21 #include <QMap>
22 #include <QPushButton>
23 #include <QSet>
24 #include <QSystemTrayIcon>
25 #include <QTimer>
26 #include <QWidgetList>
28 extern "C" {
29 struct tr_benc;
32 #include "filters.h"
33 #include "torrent-filter.h"
34 #include "ui_mainwin.h"
36 class ActionDelegator;
37 class Prefs;
38 class Details;
39 class Session;
40 class TorrentDelegate;
41 class TorrentDelegateMin;
42 class TorrentModel;
43 class QAction;
44 class QLabel;
45 class QMenu;
46 class QModelIndex;
47 class QSortFilterProxyModel;
48 class Filterbar;
50 class TrMainWindow: public QMainWindow
52 Q_OBJECT
54 private:
55 virtual void closeEvent( QCloseEvent * event );
57 private:
58 time_t myLastFullUpdateTime;
59 QDialog * mySessionDialog;
60 QDialog * myPrefsDialog;
61 QDialog * myAboutDialog;
62 QDialog * myStatsDialog;
63 Details * myDetailsDialog;
64 QCheckBox * myFileDialogOptionsCheck;
65 QSystemTrayIcon myTrayIcon;
66 TorrentFilter myFilterModel;
67 TorrentDelegate * myTorrentDelegate;
68 TorrentDelegateMin * myTorrentDelegateMin;
69 Session& mySession;
70 Prefs& myPrefs;
71 TorrentModel& myModel;
72 Ui_MainWindow ui;
73 QIcon mySpeedModeOffIcon;
74 QIcon mySpeedModeOnIcon;
75 time_t myLastSendTime;
76 time_t myLastReadTime;
77 QTimer myNetworkTimer;
78 QAction * myDlimitOffAction;
79 QAction * myDlimitOnAction;
80 QAction * myUlimitOffAction;
81 QAction * myUlimitOnAction;
82 QAction * myRatioOffAction;
83 QAction * myRatioOnAction;
85 private:
86 QIcon getStockIcon( const QString&, int fallback=-1 );
88 private:
89 QSet<int> getSelectedTorrents( ) const;
90 void updateNetworkIcon( );
91 QWidgetList myHidden;
93 public slots:
94 void openURL( QString );
96 private slots:
97 void onPrefsDestroyed( );
98 void openPreferences( );
99 void onDetailsDestroyed( );
100 void showTotalRatio( );
101 void showTotalTransfer( );
102 void showSessionRatio( );
103 void showSessionTransfer( );
104 void refreshVisibleCount( );
105 void refreshTitle( );
106 void refreshStatusBar( );
107 void refreshTrayIcon( );
108 void openTorrent( );
109 void openURL( );
110 void newTorrent( );
111 void trayActivated( QSystemTrayIcon::ActivationReason );
112 void refreshPref( int key );
113 void addTorrents( const QStringList& filenames );
114 void removeTorrents( const bool deleteFiles );
115 void openDonate( );
116 void openHelp( );
117 void openFolder( );
118 void copyMagnetLinkToClipboard( );
119 void setLocation( );
120 void openProperties( );
121 void toggleSpeedMode( );
122 void dataReadProgress( );
123 void dataSendProgress( );
124 void toggleWindows( bool doShow );
125 void onSetPrefs( );
126 void onSetPrefs( bool );
127 void onSessionSourceChanged( );
128 void onModelReset( );
130 private slots:
131 void setSortPref ( int );
132 void setSortAscendingPref ( bool );
133 void onSortByActivityToggled ( bool );
134 void onSortByAgeToggled ( bool );
135 void onSortByETAToggled ( bool );
136 void onSortByNameToggled ( bool );
137 void onSortByProgressToggled ( bool );
138 void onSortByRatioToggled ( bool );
139 void onSortBySizeToggled ( bool );
140 void onSortByStateToggled ( bool );
142 private:
143 QWidget * myFilterBar;
145 private:
146 QMenu * createOptionsMenu( void );
147 QWidget * createStatusBar( void );
148 QWidget * myStatusBar;
149 QPushButton * myAltSpeedButton;
150 QPushButton * myOptionsButton;
151 QLabel * myVisibleCountLabel;
152 QPushButton * myStatsModeButton;
153 QLabel * myStatsLabel;
154 QLabel * myDownloadSpeedLabel;
155 QLabel * myUploadSpeedLabel;
156 QLabel * myNetworkLabel;
158 public slots:
159 void startAll( );
160 void startSelected( );
161 void pauseAll( );
162 void pauseSelected( );
163 void removeSelected( );
164 void deleteSelected( );
165 void verifySelected( );
166 void reannounceSelected( );
167 void addTorrent( const QString& filename );
168 void onNetworkTimer( );
170 private:
171 void clearSelection( );
173 public slots:
174 void setToolbarVisible( bool );
175 void setFilterbarVisible( bool );
176 void setStatusbarVisible( bool );
177 void setCompactView( bool );
178 void refreshActionSensitivity( );
179 void wrongAuthentication( );
181 public:
182 TrMainWindow( Session&, Prefs&, TorrentModel&, bool minized );
183 virtual ~TrMainWindow( );
185 protected:
186 virtual void dragEnterEvent( QDragEnterEvent * );
187 virtual void dropEvent( QDropEvent * );
190 #endif