Mercurial > minori
annotate include/core/config.h @ 150:ffa535b6d630
*: avoid usage of std::[pair,tuple]
https://arne-mertz.de/2017/03/smelly-pair-tuple/
it's better to use real structures and such where variables are easily known...
also apparently using [] on structs is actually valid? I had no idea.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 14 Nov 2023 16:27:33 -0500 |
parents | e41505d24733 |
children | 62e336597bb7 |
rev | line source |
---|---|
9 | 1 #ifndef __core__config_h |
2 #define __core__config_h | |
85 | 3 |
9 | 4 #include "core/anime.h" |
102 | 5 #include "gui/theme.h" |
108 | 6 #include "gui/locale.h" |
147
6fdf0632c003
track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents:
120
diff
changeset
|
7 |
6fdf0632c003
track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents:
120
diff
changeset
|
8 #include "animia/player.h" |
6fdf0632c003
track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents:
120
diff
changeset
|
9 |
118
39521c47c7a3
*: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
10 #include <string> |
39521c47c7a3
*: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
11 #include <vector> |
147
6fdf0632c003
track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents:
120
diff
changeset
|
12 #include <utility> |
9 | 13 |
150
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
149
diff
changeset
|
14 struct MediaPlayer { |
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
149
diff
changeset
|
15 bool enabled = true; |
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
149
diff
changeset
|
16 animia::Player player; |
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
149
diff
changeset
|
17 }; |
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
149
diff
changeset
|
18 |
9 | 19 class Config { |
20 public: | |
21 int Load(); | |
118
39521c47c7a3
*: another huge megacommit, SORRY
Paper <mrpapersonic@gmail.com>
parents:
116
diff
changeset
|
22 int Save() const; |
9 | 23 |
24 Anime::Services service; | |
102 | 25 Theme::Theme theme; |
108 | 26 Locale::Locale locale; |
9 | 27 |
28 struct { | |
29 public: | |
30 Anime::TitleLanguage language; | |
31 bool display_aired_episodes; | |
32 bool display_available_episodes; | |
33 bool highlight_anime_if_available; | |
34 bool highlighted_anime_above_others; | |
35 } anime_list; | |
36 | |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
37 /* these should preferably be in an |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
38 "auth" struct... */ |
9 | 39 struct { |
40 public: | |
120 | 41 struct { |
42 public: | |
43 std::string auth_token; | |
44 std::string username; | |
45 int user_id; | |
46 } anilist; | |
47 } auth; | |
48 | |
49 struct { | |
50 public: | |
51 bool detect_media_players; | |
150
ffa535b6d630
*: avoid usage of std::[pair,tuple]
Paper <mrpapersonic@gmail.com>
parents:
149
diff
changeset
|
52 std::vector<MediaPlayer> players; |
120 | 53 } recognition; |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
54 |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
55 struct { |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
56 public: |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
57 std::string feed_link; |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
58 } torrents; |
9 | 59 }; |
11 | 60 |
102 | 61 #define WIDEIFY_EX(x) L##x |
62 #define WIDEIFY(x) WIDEIFY_EX(x) | |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
63 |
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
64 /* only on these platforms keep this uppercase. |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
65 this will not remove compatibility with older |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
66 versions, since these platforms are case insensitive |
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
67 (on macOS, only by default) */ |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
68 #if (defined(WIN32) || defined(MACOSX)) |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
69 #define CONFIG_DIR "Minori" |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
70 #else |
63 | 71 #define CONFIG_DIR "minori" |
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
72 #endif |
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
73 |
102 | 74 #define CONFIG_WDIR WIDEIFY(CONFIG_DIR) |
101
c537996cf67b
*: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents:
85
diff
changeset
|
75 #define CONFIG_NAME "config.ini" |
102 | 76 #define CONFIG_WNAME WIDEIFY(CONFIG_NAME) |
62 | 77 |
9 | 78 #define MAX_LINE_LENGTH 256 |
85 | 79 |
9 | 80 #endif // __core__config_h |