Add various “What's This?” texts to multiplayer, net and team editor frontend pages
authorWuzzy <almikes@aol.com>
Wed, 04 May 2016 19:42:20 +0200
changeset 11809 f412d539284e
parent 11808 ffe6e1344ebd
child 11810 09079c1b8ad5
Add various “What's This?” texts to multiplayer, net and team editor frontend pages
QTfrontend/hwconsts.h
QTfrontend/ui/page/pageeditteam.cpp
QTfrontend/ui/page/pagenetgame.cpp
QTfrontend/ui/widget/mapContainer.cpp
QTfrontend/ui/widget/mapContainer.h
--- a/QTfrontend/hwconsts.h	Wed May 04 18:14:25 2016 +0200
+++ b/QTfrontend/hwconsts.h	Wed May 04 19:42:20 2016 +0200
@@ -38,6 +38,8 @@
 
 extern int cMaxTeams;
 extern int cMinServerVersion;
+extern int cBaseFortDistance;
+extern int cFortDistanceUnit;
 
 class QStandardItemModel;
 
--- a/QTfrontend/ui/page/pageeditteam.cpp	Wed May 04 18:14:25 2016 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Wed May 04 19:42:20 2016 +0200
@@ -147,6 +147,7 @@
 
     hbox->addWidget(CBVoicepack, 100);
     btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
+    btnTestSound->setWhatsThis("Play a random example of this voice");
     hbox->setStretchFactor(btnTestSound, 1);
 
     GBTLayout->addLayout(hbox, 4, 1);
--- a/QTfrontend/ui/page/pagenetgame.cpp	Wed May 04 18:14:25 2016 +0200
+++ b/QTfrontend/ui/page/pagenetgame.cpp	Wed May 04 19:42:20 2016 +0200
@@ -125,8 +125,8 @@
     // Ready button
 
     BtnGo = new QPushButton(this);
-    BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
     BtnGo->setIconSize(QSize(25, 34));
+    setReadyStatus(false);
     BtnGo->setMinimumWidth(50);
     BtnGo->setMinimumHeight(50);
 
@@ -217,9 +217,15 @@
 void PageNetGame::setReadyStatus(bool isReady)
 {
     if(isReady)
+    {
         BtnGo->setIcon(QIcon(":/res/lightbulb_on.png"));
+        BtnGo->setWhatsThis(tr("You are ready for action! Click on the lightbulb if you are not ready."));
+    }
     else
+    {
         BtnGo->setIcon(QIcon(":/res/lightbulb_off.png"));
+        BtnGo->setWhatsThis(tr("You're not ready for action yet. Turn on the lightbulb when you're ready so other players will know this."));
+    }
 }
 
 void PageNetGame::onRoomNameEdited()
--- a/QTfrontend/ui/widget/mapContainer.cpp	Wed May 04 18:14:25 2016 +0200
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Wed May 04 19:42:20 2016 +0200
@@ -137,6 +137,7 @@
 
     btnSeed = new QPushButton(parentWidget()->parentWidget());
     btnSeed->setText(tr("Seed"));
+    btnSeed->setWhatsThis(tr("View and edit the seed, the source of randomness in the game"));
     btnSeed->setStyleSheet("padding: 5px;");
     btnSeed->setFixedHeight(cType->height());
     connect(btnSeed, SIGNAL(clicked()), this, SLOT(showSeedPrompt()));
@@ -255,6 +256,7 @@
     QHBoxLayout * themeHBox = new QHBoxLayout(this);
 
     btnRandTheme = new QPushButton();
+    btnRandTheme->setWhatsThis(tr("Randomize the theme"));
     btnRandTheme->setIcon(lp);
     btnRandTheme->setIconSize(QSize(24, 24));
     btnRandTheme->setFixedHeight(30);
@@ -264,6 +266,7 @@
     themeHBox->addWidget(btnRandTheme, 0);
 
     btnTheme = new QPushButton(this);
+    btnTheme->setWhatsThis(tr("Choose a theme"));
     btnTheme->setFlat(true);
     btnTheme->setIconSize(QSize(30, 30));
     btnTheme->setFixedHeight(30);
@@ -794,6 +797,45 @@
     changeMapType((MapModel::MapType)cType->itemData(index).toInt());
 }
 
+void HWMapContainer::updateHelpTexts(MapModel::MapType type)
+{
+    QString randomAll = tr("Randomize the map, theme and seed");
+    QString randomNoMap = tr("Randomize the theme and seed");
+    QString randomSeed = tr("Randomize the seed");
+    QString randomAllPrev = tr("Click to randomize the map, theme and seed");
+    QString randomNoMapPrev = tr("Click to randomize the theme and seed");
+    QString mfsComplex = QString(tr("Complexity of the generated map (current: %1)")).arg(mapFeatureSize->value());
+    int fortDistance = cBaseFortDistance + mapFeatureSize->value() * cFortDistanceUnit;
+    QString mfsFortsDistance = QString(tr("Distance between forts (current: %1)")).arg(fortDistance);
+    switch (type)
+    {
+        case MapModel::GeneratedMap:
+        case MapModel::GeneratedPerlin:
+        case MapModel::GeneratedMaze:
+            mapPreview->setWhatsThis(randomAllPrev);
+            mapFeatureSize->setWhatsThis(mfsComplex);
+            btnRandomize->setWhatsThis(randomAll);
+            break;
+        case MapModel::MissionMap:
+        case MapModel::StaticMap:
+            mapPreview->setWhatsThis(randomAllPrev);
+            btnRandomize->setWhatsThis(randomAll);
+            break;
+        case MapModel::HandDrawnMap:
+            mapPreview->setWhatsThis(tr("Click to edit"));
+            btnRandomize->setWhatsThis(randomSeed);
+            break;
+        case MapModel::FortsMap:
+            mapPreview->setWhatsThis(randomNoMapPrev);
+            mapFeatureSize->setWhatsThis(mfsFortsDistance);
+            btnRandomize->setWhatsThis(randomNoMap);
+            break;
+        default:
+            break;
+    }
+}
+ 
+
 void HWMapContainer::changeMapType(MapModel::MapType type, const QModelIndex & newMap)
 {
     staticMapList->hide();
@@ -870,6 +912,9 @@
     // Update theme button size
     updateThemeButtonSize();
 
+    // Update “What's This?” help texts
+    updateHelpTexts(type);
+
     // Update cType combobox
     for (int i = 0; i < cType->count(); i++)
     {
@@ -888,6 +933,7 @@
 void HWMapContainer::intSetFeatureSize(int val)
 {
     mapFeatureSize->setValue(val);    
+    updateHelpTexts((MapModel::MapType)cType->itemData(cType->currentIndex()).toInt());
     emit mapFeatureSizeChanged(val);
 }
 void HWMapContainer::setFeatureSize(int val)
--- a/QTfrontend/ui/widget/mapContainer.h	Wed May 04 18:14:25 2016 +0200
+++ b/QTfrontend/ui/widget/mapContainer.h	Wed May 04 19:42:20 2016 +0200
@@ -175,6 +175,7 @@
         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 updateHelpTexts(MapModel::MapType type);
         void updatePreview();
         void updateThemeButtonSize();
         void setupMissionMapsView();