Merge
authorunc0rr
Thu, 17 Jan 2013 11:16:03 +0400
changeset 8394 26f0d7ab5adf
parent 8392 71e1419b7f3c (current diff)
parent 8393 85bd6c7b2641 (diff)
child 8395 0b357c57e01c
Merge
--- a/QTfrontend/model/MapModel.cpp	Tue Jan 15 12:20:19 2013 +0400
+++ b/QTfrontend/model/MapModel.cpp	Thu Jan 17 11:16:03 2013 +0400
@@ -90,7 +90,7 @@
                 QString locale = HWApplication::keyboardInputLocale().name();
 
                 QSettings descSettings(QString("physfs://Maps/%1/desc.txt").arg(map), QSettings::IniFormat);
-                desc = descSettings.value(locale, QString()).toString().replace("|", "\n");
+                desc = descSettings.value(locale, QString()).toString().replace("|", "\n").replace("\\,", ",");
             }
 
             // let's use some semi-sane hedgehog limit, rather than none
--- a/QTfrontend/res/css/qt.css	Tue Jan 15 12:20:19 2013 +0400
+++ b/QTfrontend/res/css/qt.css	Thu Jan 17 11:16:03 2013 +0400
@@ -73,6 +73,10 @@
 border-radius: 10px;
 }
 
+#mapPreview {
+background-color: #0d0544;
+}
+
 QLineEdit, QLabel, QHeaderView, QListWidget, QListView, QTableView,
 QSpinBox, QToolBox::tab, QComboBox, QComboBox QAbstractItemView,
 IconedGroupBox, .QGroupBox, GameCFGWidget, TeamSelWidget,
--- a/QTfrontend/ui/widget/bgwidget.cpp	Tue Jan 15 12:20:19 2013 +0400
+++ b/QTfrontend/ui/widget/bgwidget.cpp	Thu Jan 17 11:16:03 2013 +0400
@@ -176,6 +176,8 @@
         int ydiff = newPos.y() - oldPos.y();
         update(oldPos.x(), oldPos.y(), xdiff+sprite.width(), ydiff+sprite.height());
     }
+
+    repaint(); // Repaint every frame. Prevents ghosting of widgets if widgets resize in runtime.
 }
 
 void BGWidget::startAnimation()
--- a/QTfrontend/ui/widget/mapContainer.cpp	Tue Jan 15 12:20:19 2013 +0400
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Thu Jan 17 11:16:03 2013 +0400
@@ -228,9 +228,10 @@
     lblDesc->setWordWrap(true);
     lblDesc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
     lblDesc->setAlignment(Qt::AlignTop | Qt::AlignLeft);
-    bottomLeftLayout->addWidget(lblDesc, 100);
+    lblDesc->setStyleSheet("font: 10px;");
+    bottomLeftLayout->addWidget(lblDesc, 1);
 
-    /* Spacing above theme chooser */
+    /* Add stretch above theme button */
 
     bottomLeftLayout->addStretch(1);
 
@@ -239,7 +240,7 @@
     btnTheme = new QPushButton();
     connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt()));
     m_childWidgets << btnTheme;
-    bottomLeftLayout->addWidget(btnTheme, 1);
+    bottomLeftLayout->addWidget(btnTheme, 0);
 
     /* Add everything to main layout */
 
@@ -254,7 +255,7 @@
     staticMapChanged(m_staticMapModel->index(0, 0));
     missionMapChanged(m_missionMapModel->index(0, 0));
     updateTheme(m_themeModel->index(0, 0));
-    mapTypeChanged(0);
+    changeMapType(MapModel::GeneratedMap);
 }
 
 void HWMapContainer::setImage(const QImage newImage)
@@ -434,6 +435,8 @@
 
     if(mdl.size())
         updateTheme(mdl.at(0));
+    else
+        intSetIconlessTheme(theme);
 }
 
 void HWMapContainer::setRandomMap()
@@ -456,7 +459,6 @@
     }
 }
 
-
 void HWMapContainer::setRandomSeed()
 {
     setSeed(QUuid::createUuid().toString());
@@ -668,7 +670,6 @@
     generationStyles->hide();
     mazeStyles->hide();
     lblDesc->hide();
-    btnTheme->hide();
     btnLoadMap->hide();
     btnEditMap->hide();
     btnRandomize->hide();
@@ -682,7 +683,6 @@
             lblMapList->show();
             generationStyles->show();
             btnRandomize->show();
-            btnTheme->show();
             break;
         case MapModel::GeneratedMaze:
             mapgen = MAPGEN_MAZE;
@@ -691,12 +691,10 @@
             lblMapList->show();
             mazeStyles->show();
             btnRandomize->show();
-            btnTheme->show();
             break;
         case MapModel::HandDrawnMap:
             mapgen = MAPGEN_DRAWN;
             setMapInfo(MapModel::MapInfoDrawn);
-            btnTheme->show();
             btnLoadMap->show();
             btnEditMap->show();
             break;
@@ -724,6 +722,9 @@
             break;
     }
 
+    // Update theme button size
+    updateThemeButtonSize();
+
     // Update cType combobox
     for (int i = 0; i < cType->count(); i++)
     {
@@ -737,6 +738,21 @@
     emit mapgenChanged(mapgen);
 }
 
