comparison include/gui/dialog/settings.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 4d461ef7d424
children 3ec7804abf17
comparison
equal deleted inserted replaced
257:699a20c57dc8 258:862d0d8619f6
3 3
4 #include "core/anime.h" 4 #include "core/anime.h"
5 #include "core/config.h" 5 #include "core/config.h"
6 #include "core/session.h" 6 #include "core/session.h"
7 #include <QDialog> 7 #include <QDialog>
8 #include <QListWidget>
9 #include <QLocale>
8 #include <QWidget> 10 #include <QWidget>
9 #include <QLocale>
10 #include <QListWidget>
11 11
12 class QLabel; 12 class QLabel;
13 class QTabWidget; 13 class QTabWidget;
14 class QStackedWidget; 14 class QStackedWidget;
15 class SideBar; 15 class SideBar;
29 void dragMoveEvent(QDragMoveEvent* event) override; 29 void dragMoveEvent(QDragMoveEvent* event) override;
30 void dropEvent(QDropEvent* event) override; 30 void dropEvent(QDropEvent* event) override;
31 }; 31 };
32 32
33 class SettingsPage : public QWidget { 33 class SettingsPage : public QWidget {
34 Q_OBJECT 34 Q_OBJECT
35 35
36 public: 36 public:
37 SettingsPage(QWidget* parent = nullptr, QString title = ""); 37 SettingsPage(QWidget* parent = nullptr, QString title = "");
38 void SetTitle(QString title); 38 void SetTitle(QString title);
39 virtual void SaveInfo() = 0; 39 virtual void SaveInfo() = 0;
40 void AddTab(QWidget* tab, QString title = ""); 40 void AddTab(QWidget* tab, QString title = "");
41 41
42 private: 42 private:
43 QLabel* page_title; 43 QLabel* page_title;
44 QTabWidget* tab_widget; 44 QTabWidget* tab_widget;
45 }; 45 };
46 46
47 class SettingsPageServices final : public SettingsPage { 47 class SettingsPageServices final : public SettingsPage {
48 Q_OBJECT 48 Q_OBJECT
49 49
50 public: 50 public:
51 SettingsPageServices(QWidget* parent = nullptr); 51 SettingsPageServices(QWidget* parent = nullptr);
52 void SaveInfo() override; 52 void SaveInfo() override;
53 53
54 private: 54 private:
55 QWidget* CreateMainPage(); 55 QWidget* CreateMainPage();
56 QWidget* CreateAniListPage(); 56 QWidget* CreateAniListPage();
57 57
58 decltype(session.config.service) service; 58 decltype(session.config.service) service;
59 }; 59 };
60 60
61 class SettingsPageApplication final : public SettingsPage { 61 class SettingsPageApplication final : public SettingsPage {
62 Q_OBJECT 62 Q_OBJECT
63 63
64 public: 64 public:
65 SettingsPageApplication(QWidget* parent = nullptr); 65 SettingsPageApplication(QWidget* parent = nullptr);
66 void SaveInfo() override; 66 void SaveInfo() override;
67 67
68 private: 68 private:
69 QWidget* CreateAnimeListWidget(); 69 QWidget* CreateAnimeListWidget();
70 QWidget* CreateGeneralWidget(); 70 QWidget* CreateGeneralWidget();
71 71
72 Themes theme; 72 Themes theme;
73 QLocale locale; 73 QLocale locale;
74 74
75 decltype(session.config.anime_list.score_format) format; 75 decltype(session.config.anime_list.score_format) format;
76 decltype(session.config.anime_list.language) language; 76 decltype(session.config.anime_list.language) language;
77 decltype(session.config.anime_list.display_aired_episodes) display_aired_episodes; 77 decltype(session.config.anime_list.display_aired_episodes) display_aired_episodes;
78 decltype(session.config.anime_list.display_available_episodes) display_available_episodes; 78 decltype(session.config.anime_list.display_available_episodes) display_available_episodes;
79 decltype(session.config.anime_list.highlight_anime_if_available) highlight_anime_if_available; 79 decltype(session.config.anime_list.highlight_anime_if_available) highlight_anime_if_available;
80 decltype(session.config.anime_list.highlighted_anime_above_others) highlighted_anime_above_others; 80 decltype(session.config.anime_list.highlighted_anime_above_others) highlighted_anime_above_others;
81 }; 81 };
82 82
83 class SettingsPageTorrents final : public SettingsPage { 83 class SettingsPageTorrents final : public SettingsPage {
84 Q_OBJECT 84 Q_OBJECT
85 85
86 public: 86 public:
87 SettingsPageTorrents(QWidget* parent = nullptr); 87 SettingsPageTorrents(QWidget* parent = nullptr);
88 void SaveInfo() override; 88 void SaveInfo() override;
89 89
90 private: 90 private:
91 QWidget* CreateGeneralWidget(); 91 QWidget* CreateGeneralWidget();
92 92
93 decltype(session.config.torrents.feed_link) feed_link; 93 decltype(session.config.torrents.feed_link) feed_link;
94 }; 94 };
95 95
96 class SettingsPageRecognition final : public SettingsPage { 96 class SettingsPageRecognition final : public SettingsPage {
97 Q_OBJECT 97 Q_OBJECT
98 98
99 public: 99 public:
100 SettingsPageRecognition(QWidget* parent = nullptr); 100 SettingsPageRecognition(QWidget* parent = nullptr);
101 void SaveInfo() override; 101 void SaveInfo() override;
102 102
103 private: 103 private:
104 QWidget* CreatePlayersWidget(); 104 QWidget* CreatePlayersWidget();
105 105
106 decltype(session.config.recognition.detect_media_players) detect_media_players; 106 decltype(session.config.recognition.detect_media_players) detect_media_players;
107 decltype(session.config.recognition.players) players; 107 decltype(session.config.recognition.players) players;
108 }; 108 };
109 109
110 class SettingsPageLibrary final : public SettingsPage { 110 class SettingsPageLibrary final : public SettingsPage {
111 Q_OBJECT 111 Q_OBJECT
112 112
113 public: 113 public:
114 SettingsPageLibrary(QWidget* parent = nullptr); 114 SettingsPageLibrary(QWidget* parent = nullptr);
115 void SaveInfo() override; 115 void SaveInfo() override;
116 116
117 private: 117 private:
118 QWidget* CreateFoldersWidget(); 118 QWidget* CreateFoldersWidget();
119 119
120 decltype(session.config.library.paths) paths; 120 decltype(session.config.library.paths) paths;
121 decltype(session.config.library.real_time_monitor) real_time_monitor; 121 decltype(session.config.library.real_time_monitor) real_time_monitor;
122 }; 122 };
123 123
124 class SettingsDialog final : public QDialog { 124 class SettingsDialog final : public QDialog {
125 Q_OBJECT 125 Q_OBJECT
126 126
127 public: 127 public:
128 SettingsDialog(QWidget* parent = nullptr); 128 SettingsDialog(QWidget* parent = nullptr);
129 QWidget* CreateServicesMainPage(QWidget* parent); 129 QWidget* CreateServicesMainPage(QWidget* parent);
130 void OnOK(); 130 void OnOK();
131 131
132 protected: 132 protected:
133 void showEvent(QShowEvent* event) override; 133 void showEvent(QShowEvent* event) override;
134 134
135 private: 135 private:
136 SideBar* sidebar; 136 SideBar* sidebar;
137 QStackedWidget* stacked; 137 QStackedWidget* stacked;
138 }; 138 };
139 139
140 #endif // __gui__dialog__settings_h 140 #endif // __gui__dialog__settings_h