Multiplayer page: Properly disable scheme/style/weapons widgets when changing style or mission map
authorWuzzy <Wuzzy2@mail.ru>
Sun, 18 Mar 2018 00:24:15 +0100
changeset 13249 d49bd0dd735d
parent 13248 480dcc29391c
child 13251 0c98d3b249f7
Multiplayer page: Properly disable scheme/style/weapons widgets when changing style or mission map
QTfrontend/ui/widget/gamecfgwidget.cpp
QTfrontend/ui/widget/gamecfgwidget.h
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Sat Mar 17 22:26:02 2018 +0100
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Sun Mar 18 00:24:15 2018 +0100
@@ -106,7 +106,8 @@
     OptionsInnerContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
     GBoxOptionsLayout = new QGridLayout(OptionsInnerContainer);
 
-    GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), this), 1, 0);
+    lblScript = new QLabel(QLabel::tr("Style"), this);
+    GBoxOptionsLayout->addWidget(lblScript, 1, 0);
 
     Scripts = new QComboBox(this);
     Scripts->setMaxVisibleItems(30);
@@ -127,12 +128,13 @@
     SchemeWidgetLayout->addWidget(GameSchemes, 0, 2);
     connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int)));
 
-    SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0);
+    lblScheme = new QLabel(QLabel::tr("Scheme"), SchemeWidget);
+    SchemeWidgetLayout->addWidget(lblScheme, 0, 0);
 
     QPixmap pmEdit(":/res/edit.png");
     QIcon iconEdit = QIcon(pmEdit);
 
-    QPushButton * goToSchemePage = new QPushButton(SchemeWidget);
+    goToSchemePage = new QPushButton(SchemeWidget);
     goToSchemePage->setWhatsThis(tr("Edit schemes"));
     goToSchemePage->setIconSize(pmEdit.size());
     goToSchemePage->setIcon(iconEdit);
@@ -140,7 +142,8 @@
     SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3);
     connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes()));
 
-    SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0);
+    lblWeapons = new QLabel(QLabel::tr("Weapons"), SchemeWidget);
+    SchemeWidgetLayout->addWidget(lblWeapons, 1, 0);
 
     WeaponsName = new QComboBox(SchemeWidget);
     WeaponsName->setMaxVisibleItems(30);
@@ -148,7 +151,7 @@
 
     connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
 
-    QPushButton * goToWeaponPage = new QPushButton(SchemeWidget);
+    goToWeaponPage = new QPushButton(SchemeWidget);
     goToWeaponPage->setWhatsThis(tr("Edit weapons"));
     goToWeaponPage->setIconSize(pmEdit.size());
     goToWeaponPage->setIcon(pmEdit);
@@ -524,16 +527,21 @@
     if(isEnabled() && pMapContainer->getCurrentIsMission())
     {
         Scripts->setEnabled(false);
+        lblScript->setEnabled(false);
         Scripts->setCurrentIndex(0);
 
         if (pMapContainer->getCurrentScheme() == "locked")
         {
             GameSchemes->setEnabled(false);
+            goToSchemePage->setEnabled(false);
+            lblScheme->setEnabled(false);
             GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
         }
         else
         {
             GameSchemes->setEnabled(true);
+            goToSchemePage->setEnabled(true);
+            lblScheme->setEnabled(true);
             int num = GameSchemes->findText(pMapContainer->getCurrentScheme());
             if (num != -1)
                 GameSchemes->setCurrentIndex(num);
@@ -544,11 +552,15 @@
         if (pMapContainer->getCurrentWeapons() == "locked")
         {
             WeaponsName->setEnabled(false);
+            goToWeaponPage->setEnabled(false);
+            lblWeapons->setEnabled(false);
             WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
         }
         else
         {
             WeaponsName->setEnabled(true);
+            goToWeaponPage->setEnabled(true);
+            lblWeapons->setEnabled(true);
             int num = WeaponsName->findText(pMapContainer->getCurrentWeapons());
             if (num != -1)
                 WeaponsName->setCurrentIndex(num);
@@ -564,8 +576,13 @@
     else
     {
         Scripts->setEnabled(true);
+        lblScript->setEnabled(true);
         GameSchemes->setEnabled(true);
+        goToSchemePage->setEnabled(true);
+        lblScheme->setEnabled(true);
         WeaponsName->setEnabled(true);
+        goToWeaponPage->setEnabled(true);
+        lblWeapons->setEnabled(true);
         bindEntries->setEnabled(true);
     }
     emit paramChanged("MAP", QStringList(value));
@@ -631,11 +648,15 @@
         if (scheme == "locked")
         {
             GameSchemes->setEnabled(false);
+            goToSchemePage->setEnabled(false);
+            lblScheme->setEnabled(false);
             GameSchemes->setCurrentIndex(GameSchemes->findText("Default"));
         }
         else if (m_master)
         {
             GameSchemes->setEnabled(true);
+            goToSchemePage->setEnabled(true);
+            lblScheme->setEnabled(true);
             int num = GameSchemes->findText(scheme);
             if (num != -1)
                 GameSchemes->setCurrentIndex(num);
@@ -646,11 +667,15 @@
         if (weapons == "locked")
         {
             WeaponsName->setEnabled(false);
+            goToWeaponPage->setEnabled(false);
+            lblWeapons->setEnabled(false);
             WeaponsName->setCurrentIndex(WeaponsName->findText("Default"));
         }
         else if (m_master)
         {
             WeaponsName->setEnabled(true);
+            goToWeaponPage->setEnabled(true);
+            lblWeapons->setEnabled(true);
             int num = WeaponsName->findText(weapons);
             if (num != -1)
                 WeaponsName->setCurrentIndex(num);
@@ -666,7 +691,11 @@
     else
     {
         GameSchemes->setEnabled(true);
+        goToSchemePage->setEnabled(true);
+        lblScheme->setEnabled(true);
         WeaponsName->setEnabled(true);
+        goToWeaponPage->setEnabled(true);
+        lblWeapons->setEnabled(true);
         bindEntries->setEnabled(true);
     }
     if (!index)
--- a/QTfrontend/ui/widget/gamecfgwidget.h	Sat Mar 17 22:26:02 2018 +0100
+++ b/QTfrontend/ui/widget/gamecfgwidget.h	Sun Mar 18 00:24:15 2018 +0100
@@ -47,6 +47,8 @@
         QComboBox * Scripts;
         QComboBox * GameSchemes;
         QComboBox * WeaponsName;
+        QPushButton * goToSchemePage;
+        QPushButton * goToWeaponPage;
         HWMapContainer* pMapContainer;
         QVariant schemeData(int column) const;
         bool isMaster();
@@ -93,6 +95,9 @@
         QGridLayout * GBoxOptionsLayout;
         QWidget * OptionsInnerContainer;
         QWidget * StackContainer;
+        QLabel * lblScript;
+        QLabel * lblScheme;
+        QLabel * lblWeapons;
 
         QWidget * mapContainerFree;
         QWidget * mapContainerTabbed;