mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-29 12:53:42 +08:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -18,3 +18,4 @@ QString getUserAgent(bool sunnylink = false);
|
||||
std::optional<QString> getSunnylinkDongleId();
|
||||
std::optional<QString> getParamIgnoringDefault(const std::string ¶m_name, const std::string &default_value);
|
||||
QMap<QString, QVariantMap> loadPlatformList();
|
||||
bool isBrandInList(const std::string &brand, const std::vector<std::string> &list);
|
||||
|
||||
Reference in New Issue
Block a user