Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/src/main.cpp
Show All 29 Lines | |||||
30 | // Frameworks | 30 | // Frameworks | ||
31 | #include <KConfigGroup> | 31 | #include <KConfigGroup> | ||
32 | #include <KDeclarative/KDeclarative> | 32 | #include <KDeclarative/KDeclarative> | ||
33 | #include <KLocalizedString> | 33 | #include <KLocalizedString> | ||
34 | #include <KPackage/PackageLoader> | 34 | #include <KPackage/PackageLoader> | ||
35 | #include <Plasma/Theme> | 35 | #include <Plasma/Theme> | ||
36 | 36 | | |||
37 | // Own | 37 | // Own | ||
38 | #include "colorschemes.h" | ||||
38 | #include "iconmodel.h" | 39 | #include "iconmodel.h" | ||
39 | 40 | | |||
40 | void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) | 41 | void messageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) | ||
41 | { | 42 | { | ||
42 | if ((msg.contains("qt.svg") && msg.contains("Could not resolve property: #linearGradient")) || msg.contains("Could not resolve property: #pattern")) { | 43 | if ((msg.contains("qt.svg") && msg.contains("Could not resolve property: #linearGradient")) || msg.contains("Could not resolve property: #pattern")) { | ||
43 | return; | 44 | return; | ||
44 | } | 45 | } | ||
45 | 46 | | |||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 70 | { | |||
113 | auto package = KPackage::PackageLoader::self()->loadPackage("Plasma/Generic"); | 114 | auto package = KPackage::PackageLoader::self()->loadPackage("Plasma/Generic"); | ||
114 | package.setPath("org.kde.plasma.cuttlefish"); | 115 | package.setPath("org.kde.plasma.cuttlefish"); | ||
115 | 116 | | |||
116 | if (!package.isValid() || !package.metadata().isValid()) { | 117 | if (!package.isValid() || !package.metadata().isValid()) { | ||
117 | qWarning() << "Could not load package org.kde.plasma.cuttlefish:" << package.path(); | 118 | qWarning() << "Could not load package org.kde.plasma.cuttlefish:" << package.path(); | ||
118 | return -1; | 119 | return -1; | ||
119 | } | 120 | } | ||
120 | 121 | | |||
121 | engine.load(QUrl::fromLocalFile(package.filePath("mainscript"))); | | |||
122 | if (engine.rootObjects().isEmpty()) | | |||
123 | return -1; | | |||
124 | | ||||
125 | auto iconModel = new CuttleFish::IconModel(engine.rootContext()); | 122 | auto iconModel = new CuttleFish::IconModel(engine.rootContext()); | ||
126 | engine.rootContext()->setContextProperty("iconModel", iconModel); | 123 | engine.rootContext()->setContextProperty("iconModel", iconModel); | ||
127 | engine.rootContext()->setContextProperty("pickerMode", parser.isSet("picker")); | 124 | engine.rootContext()->setContextProperty("pickerMode", parser.isSet("picker")); | ||
128 | qmlRegisterType<CuttleFish::IconModel>(); | 125 | qmlRegisterType<CuttleFish::IconModel>(); | ||
129 | 126 | | |||
ngraham: typo causes a build failure | |||||
127 | qmlRegisterType<CuttleFish::ColorSchemes>(); | ||||
128 | auto colorSchemes = new CuttleFish::ColorSchemes(engine.rootContext()); | ||||
129 | engine.rootContext()->setContextProperty("colorSchemes", colorSchemes); | ||||
130 | engine.load(QUrl::fromLocalFile(package.filePath("mainscript"))); | ||||
Moving the setting of the context properties before loading of the file fixes these being unavailable at the beginning. => Less errors on startup and we can select the the current color scheme on startup because the index isn't reset when the color scheme model becomes available. davidre: Moving the setting of the context properties before loading of the file fixes these being… | |||||
131 | | ||||
132 | if (engine.rootObjects().isEmpty()) | ||||
133 | return -1; | ||||
134 | | ||||
130 | return app.exec(); | 135 | return app.exec(); | ||
131 | } | 136 | } |
typo causes a build failure