diff src/core/config.cc @ 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 c130f47f6f48
children ec0a2b5493f8
line wrap: on
line diff
--- a/src/core/config.cc	Sun Feb 18 16:02:14 2024 -0500
+++ b/src/core/config.cc	Mon Apr 01 02:43:44 2024 -0400
@@ -3,15 +3,15 @@
  * parses the config... lol
  **/
 #include "core/config.h"
-#include "core/strings.h"
 #include "core/anime.h"
+#include "core/filesystem.h"
 #include "core/ini.h"
-#include "core/filesystem.h"
 #include "core/json.h"
+#include "core/strings.h"
 #include "gui/translate/anime.h"
 #include "gui/translate/config.h"
 
-#include "animia/player.h"
+#include "animone/player.h"
 
 #include <algorithm>
 #include <cstdlib>
@@ -30,7 +30,7 @@
  *
  * It technically isn't to spec, because I'm making these case-sensitive.
  * Boohoo.
-*/
+ */
 
 int Config::Load() {
 	std::filesystem::path cfg_path = Filesystem::GetConfigPath();
@@ -41,21 +41,27 @@
 
 	service = Translate::ToService(INI::GetIniValue<std::string>(ini, "General", "Service", "None"));
 
-	anime_list.score_format = Translate::ToScoreFormat(INI::GetIniValue<std::string>(ini, "Anime List", "Score format", "POINT_100"));
-	anime_list.language = Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji"));
+	anime_list.score_format =
+	    Translate::ToScoreFormat(INI::GetIniValue<std::string>(ini, "Anime List", "Score format", "POINT_100"));
+	anime_list.language =
+	    Translate::ToLanguage(INI::GetIniValue<std::string>(ini, "Anime List", "Title language", "Romaji"));
 	anime_list.display_aired_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only aired episodes", true);
-	anime_list.display_available_episodes = INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true);
-	anime_list.highlight_anime_if_available = INI::GetIniValue<bool>(ini, "Anime List", "Highlight anime if available", true);
+	anime_list.display_available_episodes =
+	    INI::GetIniValue<bool>(ini, "Anime List", "Display only available episodes in library", true);
+	anime_list.highlight_anime_if_available =
+	    INI::GetIniValue<bool>(ini, "Anime List", "Highlight anime if available", true);
 
 	if (anime_list.highlight_anime_if_available) // sanity check
-		anime_list.highlighted_anime_above_others = INI::GetIniValue<bool>(ini, "Anime List", "Display highlighted anime above others", false);
+		anime_list.highlighted_anime_above_others =
+		    INI::GetIniValue<bool>(ini, "Anime List", "Display highlighted anime above others", false);
 	else
 		anime_list.highlighted_anime_above_others = false;
 
 	auth.anilist.auth_token = INI::GetIniValue<std::string>(ini, "Authentication/AniList", "Auth Token", "");
 	auth.anilist.user_id = INI::GetIniValue<int>(ini, "Authentication/AniList", "User ID", 0);
 
-	torrents.feed_link = INI::GetIniValue<std::string>(ini, "Torrents", "RSS feed", "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0");
+	torrents.feed_link = INI::GetIniValue<std::string>(ini, "Torrents", "RSS feed",
+	                                                   "https://www.tokyotosho.info/rss.php?filter=1,11&zwnj=0");
 
 	recognition.detect_media_players = INI::GetIniValue<bool>(ini, "Recognition", "Detect media players", true);
 
@@ -69,9 +75,9 @@
 		f.open(QFile::ReadOnly | QFile::Text);
 		QTextStream ts(&f);
 
-		std::vector<animia::Player> players;
+		std::vector<animone::Player> players;
 
-		if (!animia::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players))
+		if (!animone::ParsePlayersData(Strings::ToUtf8String(ts.readAll()), players))
 			return false;
 
 		recognition.players.reserve(players.size());
@@ -82,17 +88,18 @@
 	for (auto& [enabled, player] : recognition.players) {
 		switch (player.type) {
 			default:
-			case animia::PlayerType::Default:
+			case animone::PlayerType::Default:
 				enabled = INI::GetIniValue<bool>(ini, "Recognition/Players", player.name, true);
 				break;
-			case animia::PlayerType::WebBrowser:
+			case animone::PlayerType::WebBrowser:
 				enabled = INI::GetIniValue<bool>(ini, "Recognition/Browsers", player.name, true);
 				break;
 		}
 	}
 
 	locale.RefreshAvailableLocales();
-	locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US"))));
+	locale.SetActiveLocale(
+	    QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US"))));
 
 	theme.SetTheme(Translate::ToTheme(INI::GetIniValue<std::string>(ini, "Appearance", "Theme", "Default")));
 
@@ -121,9 +128,11 @@
 	INI::SetIniValue(ini, "Anime List", "Score format", Translate::ToString(anime_list.score_format));
 	INI::SetIniValue(ini, "Anime List", "Title language", anime_list.language);
 	INI::SetIniValue(ini, "Anime List", "Display only aired episodes", anime_list.display_aired_episodes);
-	INI::SetIniValue(ini, "Anime List", "Display only available episodes in library", anime_list.display_available_episodes);
+	INI::SetIniValue(ini, "Anime List", "Display only available episodes in library",
+	                 anime_list.display_available_episodes);
 	INI::SetIniValue(ini, "Anime List", "Highlight anime if available", anime_list.highlight_anime_if_available);
-	INI::SetIniValue(ini, "Anime List", "Display highlighted anime above others", anime_list.highlighted_anime_above_others);
+	INI::SetIniValue(ini, "Anime List", "Display highlighted anime above others",
+	                 anime_list.highlighted_anime_above_others);
 
 	INI::SetIniValue(ini, "Authentication/AniList", "Auth Token", auth.anilist.auth_token);
 	INI::SetIniValue(ini, "Authentication/AniList", "User ID", auth.anilist.user_id);
@@ -137,10 +146,8 @@
 	for (const auto& [enabled, player] : recognition.players) {
 		switch (player.type) {
 			default:
-			case animia::PlayerType::Default:
-				INI::SetIniValue(ini, "Recognition/Players", player.name, enabled);
-				break;
-			case animia::PlayerType::WebBrowser:
+			case animone::PlayerType::Default: INI::SetIniValue(ini, "Recognition/Players", player.name, enabled); break;
+			case animone::PlayerType::WebBrowser:
 				INI::SetIniValue(ini, "Recognition/Browsers", player.name, enabled);
 				break;
 		}