From b8ac0c045c7d06914b0aaed0aa0da94b7714aa49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Fri, 15 Feb 2013 02:41:31 +0100 Subject: [PATCH] Port PlasmaExtras to Qt5 The only thing missing is ResourceInstance, which needs KActivities ported to Qt5 first. Otherwise, seems to work. --- .../plasmaextracomponents/CMakeLists.txt | 41 ++++++++++++------- .../appbackgroundprovider.cpp | 2 +- .../appbackgroundprovider_p.h | 4 +- .../plasmaextracomponentsplugin.cpp | 10 ++--- .../plasmaextracomponentsplugin.h | 11 +++-- .../resourceinstance.cpp | 4 +- .../plasmaextracomponents/resourceinstance.h | 6 +-- 7 files changed, 44 insertions(+), 34 deletions(-) diff --git a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt index e4689135f..73a853010 100644 --- a/src/declarativeimports/plasmaextracomponents/CMakeLists.txt +++ b/src/declarativeimports/plasmaextracomponents/CMakeLists.txt @@ -1,33 +1,44 @@ project(plasmaextracomponents) -find_package(KActivities QUIET CONFIG) -set_package_properties(KActivities PROPERTIES DESCRIPTION "Library and infrastructure for using Activities from applications" - URL "https://projects.kde.org/kactivities" - TYPE REQUIRED - PURPOSE "Provides the ability to access activities from QML." - ) +# find_package(KActivities QUIET CONFIG) +# set_package_properties(KActivities PROPERTIES DESCRIPTION "Library and infrastructure for using Activities from applications" +# URL "https://projects.kde.org/kactivities" +# TYPE REQUIRED +# PURPOSE "Provides the ability to access activities from QML." +# ) set(plasmaextracomponents_SRCS appbackgroundprovider.cpp - resourceinstance.cpp + #resourceinstance.cpp plasmaextracomponentsplugin.cpp fallbackcomponent.cpp ) -include_directories( - ${KACTIVITIES_INCLUDE_DIRS} -) +# include_directories( +# ${KACTIVITIES_INCLUDE_DIRS} +# ) qt4_automoc(${plasmaextracomponents_SRCS}) add_library(plasmaextracomponentsplugin SHARED ${plasmaextracomponents_SRCS}) -target_link_libraries(plasmaextracomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTGUI_LIBRARY} ${KDE4_PLASMA_LIBS} ${KACTIVITIES_LIBRARY} ) +#target_link_libraries(plasmaextracomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY} +# ${QT_QTGUI_LIBRARY} ${KDE4_PLASMA_LIBS} ${KACTIVITIES_LIBRARY} ) -install(TARGETS plasmaextracomponentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras) +target_link_libraries(plasmaextracomponentsplugin + ${QT_QTCORE_LIBRARY} + ${Qt5Quick_LIBRARIES} + ${Qt5Qml_LIBRARIES} + ${QT_QTGUI_LIBRARY} + ${KDE4_KDEUI_LIBRARY} + ${KDECLARATIVE_LIBRARIES} + ${KACTIVITIES_LIBRARY} + plasma) -install(DIRECTORY qml/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras) + +install(TARGETS plasmaextracomponentsplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/extras) + +install(DIRECTORY qml/ DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/extras) # The platform specific stuff, overwrites a copy of the desktop one @@ -44,7 +55,7 @@ install(DIRECTORY qml/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras) # install(FILES qml/Title.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras) # install(DIRECTORY qml/animations/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras) -#install(DIRECTORY qml/animations/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras) +#install(DIRECTORY qml/animations/ DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/extras) #install platform overrides -- enable as we use this feature for plasmaextras #install(DIRECTORY platformcomponents/touch/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras) diff --git a/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp b/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp index 45c844888..cdbabcfd9 100644 --- a/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp +++ b/src/declarativeimports/plasmaextracomponents/appbackgroundprovider.cpp @@ -28,7 +28,7 @@ #include AppBackgroundProvider::AppBackgroundProvider() - : QDeclarativeImageProvider(QDeclarativeImageProvider::Image) + : QQuickImageProvider(QQuickImageProvider::Image) { } diff --git a/src/declarativeimports/plasmaextracomponents/appbackgroundprovider_p.h b/src/declarativeimports/plasmaextracomponents/appbackgroundprovider_p.h index fd50a5ae2..b30eb0f48 100644 --- a/src/declarativeimports/plasmaextracomponents/appbackgroundprovider_p.h +++ b/src/declarativeimports/plasmaextracomponents/appbackgroundprovider_p.h @@ -20,10 +20,10 @@ #ifndef APPBACKGROUND_PROVIDER_H #define APPBACKGROUND_PROVIDER_H -#include +#include -class AppBackgroundProvider : public QDeclarativeImageProvider +class AppBackgroundProvider : public QQuickImageProvider { public: diff --git a/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.cpp b/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.cpp index 591ec5459..f7e1e2974 100644 --- a/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.cpp +++ b/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.cpp @@ -20,17 +20,17 @@ #include "plasmaextracomponentsplugin.h" #include "appbackgroundprovider_p.h" -#include "resourceinstance.h" +//#include "resourceinstance.h" #include "fallbackcomponent.h" -#include -#include +#include +#include // #include // #include -void PlasmaExtraComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) +void PlasmaExtraComponentsPlugin::initializeEngine(QQmlEngine *engine, const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.plasma.extras")); engine->addImageProvider(QLatin1String("appbackgrounds"), new AppBackgroundProvider); @@ -39,7 +39,7 @@ void PlasmaExtraComponentsPlugin::initializeEngine(QDeclarativeEngine *engine, c void PlasmaExtraComponentsPlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.plasma.extras")); - qmlRegisterType(uri, 0, 1, "ResourceInstance"); + //qmlRegisterType(uri, 0, 1, "ResourceInstance"); qmlRegisterType(uri, 0, 1, "FallbackComponent"); } diff --git a/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.h b/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.h index 8834ede0b..3fa78cc91 100644 --- a/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.h +++ b/src/declarativeimports/plasmaextracomponents/plasmaextracomponentsplugin.h @@ -21,19 +21,18 @@ #ifndef PLASMAEXTRACOMPONENTSPLUGIN_H #define PLASMAEXTRACOMPONENTSPLUGIN_H -#include +#include -class QDeclarativeEngine; +class QQmlEngine; -class PlasmaExtraComponentsPlugin : public QDeclarativeExtensionPlugin +class PlasmaExtraComponentsPlugin : public QQmlExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: - void initializeEngine(QDeclarativeEngine *engine, const char *uri); + void initializeEngine(QQmlEngine *engine, const char *uri); void registerTypes(const char *uri); }; -Q_EXPORT_PLUGIN2(plasmaexracomponentsplugin, PlasmaExtraComponentsPlugin); - #endif diff --git a/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp b/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp index ddcb96870..4d5d99139 100644 --- a/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp +++ b/src/declarativeimports/plasmaextracomponents/resourceinstance.cpp @@ -28,8 +28,8 @@ #include -ResourceInstance::ResourceInstance(QDeclarativeItem *parent) - : QDeclarativeItem(parent) +ResourceInstance::ResourceInstance(QQuickItem *parent) + : QQuickItem(parent) { m_syncTimer = new QTimer(this); m_syncTimer->setSingleShot(true); diff --git a/src/declarativeimports/plasmaextracomponents/resourceinstance.h b/src/declarativeimports/plasmaextracomponents/resourceinstance.h index 9f69efb5f..d890f6cdb 100644 --- a/src/declarativeimports/plasmaextracomponents/resourceinstance.h +++ b/src/declarativeimports/plasmaextracomponents/resourceinstance.h @@ -19,7 +19,7 @@ #ifndef RESOURCEINSTANCE_H #define RESOURCEINSTANCE_H -#include +#include #include namespace KActivities { @@ -29,7 +29,7 @@ namespace KActivities { class QTimer; class QGraphicsView; -class ResourceInstance : public QDeclarativeItem +class ResourceInstance : public QQuickItem { Q_OBJECT @@ -39,7 +39,7 @@ class ResourceInstance : public QDeclarativeItem //Q_PROPERTY(OpenReason openReason READ openReason) public: - ResourceInstance(QDeclarativeItem *parent = 0); + ResourceInstance(QQuickItem *parent = 0); ~ResourceInstance(); QUrl uri() const;