QTfrontent: Print map and style name in red, if missing. And update map label after delegation
--- a/QTfrontend/res/css/qt.css Thu Mar 22 13:29:07 2018 +0100
+++ b/QTfrontend/res/css/qt.css Thu Mar 22 14:09:10 2018 +0100
@@ -122,6 +122,9 @@
#mapName {
font: bold 13px;
}
+.QLabel{
+background-color: transparent;
+}
SelWeaponWidget QTabWidget::pane, SelWeaponWidget QTabBar::tab:selected {
background-position: bottom center;
background-repeat: repeat-x;
--- a/QTfrontend/ui/widget/mapContainer.cpp Thu Mar 22 13:29:07 2018 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp Thu Mar 22 14:09:10 2018 +0100
@@ -216,9 +216,7 @@
teMapName->setReadOnly(true);
teMapName->setAcceptRichText(false);
teMapName->setFrameStyle(QFrame::NoFrame);
- QPalette pal = QPalette(qApp->palette());
- pal.setColor(QPalette::Base, Qt::transparent);
- teMapName->setPalette(pal);
+ teMapName->setStyleSheet("background-color: transparent");
teMapName->setLineWrapMode(QTextEdit::WidgetWidth);
teMapName->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
@@ -579,7 +577,7 @@
m_missingMap = true;
m_curMap = map;
m_mapInfo.name = map;
- setMapNameLabel(map);
+ setMapNameLabel(map, false);
if (m_mapInfo.type == MapModel::StaticMap)
setupStaticMapsView(m_curMap);
else if (m_mapInfo.type == MapModel::MissionMap)
@@ -1000,7 +998,7 @@
missionMapChanged(newMap.isValid() ? newMap : missionMapList->currentIndex());
lblMapList->setText(tr("Mission:"));
lblMapList->show();
- setMapNameLabel(m_curMap);
+ setMapNameLabel(m_curMap, !m_missingMap);
if(m_master)
{
missionMapList->show();
@@ -1020,7 +1018,7 @@
staticMapChanged(newMap.isValid() ? newMap : staticMapList->currentIndex());
lblMapList->setText(tr("Map:"));
lblMapList->show();
- setMapNameLabel(m_curMap);
+ setMapNameLabel(m_curMap, !m_missingMap);
if(m_master)
{
staticMapList->show();
@@ -1284,6 +1282,10 @@
setRandomTheme();
}
}
+ else
+ {
+ setMapNameLabel(m_curMap, true);
+ }
}
void HWMapContainer::setMissingTheme(const QString & name)
@@ -1341,7 +1343,7 @@
// Call this function instead of setting the text of the map name label
// directly.
-void HWMapContainer::setMapNameLabel(QString mapName)
+void HWMapContainer::setMapNameLabel(QString mapName, bool validMap)
{
// Cut off insanely long names to be displayed
if(mapName.length() >= 90)
@@ -1350,4 +1352,8 @@
mapName.append(" (...)");
}
teMapName->setPlainText(mapName);
+ if(validMap)
+ teMapName->setStyleSheet("background-color: transparent;");
+ else
+ teMapName->setStyleSheet("background-color: transparent; color: #b50000;");
}
--- a/QTfrontend/ui/widget/mapContainer.h Thu Mar 22 13:29:07 2018 +0100
+++ b/QTfrontend/ui/widget/mapContainer.h Thu Mar 22 14:09:10 2018 +0100
@@ -187,7 +187,7 @@
void updateThemeButtonSize();
void setupMissionMapsView(const QString & initialMap = QString());
void setupStaticMapsView(const QString & initialMap = QString());
- void setMapNameLabel(QString mapName);
+ void setMapNameLabel(QString mapName, bool validMap);
MapModel::MapInfo m_mapInfo;
int m_themeID;