summaryrefslogtreecommitdiffstats
path: root/clients/tde/src/app/main.cpp
blob: b2d29884705e08d80ae90abb68ce57629a51c506 (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
//Author:    Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012
//Copyright: See COPYING file that comes with this distribution

#include "define.h"
#include <kaboutdata.h>
#include <kapplication.h>
#include <kinputdialog.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kurl.h>
#include <kconfig.h>
#include "remotemdi.h"

static const KCmdLineOptions options[] =
{
	{ "+[server]", I18N_NOOP( "Connect to remote server 'server'" ), 0 },
	{ 0, 0, 0 }
};

static KAboutData about(
	APP_NAME, I18N_NOOP( APP_PRETTYNAME ), APP_VERSION,
	I18N_NOOP("Graphical remote laboratory client"), KAboutData::License_GPL_V2,
	I18N_NOOP("(C) 2012 Timothy Pearson"), 0,
	"http://remotefpga.pearsoncomputing.net/", "kb9vqf@pearsoncomputing.net" );


int main(int argc, char *argv[])
{
	about.addAuthor("Timothy Pearson", I18N_NOOP("Author, maintainer"), "kb9vqf@pearsoncomputing.net", "http://remotefpga.pearsoncomputing.net/");

	KCmdLineArgs::init(argc, argv, &about);
	KCmdLineArgs::addCmdLineOptions(options);

	KApplication app;

	// Read MDI settings (window positions, etc)
	// FIXME
	KConfig *c = app.config();

	// Create main window
	RemoteMDI *mainWin = new RemoteMDI();
	app.setMainWidget(mainWin);

	KCmdLineArgs* const args = KCmdLineArgs::parsedArgs();
	if (args->count() > 0) {
		mainWin->setServerHost(args->arg(0));
	}
	else {
		bool accepted;
		TQString serverHost = KInputDialog::getText(i18n("Enter server FQDN"), i18n("Please enter the FQDN of the desired remote laboratory server below"), "", &accepted);
		if (accepted) {
			if (serverHost != "") {
				mainWin->setServerHost(serverHost);
			}
			else {
				return -1;
			}
		}
		else {
			return -1;
		}
	}
	args->clear();

	mainWin->show();
	
	// mainWin has WDestructiveClose flag by default, so it will delete itself.
	return app.exec();
}