Add dark icon property

This commit is contained in:
GenevensiS
2025-12-05 13:36:09 +01:00
parent 039a9c5b34
commit 04a3289755
10 changed files with 118 additions and 84 deletions
+13 -3
View File
@@ -572,6 +572,7 @@ IMPLEMENT_REFLECTION(Packaged) {
REFLECT(full_name);
REFLECT(folder_name);
REFLECT_N("icon", icon_filename);
REFLECT_N("dark_icon", dark_icon_filename);
REFLECT_NO_SCRIPT(position_hint);
REFLECT(installer_group);
REFLECT(version);
@@ -584,9 +585,18 @@ Packaged::Packaged()
, fully_loaded(true)
{}
unique_ptr<wxInputStream> Packaged::openIconFile() {
if (!icon_filename.empty()) {
return openIn(icon_filename);
unique_ptr<wxInputStream> Packaged::openIconFile() {
String filename = icon_filename;
if (!dark_icon_filename.empty()) {
if (settings.darkMode()) {
wxFileName fn (dark_icon_filename);
String extension = fn.GetExt();
filename = dark_icon_filename.Replace(extension, _("")) + "_dark" + extension;
}
else filename = dark_icon_filename;
}
if (!filename.empty()) {
return openIn(filename);
} else {
return unique_ptr<wxInputStream>();
}
+10 -9
View File
@@ -305,15 +305,16 @@ public:
Packaged();
virtual ~Packaged() {}
Version version; ///< Version number of this package
Version compatible_version; ///< Earliest version number this package is compatible with
String installer_group; ///< Group to place this package in in the installer
String short_name; ///< Short name of this package
String full_name; ///< Name of this package, for menus etc.
String folder_name; ///< Name of the folder this package is loaded from.
String icon_filename; ///< Filename of icon to use in package lists
vector<PackageDependencyP> dependencies; ///< Dependencies of this package
int position_hint; ///< A hint for the package list
Version version; ///< Version number of this package
Version compatible_version; ///< Earliest version number this package is compatible with
String installer_group; ///< Group to place this package in in the installer
String short_name; ///< Short name of this package
String full_name; ///< Name of this package, for menus etc.
String folder_name; ///< Name of the folder this package is loaded from.
String icon_filename; ///< Filename of icon to use in package lists
String dark_icon_filename; ///< Filename of icon to use in package lists, when a variant for dark mode is needed
vector<PackageDependencyP> dependencies; ///< Dependencies of this package
int position_hint; ///< A hint for the package list
/// Get an input stream for the package icon, if there is any
unique_ptr<wxInputStream> openIconFile();