Debian Codegraph @

utils/fgqcanvas/main.cpp

raw symbols SCIP
1 //
2 // Copyright (C) 2017 James Turner [email protected]
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 #include <QApplication>
19 #include <QQmlEngine>
20 #include <QQuickView>
21 #include <QQmlContext>
22 #include <QCommandLineParser>
23 #include <QScreen>
24
25 #include "canvasitem.h"
26 #include "applicationcontroller.h"
27 #include "canvasdisplay.h"
28 #include "canvasconnection.h"
29 #include "canvaspainteddisplay.h"
30 #include "WindowData.h"
31
32 int main(int argc, char *argv[])
33 {
34 QApplication a(argc, argv);
35
36 a.setApplicationName("FGCanvas");
37 a.setOrganizationDomain("flightgear.org");
38 a.setOrganizationName("FlightGear");
39
40 QCommandLineParser parser;
41 parser.addPositionalArgument("config", QCoreApplication::translate("main", "JSON configuration to load"));
42 parser.process(a);
43
44 ApplicationController appController;
45
46 qmlRegisterType<CanvasItem>("FlightGear", 1, 0, "CanvasItem");
47 qmlRegisterType<CanvasDisplay>("FlightGear", 1, 0, "CanvasDisplay");
48 qmlRegisterType<CanvasPaintedDisplay>("FlightGear", 1, 0, "PaintedCanvasDisplay");
49
50 qmlRegisterUncreatableType<WindowData>("FlightGear", 1, 0, "WindowData", "Don't create me");
51 qmlRegisterUncreatableType<CanvasConnection>("FlightGear", 1, 0, "CanvasConnection", "Don't create me");
52 qmlRegisterUncreatableType<ApplicationController>("FlightGear", 1, 0, "Application", "Can't create");
53
54 const QStringList args = parser.positionalArguments();
55
56 if (!args.empty()) {
57 appController.setDaemonMode();
58 appController.loadFromFile(args.front());
59 }
60
61 appController.createWindows();
62
63 int result = a.exec();
64 return result;
65 }