-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathmainwindow.h
More file actions
162 lines (134 loc) · 4.2 KB
/
mainwindow.h
File metadata and controls
162 lines (134 loc) · 4.2 KB
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
162
/* - ArrowDL - Copyright (C) 2019-present Sebastien Vavassori
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtWidgets/QMainWindow>
class AbstractJob;
class Scheduler;
class StreamManager;
class FileAccessManager;
class Settings;
class UpdateChecker;
class SystemTray;
QT_BEGIN_NAMESPACE
class QLabel;
class QMimeData;
QT_END_NAMESPACE
#ifdef USE_QT_WINEXTRAS
class QWinTaskbarButton;
class QWinTaskbarProgress;
#endif
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
bool saveFile(const QString &path);
bool loadFile(const QString &path);
protected:
void closeEvent(QCloseEvent *event) override;
void showEvent(QShowEvent *event) override;
void changeEvent(QEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void dropEvent(QDropEvent *event) override;
public slots:
// File
void importFromFile();
void exportSelectedToFile();
// Edit
void copy();
// View
void showInformation();
void openFile();
void openFile(AbstractJob *job);
void renameFile();
void deleteFile();
void openDirectory();
void removeCompleted();
void removeSelected();
void removeAll();
// Download
void handleMessage(const QString &message);
void home();
void addContent();
void addContent(const QUrl &url);
void addContent(const QString &message);
void addBatch();
void addBatch(const QUrl &url);
void addStream();
void addStream(const QUrl &url);
void addTorrent();
void addTorrent(const QUrl &url);
void addUrls();
void addUrls(const QString &text);
void resume();
void cancel();
void pause();
// Options
void showPreferences();
// Help
void onUpdateAvailableForConsole();
void checkForUpdates();
void showTutorial();
void about();
void aboutCompiler();
void aboutStream();
void aboutWebsite();
private slots:
void onDataChanged();
void onMetricsChanged();
void onJobFinished(AbstractJob *job);
void onJobRenamed(const QString &oldName, const QString &newName, bool success);
void onSelectionChanged();
void onTorrentContextChanged();
private:
Ui::MainWindow *ui = nullptr;
Scheduler *m_scheduler = nullptr;
StreamManager *m_streamManager = nullptr;
FileAccessManager *m_fileAccessManager = nullptr;
Settings *m_settings = nullptr;
QLabel *m_statusBarLabel = nullptr;
#ifdef USE_QT_WINEXTRAS
QWinTaskbarButton *m_winTaskbarButton = nullptr;
QWinTaskbarProgress *m_winTaskbarProgress = nullptr;
#endif
UpdateChecker *m_updateChecker = nullptr;
SystemTray *m_systemTray = nullptr;
void readSettings();
void writeSettings();
void createActions();
void createContextMenu();
void createStatusbar();
void createSystemTray();
void propagateToolTips();
void propagateIcons();
void refreshTitleAndStatus();
void refreshMenus();
void refreshSplitter();
inline bool askConfirmation(const QString &text);
inline QUrl droppedUrl(const QMimeData* mimeData) const;
inline QString fromClipboard() const;
inline QUrl urlFromClipboard() const;
inline void setWorkingDirectory(const QString &path);
QString askSaveFileName(const QString &fileFilter, const QString &title = tr("Save As"));
QString askOpenFileName(const QString &fileFilter, const QString &title = tr("Open"));
};
#endif // MAINWINDOW_H