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 diff
     1.1 --- a/NewArmyDialog.cs	Sat Jul 31 16:03:14 2010 +0000
     1.2 +++ b/NewArmyDialog.cs	Sat Jul 31 20:30:30 2010 +0000
     1.3 @@ -46,6 +46,11 @@
     1.4  			{
     1.5  				layout.gameSystems.AddItem(system.Name);
     1.6  			}
     1.7 +			
     1.8 +			if (gameSystems.Length == 1)
     1.9 +			{
    1.10 +				layout.gameSystems.CurrentIndex = 0;
    1.11 +			}
    1.12  		}
    1.13  		
    1.14  		private void GameSystemSelectionChanged()
    1.15 @@ -61,7 +66,18 @@
    1.16  				{
    1.17  					layout.raceList.AddItem(race.Name);
    1.18  				}
    1.19 -			}				
    1.20 +				
    1.21 +				if (races.Length == 1)
    1.22 +				{
    1.23 +					layout.raceList.SetCurrentRow(0, (uint)QItemSelectionModel.SelectionFlag.ClearAndSelect);
    1.24 +				}
    1.25 +				
    1.26 +				layout.raceList.Enabled = true;
    1.27 +			}
    1.28 +			else
    1.29 +			{
    1.30 +				layout.raceList.Enabled = false;
    1.31 +			}
    1.32  		}
    1.33  		
    1.34  		private void ValidateForm()
    1.35 @@ -86,9 +102,12 @@
    1.36  			return system;
    1.37  		}
    1.38  		
    1.39 -		private void RaceTypeChanged() 
    1.40 +		private void RaceTypeChanged()
    1.41  		{
    1.42 -			ValidateForm(); 
    1.43 +			ValidateForm();
    1.44 +			bool raceSelected = (layout.raceList.CurrentRow != -1);
    1.45 +			layout.armyName.Enabled = raceSelected;
    1.46 +			layout.armySize.Enabled = raceSelected;
    1.47  		}
    1.48  		
    1.49  		public Race GetSelectedRace()
     2.1 --- a/qt-gui/CreateNewArmyLayout.cs	Sat Jul 31 16:03:14 2010 +0000
     2.2 +++ b/qt-gui/CreateNewArmyLayout.cs	Sat Jul 31 20:30:30 2010 +0000
     2.3 @@ -1,8 +1,8 @@
     2.4  /********************************************************************************
     2.5  ** Form generated from reading ui file 'CreateNewArmyLayout.ui'
     2.6  **
     2.7 -** Created: Sat Jan 30 20:56:06 2010
     2.8 -**      by: Qt User Interface Compiler for C# version 4.5.3
     2.9 +** Created: Sat Jul 31 20:16:09 2010
    2.10 +**      by: Qt User Interface Compiler for C# version 4.6.3
    2.11  **
    2.12  ** WARNING! All changes made in this file will be lost when recompiling ui file!
    2.13  ********************************************************************************/
    2.14 @@ -71,6 +71,7 @@
    2.15  
    2.16      armySize = new QSpinBox(CreateNewArmyLayout);
    2.17      armySize.ObjectName = "armySize";
    2.18 +    armySize.Enabled = false;
    2.19      armySize.Frame = true;
    2.20      armySize.buttonSymbols = QAbstractSpinBox.ButtonSymbols.UpDownArrows;
    2.21      armySize.Maximum = 100000;
    2.22 @@ -81,11 +82,13 @@
    2.23  
    2.24      armyName = new QLineEdit(CreateNewArmyLayout);
    2.25      armyName.ObjectName = "armyName";
    2.26 +    armyName.Enabled = false;
    2.27  
    2.28      gridLayout.AddWidget(armyName, 2, 2, 1, 1);
    2.29  
    2.30      raceList = new QListWidget(CreateNewArmyLayout);
    2.31      raceList.ObjectName = "raceList";
    2.32 +    raceList.Enabled = false;
    2.33  
    2.34      gridLayout.AddWidget(raceList, 1, 2, 1, 1);
    2.35  
     3.1 --- a/qt-gui/CreateNewArmyLayout.ui	Sat Jul 31 16:03:14 2010 +0000
     3.2 +++ b/qt-gui/CreateNewArmyLayout.ui	Sat Jul 31 20:30:30 2010 +0000
     3.3 @@ -72,6 +72,9 @@
     3.4     </item>
     3.5     <item row="3" column="2">
     3.6      <widget class="QSpinBox" name="armySize">
     3.7 +     <property name="enabled">
     3.8 +      <bool>false</bool>
     3.9 +     </property>
    3.10       <property name="frame">
    3.11        <bool>true</bool>
    3.12       </property>
    3.13 @@ -90,10 +93,18 @@
    3.14      </widget>
    3.15     </item>
    3.16     <item row="2" column="2">
    3.17 -    <widget class="QLineEdit" name="armyName"/>
    3.18 +    <widget class="QLineEdit" name="armyName">
    3.19 +     <property name="enabled">
    3.20 +      <bool>false</bool>
    3.21 +     </property>
    3.22 +    </widget>
    3.23     </item>
    3.24     <item row="1" column="2">
    3.25 -    <widget class="QListWidget" name="raceList"/>
    3.26 +    <widget class="QListWidget" name="raceList">
    3.27 +     <property name="enabled">
    3.28 +      <bool>false</bool>
    3.29 +     </property>
    3.30 +    </widget>
    3.31     </item>
    3.32    </layout>
    3.33   </widget>