decouple current theme from map theme (fixes theme confusion bugs of last commit)
authorsheepluva
Fri, 27 Apr 2012 23:10:48 +0200
changeset 6940 211aca8c1f4f
parent 6939 970389573788
child 6941 228c0ab239f1
decouple current theme from map theme (fixes theme confusion bugs of last commit)
QTfrontend/model/ThemeModel.cpp
QTfrontend/model/ThemeModel.h
QTfrontend/ui/widget/mapContainer.cpp
QTfrontend/ui/widget/mapContainer.h
--- a/QTfrontend/ui/widget/mapContainer.cpp	Fri Apr 27 22:22:04 2012 +0200
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Fri Apr 27 23:10:48 2012 +0200
@@ -250,10 +250,15 @@
             cbTemplateFilter->hide();
             maze_size_label->hide();
             cbMazeSize->hide();
+            m_theme = m_mapInfo.theme;
     }
 
+    // the map has no pre-defined theme, so let's use the selected one
     if (m_mapInfo.theme.isEmpty())
-        emit themeChanged(lvThemes->currentIndex().data().toString());
+    {
+        m_theme = lvThemes->currentIndex().data().toString();
+        emit themeChanged(m_theme);
+    }
     emit mapChanged(m_mapInfo.name);
     emit mapgenChanged(mapgen);
 }
@@ -300,10 +305,10 @@
 
 void HWMapContainer::themeSelected(const QModelIndex & current, const QModelIndex &)
 {
-    m_mapInfo.theme = current.data().toString();
+    m_theme = current.data().toString();
 
     gbThemes->setIcon(qVariantValue<QIcon>(current.data(Qt::UserRole)));
-    emit themeChanged(m_mapInfo.theme);
+    emit themeChanged(m_theme);
 }
 
 QString HWMapContainer::getCurrentSeed() const
@@ -319,7 +324,7 @@
 
 QString HWMapContainer::getCurrentTheme() const
 {
-    return(m_mapInfo.theme);
+    return(m_theme);
 }
 
 bool HWMapContainer::getCurrentIsMission() const
--- a/QTfrontend/ui/widget/mapContainer.h	Fri Apr 27 22:22:04 2012 +0200
+++ b/QTfrontend/ui/widget/mapContainer.h	Fri Apr 27 23:10:48 2012 +0200
@@ -131,6 +131,7 @@
         void updatePreview();
 
         MapModel::MapInfo m_mapInfo;
+        QString m_theme;
 };
 
 #endif // _HWMAP_CONTAINER_INCLUDED