comparison src/core/config.cc @ 149:e41505d24733

players: filter out web browsers, they aren't even supported in animia yet
author Paper <mrpapersonic@gmail.com>
date Tue, 14 Nov 2023 13:40:11 -0500
parents 6fdf0632c003
children ffa535b6d630
comparison
equal deleted inserted replaced
148:aa4df5a84338 149:e41505d24733
66 recognition.players.reserve(players.size()); 66 recognition.players.reserve(players.size());
67 for (const auto& player : players) 67 for (const auto& player : players)
68 recognition.players.push_back({true, player}); 68 recognition.players.push_back({true, player});
69 } 69 }
70 70
71 for (auto& player : recognition.players) 71 for (auto& [enabled, player] : recognition.players) {
72 player.first = INI::GetIniValue<bool>(ini, "Recognition/Players", player.second.name, true); 72 switch (player.type) {
73 default:
74 case animia::PlayerType::Default:
75 enabled = INI::GetIniValue<bool>(ini, "Recognition/Players", player.name, true);
76 break;
77 case animia::PlayerType::WebBrowser:
78 enabled = INI::GetIniValue<bool>(ini, "Recognition/Browsers", player.name, true);
79 break;
80 }
81 }
73 82
74 /* ew */ 83 /* ew */
75 locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US")))); 84 locale.SetActiveLocale(QLocale(Strings::ToQString(INI::GetIniValue<std::string>(ini, "General", "Locale", "en_US"))));
76 85
77 theme.SetTheme(Translate::ToTheme(INI::GetIniValue<std::string>(ini, "Appearance", "Theme", "Default"))); 86 theme.SetTheme(Translate::ToTheme(INI::GetIniValue<std::string>(ini, "Appearance", "Theme", "Default")));
102 111
103 INI::SetIniValue(ini, "Torrents", "RSS feed", torrents.feed_link); 112 INI::SetIniValue(ini, "Torrents", "RSS feed", torrents.feed_link);
104 113
105 INI::SetIniValue(ini, "Recognition", "Detect media players", recognition.detect_media_players); 114 INI::SetIniValue(ini, "Recognition", "Detect media players", recognition.detect_media_players);
106 115
107 for (const auto& player : recognition.players) 116 for (const auto& [enabled, player] : recognition.players) {
108 INI::SetIniValue(ini, "Recognition/Players", player.second.name, player.first); 117 switch (player.type) {
118 default:
119 case animia::PlayerType::Default:
120 INI::SetIniValue(ini, "Recognition/Players", player.name, enabled);
121 break;
122 case animia::PlayerType::WebBrowser:
123 INI::SetIniValue(ini, "Recognition/Browsers", player.name, enabled);
124 break;
125 }
126 }
109 127
110 file.write(ini); 128 file.write(ini);
111 129
112 return 0; 130 return 0;
113 } 131 }