annotate include/gui/window.h @ 333:5980a960f3e1

translate/anime: use fmt for translating anime seasons
author Paper <paper@paper.us.eu.org>
date Mon, 17 Jun 2024 20:03:58 -0400
parents 34347fd2a2de
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
1 #ifndef MINORI_WINDOW_H_
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
2 #define MINORI_WINDOW_H_
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
3
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
4 #include "core/config.h"
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
5 #include "gui/widgets/sidebar.h"
79
c489dd4434af *: what did I do again?
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
6
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
7 /* pages; these should really be in a namespace */
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
8 #include "gui/pages/anime_list.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
9 #include "gui/pages/history.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
10 #include "gui/pages/now_playing.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
11 #include "gui/pages/search.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
12 #include "gui/pages/seasons.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
13 #include "gui/pages/statistics.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
14 #include "gui/pages/torrents.h"
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
15
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
16 #include <QMainWindow>
114
ab191e28e69d *: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents: 112
diff changeset
17 #include <QCloseEvent>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
18 #include <QStackedWidget>
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
19 #include <QThread>
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
20 #include <QTimer>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
21 #include <QWidget>
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
22
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
23 #include <memory>
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
24
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
25 class QMenu;
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
26 class AnimeListPage;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
27
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
28 /* ... :) */
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
29 Q_DECLARE_METATYPE(std::vector<std::string>);
315
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
30 Q_DECLARE_METATYPE(std::string);
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
31
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
32 class MainWindowPlayingThread final : public QThread {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
33 Q_OBJECT
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
34
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
35 public:
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
36 MainWindowPlayingThread(QObject* object = nullptr) : QThread(object) {}
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
37
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
38 protected:
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
39 void run() override;
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
40
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
41 signals:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
42 void Done(const std::vector<std::string>& files);
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
43 };
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
44
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
45 class MainWindowAsyncSynchronizeThread final : public QThread {
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
46 Q_OBJECT
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
47
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
48 public:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
49 MainWindowAsyncSynchronizeThread(QAction* action, AnimeListPage* page, QObject* object = nullptr);
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
50 void SetAction(QAction* action);
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
51 void SetPage(AnimeListPage* page);
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
52
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
53 protected:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
54 void run() override;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
55
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
56 private:
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
57 QAction* action_ = nullptr;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
58 AnimeListPage* page_ = nullptr;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
59 };
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
60
95
8043152ef9d4 include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents: 79
diff changeset
61 class MainWindow final : public QMainWindow {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
62 Q_OBJECT
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
63
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
64 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
65 enum class Pages {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
66 NOW_PLAYING,
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
67
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
68 ANIME_LIST,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
69 HISTORY,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
70 STATISTICS,
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
71
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
72 SEARCH,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
73 SEASONS,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
74 TORRENTS
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
75 };
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
76
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
77 MainWindow(QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
78 void SetActivePage(QWidget* page);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
79 void CreateBars();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
80 void AddMainWidgets();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
81 void RetranslateUI();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
82 void UpdateFolderMenu();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
83 void AsyncSynchronize(QAction* action, QStackedWidget* stack);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
84 void changeEvent(QEvent* event) override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
85 void showEvent(QShowEvent* event) override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
86 void closeEvent(QCloseEvent* event) override;
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
87
315
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
88 public slots:
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
89 void SetStatusMessage(const std::string& message);
34347fd2a2de session: allow printing status messages
Paper <paper@paper.us.eu.org>
parents: 291
diff changeset
90
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
91 private:
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
92 QWidget main_widget_;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
93 QStackedWidget stack_;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
94 SideBar sidebar_;
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
95
291
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
96 AnimeListPage anime_list_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
97 HistoryPage history_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
98 NowPlayingPage now_playing_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
99 SearchPage search_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
100 SeasonsPage seasons_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
101 StatisticsPage statistics_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
102 TorrentsPage torrents_page_;
9a88e1725fd2 *: refactor lots of stuff
Paper <paper@paper.us.eu.org>
parents: 273
diff changeset
103
273
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
104 MainWindowPlayingThread playing_thread_;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
105 QTimer playing_thread_timer_;
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
106
f31305b9f60a *: various code safety changes
Paper <paper@paper.us.eu.org>
parents: 261
diff changeset
107 MainWindowAsyncSynchronizeThread async_synchronize_thread_;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
108
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
109 QMenu* folder_menu = nullptr;
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
110 };
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
111
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
112 #endif // MINORI_WINDOW_H_