Mercurial > minori
annotate include/gui/dialog/settings.h @ 339:eac06513db86
dialog/about: add licenses button
otherwise we wouldn't be complying with most of the libraries
and external software we use
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 19 Jun 2024 14:02:11 -0400 |
parents | b1f4d1867ab1 |
children |
rev | line source |
---|---|
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
1 #ifndef MINORI_GUI_DIALOG_SETTINGS_H_ |
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
2 #define MINORI_GUI_DIALOG_SETTINGS_H_ |
85 | 3 |
9 | 4 #include "core/anime.h" |
101
c537996cf67b
*: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents:
95
diff
changeset
|
5 #include "core/config.h" |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
6 #include "core/session.h" |
316 | 7 #include "gui/widgets/sidebar.h" |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
8 #include <QDialog> |
316 | 9 #include <QDialogButtonBox> |
10 #include <QLabel> | |
258 | 11 #include <QListWidget> |
108 | 12 #include <QLocale> |
316 | 13 #include <QStackedWidget> |
14 #include <QTabWidget> | |
15 #include <QVBoxLayout> | |
258 | 16 #include <QWidget> |
9 | 17 |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
18 class SettingsPage : public QWidget { |
258 | 19 Q_OBJECT |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
20 |
258 | 21 public: |
22 SettingsPage(QWidget* parent = nullptr, QString title = ""); | |
23 void SetTitle(QString title); | |
24 virtual void SaveInfo() = 0; | |
25 void AddTab(QWidget* tab, QString title = ""); | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
26 |
258 | 27 private: |
316 | 28 QLabel page_title_; |
29 QTabWidget tab_widget_; | |
30 QVBoxLayout layout_; | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
31 }; |
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
32 |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
33 class SettingsPageServices final : public SettingsPage { |
258 | 34 Q_OBJECT |
108 | 35 |
258 | 36 public: |
37 SettingsPageServices(QWidget* parent = nullptr); | |
38 void SaveInfo() override; | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
39 |
258 | 40 private: |
41 QWidget* CreateMainPage(); | |
42 QWidget* CreateAniListPage(); | |
317
b1f4d1867ab1
services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents:
316
diff
changeset
|
43 QWidget* CreateKitsuPage(); |
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
44 |
258 | 45 decltype(session.config.service) service; |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
46 }; |
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
47 |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
48 class SettingsPageApplication final : public SettingsPage { |
258 | 49 Q_OBJECT |
108 | 50 |
258 | 51 public: |
52 SettingsPageApplication(QWidget* parent = nullptr); | |
53 void SaveInfo() override; | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
54 |
258 | 55 private: |
56 QWidget* CreateAnimeListWidget(); | |
57 QWidget* CreateGeneralWidget(); | |
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
58 |
279 | 59 Theme::Theme theme; |
258 | 60 QLocale locale; |
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
61 |
258 | 62 decltype(session.config.anime_list.score_format) format; |
63 decltype(session.config.anime_list.language) language; | |
64 decltype(session.config.anime_list.display_aired_episodes) display_aired_episodes; | |
65 decltype(session.config.anime_list.display_available_episodes) display_available_episodes; | |
66 decltype(session.config.anime_list.highlight_anime_if_available) highlight_anime_if_available; | |
67 decltype(session.config.anime_list.highlighted_anime_above_others) highlighted_anime_above_others; | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
68 }; |
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
69 |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
70 class SettingsPageTorrents final : public SettingsPage { |
258 | 71 Q_OBJECT |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
72 |
258 | 73 public: |
74 SettingsPageTorrents(QWidget* parent = nullptr); | |
75 void SaveInfo() override; | |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
76 |
258 | 77 private: |
78 QWidget* CreateGeneralWidget(); | |
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
79 |
258 | 80 decltype(session.config.torrents.feed_link) feed_link; |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
81 }; |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
82 |
119
4eae379cb1ff
settings: add a very early recognition tab for configuring players and extensions
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
83 class SettingsPageRecognition final : public SettingsPage { |
258 | 84 Q_OBJECT |
119
4eae379cb1ff
settings: add a very early recognition tab for configuring players and extensions
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
85 |
258 | 86 public: |
87 SettingsPageRecognition(QWidget* parent = nullptr); | |
88 void SaveInfo() override; | |
119
4eae379cb1ff
settings: add a very early recognition tab for configuring players and extensions
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
89 |
258 | 90 private: |
91 QWidget* CreatePlayersWidget(); | |
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
92 |
258 | 93 decltype(session.config.recognition.detect_media_players) detect_media_players; |
94 decltype(session.config.recognition.players) players; | |
119
4eae379cb1ff
settings: add a very early recognition tab for configuring players and extensions
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
95 }; |
4eae379cb1ff
settings: add a very early recognition tab for configuring players and extensions
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
96 |
226 | 97 class SettingsPageLibrary final : public SettingsPage { |
258 | 98 Q_OBJECT |
226 | 99 |
258 | 100 public: |
101 SettingsPageLibrary(QWidget* parent = nullptr); | |
102 void SaveInfo() override; | |
226 | 103 |
258 | 104 private: |
105 QWidget* CreateFoldersWidget(); | |
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
106 |
258 | 107 decltype(session.config.library.paths) paths; |
108 decltype(session.config.library.real_time_monitor) real_time_monitor; | |
226 | 109 }; |
110 | |
95
8043152ef9d4
include: set classes as final where appropriate
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
111 class SettingsDialog final : public QDialog { |
258 | 112 Q_OBJECT |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
113 |
258 | 114 public: |
115 SettingsDialog(QWidget* parent = nullptr); | |
116 QWidget* CreateServicesMainPage(QWidget* parent); | |
117 void OnOK(); | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
118 |
258 | 119 protected: |
120 void showEvent(QShowEvent* event) override; | |
108 | 121 |
258 | 122 private: |
316 | 123 QVBoxLayout layout_; |
124 | |
125 QWidget widget_; | |
126 QHBoxLayout widget_layout_; | |
127 | |
128 SideBar sidebar_; | |
129 QStackedWidget stacked_; | |
130 | |
131 SettingsPageServices services_page_; | |
132 SettingsPageApplication application_page_; | |
133 SettingsPageTorrents torrents_page_; | |
134 SettingsPageRecognition recognition_page_; | |
135 SettingsPageLibrary library_page_; | |
136 | |
137 QDialogButtonBox button_box_; | |
6
1d82f6e04d7d
Update: add first parts to the settings dialog
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
138 }; |
85 | 139 |
261
3ec7804abf17
include: make header guards more sane
Paper <paper@paper.us.eu.org>
parents:
258
diff
changeset
|
140 #endif // MINORI_GUI_DIALOG_SETTINGS_H_ |