From 0f3d090bd1dc9a6b912eb0b1e587602573304b4a Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 17 Feb 2016 20:41:52 +0100 Subject: First attempt at QML hacking. Main and ServiceControl adapted. Project files --- rockwork/main.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'rockwork/main.cpp') diff --git a/rockwork/main.cpp b/rockwork/main.cpp index 70fd0d7..57a8772 100644 --- a/rockwork/main.cpp +++ b/rockwork/main.cpp @@ -12,26 +12,28 @@ #include "applicationsfiltermodel.h" #include "appstoreclient.h" #include "screenshotmodel.h" +#include int main(int argc, char *argv[]) { - QGuiApplication app(argc, argv); + QScopedPointer app(SailfishApp::application(argc, argv)); + app->setApplicationName("pebble"); + app->setOrganizationName(""); - qmlRegisterUncreatableType("RockWork", 1, 0, "Pebble", "Get them from the model"); - qmlRegisterUncreatableType("RockWork", 1, 0, "ApplicationsModel", "Get them from a Pebble object"); - qmlRegisterUncreatableType("RockWork", 1, 0, "AppItem", "Get them from an ApplicationsModel"); - qmlRegisterType("RockWork", 1, 0, "ApplicationsFilterModel"); - qmlRegisterType("RockWork", 1, 0, "Pebbles"); - qmlRegisterUncreatableType("RockWork", 1, 0, "NotificationSourceModel", "Get it from a Pebble object"); - qmlRegisterType("RockWork", 1, 0, "ServiceController"); - qmlRegisterType("RockWork", 1, 0, "AppStoreClient"); - qmlRegisterType("RockWork", 1, 0, "ScreenshotModel"); + qmlRegisterUncreatableType("RockPool", 1, 0, "Pebble", "Get them from the model"); + qmlRegisterUncreatableType("RockPool", 1, 0, "ApplicationsModel", "Get them from a Pebble object"); + qmlRegisterUncreatableType("RockPool", 1, 0, "AppItem", "Get them from an ApplicationsModel"); + qmlRegisterType("RockPool", 1, 0, "ApplicationsFilterModel"); + qmlRegisterType("RockPool", 1, 0, "Pebbles"); + qmlRegisterUncreatableType("RockPool", 1, 0, "NotificationSourceModel", "Get it from a Pebble object"); + qmlRegisterType("RockPool", 1, 0, "ServiceController"); + qmlRegisterType("RockPool", 1, 0, "AppStoreClient"); + qmlRegisterType("RockPool", 1, 0, "ScreenshotModel"); - QQuickView view; - view.engine()->rootContext()->setContextProperty("version", QStringLiteral(VERSION)); - view.engine()->rootContext()->setContextProperty("homePath", QStandardPaths::standardLocations(QStandardPaths::HomeLocation).first()); - view.setSource(QUrl(QStringLiteral("qrc:///Main.qml"))); - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.show(); - return app.exec(); + QScopedPointer view(SailfishApp::createView()); + view->rootContext()->setContextProperty("version", QStringLiteral(VERSION)); + view->setSource(SailfishApp::pathTo("qml/Main.qml")); + view->show(); + + return app->exec(); } -- cgit v1.2.3