summaryrefslogtreecommitdiffstats
path: root/kenolaba/kenolaba.cpp
blob: fe9bbaccb724f66ae1f3d94d31613b4be3664b48 (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(TDECmdLineArgs *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[])
{
	TDEAboutData aboutData( "kenolaba", I18N_NOOP("Kenolaba"),
		KENOLABA_VERSION, description, TDEAboutData::License_GPL,
		"(c) 1997-2000, Josef Weidendorfer");
	aboutData.addAuthor("Josef Weidendorfer",0, "[email protected]");
	aboutData.addAuthor("Robert Williams");
	TDECmdLineArgs::init( argc, argv, &aboutData );
	TDECmdLineArgs::addCmdLineOptions( options ); // Add our own options.

	TDEApplication app;
	TDEGlobal::locale()->insertCatalogue("libtdegames");

	/* command line handling */
	TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();

	/* session management */
	if ( app.isRestored() ) {
        uint n = 1;
        while ( TDEMainWindow::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();
}