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 $
20 #include <QMainWindow>
22 #include <QPushButton>
24 #include <QSystemTrayIcon>
26 #include <QWidgetList>
33 #include "torrent-filter.h"
34 #include "ui_mainwin.h"
36 class ActionDelegator
;
40 class TorrentDelegate
;
41 class TorrentDelegateMin
;
47 class QSortFilterProxyModel
;
50 class TrMainWindow
: public QMainWindow
55 virtual void closeEvent( QCloseEvent
* event
);
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
;
71 TorrentModel
& myModel
;
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
;
86 QIcon
getStockIcon( const QString
&, int fallback
=-1 );
89 QSet
<int> getSelectedTorrents( ) const;
90 void updateNetworkIcon( );
94 void openURL( QString
);
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( );
111 void trayActivated( QSystemTrayIcon::ActivationReason
);
112 void refreshPref( int key
);
113 void addTorrents( const QStringList
& filenames
);
114 void removeTorrents( const bool deleteFiles
);
118 void copyMagnetLinkToClipboard( );
120 void openProperties( );
121 void toggleSpeedMode( );
122 void dataReadProgress( );
123 void dataSendProgress( );
124 void toggleWindows( bool doShow
);
126 void onSetPrefs( bool );
127 void onSessionSourceChanged( );
128 void onModelReset( );
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 );
143 QWidget
* myFilterBar
;
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
;
160 void startSelected( );
162 void pauseSelected( );
163 void removeSelected( );
164 void deleteSelected( );
165 void verifySelected( );
166 void reannounceSelected( );
167 void addTorrent( const QString
& filename
);
168 void onNetworkTimer( );
171 void clearSelection( );
174 void setToolbarVisible( bool );
175 void setFilterbarVisible( bool );
176 void setStatusbarVisible( bool );
177 void setCompactView( bool );
178 void refreshActionSensitivity( );
179 void wrongAuthentication( );
182 TrMainWindow( Session
&, Prefs
&, TorrentModel
&, bool minized
);
183 virtual ~TrMainWindow( );
186 virtual void dragEnterEvent( QDragEnterEvent
* );
187 virtual void dropEvent( QDropEvent
* );