# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1548058359 -3600
# Node ID e3e6b0c6543ff7ca77c9ff0faddf65fe5b101513
# Parent  9e7092e5990a3b3cd4ca2123572da0c18e3d86a4
Frontend: Gray out campaign/training start buttons when no human team available

diff -r 9e7092e5990a -r e3e6b0c6543f QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp	Mon Jan 21 07:10:59 2019 +0100
+++ b/QTfrontend/hwform.cpp	Mon Jan 21 09:12:39 2019 +0100
@@ -579,6 +579,7 @@
     ui.pageCampaign->CBTeam->clear();
     ui.pageTraining->CBTeam->clear();
     /* Only show human teams in campaign/training page */
+    bool playable = false;
     for(int i=0; i<teamslist.length(); i++)
     {
         HWTeam testTeam = HWTeam(teamslist[i]);
@@ -587,8 +588,13 @@
         {
             ui.pageCampaign->CBTeam->addItem(teamslist[i]);
             ui.pageTraining->CBTeam->addItem(teamslist[i]);
+            playable = true;
         }
     }
+    ui.pageCampaign->BtnStartCampaign->setEnabled(playable);
+    ui.pageCampaign->btnPreview->setEnabled(playable);
+    ui.pageTraining->btnStart->setEnabled(playable);
+    ui.pageTraining->btnPreview->setEnabled(playable);
     UpdateTrainingPageTeam(0);
 }
 
diff -r 9e7092e5990a -r e3e6b0c6543f QTfrontend/ui/page/pagetraining.cpp
--- a/QTfrontend/ui/page/pagetraining.cpp	Mon Jan 21 07:10:59 2019 +0100
+++ b/QTfrontend/ui/page/pagetraining.cpp	Mon Jan 21 09:12:39 2019 +0100
@@ -304,7 +304,7 @@
     list = (QListWidget*) tbw->currentWidget();
     QListWidgetItem * curItem = list->currentItem();
 
-    if (curItem != NULL)
+    if ((curItem != NULL) && (CBTeam->currentIndex() != -1))
         emit startMission(curItem->data(Qt::UserRole).toString(), getSubFolderOfSelected());
 }
 
diff -r 9e7092e5990a -r e3e6b0c6543f QTfrontend/ui/page/pagetraining.h
--- a/QTfrontend/ui/page/pagetraining.h	Mon Jan 21 07:10:59 2019 +0100
+++ b/QTfrontend/ui/page/pagetraining.h	Mon Jan 21 09:12:39 2019 +0100
@@ -30,6 +30,8 @@
         QListWidget * lstTrainings;
         QListWidget * lstChallenges;
         QListWidget * lstScenarios;
+        QPushButton * btnPreview;
+        QPushButton * btnStart;
         QComboBox * CBTeam;
 
     public slots:
@@ -46,8 +48,6 @@
 
 
     private:
-        QPushButton * btnPreview;
-        QPushButton * btnStart;
         QLabel * lblCaption;
         QLabel * lblDescription;
         QLabel * lblHighscores;