Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/qmlplugin.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include "quickengine.h" | 24 | #include "quickengine.h" | ||
25 | #include "quickitemsmodel.h" | 25 | #include "quickitemsmodel.h" | ||
26 | #include "quickquestionlistener.h" | 26 | #include "quickquestionlistener.h" | ||
27 | #include "author.h" | 27 | #include "author.h" | ||
28 | #include "categoriesmodel.h" | 28 | #include "categoriesmodel.h" | ||
29 | #include "commentsmodel.h" | 29 | #include "commentsmodel.h" | ||
30 | #include "downloadlinkinfo.h" | 30 | #include "downloadlinkinfo.h" | ||
31 | #include "entrywrapper.h" | ||||
31 | 32 | | |||
32 | #include "provider.h" | 33 | #include "provider.h" | ||
33 | #include "question.h" | 34 | #include "question.h" | ||
34 | 35 | | |||
35 | #include <QQmlEngine> | 36 | #include <QQmlEngine> | ||
36 | #include <qqml.h> | 37 | #include <qqml.h> | ||
37 | 38 | | |||
38 | void QmlPlugins::initializeEngine(QQmlEngine *engine, const char *) | 39 | void QmlPlugins::initializeEngine(QQmlEngine *engine, const char *) | ||
39 | { | 40 | { | ||
40 | Q_UNUSED(engine); | 41 | Q_UNUSED(engine); | ||
41 | } | 42 | } | ||
42 | 43 | | |||
43 | void QmlPlugins::registerTypes(const char *uri) | 44 | void QmlPlugins::registerTypes(const char *uri) | ||
44 | { | 45 | { | ||
46 | const char* coreUri{"org.kde.newstuff.core"}; | ||||
47 | | ||||
48 | // Initial version | ||||
45 | qmlRegisterType<Engine>(uri, 1, 0, "Engine"); | 49 | qmlRegisterType<Engine>(uri, 1, 0, "Engine"); | ||
46 | qmlRegisterType<ItemsModel>(uri, 1, 0, "ItemsModel"); | 50 | qmlRegisterType<ItemsModel>(uri, 1, 0, "ItemsModel"); | ||
51 | | ||||
52 | // Version 1.62 | ||||
47 | qmlRegisterType<KNewStuffQuick::Author>(uri, 1, 62, "Author"); | 53 | qmlRegisterType<KNewStuffQuick::Author>(uri, 1, 62, "Author"); | ||
48 | qmlRegisterType<KNewStuffQuick::CommentsModel>(uri, 1, 62, "CommentsModel"); | 54 | qmlRegisterType<KNewStuffQuick::CommentsModel>(uri, 1, 62, "CommentsModel"); | ||
49 | qmlRegisterUncreatableType<DownloadLinkInfo>(uri, 1, 0, "DownloadLinkInfo", QStringLiteral("This should only be created by the ItemsModel, and is associated with one entry in that model")); | 55 | qmlRegisterUncreatableType<DownloadLinkInfo>(uri, 1, 0, "DownloadLinkInfo", QStringLiteral("This should only be created by the ItemsModel, and is associated with one entry in that model")); | ||
50 | qmlRegisterUncreatableType<CategoriesModel>(uri, 1, 0, "CategoriesModel", QStringLiteral("This should only be created by the Engine, and provides the categories available in that engine")); | 56 | qmlRegisterUncreatableType<CategoriesModel>(uri, 1, 0, "CategoriesModel", QStringLiteral("This should only be created by the Engine, and provides the categories available in that engine")); | ||
51 | qmlRegisterUncreatableMetaObject(KNSCore::Provider::staticMetaObject, "org.kde.newstuff.core", 1, 62, "Provider", QLatin1String("Error: this only exists to forward enums")); | 57 | qmlRegisterUncreatableMetaObject(KNSCore::Provider::staticMetaObject, coreUri, 1, 62, "Provider", QLatin1String("Error: this only exists to forward enums")); | ||
52 | qmlRegisterUncreatableMetaObject(KNSCore::Question::staticMetaObject, "org.kde.newstuff.core", 1, 62, "Question", QLatin1String("Error: this only exists to forward enums")); | 58 | qmlRegisterUncreatableMetaObject(KNSCore::Question::staticMetaObject, coreUri, 1, 62, "Question", QLatin1String("Error: this only exists to forward enums")); | ||
53 | qmlRegisterSingletonType<KNewStuffQuick::QuickQuestionListener>(uri, 1, 62, "QuickQuestionListener", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * { | 59 | qmlRegisterSingletonType<KNewStuffQuick::QuickQuestionListener>(uri, 1, 62, "QuickQuestionListener", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * { | ||
54 | Q_UNUSED(scriptEngine) | 60 | Q_UNUSED(scriptEngine) | ||
55 | engine->setObjectOwnership(KNewStuffQuick::QuickQuestionListener::instance(), QQmlEngine::CppOwnership); | 61 | engine->setObjectOwnership(KNewStuffQuick::QuickQuestionListener::instance(), QQmlEngine::CppOwnership); | ||
56 | return KNewStuffQuick::QuickQuestionListener::instance(); | 62 | return KNewStuffQuick::QuickQuestionListener::instance(); | ||
57 | }); | 63 | }); | ||
64 | | ||||
65 | // Version 1.67 | ||||
66 | qmlRegisterUncreatableType<KNSCore::EntryWrapper>(coreUri, 1, 67, "EntryWrapper", QStringLiteral("This should only be created by the Engine, and wraps EntryInternal objects for passing through Qt Quick")); | ||||
58 | } | 67 | } |