Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/src/main.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 69 | { | |||
---|---|---|---|---|---|
114 | auto package = KPackage::PackageLoader::self()->loadPackage("Plasma/Generic"); | 114 | auto package = KPackage::PackageLoader::self()->loadPackage("Plasma/Generic"); | ||
115 | package.setPath("org.kde.plasma.cuttlefish"); | 115 | package.setPath("org.kde.plasma.cuttlefish"); | ||
116 | 116 | | |||
117 | if (!package.isValid() || !package.metadata().isValid()) { | 117 | if (!package.isValid() || !package.metadata().isValid()) { | ||
118 | qWarning() << "Could not load package org.kde.plasma.cuttlefish:" << package.path(); | 118 | qWarning() << "Could not load package org.kde.plasma.cuttlefish:" << package.path(); | ||
119 | return -1; | 119 | return -1; | ||
120 | } | 120 | } | ||
121 | 121 | | |||
122 | engine.load(QUrl::fromLocalFile(package.filePath("mainscript"))); | | |||
123 | if (engine.rootObjects().isEmpty()) | | |||
124 | return -1; | | |||
125 | | ||||
126 | auto iconModel = new CuttleFish::IconModel(engine.rootContext()); | 122 | auto iconModel = new CuttleFish::IconModel(engine.rootContext()); | ||
127 | engine.rootContext()->setContextProperty("iconModel", iconModel); | 123 | engine.rootContext()->setContextProperty("iconModel", iconModel); | ||
128 | engine.rootContext()->setContextProperty("pickerMode", parser.isSet("picker")); | 124 | engine.rootContext()->setContextProperty("pickerMode", parser.isSet("picker")); | ||
129 | 125 | | |||
126 | engine.load(QUrl::fromLocalFile(package.filePath("mainscript"))); | ||||
127 | if (engine.rootObjects().isEmpty()) { | ||||
128 | return -1; | ||||
129 | } | ||||
130 | | ||||
130 | #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) | 131 | #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) | ||
131 | qmlRegisterType<CuttleFish::IconModel>(); | 132 | qmlRegisterType<CuttleFish::IconModel>(); | ||
132 | #else | 133 | #else | ||
133 | qmlRegisterAnonymousType<CuttleFish::IconModel>("org.kde.plasma.sdk", 1); | 134 | qmlRegisterAnonymousType<CuttleFish::IconModel>("org.kde.plasma.sdk", 1); | ||
134 | #endif | 135 | #endif | ||
135 | 136 | | |||
136 | return app.exec(); | 137 | return app.exec(); | ||
137 | } | 138 | } |