# HG changeset patch # User IBBoard # Date 1264280082 0 # Node ID ac1bf60edf637bb5eab137f301816eb88e02ffeb # Parent cf68a996b3f197a9bec215af3d9f41675a0dd843 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 diff -r cf68a996b3f1 -r ac1bf60edf63 IBBoard.WarFoundry.GUI.QtSharp.csproj --- a/IBBoard.WarFoundry.GUI.QtSharp.csproj Sat Jan 23 20:26:04 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.QtSharp.csproj Sat Jan 23 20:54:42 2010 +0000 @@ -36,6 +36,8 @@ + + @@ -73,6 +75,7 @@ PreserveNewest + diff -r cf68a996b3f1 -r ac1bf60edf63 MainWindow.cs --- a/MainWindow.cs Sat Jan 23 20:26:04 2010 +0000 +++ b/MainWindow.cs Sat Jan 23 20:54:42 2010 +0000 @@ -5,49 +5,60 @@ using System.Collections.Generic; using Qyoto; -public partial class MainWindow : QMainWindow +namespace IBBoard.WarFoundry.GUI.QtSharp { - private Ui_MainWindowLayout layout; - - public MainWindow () - { - layout = new Ui_MainWindowLayout(); - layout.SetupUi(this); - WindowIcon = new QIcon("icons/App.png"); - SetUpActionIcons(); - ConnectMenuActions(); - SetUpToolbar(); - layout.unitTabs.Clear(); - } - - private void SetUpActionIcons() + public class MainWindow : QMainWindow { - layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png"); - layout.actionOpenArmy.icon = new QIcon("icons/ui/fileopen.png"); - layout.actionSaveArmy.icon = new QIcon("icons/ui/filesave.png"); - layout.actionSaveArmyAs.icon = new QIcon("icons/ui/filesaveas.png"); - layout.menuExportArmyAs.icon = new QIcon("icons/ui/export.png"); - layout.actionCloseArmy.icon = new QIcon("icons/ui/window-close.png"); - layout.actionExit.icon = new QIcon("icons/ui/exit.png"); - layout.actionUndo.icon = new QIcon("icons/ui/edit-undo.png"); - layout.actionRedo.icon = new QIcon("icons/ui/edit-redo.png"); - layout.actionAbout.icon = new QIcon("icons/ui/help-about.png"); - } - - private void ConnectMenuActions() - { + private Ui_MainWindowLayout layout; + + public MainWindow () + { + layout = new Ui_MainWindowLayout(); + layout.SetupUi(this); + WindowIcon = new QIcon("icons/App.png"); + SetUpActionIcons(); + ConnectMenuActions(); + SetUpToolbar(); + layout.unitTabs.Clear(); + } + + private void SetUpActionIcons() + { + layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png"); + layout.actionOpenArmy.icon = new QIcon("icons/ui/fileopen.png"); + layout.actionSaveArmy.icon = new QIcon("icons/ui/filesave.png"); + layout.actionSaveArmyAs.icon = new QIcon("icons/ui/filesaveas.png"); + layout.menuExportArmyAs.icon = new QIcon("icons/ui/export.png"); + layout.actionCloseArmy.icon = new QIcon("icons/ui/window-close.png"); + layout.actionExit.icon = new QIcon("icons/ui/exit.png"); + layout.actionUndo.icon = new QIcon("icons/ui/edit-undo.png"); + layout.actionRedo.icon = new QIcon("icons/ui/edit-redo.png"); + layout.actionAbout.icon = new QIcon("icons/ui/help-about.png"); + } + + private void ConnectMenuActions() + { + QObject.Connect(layout.actionCreateArmy, Qt.SIGNAL("triggered()"), delegate(){CreateNewArmy();}); + } + + [Q_SLOT()] + private void CreateNewArmy() + { + NewArmyDialog dialog = new NewArmyDialog(); + dialog.Show(); + } + + private void SetUpToolbar() + { + List actions = new List(){ + layout.actionCreateArmy, + layout.actionOpenArmy, + layout.actionSaveArmy}; + layout.toolBar.AddActions(actions); + layout.toolBar.AddSeparator(); + layout.toolBar.AddAction(layout.actionUndo); + layout.toolBar.AddAction(layout.actionRedo); + layout.toolBar.AddSeparator(); + } } - - private void SetUpToolbar() - { - List actions = new List(){ - layout.actionCreateArmy, - layout.actionOpenArmy, - layout.actionSaveArmy}; - layout.toolBar.AddActions(actions); - layout.toolBar.AddSeparator(); - layout.toolBar.AddAction(layout.actionUndo); - layout.toolBar.AddAction(layout.actionRedo); - layout.toolBar.AddSeparator(); - } -} +} \ No newline at end of file diff -r cf68a996b3f1 -r ac1bf60edf63 NewArmyDialog.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NewArmyDialog.cs Sat Jan 23 20:54:42 2010 +0000 @@ -0,0 +1,21 @@ +// This file (NewArmyDialog.cs) is a part of the IBBoard.WarFoundry.GUI.QtSharp project and is copyright 2010 IBBoard +// +// 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. + +using System; +using Qyoto; + +namespace IBBoard.WarFoundry.GUI.QtSharp +{ + public class NewArmyDialog : QDialog + { + private Ui_CreateNewArmyLayout layout; + + public NewArmyDialog () + { + layout = new Ui_CreateNewArmyLayout(); + layout.SetupUi(this); + + } + } +} diff -r cf68a996b3f1 -r ac1bf60edf63 qt-gui/CreateNewArmyLayout.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt-gui/CreateNewArmyLayout.cs Sat Jan 23 20:54:42 2010 +0000 @@ -0,0 +1,108 @@ +/******************************************************************************** +** Form generated from reading ui file 'CreateNewArmyLayout.ui' +** +** Created: Sat Jan 23 20:40:44 2010 +** by: Qt User Interface Compiler for C# version 4.5.3 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + + +using Qyoto; + +public class Ui_CreateNewArmyLayout +{ + public QGridLayout gridLayout; + public QDialogButtonBox buttonBox; + public QComboBox gameSystems; + public QLabel lblGameSystem; + public QLabel lblRace; + public QListView raceList; + public QLabel lblArmyName; + public QLabel lblArmySize; + public QSpinBox armySize; + public QLineEdit armyName; + + public void SetupUi(QDialog CreateNewArmyLayout) + { + if (CreateNewArmyLayout.ObjectName == "") + CreateNewArmyLayout.ObjectName = "CreateNewArmyLayout"; + QSize Size = new QSize(400, 300); + Size = Size.ExpandedTo(CreateNewArmyLayout.MinimumSizeHint()); + CreateNewArmyLayout.Size = Size; + gridLayout = new QGridLayout(CreateNewArmyLayout); + gridLayout.ObjectName = "gridLayout"; + buttonBox = new QDialogButtonBox(CreateNewArmyLayout); + buttonBox.ObjectName = "buttonBox"; + buttonBox.Orientation = Qt.Orientation.Horizontal; + buttonBox.StandardButtons = Qyoto.Qyoto.GetCPPEnumValue("QDialogButtonBox", "Cancel") | Qyoto.Qyoto.GetCPPEnumValue("QDialogButtonBox", "Ok"); + + gridLayout.AddWidget(buttonBox, 4, 2, 1, 1); + + gameSystems = new QComboBox(CreateNewArmyLayout); + gameSystems.ObjectName = "gameSystems"; + + gridLayout.AddWidget(gameSystems, 0, 2, 1, 1); + + lblGameSystem = new QLabel(CreateNewArmyLayout); + lblGameSystem.ObjectName = "lblGameSystem"; + lblGameSystem.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignVCenter"); + + gridLayout.AddWidget(lblGameSystem, 0, 0, 1, 1); + + lblRace = new QLabel(CreateNewArmyLayout); + lblRace.ObjectName = "lblRace"; + lblRace.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTop") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing"); + + gridLayout.AddWidget(lblRace, 1, 0, 1, 1); + + raceList = new QListView(CreateNewArmyLayout); + raceList.ObjectName = "raceList"; + + gridLayout.AddWidget(raceList, 1, 2, 1, 1); + + lblArmyName = new QLabel(CreateNewArmyLayout); + lblArmyName.ObjectName = "lblArmyName"; + lblArmyName.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignVCenter"); + + gridLayout.AddWidget(lblArmyName, 2, 0, 1, 1); + + lblArmySize = new QLabel(CreateNewArmyLayout); + lblArmySize.ObjectName = "lblArmySize"; + lblArmySize.Alignment = Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignRight") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignTrailing") | Qyoto.Qyoto.GetCPPEnumValue("Qt", "AlignVCenter"); + + gridLayout.AddWidget(lblArmySize, 3, 0, 1, 1); + + armySize = new QSpinBox(CreateNewArmyLayout); + armySize.ObjectName = "armySize"; + + gridLayout.AddWidget(armySize, 3, 2, 1, 1); + + armyName = new QLineEdit(CreateNewArmyLayout); + armyName.ObjectName = "armyName"; + + gridLayout.AddWidget(armyName, 2, 2, 1, 1); + + + RetranslateUi(CreateNewArmyLayout); + QObject.Connect(buttonBox, Qt.SIGNAL("accepted()"), CreateNewArmyLayout, Qt.SLOT("accept()")); + QObject.Connect(buttonBox, Qt.SIGNAL("rejected()"), CreateNewArmyLayout, Qt.SLOT("reject()")); + + QMetaObject.ConnectSlotsByName(CreateNewArmyLayout); + } // SetupUi + + public void RetranslateUi(QDialog CreateNewArmyLayout) + { + CreateNewArmyLayout.WindowTitle = QApplication.Translate("CreateNewArmyLayout", "Dialog", null, QApplication.Encoding.UnicodeUTF8); + lblGameSystem.Text = QApplication.Translate("CreateNewArmyLayout", "game system:", null, QApplication.Encoding.UnicodeUTF8); + lblRace.Text = QApplication.Translate("CreateNewArmyLayout", "race:", null, QApplication.Encoding.UnicodeUTF8); + lblArmyName.Text = QApplication.Translate("CreateNewArmyLayout", "TextLabel", null, QApplication.Encoding.UnicodeUTF8); + lblArmySize.Text = QApplication.Translate("CreateNewArmyLayout", "TextLabel", null, QApplication.Encoding.UnicodeUTF8); + } // RetranslateUi + +} + +namespace Ui { + public class CreateNewArmyLayout : Ui_CreateNewArmyLayout {} +} // namespace Ui + diff -r cf68a996b3f1 -r ac1bf60edf63 qt-gui/CreateNewArmyLayout.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qt-gui/CreateNewArmyLayout.ui Sat Jan 23 20:54:42 2010 +0000 @@ -0,0 +1,116 @@ + + + CreateNewArmyLayout + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + game system: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + race: + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + + + + + + + + TextLabel + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + TextLabel + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + buttonBox + accepted() + CreateNewArmyLayout + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + CreateNewArmyLayout + reject() + + + 316 + 260 + + + 286 + 274 + + + + +