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

#include <sowatch.h>

#include "watchesmodel.h"
#include "watchscannermodel.h"
#include "providersmodel.h"
#include "watchletsmodel.h"

static sowatch::Registry *registry;
static WatchesModel *watches;
static WatchScannerModel *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 WatchScannerModel(app.data());

	qDebug() << "Starting" << watches << endl;

	qmlRegisterType<sowatch::ConfigKey>();
	qmlRegisterType<sowatch::GConfKey>("com.javispedro.sowatch", 1, 0, "GConfKey");
	qmlRegisterType<ProvidersModel>("com.javispedro.sowatch", 1, 0, "ProvidersModel");
	qmlRegisterType<WatchletsModel>("com.javispedro.sowatch", 1, 0, "WatchletsModel");

	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();
}