comparison 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
comparison
equal deleted inserted replaced
257:699a20c57dc8 258:862d0d8619f6
5 #include <memory> 5 #include <memory>
6 6
7 /* *could* be forward-declared, but this causes 7 /* *could* be forward-declared, but this causes
8 any file that #includes this to have to #include 8 any file that #includes this to have to #include
9 these as well due to unique_ptr */ 9 these as well due to unique_ptr */
10 #include "gui/widgets/sidebar.h"
11 #include <QCloseEvent>
12 #include <QStackedWidget>
13 #include <QThread>
10 #include <QWidget> 14 #include <QWidget>
11 #include <QStackedWidget>
12 #include <QCloseEvent>
13 #include <QThread>
14 #include "gui/widgets/sidebar.h"
15 15
16 class QMenu; 16 class QMenu;
17 17
18 Q_DECLARE_METATYPE(std::vector<std::string>); 18 Q_DECLARE_METATYPE(std::vector<std::string>);
19 19
20 class PlayingThread : public QThread { 20 class PlayingThread : public QThread {
21 Q_OBJECT 21 Q_OBJECT
22 22
23 public: 23 public:
24 PlayingThread(QObject* object = nullptr) : QThread(object) {} 24 PlayingThread(QObject* object = nullptr) : QThread(object) {}
25 25
26 private: 26 private:
27 void run() override; 27 void run() override;
28 28
29 signals: 29 signals:
30 void Done(const std::vector<std::string>& files); 30 void Done(const std::vector<std::string>& files);
31 }; 31 };
32 32
33 class MainWindow final : public QMainWindow { 33 class MainWindow final : public QMainWindow {
34 Q_OBJECT 34 Q_OBJECT
35 35
36 public: 36 public:
37 enum class Pages { 37 enum class Pages {
38 NOW_PLAYING, 38 NOW_PLAYING,
39 39
40 ANIME_LIST, 40 ANIME_LIST,
41 HISTORY, 41 HISTORY,
42 STATISTICS, 42 STATISTICS,
43 43
44 SEARCH, 44 SEARCH,
45 SEASONS, 45 SEASONS,
46 TORRENTS 46 TORRENTS
47 }; 47 };
48 48
49 MainWindow(QWidget* parent = nullptr); 49 MainWindow(QWidget* parent = nullptr);
50 void SetActivePage(QWidget* page); 50 void SetActivePage(QWidget* page);
51 void CreateBars(); 51 void CreateBars();
52 void AddMainWidgets(); 52 void AddMainWidgets();
53 void RetranslateUI(); 53 void RetranslateUI();
54 void UpdateFolderMenu(); 54 void UpdateFolderMenu();
55 void AsyncSynchronize(QAction* action, QStackedWidget* stack); 55 void AsyncSynchronize(QAction* action, QStackedWidget* stack);
56 void changeEvent(QEvent* event) override; 56 void changeEvent(QEvent* event) override;
57 void showEvent(QShowEvent* event) override; 57 void showEvent(QShowEvent* event) override;
58 void closeEvent(QCloseEvent* event) override; 58 void closeEvent(QCloseEvent* event) override;
59 59
60 private: 60 private:
61 std::unique_ptr<QWidget> main_widget = nullptr; 61 std::unique_ptr<QWidget> main_widget = nullptr;
62 std::unique_ptr<QStackedWidget> stack = nullptr; 62 std::unique_ptr<QStackedWidget> stack = nullptr;
63 std::unique_ptr<SideBar> sidebar = nullptr; 63 std::unique_ptr<SideBar> sidebar = nullptr;
64 64
65 std::unique_ptr<PlayingThread> thread = nullptr; 65 std::unique_ptr<PlayingThread> thread = nullptr;
66 66
67 QMenu* folder_menu = nullptr; 67 QMenu* folder_menu = nullptr;
68 }; 68 };
69 69
70 #endif // __window_h 70 #endif // __window_h