+void HWMapContainer::updateThemeButtonSize()
+{
+    if (m_mapInfo.type == MapModel::MissionMap)
+    {
+        btnTheme->setIconSize(QSize(30, 30));
+        btnTheme->setFixedHeight(30);
+    }
+    else
+    {
+        QSize iconSize = btnTheme->icon().actualSize(QSize(65535, 65535));
+        btnTheme->setIconSize(iconSize);
+        btnTheme->setFixedHeight(64);
+    }
+}
+
 void HWMapContainer::showThemePrompt()
 {
     ThemePrompt prompt(this);
@@ -745,7 +761,6 @@
 
     QModelIndex current = m_themeModel->index(theme, 0);
     updateTheme(current);
-    
     emit themeChanged(m_theme);
 }
 
@@ -754,11 +769,11 @@
     m_theme = selectedTheme = current.data().toString();
     QIcon icon = qVariantValue<QIcon>(current.data(Qt::UserRole));
     QSize iconSize = icon.actualSize(QSize(65535, 65535));
-    btnTheme->setFixedHeight(iconSize.height());
+    btnTheme->setFixedHeight(64);
     btnTheme->setIconSize(iconSize);
     btnTheme->setIcon(icon);
     btnTheme->setText(tr("Theme: ") + current.data(Qt::DisplayRole).toString());
-    emit themeChanged(m_theme);
+    updateThemeButtonSize();
 }
 
 void HWMapContainer::staticMapChanged(const QModelIndex & map, const QModelIndex & old)
@@ -815,13 +830,20 @@
 {
     m_mapInfo = mapInfo;
     m_curMap = m_mapInfo.name;
-    m_theme = m_mapInfo.theme;
 
     // the map has no pre-defined theme, so let's use the selected one
     if (m_mapInfo.theme.isEmpty())
     {
-        m_theme = selectedTheme;
-        emit themeChanged(m_theme);
+        if (!selectedTheme.isEmpty())
+        {
+            setTheme(selectedTheme);
+            emit themeChanged(selectedTheme);
+        }
+    }
+    else
+    {
+        setTheme(m_mapInfo.theme);
+        emit themeChanged(m_mapInfo.theme);
     }
 
     lblDesc->setText(mapInfo.desc);
@@ -832,14 +854,10 @@
 
 void HWMapContainer::loadDrawing()
 {
-
-
     QString fileName = QFileDialog::getOpenFileName(NULL, tr("Load drawn map"), ".", tr("Drawn Maps") + " (*.hwmap);;" + tr("All files") + " (*)");
 
     if(fileName.isEmpty()) return;
 
-
-
     QFile f(fileName);
 
     if(!f.open(QIODevice::ReadOnly))
@@ -878,3 +896,12 @@
     foreach (QWidget *widget, m_childWidgets)
         widget->setEnabled(master);
 }
+
+void HWMapContainer::intSetIconlessTheme(const QString & name)
+{
+    if (name.isEmpty()) return;
+
+    m_theme = name;
+    btnTheme->setIcon(QIcon());
+    btnTheme->setText(tr("Theme: ") + name);
+}
\ No newline at end of file
--- a/QTfrontend/ui/widget/mapContainer.h	Tue Jan 15 12:20:19 2013 +0400
+++ b/QTfrontend/ui/widget/mapContainer.h	Thu Jan 17 11:16:03 2013 +0400
@@ -154,10 +154,12 @@
         void intSetMapgen(MapGenerator m);
         void intSetTemplateFilter(int);
         void intSetMazeSize(int size);
+        void intSetIconlessTheme(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());
         void updatePreview();
+        void updateThemeButtonSize();
 
         MapModel::MapInfo m_mapInfo;
         QString m_theme;
--- a/share/hedgewars/Data/Maps/CTF_Blizzard/desc.txt	Tue Jan 15 12:20:19 2013 +0400
+++ b/share/hedgewars/Data/Maps/CTF_Blizzard/desc.txt	Thu Jan 17 11:16:03 2013 +0400
@@ -1,1 +1,1 @@
-en_US=Capture the Flag, blizzard style!
+en_US=Capture the Flag\, blizzard style!
--- a/share/hedgewars/Data/Maps/Control/desc.txt	Tue Jan 15 12:20:19 2013 +0400
+++ b/share/hedgewars/Data/Maps/Control/desc.txt	Thu Jan 17 11:16:03 2013 +0400
@@ -1,1 +1,1 @@
-en_US=Islands scattered everywhere, full set of|weapons.
+en_US=Islands scattered everywhere\, full set of|weapons.
--- a/share/hedgewars/Data/Maps/TrophyRace/desc.txt	Tue Jan 15 12:20:19 2013 +0400
+++ b/share/hedgewars/Data/Maps/TrophyRace/desc.txt	Thu Jan 17 11:16:03 2013 +0400
@@ -1,1 +1,1 @@
-en_US=Ready, set, go! Who is going to|be the first in this|crazy race?
+en_US=Ready\, set\, go! Who is going to|be the first in this|crazy race?
\ No newline at end of file