source: trunk/qt/mainwin.h @ 14176

Last change on this file since 14176 was 14176, checked in by jordan, 10 years ago

no need for a semicolon after the closing brace in a C++ 'extern' block

  • Property svn:keywords set to Date Rev Author Id
File size: 5.0 KB
Line 
1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
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.
7 *
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 *
10 * $Id: mainwin.h 14176 2013-08-24 19:26:21Z jordan $
11 */
12
13#ifndef MAIN_WINDOW_H
14#define MAIN_WINDOW_H
15
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>
27
28extern "C"
29{
30  struct tr_variant;
31}
32
33#include "filters.h"
34#include "torrent-filter.h"
35#include "ui_mainwin.h"
36
37class AddData;
38class ActionDelegator;
39class Prefs;
40class Details;
41class Session;
42class TorrentDelegate;
43class TorrentDelegateMin;
44class TorrentModel;
45class QAction;
46class QLabel;
47class QMenu;
48class QModelIndex;
49class QSortFilterProxyModel;
50class Filterbar;
51
52class TrMainWindow: public QMainWindow
53{
54    Q_OBJECT
55
56  private:
57    virtual void hideEvent (QHideEvent * event);
58    virtual void showEvent (QShowEvent * event);
59
60  private:
61    time_t myLastFullUpdateTime;
62    QDialog * mySessionDialog;
63    QDialog * myPrefsDialog;
64    QDialog * myAboutDialog;
65    QDialog * myStatsDialog;
66    Details * myDetailsDialog;
67    QCheckBox * myFileDialogOptionsCheck;
68    QSystemTrayIcon myTrayIcon;
69    TorrentFilter myFilterModel;
70    TorrentDelegate * myTorrentDelegate;
71    TorrentDelegateMin * myTorrentDelegateMin;
72    Session& mySession;
73    Prefs& myPrefs;
74    TorrentModel& myModel;
75    Ui_MainWindow ui;
76    QIcon mySpeedModeOffIcon;
77    QIcon mySpeedModeOnIcon;
78    time_t myLastSendTime;
79    time_t myLastReadTime;
80    QTimer myNetworkTimer;
81    QTimer myRefreshTrayIconTimer;
82    QTimer myRefreshActionSensitivityTimer;
83    QAction * myDlimitOffAction;
84    QAction * myDlimitOnAction;
85    QAction * myUlimitOffAction;
86    QAction * myUlimitOnAction;
87    QAction * myRatioOffAction;
88    QAction * myRatioOnAction;
89
90  private:
91    QIcon getStockIcon (const QString&, int fallback=-1);
92
93  private:
94    QSet<int> getSelectedTorrents () const;
95    void updateNetworkIcon ();
96    QWidgetList myHidden;
97
98  private slots:
99    void onPrefsDestroyed ();
100    void openPreferences ();
101    void onDetailsDestroyed ();
102    void showTotalRatio ();
103    void showTotalTransfer ();
104    void showSessionRatio ();
105    void showSessionTransfer ();
106    void refreshTitle ();
107    void refreshStatusBar ();
108    void refreshTrayIcon ();
109    void refreshTrayIconSoon ();
110    void openTorrent ();
111    void openURL ();
112    void newTorrent ();
113    void trayActivated (QSystemTrayIcon::ActivationReason);
114    void refreshPref (int key);
115    void addTorrents (const QStringList& filenames);
116    void removeTorrents (const bool deleteFiles);
117    void openDonate ();
118    void openHelp ();
119    void openFolder ();
120    void copyMagnetLinkToClipboard ();
121    void setLocation ();
122    void openProperties ();
123    void toggleSpeedMode ();
124    void dataReadProgress ();
125    void dataSendProgress ();
126    void toggleWindows (bool doShow);
127    void onSetPrefs ();
128    void onSetPrefs (bool);
129    void onSessionSourceChanged ();
130    void onModelReset ();
131
132  private slots:
133    void setSortPref (int);
134    void setSortAscendingPref (bool);
135    void onSortByActivityToggled (bool);
136    void onSortByAgeToggled (bool);
137    void onSortByETAToggled (bool);
138    void onSortByNameToggled (bool);
139    void onSortByProgressToggled (bool);
140    void onSortByQueueToggled (bool);
141    void onSortByRatioToggled (bool);
142    void onSortBySizeToggled (bool);
143    void onSortByStateToggled (bool);
144
145  private:
146    QWidget * myFilterBar;
147
148  private:
149    QMenu * createOptionsMenu (void);
150    QWidget * createStatusBar (void);
151    QWidget * myStatusBar;
152    QPushButton * myAltSpeedButton;
153    QAction * myAltSpeedAction;
154    QPushButton * myOptionsButton;
155    QPushButton * myStatsModeButton;
156    QLabel * myStatsLabel;
157    QLabel * myDownloadSpeedLabel;
158    QLabel * myUploadSpeedLabel;
159    QLabel * myNetworkLabel;
160
161  public slots:
162    void startAll ();
163    void startSelected ();
164    void startSelectedNow ();
165    void pauseAll ();
166    void pauseSelected ();
167    void removeSelected ();
168    void deleteSelected ();
169    void verifySelected ();
170    void queueMoveTop ();
171    void queueMoveUp ();
172    void queueMoveDown ();
173    void queueMoveBottom ();
174    void reannounceSelected ();
175    void addTorrent (const AddData& addMe);
176    void onNetworkTimer ();
177
178  private:
179    void clearSelection ();
180
181  public slots:
182    void setToolbarVisible (bool);
183    void setFilterbarVisible (bool);
184    void setStatusbarVisible (bool);
185    void setCompactView (bool);
186    void refreshActionSensitivity ();
187    void refreshActionSensitivitySoon ();
188    void wrongAuthentication ();
189
190  public:
191    TrMainWindow (Session&, Prefs&, TorrentModel&, bool minized);
192    virtual ~TrMainWindow ();
193
194  protected:
195    virtual void contextMenuEvent (QContextMenuEvent *);
196    virtual void dragEnterEvent (QDragEnterEvent *);
197    virtual void dropEvent (QDropEvent *);
198};
199
200#endif
Note: See TracBrowser for help on using the repository browser.