Fix blurry icons - specify image size when add file to icon.

This commit is contained in:
craig.p.drummond@gmail.com
2012-10-10 11:32:07 +00:00
committed by craig.p.drummond@gmail.com
parent d29096854b
commit b07dbf387c
3 changed files with 21 additions and 10 deletions

View File

@@ -75,11 +75,15 @@ Icon Icon::getMediaIcon(const QString &name)
return icn;
}
Icon Icon::create(const QStringList &sizes)
Icon Icon::create(const QList<File> &files)
{
Icon icon(sizes.at(0));
for (int i=1; i<sizes.size(); ++i) {
icon.addFile(sizes.at(i));
Icon icon;
foreach (const File &f, files) {
if (0!=f.size) {
icon.addFile(f.name, QSize(f.size, f.size));
} else {
icon.addFile(f.name);
}
}
return icon;
}

View File

@@ -63,7 +63,13 @@ public:
#endif
#ifndef ENABLE_KDE_SUPPORT
static Icon create(const QStringList &sizes);
struct File
{
File(const QString &n, int s=0) : name(n), size(s) { }
QString name;
int size;
};
static Icon create(const QList<File> &files);
#endif
};

View File

@@ -137,20 +137,21 @@ void Icons::init()
variousArtistsIcon=Icon("cantata-view-media-artist-various");
artistIcon=Icon("view-media-artist");
#ifndef ENABLE_KDE_SUPPORT
appIcon=Icon::create(QStringList() << ":cantata.svg" << ":cantata16.png" << ":cantata22.png" << ":cantata32.png" << ":cantata48.png" << ":cantata64.png");
appIcon=Icon::create(QList<Icon::File>() << Icon::File(":cantata.svg") << Icon::File(":cantata16.png", 16) << Icon::File(":cantata22.png", 22)
<< Icon::File(":cantata32.png", 32) << Icon::File(":cantata48.png", 48) << Icon::File(":cantata64.png", 64));
shortcutsIcon=Icon("preferences-desktop-keyboard");
if (repeatIcon.isNull()) {
repeatIcon=Icon::create(QStringList() << ":repeat16.png" << ":repeat22.png");
repeatIcon=Icon::create(QList<Icon::File>() << Icon::File(":repeat16.png", 16) << Icon::File(":repeat22.png", 22));
}
if (shuffleIcon.isNull()) {
shuffleIcon=Icon::create(QStringList() << ":shuffle16.png" << ":shuffle22.png");
shuffleIcon=Icon::create(QList<Icon::File>() << Icon::File(":shuffle16.png", 16) << Icon::File(":shuffle22.png", 22));
}
if (libraryIcon.isNull()) {
libraryIcon=Icon::create(QStringList() << ":lib16.png" << ":lib32.png");
libraryIcon=Icon::create(QList<Icon::File>() << Icon::File(":lib16.png", 16) << Icon::File(":lib32.png", 22));
}
if (wikiIcon.isNull()) {
wikiIcon=Icon::create(QStringList() << ":wiki16.png" << ":wiki32.png");
wikiIcon=Icon::create(QList<Icon::File>() << Icon::File(":wiki16.png", 16) << Icon::File(":wiki32.png", 22));
}
#ifndef Q_OS_WIN