diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2020-11-20 01:01:35 +0100 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-01-31 17:07:46 +0100 |
commit | 63d4ee1968144cc3d115f92baef95785abf813ac (patch) | |
tree | 8a06b6882e8e57e1978b521158c288ff6c8f2dd9 /src/qt/networkstyle.cpp | |
parent | 4c55f92c7644c267997c7ddab37d195216d6cf39 (diff) |
refactor: iterate arrays via C++11 range-based for loops if idx is not needed
Diffstat (limited to 'src/qt/networkstyle.cpp')
-rw-r--r-- | src/qt/networkstyle.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index b1081f6aee..ee70c1bc30 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -22,7 +22,6 @@ static const struct { {"signet", QAPP_APP_NAME_SIGNET, 35, 15}, {"regtest", QAPP_APP_NAME_REGTEST, 160, 30}, }; -static const unsigned network_styles_count = sizeof(network_styles)/sizeof(*network_styles); // titleAddText needs to be const char* for tr() NetworkStyle::NetworkStyle(const QString &_appName, const int iconColorHueShift, const int iconColorSaturationReduction, const char *_titleAddText): @@ -81,14 +80,12 @@ NetworkStyle::NetworkStyle(const QString &_appName, const int iconColorHueShift, const NetworkStyle* NetworkStyle::instantiate(const std::string& networkId) { std::string titleAddText = networkId == CBaseChainParams::MAIN ? "" : strprintf("[%s]", networkId); - for (unsigned x=0; x<network_styles_count; ++x) - { - if (networkId == network_styles[x].networkId) - { + for (const auto& network_style : network_styles) { + if (networkId == network_style.networkId) { return new NetworkStyle( - network_styles[x].appName, - network_styles[x].iconColorHueShift, - network_styles[x].iconColorSaturationReduction, + network_style.appName, + network_style.iconColorHueShift, + network_style.iconColorSaturationReduction, titleAddText.c_str()); } } |