annotate include/gui/window.h @ 261:3ec7804abf17

include: make header guards more sane The C++ standard[1] says: Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the implementation for any use. [1]: https://timsong-cpp.github.io/cppwp/n4659/lex.name#3.1
author Paper <paper@paper.us.eu.org>
date Wed, 03 Apr 2024 20:04:28 -0400
parents 862d0d8619f6
children f31305b9f60a
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_
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
3 #include "core/config.h"
7
Paper <mrpapersonic@gmail.com>
parents: 6
diff changeset
4 #include <QMainWindow>
114
ab191e28e69d *: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents: 112
diff changeset
5 #include <memory>
79
c489dd4434af *: what did I do again?
Paper <mrpapersonic@gmail.com>
parents: 46
diff changeset
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
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
10 #include "gui/widgets/sidebar.h"
114
ab191e28e69d *: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents: 112
diff changeset
11 #include <QCloseEvent>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
12 #include <QStackedWidget>
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
13 #include <QThread>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
14 #include <QWidget>
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
15
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
16 class QMenu;
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
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
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
21 Q_OBJECT
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
22
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
23 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
24 PlayingThread(QObject* object = nullptr) : QThread(object) {}
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
25
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
26 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
27 void run() override;
170
c8375765f0fc window: make threading somewhat sane
Paper <mrpapersonic@gmail.com>
parents: 114
diff changeset
28
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
29 signals:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
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
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
34 Q_OBJECT
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents: 7
diff changeset
35
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
36 public:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
37 enum class Pages {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
38 NOW_PLAYING,
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
39
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
40 ANIME_LIST,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
41 HISTORY,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
42 STATISTICS,
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
43
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
44 SEARCH,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
45 SEASONS,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
46 TORRENTS
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
47 };
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
48
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
49 MainWindow(QWidget* parent = nullptr);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
50 void SetActivePage(QWidget* page);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
51 void CreateBars();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
52 void AddMainWidgets();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
53 void RetranslateUI();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
54 void UpdateFolderMenu();
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
55 void AsyncSynchronize(QAction* action, QStackedWidget* stack);
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
56 void changeEvent(QEvent* event) override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
57 void showEvent(QShowEvent* event) override;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
58 void closeEvent(QCloseEvent* event) override;
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
59
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
60 private:
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
61 std::unique_ptr<QWidget> main_widget = nullptr;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
62 std::unique_ptr<QStackedWidget> stack = nullptr;
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
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
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
65 std::unique_ptr<PlayingThread> thread = nullptr;
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
66
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
67 QMenu* folder_menu = nullptr;
2
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
68 };
Paper <mrpapersonic@gmail.com>
parents: 1
diff changeset
69
261
3ec7804abf17 include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents: 258
diff changeset
70 #endif // MINORI_WINDOW_H_