summaryrefslogtreecommitdiffstats
path: root/src/client/main.cpp
blob: cea9ae8560f5f8f3fe52fb2dabf0c29a38b75fc9 (plain) (blame)
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
#include "toolbar/toolbar.h"
#include "util/util.h"

int main(int argc, char** argv)
{
   QApplication app(argc, argv);
   app.setOrganizationName("openslx");
   app.setOrganizationDomain("openslx.org");
   app.setApplicationName("pvsclient");

   qsrand((uint)QDateTime::currentMSecsSinceEpoch());

   // Make sure settings directory exists
   do {
		USER_SETTINGS(settings);
		QFileInfo fi(settings.fileName());
		QDir path(fi.path());
		qDebug() << "Settings directory is " << fi.path();
		if (!path.exists())
			path.mkpath(path.absolutePath());
		// Now check if settings file exists. If not, copy system default (if available)
		if (!fi.exists())
		{
			SYSTEM_SETTINGS(sys);
			QFileInfo sysfi(sys.fileName());
			if (sysfi.exists())
			{
				if (!QFile::copy(sys.fileName(), settings.fileName()))
					qDebug() << "Copying default settings from " << sys.fileName() << " to " << settings.fileName() << " failed.";
			}
		}
   } while (0);

   // use system locale as language to translate gui
   QTranslator translator;
   translator.load(":pvsclient");
   app.installTranslator(&translator);

   Toolbar pvsclient;
   return app.exec();
}