Port PlasmaExtras to Qt5

The only thing missing is ResourceInstance, which needs KActivities
ported to Qt5 first. Otherwise, seems to work.
This commit is contained in:
Sebastian Kügler 2013-02-15 02:41:31 +01:00
parent 72ebf77b53
commit b8ac0c045c
7 changed files with 44 additions and 34 deletions

View File

@ -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)

View File

@ -28,7 +28,7 @@
#include <Plasma/Theme>
AppBackgroundProvider::AppBackgroundProvider()
: QDeclarativeImageProvider(QDeclarativeImageProvider::Image)
: QQuickImageProvider(QQuickImageProvider::Image)
{
}

View File

@ -20,10 +20,10 @@
#ifndef APPBACKGROUND_PROVIDER_H
#define APPBACKGROUND_PROVIDER_H
#include <QDeclarativeImageProvider>
#include <QQuickImageProvider>
class AppBackgroundProvider : public QDeclarativeImageProvider
class AppBackgroundProvider : public QQuickImageProvider
{
public:

View File

@ -20,17 +20,17 @@
#include "plasmaextracomponentsplugin.h"
#include "appbackgroundprovider_p.h"
#include "resourceinstance.h"
//#include "resourceinstance.h"
#include "fallbackcomponent.h"
#include <QtDeclarative/qdeclarative.h>
#include <QtDeclarative/QDeclarativeEngine>
#include <QtQml>
#include <QQmlEngine>
// #include <KSharedConfig>
// #include <KConfigGroup>
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<ResourceInstance>(uri, 0, 1, "ResourceInstance");
//qmlRegisterType<ResourceInstance>(uri, 0, 1, "ResourceInstance");
qmlRegisterType<FallbackComponent>(uri, 0, 1, "FallbackComponent");
}

View File

@ -21,19 +21,18 @@
#ifndef PLASMAEXTRACOMPONENTSPLUGIN_H
#define PLASMAEXTRACOMPONENTSPLUGIN_H
#include <QDeclarativeExtensionPlugin>
#include <QQmlExtensionPlugin>
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

View File

@ -28,8 +28,8 @@
#include <KDebug>
ResourceInstance::ResourceInstance(QDeclarativeItem *parent)
: QDeclarativeItem(parent)
ResourceInstance::ResourceInstance(QQuickItem *parent)
: QQuickItem(parent)
{
m_syncTimer = new QTimer(this);
m_syncTimer->setSingleShot(true);

View File

@ -19,7 +19,7 @@
#ifndef RESOURCEINSTANCE_H
#define RESOURCEINSTANCE_H
#include <QDeclarativeItem>
#include <QQuickItem>
#include <QUrl>
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;