From f85902d161ae8c78f2defc2b587ac242a1d7f172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 24 Feb 2026 00:26:39 +0100 Subject: [PATCH] Some minor code style cleanup --- UI/Theme.cpp | 25 ++++++++++++++----------- UI/Theme.h | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/UI/Theme.cpp b/UI/Theme.cpp index 9ab5cc0b59..acd85e18de 100644 --- a/UI/Theme.cpp +++ b/UI/Theme.cpp @@ -88,29 +88,32 @@ static void LoadThemeInfo(const std::vector &directories) { themeInfos.push_back(info); }; - for (size_t d = 0; d < directories.size(); d++) { + for (const auto &d : directories) { std::vector fileInfo; - g_VFS.GetFileListing(directories[d].c_str(), &fileInfo, "ini:"); + g_VFS.GetFileListing(d.c_str(), &fileInfo, "ini:"); if (fileInfo.empty()) { - File::GetFilesInDir(directories[d], &fileInfo, "ini:"); + File::GetFilesInDir(d, &fileInfo, "ini:"); } - for (size_t f = 0; f < fileInfo.size(); f++) { + for (const auto &f : fileInfo) { IniFile ini; bool success = false; - if (fileInfo[f].isDirectory) + if (f.isDirectory) { continue; + } - Path name = fileInfo[f].fullName; - Path path = directories[d]; + Path name(f.fullName); + Path path = d; // Hack around Android VFS path bug. really need to redesign this. - if (name.ToString().substr(0, 7) == "assets/") + if (name.ToString().substr(0, 7) == "assets/") { name = Path(name.ToString().substr(7)); - if (path.ToString().substr(0, 7) == "assets/") + } + if (path.ToString().substr(0, 7) == "assets/") { path = Path(path.ToString().substr(7)); + } - if (ini.LoadFromVFS(g_VFS, name.ToString()) || ini.Load(fileInfo[f].fullName)) { + if (ini.LoadFromVFS(g_VFS, name.ToString()) || ini.Load(f.fullName)) { success = true; } @@ -245,7 +248,7 @@ void UpdateTheme() { ui_theme.popupSliderFocusedColor = themeInfo.uPopupSliderFocusedColor; } -UI::Theme *GetTheme() { +const UI::Theme *GetTheme() { return &ui_theme; } diff --git a/UI/Theme.h b/UI/Theme.h index cae6d1e95a..50fd82c506 100644 --- a/UI/Theme.h +++ b/UI/Theme.h @@ -27,4 +27,4 @@ void ReloadAllThemeInfo(); std::vector GetThemeInfoNames(); void UpdateTheme(); -UI::Theme *GetTheme(); +const UI::Theme *GetTheme();