GCI2012: Empty list help text (Issue 375)
authorBryan Dunsmore
Wed, 28 Nov 2012 11:57:39 +0100 (2012-11-28)
changeset 8129 98e4a60da2ca
parent 8127 cffa2c8275e0
child 8131 2c8e8c204490
GCI2012: Empty list help text (issue #375)
QTfrontend/ui/widget/teamselect.cpp
QTfrontend/ui/widget/teamselect.h
--- a/QTfrontend/ui/widget/teamselect.cpp	Wed Nov 28 00:27:30 2012 +0400
+++ b/QTfrontend/ui/widget/teamselect.cpp	Wed Nov 28 11:57:39 2012 +0100
@@ -59,6 +59,7 @@
                     this, SLOT(changeTeamStatus(HWTeam)));
         }
     }
+
     emit setEnabledGameStart(curPlayingTeams.size()>1);
 }
 
@@ -168,6 +169,12 @@
         m_curNotPlayingTeams.push_back(*itPlay);
         emit teamNotPlaying(*itPlay);
         curPlayingTeams.erase(itPlay);
+
+        // Show team notice if less than two teams.
+        if (curPlayingTeams.size() < 2)
+        {
+            numTeamNotice->show();
+        }
     }
     else
     {
@@ -179,6 +186,12 @@
         curPlayingTeams.push_back(*itDontPlay);
         if(!m_acceptOuter) emit teamWillPlay(*itDontPlay);
         m_curNotPlayingTeams.erase(itDontPlay);
+
+        // Hide team notice if at least two teams.
+        if (curPlayingTeams.size() >= 2)
+        {
+            numTeamNotice->hide();
+        }
     }
 
     FrameTeams* pRemoveTeams;
@@ -254,6 +267,10 @@
     framePlaying = new FrameTeams();
     frameDontPlaying = new FrameTeams();
 
+    // Add notice about number of required teams.
+    numTeamNotice = new QLabel("Two teams are required to play!");
+    mainLayout.addWidget((QWidget*)numTeamNotice);
+
     QPalette p;
     p.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00));
     addScrArea(framePlaying, p.color(QPalette::Window).light(105), 250);
--- a/QTfrontend/ui/widget/teamselect.h	Wed Nov 28 00:27:30 2012 +0400
+++ b/QTfrontend/ui/widget/teamselect.h	Wed Nov 28 11:57:39 2012 +0100
@@ -20,6 +20,7 @@
 #ifndef _TEAM_SELECT_INCLUDED
 #define _TEAM_SELECT_INCLUDED
 
+#include <QLabel>
 #include <QGroupBox>
 #include <QVBoxLayout>
 #include <QColor>
@@ -74,6 +75,7 @@
         FrameTeams* framePlaying;
 
         QVBoxLayout mainLayout;
+        QLabel *numTeamNotice;
         bool m_acceptOuter;
 
         QList<HWTeam> curPlayingTeams;