comparison src/core/config.cc @ 202:71832ffe425a

animia: re-add kvm fd source this is all being merged from my wildly out-of-date laptop. SORRY! in other news, I edited the CI file to install the wayland client as well, so the linux CI build might finally get wayland stuff.
author Paper <paper@paper.us.eu.org>
date Tue, 02 Jan 2024 06:05:06 -0500
parents bc1ae1810855
children 53211cb1e7f5
comparison
equal deleted inserted replaced
201:8f6f8dd2eb23 202:71832ffe425a
33 mINI::INIStructure ini; 33 mINI::INIStructure ini;
34 file.read(ini); 34 file.read(ini);
35 35
36 service = Translate::ToService(INI::GetIniValue<std::string>(ini, "General", "Service", "None")); 36 service = Translate::ToService(INI::GetIniValue<std::string>(ini, "General", "Service", "None"));
37 37
38 anime_list.score_format = Translate::ToScoreFormat(INI::GetIniValue<std::string>(ini, "Anime List", "Score format", "POINT_100"));
38 anime_list.language = Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji")); 39 anime_list.language = Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji"));
39 anime_list.display_aired_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only aired episodes", true); 40 anime_list.display_aired_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only aired episodes", true);
40 anime_list.display_available_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true); 41 anime_list.display_available_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true);
41 anime_list.highlight_anime_if_available = INI::GetIniValue<bool>(ini, "Anime List", "Highlight anime if available", true); 42 anime_list.highlight_anime_if_available = INI::GetIniValue<bool>(ini, "Anime List", "Highlight anime if available", true);
42 anime_list.highlighted_anime_above_others = INI::GetIniValue<bool>(ini, "Anime List", "Display highlighted anime above others", false); 43
44 if (anime_list.highlight_anime_if_available) // sanity check
45 anime_list.highlighted_anime_above_others = INI::GetIniValue<bool>(ini, "Anime List", "Display highlighted anime above others", false);
46 else
47 anime_list.highlighted_anime_above_others = false;
43 48
44 auth.anilist.auth_token = INI::GetIniValue<std::string>(ini, "Authentication/AniList", "Auth Token", ""); 49 auth.anilist.auth_token = INI::GetIniValue<std::string>(ini, "Authentication/AniList", "Auth Token", "");
45 auth.anilist.user_id = INI::GetIniValue<int>(ini, "Authentication/AniList", "User ID", 0); 50 auth.anilist.user_id = INI::GetIniValue<int>(ini, "Authentication/AniList", "User ID", 0);
46 51
47 torrents.feed_link = INI::GetIniValue<std::string>(ini, "Torrents", "RSS feed", "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0"); 52 torrents.feed_link = INI::GetIniValue<std::string>(ini, "Torrents", "RSS feed", "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0");
62 67
63 if (!animia::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players)) 68 if (!animia::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players))
64 return false; 69 return false;
65 70
66 recognition.players.reserve(players.size()); 71 recognition.players.reserve(players.size());
67 for (const auto& player : players) { 72 for (const auto& player : players)
68 recognition.players.push_back({true, player}); 73 recognition.players.push_back({true, player});
69 }
70 } 74 }
71 75
72 for (auto& [enabled, player] : recognition.players) { 76 for (auto& [enabled, player] : recognition.players) {
73 switch (player.type) { 77 switch (player.type) {
74 default: 78 default:
79 enabled = INI::GetIniValue<bool>(ini, "Recognition/Browsers", player.name, true); 83 enabled = INI::GetIniValue<bool>(ini, "Recognition/Browsers", player.name, true);
80 break; 84 break;
81 } 85 }
82 } 86 }
83 87
84 /* ew */
85 locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US")))); 88 locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US"))));
86 89
87 theme.SetTheme(Translate::ToTheme(INI::GetIniValue<std::string>(ini, "Appearance", "Theme", "Default"))); 90 theme.SetTheme(Translate::ToTheme(INI::GetIniValue<std::string>(ini, "Appearance", "Theme", "Default")));
88 91
89 return 0; 92 return 0;
97 mINI::INIStructure ini; 100 mINI::INIStructure ini;
98 101
99 INI::SetIniValue(ini, "General", "Service", service); 102 INI::SetIniValue(ini, "General", "Service", service);
100 INI::SetIniValue(ini, "General", "Locale", locale.GetLocale().name()); 103 INI::SetIniValue(ini, "General", "Locale", locale.GetLocale().name());
101 104
105 INI::SetIniValue(ini, "Anime List", "Score format", Translate::ToString(anime_list.score_format));
102 INI::SetIniValue(ini, "Anime List", "Title language", anime_list.language); 106 INI::SetIniValue(ini, "Anime List", "Title language", anime_list.language);
103 INI::SetIniValue(ini, "Anime List", "Display only aired episodes", anime_list.display_aired_episodes); 107 INI::SetIniValue(ini, "Anime List", "Display only aired episodes", anime_list.display_aired_episodes);
104 INI::SetIniValue(ini, "Anime List", "Display only available episodes in library", anime_list.display_available_episodes); 108 INI::SetIniValue(ini, "Anime List", "Display only available episodes in library", anime_list.display_available_episodes);
105 INI::SetIniValue(ini, "Anime List", "Highlight anime if available", anime_list.highlight_anime_if_available); 109 INI::SetIniValue(ini, "Anime List", "Highlight anime if available", anime_list.highlight_anime_if_available);
106 INI::SetIniValue(ini, "Anime List", "Display highlighted anime above others", anime_list.highlighted_anime_above_others); 110 INI::SetIniValue(ini, "Anime List", "Display highlighted anime above others", anime_list.highlighted_anime_above_others);