Enhance theme management with dynamic discovery and macOS bundle support

- Updated CMake configuration to ensure theme files are included in macOS bundles and added explicit file handling for theme resources.
- Refactored ThemeManager to replace hardcoded theme lists with dynamic discovery of available themes, improving flexibility across development and deployment scenarios.
- Introduced methods for refreshing and loading themes at runtime, enhancing user experience and customization options.
- Improved logging for theme loading processes, providing better feedback on successes and failures.
This commit is contained in:
scawful
2025-09-26 19:55:40 -04:00
parent 83d31556bb
commit c5e8e04f65
4 changed files with 190 additions and 16 deletions

View File

@@ -138,6 +138,12 @@ public:
absl::Status LoadThemeFromFile(const std::string& filepath);
absl::Status SaveThemeToFile(const EnhancedTheme& theme, const std::string& filepath) const;
// Dynamic theme discovery - replaces hardcoded theme lists with automatic discovery
// This works across development builds, macOS app bundles, and other deployment scenarios
std::vector<std::string> DiscoverAvailableThemeFiles() const;
absl::Status LoadAllAvailableThemes();
absl::Status RefreshAvailableThemes(); // Public method to refresh at runtime
// Built-in themes
void InitializeBuiltInThemes();
std::vector<std::string> GetAvailableThemes() const;
@@ -171,6 +177,10 @@ private:
absl::Status ParseThemeFile(const std::string& content, EnhancedTheme& theme);
Color ParseColorFromString(const std::string& color_str) const;
std::string SerializeTheme(const EnhancedTheme& theme) const;
// Helper methods for path resolution
std::vector<std::string> GetThemeSearchPaths() const;
std::string GetThemesDirectory() const;
};
} // namespace gui