summaryrefslogtreecommitdiff
path: root/sowatchui/main.cpp
blob: f306fa93072e549ffccc17a1b49ef55715a481f3 (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
#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"

#include <sowatch.h>

#include "watchesmodel.h"
#include "scanwatchesmodel.h"

static sowatch::Registry *registry;
static WatchesModel *watches;
static ScanWatchesModel *watchScanner;

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));
    QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());

	registry = sowatch::Registry::registry();
	watches = new WatchesModel(app.data());
	watchScanner = new ScanWatchesModel(app.data());

	viewer->rootContext()->setContextProperty("watches", watches);
	viewer->rootContext()->setContextProperty("watchScanner", watchScanner);

    viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
	viewer->setMainQmlFile(QLatin1String("qml/main.qml"));
    viewer->showExpanded();

    return app->exec();
}