From c90c389a8a8d9d8661e9772ec4144c5cf2039f23 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- kenolaba/kenolaba.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 kenolaba/kenolaba.cpp (limited to 'kenolaba/kenolaba.cpp') 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 + +#include +#include +#include +#include + +#include + +#include "version.h" +#include "AbTop.h" + + +static const char description[] = + I18N_NOOP("Board game inspired by Abalone"); + +static KCmdLineOptions options[] = +{ + { "h", 0, 0}, + { "host ", I18N_NOOP("Use 'host' for network game"), 0 }, + { "p", 0, 0}, + { "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(); +} + -- cgit v1.2.3