Mercurial > minori
annotate include/gui/window.h @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | c130f47f6f48 |
children | 3ec7804abf17 |
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 */ |
258 | 10 #include "gui/widgets/sidebar.h" |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
11 #include <QCloseEvent> |
258 | 12 #include <QStackedWidget> |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
13 #include <QThread> |
258 | 14 #include <QWidget> |
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 { |
258 | 21 Q_OBJECT |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
22 |
258 | 23 public: |
24 PlayingThread(QObject* object = nullptr) : QThread(object) {} | |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
25 |
258 | 26 private: |
27 void run() override; | |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
28 |
258 | 29 signals: |
30 void Done(const std::vector<std::string>& files); | |
170
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 { |
258 | 34 Q_OBJECT |
9 | 35 |
258 | 36 public: |
37 enum class Pages { | |
38 NOW_PLAYING, | |
250 | 39 |
258 | 40 ANIME_LIST, |
41 HISTORY, | |
42 STATISTICS, | |
250 | 43 |
258 | 44 SEARCH, |
45 SEASONS, | |
46 TORRENTS | |
47 }; | |
250 | 48 |
258 | 49 MainWindow(QWidget* parent = nullptr); |
50 void SetActivePage(QWidget* page); | |
51 void CreateBars(); | |
52 void AddMainWidgets(); | |
53 void RetranslateUI(); | |
54 void UpdateFolderMenu(); | |
55 void AsyncSynchronize(QAction* action, QStackedWidget* stack); | |
56 void changeEvent(QEvent* event) override; | |
57 void showEvent(QShowEvent* event) override; | |
58 void closeEvent(QCloseEvent* event) override; | |
2 | 59 |
258 | 60 private: |
61 std::unique_ptr<QWidget> main_widget = nullptr; | |
62 std::unique_ptr<QStackedWidget> stack = nullptr; | |
63 std::unique_ptr<SideBar> sidebar = nullptr; | |
170
c8375765f0fc
window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
64 |
258 | 65 std::unique_ptr<PlayingThread> thread = nullptr; |
250 | 66 |
258 | 67 QMenu* folder_menu = nullptr; |
2 | 68 }; |
69 | |
70 #endif // __window_h |