Mercurial > repos > IBBoard.WarFoundry.GUI.QtSharp
comparison MainWindow.cs @ 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 |
comparison
equal
deleted
inserted
replaced
2:cf68a996b3f1 | 3:ac1bf60edf63 |
---|---|
3 // 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 // 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. |
4 using System; | 4 using System; |
5 using System.Collections.Generic; | 5 using System.Collections.Generic; |
6 using Qyoto; | 6 using Qyoto; |
7 | 7 |
8 public partial class MainWindow : QMainWindow | 8 namespace IBBoard.WarFoundry.GUI.QtSharp |
9 { | 9 { |
10 private Ui_MainWindowLayout layout; | 10 public class MainWindow : QMainWindow |
11 | |
12 public MainWindow () | |
13 { | 11 { |
14 layout = new Ui_MainWindowLayout(); | 12 private Ui_MainWindowLayout layout; |
15 layout.SetupUi(this); | 13 |
16 WindowIcon = new QIcon("icons/App.png"); | 14 public MainWindow () |
17 SetUpActionIcons(); | 15 { |
18 ConnectMenuActions(); | 16 layout = new Ui_MainWindowLayout(); |
19 SetUpToolbar(); | 17 layout.SetupUi(this); |
20 layout.unitTabs.Clear(); | 18 WindowIcon = new QIcon("icons/App.png"); |
21 } | 19 SetUpActionIcons(); |
22 | 20 ConnectMenuActions(); |
23 private void SetUpActionIcons() | 21 SetUpToolbar(); |
24 { | 22 layout.unitTabs.Clear(); |
25 layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png"); | 23 } |
26 layout.actionOpenArmy.icon = new QIcon("icons/ui/fileopen.png"); | 24 |
27 layout.actionSaveArmy.icon = new QIcon("icons/ui/filesave.png"); | 25 private void SetUpActionIcons() |
28 layout.actionSaveArmyAs.icon = new QIcon("icons/ui/filesaveas.png"); | 26 { |
29 layout.menuExportArmyAs.icon = new QIcon("icons/ui/export.png"); | 27 layout.actionCreateArmy.icon = new QIcon("icons/ui/filenew.png"); |
30 layout.actionCloseArmy.icon = new QIcon("icons/ui/window-close.png"); | 28 layout.actionOpenArmy.icon = new QIcon("icons/ui/fileopen.png"); |
31 layout.actionExit.icon = new QIcon("icons/ui/exit.png"); | 29 layout.actionSaveArmy.icon = new QIcon("icons/ui/filesave.png"); |
32 layout.actionUndo.icon = new QIcon("icons/ui/edit-undo.png"); | 30 layout.actionSaveArmyAs.icon = new QIcon("icons/ui/filesaveas.png"); |
33 layout.actionRedo.icon = new QIcon("icons/ui/edit-redo.png"); | 31 layout.menuExportArmyAs.icon = new QIcon("icons/ui/export.png"); |
34 layout.actionAbout.icon = new QIcon("icons/ui/help-about.png"); | 32 layout.actionCloseArmy.icon = new QIcon("icons/ui/window-close.png"); |
35 } | 33 layout.actionExit.icon = new QIcon("icons/ui/exit.png"); |
36 | 34 layout.actionUndo.icon = new QIcon("icons/ui/edit-undo.png"); |
37 private void ConnectMenuActions() | 35 layout.actionRedo.icon = new QIcon("icons/ui/edit-redo.png"); |
38 { | 36 layout.actionAbout.icon = new QIcon("icons/ui/help-about.png"); |
39 } | 37 } |
40 | 38 |
41 private void SetUpToolbar() | 39 private void ConnectMenuActions() |
42 { | 40 { |
43 List<QAction> actions = new List<QAction>(){ | 41 QObject.Connect(layout.actionCreateArmy, Qt.SIGNAL("triggered()"), delegate(){CreateNewArmy();}); |
44 layout.actionCreateArmy, | 42 } |
45 layout.actionOpenArmy, | 43 |
46 layout.actionSaveArmy}; | 44 [Q_SLOT()] |
47 layout.toolBar.AddActions(actions); | 45 private void CreateNewArmy() |
48 layout.toolBar.AddSeparator(); | 46 { |
49 layout.toolBar.AddAction(layout.actionUndo); | 47 NewArmyDialog dialog = new NewArmyDialog(); |
50 layout.toolBar.AddAction(layout.actionRedo); | 48 dialog.Show(); |
51 layout.toolBar.AddSeparator(); | 49 } |
50 | |
51 private void SetUpToolbar() | |
52 { | |
53 List<QAction> actions = new List<QAction>(){ | |
54 layout.actionCreateArmy, | |
55 layout.actionOpenArmy, | |
56 layout.actionSaveArmy}; | |
57 layout.toolBar.AddActions(actions); | |
58 layout.toolBar.AddSeparator(); | |
59 layout.toolBar.AddAction(layout.actionUndo); | |
60 layout.toolBar.AddAction(layout.actionRedo); | |
61 layout.toolBar.AddSeparator(); | |
62 } | |
52 } | 63 } |
53 } | 64 } |