changeset 20:f1be1b509134

Re #242: Create Qt# UI for WarFoundry * Add preferences and translations (based on GTK# app)
author IBBoard <dev@ibboard.co.uk>
date Sun, 21 Feb 2010 13:53:47 +0000
parents fc205d5e0c52
children d6e95d51b9a4
files IBBoard.WarFoundry.GUI.QtSharp.csproj Main.cs MainWindow.cs WarFoundryQtPref.xml translations/en.translation
diffstat 5 files changed, 80 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/IBBoard.WarFoundry.GUI.QtSharp.csproj	Sat Feb 20 15:58:17 2010 +0000
     1.2 +++ b/IBBoard.WarFoundry.GUI.QtSharp.csproj	Sun Feb 21 13:53:47 2010 +0000
     1.3 @@ -94,6 +94,13 @@
     1.4      <None Include="WarFoundry.exe.log4net">
     1.5        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     1.6      </None>
     1.7 +    <None Include="translations\en.translation">
     1.8 +      <Gettext-ScanForTranslations>false</Gettext-ScanForTranslations>
     1.9 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    1.10 +    </None>
    1.11 +    <None Include="WarFoundryQtPref.xml">
    1.12 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    1.13 +    </None>
    1.14    </ItemGroup>
    1.15    <ItemGroup>
    1.16      <Folder Include="qt-gui\" />
     2.1 --- a/Main.cs	Sat Feb 20 15:58:17 2010 +0000
     2.2 +++ b/Main.cs	Sun Feb 21 13:53:47 2010 +0000
     2.3 @@ -33,6 +33,7 @@
     2.4  			catch(Exception ex)
     2.5  			{
     2.6  				logger.Fatal(ex);
     2.7 +				QMessageBox.Critical(null, "Unhandled exception", ex.Message+"\n\nPlease see log for more details");
     2.8  			}
     2.9  				
    2.10  		}
     3.1 --- a/MainWindow.cs	Sat Feb 20 15:58:17 2010 +0000
     3.2 +++ b/MainWindow.cs	Sun Feb 21 13:53:47 2010 +0000
     3.3 @@ -26,12 +26,25 @@
     3.4  		private CommandStack commandStack;
     3.5  		private QFileDialog saveArmyDialog;
     3.6  		private QFileDialog openArmyDialog;
     3.7 +		private Preferences preferences;
     3.8  		
     3.9  		public MainWindow ()
    3.10  		{
    3.11  			layout = new Ui_MainWindowLayout();
    3.12  			layout.SetupUi(this);
    3.13  			WindowIcon = new QIcon("icons/App.png");
    3.14 +			Preferences = new Preferences("WarFoundryQt");
    3.15 +			
    3.16 +			try
    3.17 +			{
    3.18 +				Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
    3.19 +			}
    3.20 +			catch (TranslationLoadException ex)
    3.21 +			{
    3.22 +				log.Error(ex);
    3.23 +				QMessageBox.Critical(this, "Translation loading failed", ex.Message);
    3.24 +			}
    3.25 +			
    3.26  			SetAppTitle();
    3.27  			saveArmyDialog = new QFileDialog(this);
    3.28  			saveArmyDialog.acceptMode = QFileDialog.AcceptMode.AcceptSave;
    3.29 @@ -525,5 +538,11 @@
    3.30  			
    3.31  			return closed;
    3.32  		}
    3.33 +		
    3.34 +		public Preferences Preferences
    3.35 +		{
    3.36 +			get { return preferences; }
    3.37 +			set { preferences = value; }
    3.38 +		}
    3.39  	}
    3.40  }
    3.41 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/WarFoundryQtPref.xml	Sun Feb 21 13:53:47 2010 +0000
     4.3 @@ -0,0 +1,13 @@
     4.4 +<?xml version="1.0" encoding="ISO-8859-1"?>
     4.5 +<!DOCTYPE preferences[
     4.6 +  <!ELEMENT preference (CDATA|preferenceArr+)> 
     4.7 +  <!ELEMENT preferenceArr (CDATA)>
     4.8 +  <!ATTLIST preference id ID #REQUIRED>
     4.9 +  <!ATTLIST preference type CDATA #REQUIRED>
    4.10 +  <!ATTLIST preferenceArr id ID #REQUIRED>
    4.11 +]>
    4.12 +<preferences>
    4.13 +<preference id="language" type="System.String">en</preference>
    4.14 +<preference id="currSystem" type="System.String"></preference>
    4.15 +<preference id="logLevel" type="System.String">Info</preference>
    4.16 +</preferences>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/translations/en.translation	Sun Feb 21 13:53:47 2010 +0000
     5.3 @@ -0,0 +1,40 @@
     5.4 +<?xml version="1.0" encoding="ISO-8859-1"?>
     5.5 +<translations xmlns="http://ibboard.co.uk/translation"
     5.6 +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     5.7 +lang="en">
     5.8 +<translation id="menuFile">File</translation>
     5.9 +<translation id="menuEdit">Edit</translation>
    5.10 +<translation id="menuHelp">Help</translation>
    5.11 +<translation id="miNewArmy">Create army</translation>
    5.12 +<translation id="miOpenArmy">Open army</translation>
    5.13 +<translation id="miExit">Exit</translation>
    5.14 +<translation id="miAbout">About</translation>
    5.15 +<translation id="miSaveArmy">Save army</translation>
    5.16 +<translation id="miSaveArmyAs">Save army as...</translation>
    5.17 +<translation id="miCloseArmy">Close army</translation>
    5.18 +<translation id="miChangeSystem">Change game system</translation>
    5.19 +<translation id="miUndo">Undo</translation>
    5.20 +<translation id="miRedo">Redo</translation>
    5.21 +<translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation>
    5.22 +<translation id="bttnSelectRace">Create army</translation>
    5.23 +<translation id="bttnCancel">Cancel</translation>
    5.24 +<translation id="bttnSelectUnit">Create unit</translation>
    5.25 +<translation id="lblUnitList">Unit types:</translation>
    5.26 +<translation id="lblRaceList">Races:</translation>
    5.27 +<translation id="lblArmyName">Army name:</translation>
    5.28 +<translation id="bttnSelectSystem">Select system</translation>
    5.29 +<translation id="lblSystemList">Game systems:</translation>
    5.30 +<translation id="FrmSelectSystem">Game system selection</translation>
    5.31 +<translation id="ArmyTree">Army tree</translation>
    5.32 +<translation id="FrmNewArmy">Create new army</translation>
    5.33 +<translation id="saveArmyDialog">Save army</translation>
    5.34 +<translation id="lblArmySize">Army size:</translation>
    5.35 +<translation id="defaultUnitName">Unit of {0} {1}</translation>
    5.36 +<translation id="bttnNewArmy">Create army</translation>
    5.37 +<translation id="bttnOpenArmy">Open army</translation>
    5.38 +<translation id="bttnSaveArmy">Save army</translation>
    5.39 +<translation id="statusPanelPoints">{0} pts / {1} pts</translation>
    5.40 +<translation id="miReloadFiles">Reload files</translation>
    5.41 +<translation id="miDebugWindow">Debug information</translation>
    5.42 +<translation id="FrmNewUnit">Add New {0} Choice</translation>
    5.43 +</translations>
    5.44 \ No newline at end of file