summaryrefslogtreecommitdiffstats
path: root/kenolaba/kenolaba.cpp
blob: 754726c289b20ba75bca07faa6e5a4210f247572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* Start point */

#include <tqobject.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("libtdegames");

	/* 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();
}