Mercurial > repos > IBBoard.WarFoundry.GUI.QtSharp
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 wrap: on
line diff
--- a/IBBoard.WarFoundry.GUI.QtSharp.csproj Sat Feb 20 15:58:17 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.QtSharp.csproj Sun Feb 21 13:53:47 2010 +0000 @@ -94,6 +94,13 @@ <None Include="WarFoundry.exe.log4net"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> + <None Include="translations\en.translation"> + <Gettext-ScanForTranslations>false</Gettext-ScanForTranslations> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="WarFoundryQtPref.xml"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> </ItemGroup> <ItemGroup> <Folder Include="qt-gui\" />
--- a/Main.cs Sat Feb 20 15:58:17 2010 +0000 +++ b/Main.cs Sun Feb 21 13:53:47 2010 +0000 @@ -33,6 +33,7 @@ catch(Exception ex) { logger.Fatal(ex); + QMessageBox.Critical(null, "Unhandled exception", ex.Message+"\n\nPlease see log for more details"); } }
--- a/MainWindow.cs Sat Feb 20 15:58:17 2010 +0000 +++ b/MainWindow.cs Sun Feb 21 13:53:47 2010 +0000 @@ -26,12 +26,25 @@ private CommandStack commandStack; private QFileDialog saveArmyDialog; private QFileDialog openArmyDialog; + private Preferences preferences; public MainWindow () { layout = new Ui_MainWindowLayout(); layout.SetupUi(this); WindowIcon = new QIcon("icons/App.png"); + Preferences = new Preferences("WarFoundryQt"); + + try + { + Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); + } + catch (TranslationLoadException ex) + { + log.Error(ex); + QMessageBox.Critical(this, "Translation loading failed", ex.Message); + } + SetAppTitle(); saveArmyDialog = new QFileDialog(this); saveArmyDialog.acceptMode = QFileDialog.AcceptMode.AcceptSave; @@ -525,5 +538,11 @@ return closed; } + + public Preferences Preferences + { + get { return preferences; } + set { preferences = value; } + } } } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WarFoundryQtPref.xml Sun Feb 21 13:53:47 2010 +0000 @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE preferences[ + <!ELEMENT preference (CDATA|preferenceArr+)> + <!ELEMENT preferenceArr (CDATA)> + <!ATTLIST preference id ID #REQUIRED> + <!ATTLIST preference type CDATA #REQUIRED> + <!ATTLIST preferenceArr id ID #REQUIRED> +]> +<preferences> +<preference id="language" type="System.String">en</preference> +<preference id="currSystem" type="System.String"></preference> +<preference id="logLevel" type="System.String">Info</preference> +</preferences>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/translations/en.translation Sun Feb 21 13:53:47 2010 +0000 @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<translations xmlns="http://ibboard.co.uk/translation" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +lang="en"> +<translation id="menuFile">File</translation> +<translation id="menuEdit">Edit</translation> +<translation id="menuHelp">Help</translation> +<translation id="miNewArmy">Create army</translation> +<translation id="miOpenArmy">Open army</translation> +<translation id="miExit">Exit</translation> +<translation id="miAbout">About</translation> +<translation id="miSaveArmy">Save army</translation> +<translation id="miSaveArmyAs">Save army as...</translation> +<translation id="miCloseArmy">Close army</translation> +<translation id="miChangeSystem">Change game system</translation> +<translation id="miUndo">Undo</translation> +<translation id="miRedo">Redo</translation> +<translation id="armyFileFilter">WarFoundry Army Files (*.army)</translation> +<translation id="bttnSelectRace">Create army</translation> +<translation id="bttnCancel">Cancel</translation> +<translation id="bttnSelectUnit">Create unit</translation> +<translation id="lblUnitList">Unit types:</translation> +<translation id="lblRaceList">Races:</translation> +<translation id="lblArmyName">Army name:</translation> +<translation id="bttnSelectSystem">Select system</translation> +<translation id="lblSystemList">Game systems:</translation> +<translation id="FrmSelectSystem">Game system selection</translation> +<translation id="ArmyTree">Army tree</translation> +<translation id="FrmNewArmy">Create new army</translation> +<translation id="saveArmyDialog">Save army</translation> +<translation id="lblArmySize">Army size:</translation> +<translation id="defaultUnitName">Unit of {0} {1}</translation> +<translation id="bttnNewArmy">Create army</translation> +<translation id="bttnOpenArmy">Open army</translation> +<translation id="bttnSaveArmy">Save army</translation> +<translation id="statusPanelPoints">{0} pts / {1} pts</translation> +<translation id="miReloadFiles">Reload files</translation> +<translation id="miDebugWindow">Debug information</translation> +<translation id="FrmNewUnit">Add New {0} Choice</translation> +</translations> \ No newline at end of file