changeset 3:ac1bf60edf63

Re #242: Qt# UI * Make use of icons Re #243: Create "New Army" dialog in Qt# app * Create initial rendering of dialog (non-functional) Re #247: Implement menu options in Qt# app * Add initial hook for New Army dialog from menu item
author IBBoard <dev@ibboard.co.uk>
date Sat, 23 Jan 2010 20:54:42 +0000
parents cf68a996b3f1
children d8f82945a6ab
files IBBoard.WarFoundry.GUI.QtSharp.csproj MainWindow.cs NewArmyDialog.cs qt-gui/CreateNewArmyLayout.cs qt-gui/CreateNewArmyLayout.ui
diffstat 5 files changed, 302 insertions(+), 43 deletions(-) [+]
line diff
     1.1 --- a/IBBoard.WarFoundry.GUI.QtSharp.csproj	Sat Jan 23 20:26:04 2010 +0000
     1.2 +++ b/IBBoard.WarFoundry.GUI.QtSharp.csproj	Sat Jan 23 20:54:42 2010 +0000
     1.3 @@ -36,6 +36,8 @@
     1.4      <Compile Include="MainWindow.cs" />
     1.5      <Compile Include="Main.cs" />
     1.6      <Compile Include="qt-gui\MainWindowLayout.cs" />
     1.7 +    <Compile Include="qt-gui\CreateNewArmyLayout.cs" />
     1.8 +    <Compile Include="NewArmyDialog.cs" />
     1.9    </ItemGroup>
    1.10    <ItemGroup>
    1.11      <None Include="compile-ui.sh" />
    1.12 @@ -73,6 +75,7 @@
    1.13      <None Include="icons\ui\help-about.png">
    1.14        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    1.15      </None>
    1.16 +    <None Include="qt-gui\CreateNewArmyLayout.ui" />
    1.17    </ItemGroup>
    1.18    <ItemGroup>
    1.19      <Folder Include="qt-gui\" />
     2.1 --- a/MainWindow.cs	Sat Jan 23 20:26:04 2010 +0000
     2.2 +++ b/MainWindow.cs	Sat Jan 23 20:54:42 2010 +0000
     2.3 @@ -5,49 +5,60 @@
     2.4  using System.Collections.Generic;
     2.5  using Qyoto;
     2.6  
     2.7 -public partial class MainWindow : QMainWindow
     2.8 +namespace IBBoard.WarFoundry.GUI.QtSharp
     2.9  {
    2.10 -	private Ui_MainWindowLayout layout;
    2.11 -	
    2.12 -	public MainWindow ()
    2.13 +	public class MainWindow : QMainWindow
    2.14  	{
    2.15 -		layout = new Ui_MainWindowLayout();
    2.16 -		layout.SetupUi(this);
    2.17 -		WindowIcon = new QIcon("icons/App.png");
    2.18 -		SetUpActionIcons();
    2.19 -		ConnectMenuActions();
    2.20 -		SetUpToolbar();
    2.21 -		layout.unitTabs.Clear();
    2.22 +		private Ui_MainWindowLayout layout;
    2.23 +		
    2.24 +		public MainWindow ()
    2.25 +		{
    2.26 +			layout = new Ui_MainWindowLayout();
    2.27 +			layout.SetupUi(this);
    2.28 +			WindowIcon = new QIcon("icons/App.png");
    2.29 +			SetUpActionIcons();
    2.30 +			ConnectMenuActions();
    2.31 +			SetUpToolbar();
    2.32 +			layout.unitTabs.Clear();
    2.33 +		}
    2.34 +		
    2.35 +		private void SetUpActionIcons()
    2.36 +		{
    2.37 +			layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png");
    2.38 +			layout.actionOpenArmy.icon = new QIcon("icons/ui/fileopen.png");
    2.39 +			layout.actionSaveArmy.icon = new QIcon("icons/ui/filesave.png");
    2.40 +			layout.actionSaveArmyAs.icon = new QIcon("icons/ui/filesaveas.png");
    2.41 +			layout.menuExportArmyAs.icon = new QIcon("icons/ui/export.png");
    2.42 +			layout.actionCloseArmy.icon = new QIcon("icons/ui/window-close.png");
    2.43 +			layout.actionExit.icon = new QIcon("icons/ui/exit.png");
    2.44 +			layout.actionUndo.icon = new QIcon("icons/ui/edit-undo.png");
    2.45 +			layout.actionRedo.icon = new QIcon("icons/ui/edit-redo.png");
    2.46 +			layout.actionAbout.icon = new QIcon("icons/ui/help-about.png");
    2.47 +		}
    2.48 +		
    2.49 +		private void ConnectMenuActions()
    2.50 +		{
    2.51 +			QObject.Connect(layout.actionCreateArmy, Qt.SIGNAL("triggered()"), delegate(){CreateNewArmy();});
    2.52 +		}
    2.53 +		
    2.54 +		[Q_SLOT()]
    2.55 +		private void CreateNewArmy()
    2.56 +		{
    2.57 +			NewArmyDialog dialog = new NewArmyDialog();
    2.58 +			dialog.Show();
    2.59 +		}
    2.60 +		
    2.61 +		private void SetUpToolbar()
    2.62 +		{
    2.63 +			List<QAction> actions = new List<QAction>(){
    2.64 +				layout.actionCreateArmy,
    2.65 +				layout.actionOpenArmy,
    2.66 +				layout.actionSaveArmy};
    2.67 +			layout.toolBar.AddActions(actions);
    2.68 +			layout.toolBar.AddSeparator();
    2.69 +			layout.toolBar.AddAction(layout.actionUndo);
    2.70 +			layout.toolBar.AddAction(layout.actionRedo);
    2.71 +			layout.toolBar.AddSeparator();
    2.72 +		}
    2.73  	}
    2.74 -	
    2.75 -	private void SetUpActionIcons()
    2.76 -	{
    2.77 -		layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png");
    2.78 -		layout.actionOpenArmy.icon = new QIcon("icons/ui/fileopen.png");
    2.79 -		layout.actionSaveArmy.icon = new QIcon("icons/ui/filesave.png");
    2.80 -		layout.actionSaveArmyAs.icon = new QIcon("icons/ui/filesaveas.png");
    2.81 -		layout.menuExportArmyAs.icon = new QIcon("icons/ui/export.png");
    2.82 -		layout.actionCloseArmy.icon = new QIcon("icons/ui/window-close.png");
    2.83 -		layout.actionExit.icon = new QIcon("icons/ui/exit.png");
    2.84 -		layout.actionUndo.icon = new QIcon("icons/ui/edit-undo.png");
    2.85 -		layout.actionRedo.icon = new QIcon("icons/ui/edit-redo.png");
    2.86 -		layout.actionAbout.icon = new QIcon("icons/ui/help-about.png");
    2.87 -	}
    2.88 -	
    2.89 -	private void ConnectMenuActions()
    2.90 -	{
    2.91 -	}
    2.92 -	
    2.93 -	private void SetUpToolbar()
    2.94 -	{
    2.95 -		List<QAction> actions = new List<QAction>(){
    2.96 -			layout.actionCreateArmy,
    2.97 -			layout.actionOpenArmy,
    2.98 -			layout.actionSaveArmy};
    2.99 -		layout.toolBar.AddActions(actions);
   2.100 -		layout.toolBar.AddSeparator();
   2.101 -		layout.toolBar.AddAction(layout.actionUndo);
   2.102 -		layout.toolBar.AddAction(layout.actionRedo);
   2.103 -		layout.toolBar.AddSeparator();
   2.104 -	}
   2.105 -}
   2.106 +}
   2.107 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/NewArmyDialog.cs	Sat Jan 23 20:54:42 2010 +0000
     3.3 @@ -0,0 +1,21 @@
     3.4 +// This file (NewArmyDialog.cs) is a part of the IBBoard.WarFoundry.GUI.QtSharp project and is copyright 2010 IBBoard
     3.5 +// 
     3.6 +// The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
     3.7 +
     3.8 +using System;
     3.9 +using Qyoto;
    3.10 +
    3.11 +namespace IBBoard.WarFoundry.GUI.QtSharp
    3.12 +{
    3.13 +	public class NewArmyDialog : QDialog
    3.14 +	{
    3.15 +		private Ui_CreateNewArmyLayout layout;
    3.16 +		
    3.17 +		public NewArmyDialog ()
    3.18 +		{
    3.19 +			layout = new Ui_CreateNewArmyLayout();
    3.20 +			layout.SetupUi(this);
    3.21 +			
    3.22 +		}
    3.23 +	}
    3.24 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/qt-gui/CreateNewArmyLayout.cs	Sat Jan 23 20:54:42 2010 +0000
     4.3 @@ -0,0 +1,108 @@
     4.4 +/********************************************************************************
     4.5 +** Form generated from reading ui file 'CreateNewArmyLayout.ui'
     4.6 +**
     4.7 +** Created: Sat Jan 23 20:40:44 2010
     4.8 +**      by: Qt User Interface Compiler for C# version 4.5.3
     4.9 +**
    4.10 +** WARNING! All changes made in this file will be lost when recompiling ui file!
    4.11 +********************************************************************************/
    4.12 +
    4.13 +
    4.14 +using Qyoto;
    4.15 +
    4.16 +public class Ui_CreateNewArmyLayout
    4.17 +{
    4.18 +    public QGridLayout gridLayout;
    4.19 +    public QDialogButtonBox buttonBox;
    4.20 +    public QComboBox gameSystems;
    4.21 +    public QLabel lblGameSystem;
    4.22 +    public QLabel lblRace;
    4.23 +    public QListView raceList;
    4.24 +    public QLabel lblArmyName;
    4.25 +    public QLabel lblArmySize;
    4.26 +    public QSpinBox armySize;
    4.27 +    public QLineEdit armyName;
    4.28 +
    4.29 +    public void SetupUi(QDialog CreateNewArmyLayout)
    4.30 +    {
    4.31 +    if (CreateNewArmyLayout.ObjectName == "")
    4.32 +        CreateNewArmyLayout.ObjectName = "CreateNewArmyLayout";
    4.33 +    QSize Size = new QSize(400, 300);
    4.34 +    Size = Size.ExpandedTo(CreateNewArmyLayout.MinimumSizeHint());
    4.35 +    CreateNewArmyLayout.Size = Size;
    4.36 +    gridLayout = new QGridLayout(CreateNewArmyLayout);
    4.37 +    gridLayout.ObjectName = "gridLayout";
    4.38 +    buttonBox = new QDialogButtonBox(CreateNewArmyLayout);
    4.39 +    buttonBox.ObjectName = "buttonBox";
    4.40 +    buttonBox.Orientation = Qt.Orientation.Horizontal;
    4.41 +    buttonBox.StandardButtons = Qyoto.Qyoto.GetCPPEnumValue("QDialogButtonBox", "Cancel") | Qyoto.Qyoto.GetCPPEnumValue("QDialogButtonBox", "Ok");
    4.42 +
    4.43 +    gridLayout.AddWidget(buttonBox, 4, 2, 1, 1);
    4.44 +
    4.45 +    gameSystems = new QComboBox(CreateNewArmyLayout);
    4.46 +    gameSystems.ObjectName = "gameSystems";
    4.47 +
    4.48 +    gridLayout.AddWidget(gameSystems, 0, 2, 1, 1);
    4.49 +
    4.50 +    lblGameSystem = new QLabel(CreateNewArmyLayout);
    4.51 +    lblGameSystem.ObjectName = "lblGameSystem";
    4.52 +    lblGameSystem.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignVCenter");
    4.53 +
    4.54 +    gridLayout.AddWidget(lblGameSystem, 0, 0, 1, 1);
    4.55 +
    4.56 +    lblRace = new QLabel(CreateNewArmyLayout);
    4.57 +    lblRace.ObjectName = "lblRace";
    4.58 +    lblRace.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTop") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing");
    4.59 +
    4.60 +    gridLayout.AddWidget(lblRace, 1, 0, 1, 1);
    4.61 +
    4.62 +    raceList = new QListView(CreateNewArmyLayout);
    4.63 +    raceList.ObjectName = "raceList";
    4.64 +
    4.65 +    gridLayout.AddWidget(raceList, 1, 2, 1, 1);
    4.66 +
    4.67 +    lblArmyName = new QLabel(CreateNewArmyLayout);
    4.68 +    lblArmyName.ObjectName = "lblArmyName";
    4.69 +    lblArmyName.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignVCenter");
    4.70 +
    4.71 +    gridLayout.AddWidget(lblArmyName, 2, 0, 1, 1);
    4.72 +
    4.73 +    lblArmySize = new QLabel(CreateNewArmyLayout);
    4.74 +    lblArmySize.ObjectName = "lblArmySize";
    4.75 +    lblArmySize.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignVCenter");
    4.76 +
    4.77 +    gridLayout.AddWidget(lblArmySize, 3, 0, 1, 1);
    4.78 +
    4.79 +    armySize = new QSpinBox(CreateNewArmyLayout);
    4.80 +    armySize.ObjectName = "armySize";
    4.81 +
    4.82 +    gridLayout.AddWidget(armySize, 3, 2, 1, 1);
    4.83 +
    4.84 +    armyName = new QLineEdit(CreateNewArmyLayout);
    4.85 +    armyName.ObjectName = "armyName";
    4.86 +
    4.87 +    gridLayout.AddWidget(armyName, 2, 2, 1, 1);
    4.88 +
    4.89 +
    4.90 +    RetranslateUi(CreateNewArmyLayout);
    4.91 +    QObject.Connect(buttonBox, Qt.SIGNAL("accepted()"), CreateNewArmyLayout, Qt.SLOT("accept()"));
    4.92 +    QObject.Connect(buttonBox, Qt.SIGNAL("rejected()"), CreateNewArmyLayout, Qt.SLOT("reject()"));
    4.93 +
    4.94 +    QMetaObject.ConnectSlotsByName(CreateNewArmyLayout);
    4.95 +    } // SetupUi
    4.96 +
    4.97 +    public void RetranslateUi(QDialog CreateNewArmyLayout)
    4.98 +    {
    4.99 +    CreateNewArmyLayout.WindowTitle = QApplication.Translate("CreateNewArmyLayout", "Dialog", null, QApplication.Encoding.UnicodeUTF8);
   4.100 +    lblGameSystem.Text = QApplication.Translate("CreateNewArmyLayout", "game system:", null, QApplication.Encoding.UnicodeUTF8);
   4.101 +    lblRace.Text = QApplication.Translate("CreateNewArmyLayout", "race:", null, QApplication.Encoding.UnicodeUTF8);
   4.102 +    lblArmyName.Text = QApplication.Translate("CreateNewArmyLayout", "TextLabel", null, QApplication.Encoding.UnicodeUTF8);
   4.103 +    lblArmySize.Text = QApplication.Translate("CreateNewArmyLayout", "TextLabel", null, QApplication.Encoding.UnicodeUTF8);
   4.104 +    } // RetranslateUi
   4.105 +
   4.106 +}
   4.107 +
   4.108 +namespace Ui {
   4.109 +    public class CreateNewArmyLayout : Ui_CreateNewArmyLayout {}
   4.110 +} // namespace Ui
   4.111 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/qt-gui/CreateNewArmyLayout.ui	Sat Jan 23 20:54:42 2010 +0000
     5.3 @@ -0,0 +1,116 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<ui version="4.0">
     5.6 + <class>CreateNewArmyLayout</class>
     5.7 + <widget class="QDialog" name="CreateNewArmyLayout">
     5.8 +  <property name="geometry">
     5.9 +   <rect>
    5.10 +    <x>0</x>
    5.11 +    <y>0</y>
    5.12 +    <width>400</width>
    5.13 +    <height>300</height>
    5.14 +   </rect>
    5.15 +  </property>
    5.16 +  <property name="windowTitle">
    5.17 +   <string>Dialog</string>
    5.18 +  </property>
    5.19 +  <layout class="QGridLayout" name="gridLayout">
    5.20 +   <item row="4" column="2">
    5.21 +    <widget class="QDialogButtonBox" name="buttonBox">
    5.22 +     <property name="orientation">
    5.23 +      <enum>Qt::Horizontal</enum>
    5.24 +     </property>
    5.25 +     <property name="standardButtons">
    5.26 +      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
    5.27 +     </property>
    5.28 +    </widget>
    5.29 +   </item>
    5.30 +   <item row="0" column="2">
    5.31 +    <widget class="QComboBox" name="gameSystems"/>
    5.32 +   </item>
    5.33 +   <item row="0" column="0">
    5.34 +    <widget class="QLabel" name="lblGameSystem">
    5.35 +     <property name="text">
    5.36 +      <string>game system:</string>
    5.37 +     </property>
    5.38 +     <property name="alignment">
    5.39 +      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    5.40 +     </property>
    5.41 +    </widget>
    5.42 +   </item>
    5.43 +   <item row="1" column="0">
    5.44 +    <widget class="QLabel" name="lblRace">
    5.45 +     <property name="text">
    5.46 +      <string>race:</string>
    5.47 +     </property>
    5.48 +     <property name="alignment">
    5.49 +      <set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
    5.50 +     </property>
    5.51 +    </widget>
    5.52 +   </item>
    5.53 +   <item row="1" column="2">
    5.54 +    <widget class="QListView" name="raceList"/>
    5.55 +   </item>
    5.56 +   <item row="2" column="0">
    5.57 +    <widget class="QLabel" name="lblArmyName">
    5.58 +     <property name="text">
    5.59 +      <string>TextLabel</string>
    5.60 +     </property>
    5.61 +     <property name="alignment">
    5.62 +      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    5.63 +     </property>
    5.64 +    </widget>
    5.65 +   </item>
    5.66 +   <item row="3" column="0">
    5.67 +    <widget class="QLabel" name="lblArmySize">
    5.68 +     <property name="text">
    5.69 +      <string>TextLabel</string>
    5.70 +     </property>
    5.71 +     <property name="alignment">
    5.72 +      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    5.73 +     </property>
    5.74 +    </widget>
    5.75 +   </item>
    5.76 +   <item row="3" column="2">
    5.77 +    <widget class="QSpinBox" name="armySize"/>
    5.78 +   </item>
    5.79 +   <item row="2" column="2">
    5.80 +    <widget class="QLineEdit" name="armyName"/>
    5.81 +   </item>
    5.82 +  </layout>
    5.83 + </widget>
    5.84 + <resources/>
    5.85 + <connections>
    5.86 +  <connection>
    5.87 +   <sender>buttonBox</sender>
    5.88 +   <signal>accepted()</signal>
    5.89 +   <receiver>CreateNewArmyLayout</receiver>
    5.90 +   <slot>accept()</slot>
    5.91 +   <hints>
    5.92 +    <hint type="sourcelabel">
    5.93 +     <x>248</x>
    5.94 +     <y>254</y>
    5.95 +    </hint>
    5.96 +    <hint type="destinationlabel">
    5.97 +     <x>157</x>
    5.98 +     <y>274</y>
    5.99 +    </hint>
   5.100 +   </hints>
   5.101 +  </connection>
   5.102 +  <connection>
   5.103 +   <sender>buttonBox</sender>
   5.104 +   <signal>rejected()</signal>
   5.105 +   <receiver>CreateNewArmyLayout</receiver>
   5.106 +   <slot>reject()</slot>
   5.107 +   <hints>
   5.108 +    <hint type="sourcelabel">
   5.109 +     <x>316</x>
   5.110 +     <y>260</y>
   5.111 +    </hint>
   5.112 +    <hint type="destinationlabel">
   5.113 +     <x>286</x>
   5.114 +     <y>274</y>
   5.115 +    </hint>
   5.116 +   </hints>
   5.117 +  </connection>
   5.118 + </connections>
   5.119 +</ui>