annotate src/core/config.cc @ 372:a65a43766b22

dep/animone: atspi a11y impl didn't work at all and hit an assertion because paper can't code
author Paper <paper@tflc.us>
date Fri, 25 Jul 2025 11:02:29 -0400
parents 47c9f8502269
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "core/config.h"
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "core/anime.h"
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
3 #include "core/filesystem.h"
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include "core/json.h"
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
5 #include "core/strings.h"
90
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
6 #include "gui/translate/anime.h"
c4bb49c2f6eb config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents: 81
diff changeset
7 #include "gui/translate/config.h"
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
8
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
9 #include "animone/player.h"
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
10
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
11 #include <algorithm>
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 #include <cstdlib>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 #include <cstring>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 #include <filesystem>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 #include <fstream>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 #include <limits.h>
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
18 #include <toml11/toml.hpp>
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
19
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
20 #include <QFile>
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
21 #include <QTextStream>
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
22
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
23 #include <iostream>
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
24
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
25 /* NOTE: This config file is prone to breakage, as Minori is alpha software and
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
26 * as such nothing is constant. */
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
27
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
28 int Config::Load()
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
29 {
135
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
30 std::filesystem::path cfg_path = Filesystem::GetConfigPath();
102
b315f3759c56 *: big patch
Paper <mrpapersonic@gmail.com>
parents: 101
diff changeset
31
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
32 std::ifstream ifs(cfg_path, std::ios_base::binary);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
33 if (!ifs.good())
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
34 return 0;
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
35
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
36 toml::value data;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
37
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
38 try {
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
39 data = toml::parse(ifs);
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
40 } catch (const std::exception &ex) {
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
41 std::cerr << "config: failed to parse toml with error " << ex.what() << std::endl;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
42 return 0;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
43 }
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
44
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
45 service = Translate::ToService(toml::find_or(data, "General", "Service", "None"));
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
46 locale.RefreshAvailableLocales();
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
47 locale.SetActiveLocale(QLocale(Strings::ToQString(toml::find_or(data, "General", "Locale", "en_US"))));
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
48
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
49 anime_list.score_format = Translate::ToScoreFormat(toml::find_or(data, "Anime List", "Score format", "100-point"));
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
50 anime_list.language = Translate::ToLanguage(toml::find_or(data, "Anime List", "Title language", "Romaji"));
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
51 anime_list.display_aired_episodes = toml::find_or(data, "Anime List", "Display only aired episodes", true);
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
52 anime_list.display_available_episodes =
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
53 toml::find_or(data, "Anime List", "Display only available episodes in library", true);
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
54 anime_list.highlight_anime_if_available = toml::find_or(data, "Anime List", "Highlight anime if available", true);
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
55 anime_list.highlighted_anime_above_others =
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
56 (anime_list.highlight_anime_if_available)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
57 ? toml::find_or(data, "Anime List", "Display highlighted anime above others", false)
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
58 : false;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
59
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
60 auth.anilist.auth_token = toml::find_or(data, "Authentication/AniList", "Auth Token", "");
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
61 auth.anilist.user_id = toml::find_or(data, "Authentication/AniList", "User ID", 0);
317
b1f4d1867ab1 services: VERY initial Kitsu support
Paper <paper@paper.us.eu.org>
parents: 286
diff changeset
62
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
63 auth.kitsu.access_token = toml::find_or(data, "Authentication/Kitsu", "Access Token", "");
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
64 auth.kitsu.access_token_expiration =
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
65 toml::find_or(data, "Authentication/Kitsu", "Access Token Expiration", static_cast<Time::Timestamp>(0));
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
66 auth.kitsu.refresh_token = toml::find_or(data, "Authentication/Kitsu", "Refresh Token", "");
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
67 auth.kitsu.user_id = toml::find_or(data, "Authentication/Kitsu", "User ID", "");
116
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents: 108
diff changeset
68
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
69 torrents.feed_link =
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
70 toml::find_or(data, "Torrents", "RSS feed", "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0");
135
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
71
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
72 recognition.detect_media_players = toml::find_or(data, "Recognition", "Detect media players", true);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
73
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
74 {
337
a7d4e5107531 dep/animone: REFACTOR ALL THE THINGS
Paper <paper@paper.us.eu.org>
parents: 320
diff changeset
75 QFile f(":/players.animone");
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
76 if (!f.exists())
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
77 return false;
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
78
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
79 f.open(QFile::ReadOnly | QFile::Text);
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
80 QTextStream ts(&f);
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
81
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
82 std::vector<animone::Player> players;
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
83
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
84 if (!animone::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players))
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
85 return false;
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
86
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
87 recognition.players.reserve(players.size());
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
88 for (const auto &player : players)
151
54744a48a7d7 last commit part 2: struct init with {} is valid syntax, actually
Paper <mrpapersonic@gmail.com>
parents: 150
diff changeset
89 recognition.players.push_back({true, player});
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
90 }
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
91
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
92 for (auto &[enabled, player] : recognition.players) {
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
93 switch (player.type) {
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
94 default:
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
95 case animone::PlayerType::Default:
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
96 enabled = toml::find_or(data, "Recognition/Players", player.name, true);
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
97 break;
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 250
diff changeset
98 case animone::PlayerType::WebBrowser:
320
1b5c04268d6a services/kitsu: ACTUALLY finish GetAnimeList
Paper <paper@paper.us.eu.org>
parents: 318
diff changeset
99 enabled = toml::find_or(data, "Recognition/Browsers", player.name, true);
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
100 break;
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
101 }
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
102 }
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
103
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
104 theme.SetTheme(Translate::ToTheme(toml::find_or(data, "Appearance", "Theme", "Default")));
116
254b1d2b7096 settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents: 108
diff changeset
105
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
106 if (data.contains("Library") && data["Library"].contains("Folders")) {
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
107 const toml::value &folders = toml::find(data, "Library", "Folders");
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
108 std::vector<std::string> v = toml::get_or<std::vector<std::string>>(folders, {});
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
109 for (const auto &s : v)
250
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
110 if (!library.paths.count(s))
c130f47f6f48 *: many many changes
Paper <paper@paper.us.eu.org>
parents: 228
diff changeset
111 library.paths.insert(s);
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents: 224
diff changeset
112 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents: 224
diff changeset
113
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
114 library.real_time_monitor = toml::find_or(data, "Library", "Real-time monitor", true);
223
84e0a3c4737a library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents: 221
diff changeset
115
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
116 return 0;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
117 }
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
119 int Config::Save()
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
120 {
135
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
121 std::filesystem::path cfg_path = Filesystem::GetConfigPath();
0a458cb26ff4 filesystem: move to using std::filesystem after C++17 switch
Paper <mrpapersonic@gmail.com>
parents: 120
diff changeset
122 Filesystem::CreateDirectories(cfg_path);
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
123
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
124 std::ofstream file(cfg_path);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
125 if (!file.good())
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
126 return 0;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
127
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
128 toml::value data;
120
275da698697d config: template-ify INI
Paper <mrpapersonic@gmail.com>
parents: 118
diff changeset
129
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
130 data["Library"]["Folders"] = library.paths;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
131 data["Library"]["Real-time monitor"] = library.real_time_monitor;
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
132
369
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
133 for (const auto &[enabled, player] : recognition.players) {
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
134 const std::string section =
47c9f8502269 *: clang-format all the things
Paper <paper@tflc.us>
parents: 337
diff changeset
135 (player.type == animone::PlayerType::WebBrowser) ? "Recognition/Players" : "Recognition/Browsers";
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
136 data[section][player.name] = enabled;
149
e41505d24733 players: filter out web browsers, they aren't even supported in animia yet
Paper <mrpapersonic@gmail.com>
parents: 147
diff changeset
137 }
147
6fdf0632c003 track: use a bit of a more sane way to manage recognition
Paper <mrpapersonic@gmail.com>
parents: 135
diff changeset
138
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
139 data["Recognition"]["Detect media players"] = recognition.detect_media_players;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
140
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
141 data["Torrents"]["RSS feed"] = torrents.feed_link;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
142
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
143 data["Authentication/Kitsu"]["Access Token"] = auth.kitsu.access_token;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
144 data["Authentication/Kitsu"]["Access Token Expiration"] = auth.kitsu.access_token_expiration;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
145 data["Authentication/Kitsu"]["Refresh Token"] = auth.kitsu.refresh_token;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
146 data["Authentication/Kitsu"]["User ID"] = auth.kitsu.user_id;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
147
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
148 data["Authentication/AniList"]["Auth Token"] = auth.anilist.auth_token;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
149 data["Authentication/AniList"]["User ID"] = auth.anilist.user_id;
223
84e0a3c4737a library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents: 221
diff changeset
150
318
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
151 data["Anime List"]["Score format"] = Translate::ToString(anime_list.score_format);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
152 data["Anime List"]["Title language"] = Translate::ToString(anime_list.language);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
153 data["Anime List"]["Display only aired episodes"] = anime_list.display_aired_episodes;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
154 data["Anime List"]["Display only available episodes in library"] = anime_list.display_available_episodes;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
155 data["Anime List"]["Highlight anime if available"] = anime_list.highlight_anime_if_available;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
156 data["Anime List"]["Display highlighted anime above others"] = anime_list.highlighted_anime_above_others;
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
157
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
158 data["Appearance"]["Theme"] = Translate::ToString(theme.GetTheme());
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
159
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
160 data["General"]["Service"] = Translate::ToString(service);
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
161 data["General"]["Locale"] = Strings::ToUtf8String(locale.GetLocale().name());
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
162
3b355fa948c7 config: use TOML instead of INI
Paper <paper@paper.us.eu.org>
parents: 317
diff changeset
163 file << std::setw(0) << data;
101
c537996cf67b *: multitude of config changes
Paper <mrpapersonic@gmail.com>
parents: 90
diff changeset
164
9
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 return 0;
5c0397762b53 INCOMPLETE: megacommit :)
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166 }