changeset 27:7eaa8a1715e2

Re #242: Complete initial Qt# UI for WarFoundry * Made New Army dialog behave more like WinForms: * Disable everything until we need it * Make default selections where we can (single items)
author IBBoard <dev@ibboard.co.uk>
date Sat, 31 Jul 2010 20:30:30 +0000
parents 55d4f16c982b
children 5ee15def17e7
files NewArmyDialog.cs qt-gui/CreateNewArmyLayout.cs qt-gui/CreateNewArmyLayout.ui
diffstat 3 files changed, 40 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NewArmyDialog.cs	Sat Jul 31 16:03:14 2010 +0000
+++ b/NewArmyDialog.cs	Sat Jul 31 20:30:30 2010 +0000
@@ -46,6 +46,11 @@
 			{
 				layout.gameSystems.AddItem(system.Name);
 			}
+			
+			if (gameSystems.Length == 1)
+			{
+				layout.gameSystems.CurrentIndex = 0;
+			}
 		}
 		
 		private void GameSystemSelectionChanged()
@@ -61,7 +66,18 @@
 				{
 					layout.raceList.AddItem(race.Name);
 				}
-			}				
+				
+				if (races.Length == 1)
+				{
+					layout.raceList.SetCurrentRow(0, (uint)QItemSelectionModel.SelectionFlag.ClearAndSelect);
+				}
+				
+				layout.raceList.Enabled = true;
+			}
+			else
+			{
+				layout.raceList.Enabled = false;
+			}
 		}
 		
 		private void ValidateForm()
@@ -86,9 +102,12 @@
 			return system;
 		}
 		
-		private void RaceTypeChanged() 
+		private void RaceTypeChanged()
 		{
-			ValidateForm(); 
+			ValidateForm();
+			bool raceSelected = (layout.raceList.CurrentRow != -1);
+			layout.armyName.Enabled = raceSelected;
+			layout.armySize.Enabled = raceSelected;
 		}
 		
 		public Race GetSelectedRace()
--- a/qt-gui/CreateNewArmyLayout.cs	Sat Jul 31 16:03:14 2010 +0000
+++ b/qt-gui/CreateNewArmyLayout.cs	Sat Jul 31 20:30:30 2010 +0000
@@ -1,8 +1,8 @@
 /********************************************************************************
 ** Form generated from reading ui file 'CreateNewArmyLayout.ui'
 **
-** Created: Sat Jan 30 20:56:06 2010
-**      by: Qt User Interface Compiler for C# version 4.5.3
+** Created: Sat Jul 31 20:16:09 2010
+**      by: Qt User Interface Compiler for C# version 4.6.3
 **
 ** WARNING! All changes made in this file will be lost when recompiling ui file!
 ********************************************************************************/
@@ -71,6 +71,7 @@
 
     armySize = new QSpinBox(CreateNewArmyLayout);
     armySize.ObjectName = "armySize";
+    armySize.Enabled = false;
     armySize.Frame = true;
     armySize.buttonSymbols = QAbstractSpinBox.ButtonSymbols.UpDownArrows;
     armySize.Maximum = 100000;
@@ -81,11 +82,13 @@
 
     armyName = new QLineEdit(CreateNewArmyLayout);
     armyName.ObjectName = "armyName";
+    armyName.Enabled = false;
 
     gridLayout.AddWidget(armyName, 2, 2, 1, 1);
 
     raceList = new QListWidget(CreateNewArmyLayout);
     raceList.ObjectName = "raceList";
+    raceList.Enabled = false;
 
     gridLayout.AddWidget(raceList, 1, 2, 1, 1);
 
--- a/qt-gui/CreateNewArmyLayout.ui	Sat Jul 31 16:03:14 2010 +0000
+++ b/qt-gui/CreateNewArmyLayout.ui	Sat Jul 31 20:30:30 2010 +0000
@@ -72,6 +72,9 @@
    </item>
    <item row="3" column="2">
     <widget class="QSpinBox" name="armySize">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
      <property name="frame">
       <bool>true</bool>
      </property>
@@ -90,10 +93,18 @@
     </widget>
    </item>
    <item row="2" column="2">
-    <widget class="QLineEdit" name="armyName"/>
+    <widget class="QLineEdit" name="armyName">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+    </widget>
    </item>
    <item row="1" column="2">
-    <widget class="QListWidget" name="raceList"/>
+    <widget class="QListWidget" name="raceList">
+     <property name="enabled">
+      <bool>false</bool>
+     </property>
+    </widget>
    </item>
   </layout>
  </widget>