ui: Add utility function to check if a brand is in a list

Introduces `isBrandInList` to simplify checking if a given brand exists within a list of strings. This improves code clarity and avoids repetitive implementations for the same logic.
This commit is contained in:
Jason Wen
2025-05-19 12:54:48 -04:00
parent c4d202c6bb
commit 26cde3a73e
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -78,3 +78,7 @@ QMap<QString, QVariantMap> loadPlatformList() {
return _platforms;
}
bool isBrandInList(const std::string &brand, const std::vector<std::string> &list) {
return std::find(list.begin(), list.end(), brand) != list.end();
}
+1
View File
@@ -18,3 +18,4 @@ QString getUserAgent(bool sunnylink = false);
std::optional<QString> getSunnylinkDongleId();
std::optional<QString> getParamIgnoringDefault(const std::string &param_name, const std::string &default_value);
QMap<QString, QVariantMap> loadPlatformList();
bool isBrandInList(const std::string &brand, const std::vector<std::string> &list);