# HG changeset patch # User Wuzzy # Date 1521384137 -3600 # Node ID d2b58cf339fea15314882d9f3a79dd696b134491 # Parent b0022324fb4e53e1d5af1c5d3f30b3a06dfcafbd Show error icon when selected theme is missing diff -r b0022324fb4e -r d2b58cf339fe QTfrontend/hedgewars.qrc --- a/QTfrontend/hedgewars.qrc Sun Mar 18 15:24:54 2018 +0100 +++ b/QTfrontend/hedgewars.qrc Sun Mar 18 15:42:17 2018 +0100 @@ -99,6 +99,7 @@ res/missionFinished.png res/missionFinishedSelected.png res/missingMap.png + res/missingTheme@2x.png res/dlcMarker.png res/dlcMarkerSelected.png res/graphicsicon.png diff -r b0022324fb4e -r d2b58cf339fe QTfrontend/model/ThemeModel.cpp --- a/QTfrontend/model/ThemeModel.cpp Sun Mar 18 15:24:54 2018 +0100 +++ b/QTfrontend/model/ThemeModel.cpp Sun Mar 18 15:42:17 2018 +0100 @@ -131,7 +131,7 @@ dataset.insert(IsHiddenRole, true); // detect if theme is dlc - QString themeDir = PHYSFS_getRealDir(QString("Themes/%1/icon.png").arg(theme).toLocal8Bit().data()); + QString themeDir = PHYSFS_getRealDir(QString("Themes/%1").arg(theme).toLocal8Bit().data()); bool isDLC = !themeDir.startsWith(datadir->absolutePath()); dataset.insert(IsDlcRole, isDLC); diff -r b0022324fb4e -r d2b58cf339fe QTfrontend/res/missingTheme.png Binary file QTfrontend/res/missingTheme.png has changed diff -r b0022324fb4e -r d2b58cf339fe QTfrontend/res/missingTheme@2x.png Binary file QTfrontend/res/missingTheme@2x.png has changed diff -r b0022324fb4e -r d2b58cf339fe QTfrontend/ui/widget/mapContainer.cpp --- a/QTfrontend/ui/widget/mapContainer.cpp Sun Mar 18 15:24:54 2018 +0100 +++ b/QTfrontend/ui/widget/mapContainer.cpp Sun Mar 18 15:42:17 2018 +0100 @@ -541,7 +541,7 @@ if(mdl.size()) updateTheme(mdl.at(0)); else - intSetIconlessTheme(theme); + setMissingTheme(theme); } void HWMapContainer::setRandomMap() @@ -1197,13 +1197,18 @@ } } -void HWMapContainer::intSetIconlessTheme(const QString & name) +void HWMapContainer::setMissingTheme(const QString & name) { if (name.isEmpty()) return; m_theme = name; - btnTheme->setIcon(QIcon()); + QPixmap pixMissing = QPixmap(":/res/missingTheme@2x.png"); + QIcon iconMissing = QIcon(); + iconMissing.addPixmap(pixMissing, QIcon::Normal); + iconMissing.addPixmap(pixMissing, QIcon::Disabled); + btnTheme->setIcon(iconMissing); btnTheme->setText(tr("Theme: %1").arg(name)); + updateThemeButtonSize(); } void HWMapContainer::setupMissionMapsView() diff -r b0022324fb4e -r d2b58cf339fe QTfrontend/ui/widget/mapContainer.h --- a/QTfrontend/ui/widget/mapContainer.h Sun Mar 18 15:24:54 2018 +0100 +++ b/QTfrontend/ui/widget/mapContainer.h Sun Mar 18 15:42:17 2018 +0100 @@ -174,7 +174,7 @@ void intSetTemplateFilter(int); void intSetMazeSize(int size); void intSetFeatureSize(int size); - void intSetIconlessTheme(const QString & name); + void setMissingTheme(const QString & name); void mapChanged(const QModelIndex & map, int type, const QModelIndex & old = QModelIndex()); void setMapInfo(MapModel::MapInfo mapInfo); void changeMapType(MapModel::MapType type, const QModelIndex & newMap = QModelIndex());