forked from qbittorrent/qBittorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.h
161 lines (149 loc) · 4.97 KB
/
GUI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* 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.
*
* Contact : [email protected]
*/
#ifndef GUI_H
#define GUI_H
#include <QProcess>
#include <QSystemTrayIcon>
#include "ui_MainWindow.h"
#include "qtorrenthandle.h"
class bittorrent;
class createtorrent;
class QTimer;
class DownloadingTorrents;
class FinishedTorrents;
class downloadFromURL;
class SearchEngine;
class QTcpServer;
class QTcpSocket;
class QCloseEvent;
class RSSImp;
class QShortcut;
class about;
class previewSelect;
class options_imp;
class QTabWidget;
class QLabel;
class QModelIndex;
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
private:
// Bittorrent
bittorrent *BTSession;
QTimer *checkConnect;
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers;
// GUI related
QTabWidget *tabs;
options_imp *options;
QSystemTrayIcon *myTrayIcon;
QMenu *myTrayIconMenu;
DownloadingTorrents *downloadingTorrentTab;
FinishedTorrents *finishedTorrentTab;
QLabel *connecStatusLblIcon;
bool systrayIntegration;
bool force_exit;
QTimer *refresher;
// Keyboard shortcuts
QShortcut *switchSearchShortcut;
QShortcut *switchSearchShortcut2;
QShortcut *switchDownShortcut;
QShortcut *switchUpShortcut;
QShortcut *switchRSSShortcut;
// Preview
QProcess *previewProcess;
// Search
SearchEngine *searchEngine;
// RSS
RSSImp *rssWidget;
// Misc
QTcpServer *tcpServer;
QTcpSocket *clientConnection;
protected slots:
// GUI related slots
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void toggleVisibility(QSystemTrayIcon::ActivationReason e);
void on_actionAbout_triggered();
void on_actionCreate_torrent_triggered();
void on_actionWebsite_triggered() const;
void on_actionBugReport_triggered() const;
void readParamsOnSocket();
void acceptConnection();
void togglePausedState(QString hash);
void on_actionPreview_file_triggered();
void previewFile(QString filePath);
void cleanTempPreviewFile(int, QProcess::ExitStatus) const;
void balloonClicked();
void writeSettings();
void readSettings();
void on_actionExit_triggered();
void createTrayIcon();
void updateUnfinishedTorrentNumber(unsigned int nb);
void updateFinishedTorrentNumber(unsigned int nb);
void fullDiskError(QTorrentHandle& h) const;
void handleDownloadFromUrlFailure(QString, QString) const;
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayDownTab() const;
void displayUpTab() const;
void displaySearchTab() const;
void displayRSSTab() const;
// Torrent actions
void on_actionTorrent_Properties_triggered();
void on_actionPause_triggered();
void on_actionPause_All_triggered();
void on_actionStart_triggered();
void on_actionStart_All_triggered();
void on_actionOpen_triggered();
void on_actionDelete_Permanently_triggered();
void on_actionDelete_triggered();
void on_actionSet_global_upload_limit_triggered();
void on_actionSet_global_download_limit_triggered();
void on_actionDocumentation_triggered() const;
void checkConnectionStatus();
void configureSession(bool deleteOptions);
void processParams(const QStringList& params);
void addUnauthenticatedTracker(QPair<QTorrentHandle,QString> tracker);
void processScannedFiles(const QStringList& params);
void processDownloadedFiles(QString path, QString url);
void downloadFromURLList(const QStringList& urls);
void finishedTorrent(QTorrentHandle& h) const;
void torrentChecked(QString hash) const;
void updateLists();
// Options slots
void on_actionOptions_triggered();
void OptionsSaved(QString info, bool deleteOptions);
// HTTP slots
void on_actionDownload_from_URL_triggered();
public slots:
void trackerAuthenticationRequired(QTorrentHandle& h);
void setTabText(int index, QString text) const;
protected:
void closeEvent(QCloseEvent *);
void hideEvent(QHideEvent *);
public:
// Construct / Destruct
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
~GUI();
// Methods
unsigned int getCurrentTabIndex() const;
QPoint screenCenter() const;
};
#endif