OTHER: enable zipped skins in SkinChooser
For now this is an ugly hack, but I plan to rework that sometime later
This commit is contained in:
parent
2aabed9491
commit
cbcffe4b94
3 changed files with 30 additions and 1 deletions
|
|
@ -75,7 +75,7 @@ SkinList::SkinList (QWidget *parent) : QListWidget (parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QFileInfo fileInfo, list) {
|
foreach (QFileInfo fileInfo, list) {
|
||||||
QPixmap p = Skin::getPixmap ("main", fileInfo.filePath());
|
QPixmap p = Skin::getMainPixmap (fileInfo.filePath());
|
||||||
if (!p.isNull()) {
|
if (!p.isNull()) {
|
||||||
new SkinChooserItem (QIcon (p), fileInfo.baseName (),
|
new SkinChooserItem (QIcon (p), fileInfo.baseName (),
|
||||||
fileInfo.absoluteFilePath (), this);
|
fileInfo.absoluteFilePath (), this);
|
||||||
|
|
|
||||||
|
|
@ -801,6 +801,34 @@ Skin::setSkin (const QString& path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QPixmap
|
||||||
|
Skin::getMainPixmap (const QString& path)
|
||||||
|
{
|
||||||
|
DirIteratorBase *iter = DirIteratorBase::open(path);
|
||||||
|
if (iter == 0) {
|
||||||
|
return QPixmap ();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString entry;
|
||||||
|
QPixmap ret = QPixmap ();
|
||||||
|
while (!(entry = iter->next ().toLower ()).isEmpty ()) {
|
||||||
|
if ((entry = QFileInfo (entry).fileName ()).isEmpty ()) {
|
||||||
|
// workaround to ignore pathes in archives
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
entry = entry.section(".", 0, 0);
|
||||||
|
if (entry == "main") {
|
||||||
|
ret = iter->pixmapEntry ();
|
||||||
|
if (!ret.isNull ())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete iter;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
const QPixmap
|
const QPixmap
|
||||||
Skin::getPixmap (const QString& file, const QString &path)
|
Skin::getPixmap (const QString& file, const QString &path)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ class Skin : public QObject
|
||||||
const bool isValid () const {return m_valid;}
|
const bool isValid () const {return m_valid;}
|
||||||
|
|
||||||
static const QPixmap getPixmap (const QString&, const QString&);
|
static const QPixmap getPixmap (const QString&, const QString&);
|
||||||
|
static const QPixmap getMainPixmap (const QString& path);
|
||||||
|
|
||||||
const QSize getSize (uint item) const
|
const QSize getSize (uint item) const
|
||||||
{ return m_sizes.value (item); }
|
{ return m_sizes.value (item); }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue