summaryrefslogtreecommitdiffstats
path: root/kenolaba/kenolaba.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /kenolaba/kenolaba.cpp
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kenolaba/kenolaba.cpp')
-rw-r--r--kenolaba/kenolaba.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/kenolaba/kenolaba.cpp b/kenolaba/kenolaba.cpp
new file mode 100644
index 00000000..e59aa9d7
--- /dev/null
+++ b/kenolaba/kenolaba.cpp
@@ -0,0 +1,71 @@
+/* Start point */
+
+#include <qobject.h>
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kglobal.h>
+#include <kcmdlineargs.h>
+
+#include <kaboutdata.h>
+
+#include "version.h"
+#include "AbTop.h"
+
+
+static const char description[] =
+ I18N_NOOP("Board game inspired by Abalone");
+
+static KCmdLineOptions options[] =
+{
+ { "h", 0, 0},
+ { "host <host>", I18N_NOOP("Use 'host' for network game"), 0 },
+ { "p", 0, 0},
+ { "port <port>", I18N_NOOP("Use 'port' for network game"), 0 },
+ KCmdLineLastOption
+};
+
+AbTop *create(KCmdLineArgs *args)
+{
+ AbTop* top = new AbTop;
+ if (args->isSet("port"))
+ top->netPort( args->getOption("port").toInt() );
+ if (args->isSet("host"))
+ top->netHost( args->getOption("host").data() );
+ top->readConfig();
+ return top;
+}
+
+int main(int argc, char *argv[])
+{
+ KAboutData aboutData( "kenolaba", I18N_NOOP("Kenolaba"),
+ KENOLABA_VERSION, description, KAboutData::License_GPL,
+ "(c) 1997-2000, Josef Weidendorfer");
+ aboutData.addAuthor("Josef Weidendorfer",0, "Josef.Weidendorfer@gmx.de");
+ aboutData.addAuthor("Robert Williams");
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
+
+ KApplication app;
+ KGlobal::locale()->insertCatalogue("libkdegames");
+
+ /* command line handling */
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+ /* session management */
+ if ( app.isRestored() ) {
+ uint n = 1;
+ while ( KMainWindow::canBeRestored(n) ) {
+ AbTop *top = create(args);
+ top->restore(n);
+ n++;
+ }
+ } else {
+ AbTop *top = create(args);
+ app.setMainWidget(top);
+ top->show();
+ }
+ args->clear();
+ return app.exec();
+}
+