# HG changeset patch # User IBBoard # Date 1264452873 0 # Node ID 1bd8febee3850c2e0b600a64654f219c5cc6264d # Parent d8f82945a6ab435a70673b50e39818a06c0f8f54 Re #242: Create Qt# UI for WarFoundry * Add logging library * Set up WarFoundry environment * Log load errors diff -r d8f82945a6ab -r 1bd8febee385 IBBoard.WarFoundry.GUI.QtSharp.csproj --- a/IBBoard.WarFoundry.GUI.QtSharp.csproj Mon Jan 25 20:44:39 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.QtSharp.csproj Mon Jan 25 20:54:33 2010 +0000 @@ -76,11 +76,15 @@ PreserveNewest + + PreserveNewest + + @@ -90,6 +94,10 @@ + + False + lib\log4net.dll + @@ -97,5 +105,9 @@ {951E6C7A-7FBA-4F68-9D9E-F48618BB9626} IBBoard.WarFoundry.API + + {5DFD64F6-FC2B-4B4F-B92E-483BAC468105} + IBBoard + \ No newline at end of file diff -r d8f82945a6ab -r 1bd8febee385 Main.cs --- a/Main.cs Mon Jan 25 20:44:39 2010 +0000 +++ b/Main.cs Mon Jan 25 20:54:33 2010 +0000 @@ -2,19 +2,48 @@ // // 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 System.IO; +using System.Collections.Generic; using Qyoto; +using log4net; +using IBBoard; +using IBBoard.WarFoundry.API; +using IBBoard.WarFoundry.API.Factories.Xml; +using IBBoard.WarFoundry.API.Savers; + namespace IBBoard.WarFoundry.GUI.QtSharp { class MainClass { + private static ILog logger = LogManager.GetLogger(typeof(MainClass)); + public static void Main (string[] args) { new QApplication (args); + SetUpWarFoundryEnvironment (); + MainWindow win = new MainWindow (); win.Show (); QApplication.Exec (); } + + private static void SetUpWarFoundryEnvironment () + { + //FIXME: Temporary hack to add paths and factories before we get preferences and plugins + WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Path.Combine(Constants.ExecutablePath, "data"))); + WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory()); + WarFoundryLoader.GetDefault().FileLoadingFinished += FileLoadingFinished; + WarFoundrySaver.SetFileSaver(new WarFoundryXmlSaver()); + } + + private static void FileLoadingFinished (List failures) + { + foreach(FileLoadFailure failure in failures) + { + logger.Warn("Failed to load " + failure.FailedFile.FullName + ": " + failure.Message); + } + } } } diff -r d8f82945a6ab -r 1bd8febee385 MainWindow.cs --- a/MainWindow.cs Mon Jan 25 20:44:39 2010 +0000 +++ b/MainWindow.cs Mon Jan 25 20:54:33 2010 +0000 @@ -38,7 +38,7 @@ private void ConnectMenuActions() { - QObject.Connect(layout.actionCreateArmy, Qt.SIGNAL("triggered()"), CreateNewArmy); + QObject.Connect(layout.actionCreateArmy, "triggered()", CreateNewArmy); } private void CreateNewArmy() diff -r d8f82945a6ab -r 1bd8febee385 lib/log4net.dll Binary file lib/log4net.dll has changed