mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2024-12-16 10:38:53 +01:00
parent
2732536d6e
commit
627a2ef6dd
@ -69,15 +69,17 @@ QIcon IconLoader::Load(const QString &name, const int size) {
|
||||
if (IconMapper::iconmapper_.contains(name)) {
|
||||
icon_prop = IconMapper::iconmapper_[name];
|
||||
}
|
||||
ret = QIcon::fromTheme(name);
|
||||
if (ret.isNull()) {
|
||||
for (QString alt_name : icon_prop.names) {
|
||||
ret = QIcon::fromTheme(alt_name);
|
||||
if (!ret.isNull()) break;
|
||||
if (icon_prop.allow_system_icon) {
|
||||
ret = QIcon::fromTheme(name);
|
||||
if (ret.isNull()) {
|
||||
for (QString alt_name : icon_prop.names) {
|
||||
ret = QIcon::fromTheme(alt_name);
|
||||
if (!ret.isNull()) break;
|
||||
}
|
||||
}
|
||||
if (ret.isNull()) qLog(Warning) << "Couldn't load icon" << name << "from system theme icons.";
|
||||
}
|
||||
if (!ret.isNull()) return ret;
|
||||
qLog(Warning) << "Couldn't load icon" << name << "from system theme icons.";
|
||||
}
|
||||
|
||||
if (custom_icons_) {
|
||||
|
@ -26,10 +26,11 @@ namespace IconMapper {
|
||||
|
||||
struct IconProperties {
|
||||
explicit IconProperties() : min_size(0), max_size(0) {}
|
||||
IconProperties(const QStringList &_names, const int _min_size, const int _max_size) : names(_names), min_size(_min_size), max_size(_max_size) {}
|
||||
IconProperties(const QStringList &_names, const int _min_size, const int _max_size, const bool _allow_system_icon = true) : names(_names), min_size(_min_size), max_size(_max_size), allow_system_icon(_allow_system_icon) {}
|
||||
QStringList names;
|
||||
int min_size;
|
||||
int max_size;
|
||||
bool allow_system_icon;
|
||||
};
|
||||
|
||||
static const QMap<QString, IconProperties> iconmapper_ = {
|
||||
@ -61,7 +62,7 @@ static const QMap<QString, IconProperties> iconmapper_ = {
|
||||
{ "document-search", { {}, 0, 0 } },
|
||||
{ "download", { {"applications-internet", "network-workgroup"}, 0, 0 } },
|
||||
{ "edit-clear-list", { {}, 0, 0 } },
|
||||
{ "edit-clear-locationbar-ltr", { {}, 0, 0 } },
|
||||
{ "edit-clear-locationbar-ltr", { {}, 0, 0, false } },
|
||||
{ "edit-copy", { {}, 0, 0 } },
|
||||
{ "edit-delete", { {}, 0, 0 } },
|
||||
{ "edit-find", { {}, 0, 0 } },
|
||||
|
Loading…
Reference in New Issue
Block a user