# HG changeset patch # User unc0rr # Date 1309008155 -14400 # Node ID 4622f83623ac41ef453f0febf400034d2b8021ad # Parent dd53755e0fcaf12d6fb057828a8c10be134f9eda# Parent c57a8878eebe1fa818047c04007f34f4df709675 merge diff -r c57a8878eebe -r 4622f83623ac QTfrontend/main.cpp --- a/QTfrontend/main.cpp Sat Jun 25 15:11:11 2011 +0200 +++ b/QTfrontend/main.cpp Sat Jun 25 17:22:35 2011 +0400 @@ -397,39 +397,38 @@ QList > icons; + themes.sort(); for(int i = themes.size() - 1; i >= 0; --i) { QFile tmpfile; tmpfile.setFileName(QString("%1/Data/Themes/%2/icon.png").arg(cfgdir->absolutePath()).arg(themes.at(i))); if (!tmpfile.exists()) - { tmpfile.setFileName(QString("%1/Themes/%2/icon.png").arg(datadir->absolutePath()).arg(themes.at(i))); - if(tmpfile.exists()) - { // load icon - QPair ic; - ic.first = QIcon(QFileInfo(tmpfile).absoluteFilePath()); + + if(tmpfile.exists()) + { // load icon + QPair ic; + ic.first = QIcon(QFileInfo(tmpfile).absoluteFilePath()); - QFile previewIconFile; - previewIconFile.setFileName(QString("%1/Data/Themes/%2/icon@2x.png").arg(cfgdir->absolutePath()).arg(themes.at(i))); - if (previewIconFile.exists()) ic.second = QIcon(QFileInfo(previewIconFile).absoluteFilePath()); - else ic.second = QIcon(QString("%1/Themes/%2/icon@2x.png").arg(datadir->absolutePath()).arg(themes.at(i))); + QFile previewIconFile; + previewIconFile.setFileName(QString("%1/Data/Themes/%2/icon@2x.png").arg(cfgdir->absolutePath()).arg(themes.at(i))); + if (previewIconFile.exists()) ic.second = QIcon(QFileInfo(previewIconFile).absoluteFilePath()); + else ic.second = QIcon(QString("%1/Themes/%2/icon@2x.png").arg(datadir->absolutePath()).arg(themes.at(i))); - icons.prepend(ic); - } - else - { - themes.removeAt(i); - } + icons.prepend(ic); + } + else + { + themes.removeAt(i); } } themesModel = new ThemesModel(themes); + Q_ASSERT(themes.size() == icons.size()); for(int i = 0; i < icons.size(); ++i) { themesModel->setData(themesModel->index(i), icons[i].first, Qt::DecorationRole); themesModel->setData(themesModel->index(i), icons[i].second, Qt::UserRole); - - qDebug() << "icon test" << themesModel->index(i).data(Qt::UserRole).toString(); } }