Mercurial > minori
annotate include/gui/window.h @ 256:6f3d193cb4b7
*: add missing binary data
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 07 Feb 2024 17:06:31 -0500 |
parents | c130f47f6f48 |
children | 862d0d8619f6 |
rev | line source |
---|---|
2 | 1 #ifndef __window_h |
7 | 2 #define __window_h |
9 | 3 #include "core/config.h" |
7 | 4 #include <QMainWindow> |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
5 #include <memory> |
79 | 6 |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
7 /* *could* be forward-declared, but this causes |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
8 any file that #includes this to have to #include |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
9 these as well due to unique_ptr */ |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
10 #include <QWidget> |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
11 #include <QStackedWidget> |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
12 #include <QCloseEvent> |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
13 #include <QThread> |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
14 #include "gui/widgets/sidebar.h" |
2 | 15 |
250 | 16 class QMenu; |
17 | |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
18 Q_DECLARE_METATYPE(std::vector<std::string>); |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
19 |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
20 class PlayingThread : public QThread { |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
21 Q_OBJECT |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
22 |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
23 public: |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
24 PlayingThread(QObject* object = nullptr) : QThread(object) {} |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
25 |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
26 private: |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
27 void run() override; |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
28 |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
29 signals: |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
30 void Done(const std::vector<std::string>& files); |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
31 }; |
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
32 |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
79
diff
changeset
|
33 class MainWindow final : public QMainWindow { |
9 | 34 Q_OBJECT |
35 | |
2 | 36 public: |
250 | 37 enum class Pages { |
38 NOW_PLAYING, | |
39 | |
40 ANIME_LIST, | |
41 HISTORY, | |
42 STATISTICS, | |
43 | |
44 SEARCH, | |
45 SEASONS, | |
46 TORRENTS | |
47 }; | |
48 | |
2 | 49 MainWindow(QWidget* parent = nullptr); |
50 void SetActivePage(QWidget* page); | |
79 | 51 void CreateBars(); |
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
105
diff
changeset
|
52 void AddMainWidgets(); |
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
105
diff
changeset
|
53 void RetranslateUI(); |
250 | 54 void UpdateFolderMenu(); |
236
4d461ef7d424
HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents:
170
diff
changeset
|
55 void AsyncSynchronize(QAction* action, QStackedWidget* stack); |
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
105
diff
changeset
|
56 void changeEvent(QEvent* event) override; |
105
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents:
95
diff
changeset
|
57 void showEvent(QShowEvent* event) override; |
4
5af270662505
Set override functions as override
Paper <mrpapersonic@gmail.com>
parents:
2
diff
changeset
|
58 void closeEvent(QCloseEvent* event) override; |
2 | 59 |
60 private: | |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
61 std::unique_ptr<QWidget> main_widget = nullptr; |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
62 std::unique_ptr<QStackedWidget> stack = nullptr; |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
63 std::unique_ptr<SideBar> sidebar = nullptr; |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
64 |
250 | 65 std::unique_ptr<PlayingThread> thread = nullptr; |
66 | |
67 QMenu* folder_menu = nullptr; | |
2 | 68 }; |
69 | |
70 #endif // __window_h |