source: trunk/qt/mainwin.h @ 14205

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

(trunk, qt) #5487 'Qt client crash when using Open URL action' -- fixed.

  • Property svn:keywords set to Date Rev Author Id
File size: 4.9 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 14205 2013-09-14 22:50:25Z jordan $
11 */
12
13#ifndef MAIN_WINDOW_H
14#define MAIN_WINDOW_H
15
16#include <ctime>
17#include <QLineEdit>
18#include <QIcon>
19#include <QMainWindow>
20#include <QMap>
21#include <QPushButton>
22#include <QSet>
23#include <QSystemTrayIcon>
24#include <QTimer>
25#include <QWidgetList>
26
27extern "C"
28{
29  struct tr_variant;
30}
31
32#include "filters.h"
33#include "torrent-filter.h"
34#include "ui_mainwin.h"
35
36class AddData;
37class ActionDelegator;
38class Prefs;
39class Details;
40class Session;
41class TorrentDelegate;
42class TorrentDelegateMin;
43class TorrentModel;
44class QAction;
45class QLabel;
46class QMenu;
47class QModelIndex;
48class QSortFilterProxyModel;
49class Filterbar;
50
51class TrMainWindow: public QMainWindow
52{
53    Q_OBJECT
54
55  private:
56    virtual void hideEvent (QHideEvent * event);
57    virtual void showEvent (QShowEvent * event);
58
59  private:
60    time_t myLastFullUpdateTime;
61    QDialog * mySessionDialog;
62    QDialog * myPrefsDialog;
63    QDialog * myAboutDialog;
64    QDialog * myStatsDialog;
65    Details * myDetailsDialog;
66    QSystemTrayIcon myTrayIcon;
67    TorrentFilter myFilterModel;
68    TorrentDelegate * myTorrentDelegate;
69    TorrentDelegateMin * myTorrentDelegateMin;
70    Session& mySession;
71    Prefs& myPrefs;
72    TorrentModel& myModel;
73    Ui_MainWindow ui;
74    QIcon mySpeedModeOffIcon;
75    QIcon mySpeedModeOnIcon;
76    time_t myLastSendTime;
77    time_t myLastReadTime;
78    QTimer myNetworkTimer;
79    QTimer myRefreshTrayIconTimer;
80    QTimer myRefreshActionSensitivityTimer;
81    QAction * myDlimitOffAction;
82    QAction * myDlimitOnAction;
83    QAction * myUlimitOffAction;
84    QAction * myUlimitOnAction;
85    QAction * myRatioOffAction;
86    QAction * myRatioOnAction;
87
88  private:
89    QIcon getStockIcon (const QString&, int fallback=-1);
90
91  private:
92    QSet<int> getSelectedTorrents () const;
93    void updateNetworkIcon ();
94    QWidgetList myHidden;
95
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 refreshTitle ();
105    void refreshStatusBar ();
106    void refreshTrayIcon ();
107    void refreshTrayIconSoon ();
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 ();
129
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 onSortByQueueToggled (bool);
139    void onSortByRatioToggled (bool);
140    void onSortBySizeToggled (bool);
141    void onSortByStateToggled (bool);
142
143  private:
144    QWidget * myFilterBar;
145
146  private:
147    QMenu * createOptionsMenu (void);
148    QWidget * createStatusBar (void);
149    QWidget * myStatusBar;
150    QPushButton * myAltSpeedButton;
151    QAction * myAltSpeedAction;
152    QPushButton * myOptionsButton;
153    QPushButton * myStatsModeButton;
154    QLabel * myStatsLabel;
155    QLabel * myDownloadSpeedLabel;
156    QLabel * myUploadSpeedLabel;
157    QLabel * myNetworkLabel;
158
159  public slots:
160    void startAll ();
161    void startSelected ();
162    void startSelectedNow ();
163    void pauseAll ();
164    void pauseSelected ();
165    void removeSelected ();
166    void deleteSelected ();
167    void verifySelected ();
168    void queueMoveTop ();
169    void queueMoveUp ();
170    void queueMoveDown ();
171    void queueMoveBottom ();
172    void reannounceSelected ();
173    void onNetworkTimer ();
174
175  private:
176    void clearSelection ();
177    void addTorrent (const AddData& addMe, bool showOptions);
178
179  public slots:
180    void setToolbarVisible (bool);
181    void setFilterbarVisible (bool);
182    void setStatusbarVisible (bool);
183    void setCompactView (bool);
184    void refreshActionSensitivity ();
185    void refreshActionSensitivitySoon ();
186    void wrongAuthentication ();
187
188  public:
189    TrMainWindow (Session&, Prefs&, TorrentModel&, bool minized);
190    virtual ~TrMainWindow ();
191
192  protected:
193    virtual void contextMenuEvent (QContextMenuEvent *);
194    virtual void dragEnterEvent (QDragEnterEvent *);
195    virtual void dropEvent (QDropEvent *);
196};
197
198#endif
Note: See TracBrowser for help on using the repository browser.