aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
Diffstat (limited to 'libqmenumodel')
-rw-r--r--libqmenumodel/QMenuModel/CMakeLists.txt22
-rw-r--r--libqmenumodel/QMenuModel/plugin.cpp9
-rw-r--r--libqmenumodel/QMenuModel/plugin.h8
-rw-r--r--libqmenumodel/QMenuModel/qmldir2
-rw-r--r--libqmenumodel/src/CMakeLists.txt28
-rw-r--r--libqmenumodel/src/qdbusactiongroup.cpp6
-rw-r--r--libqmenumodel/src/qdbusmenumodel.cpp8
-rw-r--r--libqmenumodel/src/qdbusobject.cpp14
-rw-r--r--libqmenumodel/src/qmenumodel.cpp4
-rw-r--r--libqmenumodel/src/qstateaction.cpp4
10 files changed, 39 insertions, 66 deletions
diff --git a/libqmenumodel/QMenuModel/CMakeLists.txt b/libqmenumodel/QMenuModel/CMakeLists.txt
index 5fb1d9f..8a7702f 100644
--- a/libqmenumodel/QMenuModel/CMakeLists.txt
+++ b/libqmenumodel/QMenuModel/CMakeLists.txt
@@ -4,41 +4,29 @@ set(QMLPLUGIN_SRC
plugin.cpp
)
-set(QMLPLUGIN_HEADERS
- plugin.h
-)
-
-qt4_wrap_cpp(QMLPLUGIN_MOC
- ${QMLPLUGIN_HEADERS}
-)
-
add_library(qmenumodel-qml MODULE
${QMLPLUGIN_SRC}
- ${QMLPLUGIN_MOC}
)
include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
${src_SOURCE_DIR}
- ${QT_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}
- ${QT_QTGUI_INCLUDE_DIR}
- ${QT_QTDECLARATIVE_INCLUDE_DIR}
${GLIB_INCLUDE_DIRS}
- ${GIO_INCLUDE_DIRS}
)
target_link_libraries(qmenumodel-qml
qmenumodel
- ${QT_QTCORE_LIBRARY}
- ${QT_QTDCLARATIVE_LIBRARY}
${GLIB_LDFLAGS}
${GIO_LDFLAGS}
)
+qt5_use_modules(qmenumodel-qml Qml Widgets)
+
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
"${CMAKE_CURRENT_BINARY_DIR}/qmldir")
+# Apparently, QT_IMPORTS_DIR didn’t make it to Qt5.
+# In want of a better solution, let’s hardcode it…
+set(QT_IMPORTS_DIR /opt/qt5/imports)
set(QMLPLUGIN_INSTALL_PREFIX "${QT_IMPORTS_DIR}/QMenuModel")
install(TARGETS qmenumodel-qml DESTINATION ${QMLPLUGIN_INSTALL_PREFIX})
install(FILES qmldir DESTINATION ${QMLPLUGIN_INSTALL_PREFIX})
diff --git a/libqmenumodel/QMenuModel/plugin.cpp b/libqmenumodel/QMenuModel/plugin.cpp
index ec51ae9..26650eb 100644
--- a/libqmenumodel/QMenuModel/plugin.cpp
+++ b/libqmenumodel/QMenuModel/plugin.cpp
@@ -17,17 +17,21 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
+extern "C" {
+#include <glib-object.h>
+}
+
#include "plugin.h"
#include "qmenumodel.h"
#include "qdbusmenumodel.h"
#include "qdbusactiongroup.h"
#include "qstateaction.h"
-#include <QtDeclarative>
-
+#include <QtQml>
void QMenuModelQmlPlugin::registerTypes(const char *uri)
{
+ g_type_init();
qmlRegisterUncreatableType<QMenuModel>(uri, 0, 1, "QMenuModel",
"QMenuModel is a interface");
qmlRegisterUncreatableType<QStateAction>(uri, 0, 1, "QStateAction",
@@ -40,4 +44,3 @@ void QMenuModelQmlPlugin::registerTypes(const char *uri)
}
-Q_EXPORT_PLUGIN2(qmenumodel, QMenuModelQmlPlugin)
diff --git a/libqmenumodel/QMenuModel/plugin.h b/libqmenumodel/QMenuModel/plugin.h
index e9d6850..fc732d2 100644
--- a/libqmenumodel/QMenuModel/plugin.h
+++ b/libqmenumodel/QMenuModel/plugin.h
@@ -20,14 +20,16 @@
#ifndef QMENUMODELQMLPLUGIN_H
#define QMENUMODELQMLPLUGIN_H
-#include <QDeclarativeExtensionPlugin>
+#include <QQmlExtensionPlugin>
-
-class QMenuModelQmlPlugin : public QDeclarativeExtensionPlugin
+class QMenuModelQmlPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "com.canonical.qmenumodel")
+
public:
void registerTypes(const char *uri);
};
#endif
+
diff --git a/libqmenumodel/QMenuModel/qmldir b/libqmenumodel/QMenuModel/qmldir
index 32de804..5cb4fcd 100644
--- a/libqmenumodel/QMenuModel/qmldir
+++ b/libqmenumodel/QMenuModel/qmldir
@@ -1 +1,3 @@
+module QMenuModel
plugin qmenumodel-qml
+
diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt
index 17d11f1..373d11b 100644
--- a/libqmenumodel/src/CMakeLists.txt
+++ b/libqmenumodel/src/CMakeLists.txt
@@ -2,6 +2,7 @@ project(src)
set(QMENUMODEL_SRC
converter.cpp
+ dbus-enums.h
qmenumodel.cpp
qdbusobject.cpp
qdbusmenumodel.cpp
@@ -9,38 +10,15 @@ set(QMENUMODEL_SRC
qstateaction.cpp
)
-set(QMENUMODEL_HEADERS
- converter.h
- dbus-enums.h
- qmenumodel.h
- qdbusobject.h
- qdbusmenumodel.h
- qdbusactiongroup.h
- qstateaction.h
-)
-
-qt4_wrap_cpp(QMENUMODEL_MOC
- ${QMENUMODEL_HEADERS}
-)
-
add_library(qmenumodel STATIC
${QMENUMODEL_SRC}
- ${QMENUMODEL_MOC}
)
set_target_properties(qmenumodel PROPERTIES COMPILE_FLAGS -fPIC)
include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${QT_INCLUDE_DIR}
- ${QT_QTCORE_INCLUDE_DIR}
- ${QT_QTGUI_INCLUDE_DIR}
${GLIB_INCLUDE_DIRS}
- ${GIO_INCLUDE_DIRS}
)
-target_link_libraries(qmenumodel
- ${QT_QTCORE_LIBRARY}
- ${GLIB_LDFLAGS}
- ${GIO_LDFLAGS}
-)
+qt5_use_modules(qmenumodel Core Widgets)
+
diff --git a/libqmenumodel/src/qdbusactiongroup.cpp b/libqmenumodel/src/qdbusactiongroup.cpp
index 5a9e0bd..fc5b18e 100644
--- a/libqmenumodel/src/qdbusactiongroup.cpp
+++ b/libqmenumodel/src/qdbusactiongroup.cpp
@@ -26,12 +26,12 @@ extern "C" {
}
/*!
- \qmlclass QDBusActionGroup
+ \qmltype QDBusActionGroup
\inherits QDBusObject
\brief A DBusActionGroup implementation to be used with \l QDBusMenuModel
- \bold {This component is under heavy development.}
+ \b {This component is under heavy development.}
This class can be used as a proxy for an action group that is exported over D-Bus
@@ -67,7 +67,7 @@ QDBusActionGroup::~QDBusActionGroup()
Look for a action with the same name and return a \l QStateAction object.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
QStateAction *QDBusActionGroup::action(const QString &name)
{
diff --git a/libqmenumodel/src/qdbusmenumodel.cpp b/libqmenumodel/src/qdbusmenumodel.cpp
index 88a6084..ae88c35 100644
--- a/libqmenumodel/src/qdbusmenumodel.cpp
+++ b/libqmenumodel/src/qdbusmenumodel.cpp
@@ -20,12 +20,12 @@
#include "qdbusmenumodel.h"
/*!
- \qmlclass QDBusMenuModel
+ \qmltype QDBusMenuModel
\inherits QDBusObject
\brief The QDBusMenuModel class defines the list model for DBus menus
- \bold {This component is under heavy development.}
+ \b {This component is under heavy development.}
This class expose the menu previous exported over DBus.
@@ -63,7 +63,7 @@ QDBusMenuModel::~QDBusMenuModel()
The status will change to connecting after call this function, and as soon the busName
apperas and the objectPat was found this will change to Connected.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QDBusMenuModel::start()
{
@@ -75,7 +75,7 @@ void QDBusMenuModel::start()
Stops dbus watch and clear the model, the status wil change to Disconnected.
- \bold Note: methods should only be called after the Component has completed.
+ \b Note: methods should only be called after the Component has completed.
*/
void QDBusMenuModel::stop()
{
diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp
index abc68b4..63be580 100644
--- a/libqmenumodel/src/qdbusobject.cpp
+++ b/libqmenumodel/src/qdbusobject.cpp
@@ -22,10 +22,10 @@
#include <QDebug>
/*!
- \qmlclass QDBusObject
+ \qmltype QDBusObject
\brief The QDBusObject is a base class
- \bold {This component is under heavy development.}
+ \b {This component is under heavy development.}
This is a abstracted class used by QDBusMenuModel and QDBusActionGroup
*/
@@ -37,8 +37,8 @@
This must be seteed before call start method
The valid values are:
\list
- \o 1 - SessionBus
- \o 2 - SystemBus
+ \li 1 - SessionBus
+ \li 2 - SystemBus
\endlist
*/
@@ -62,9 +62,9 @@
Te velid status are:
\list
- \o 0 - Disconnected
- \o 1 - Connecting
- \o 2 - Connected
+ \li 0 - Disconnected
+ \li 1 - Connecting
+ \li 2 - Connected
\endlist
*/
diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp
index e88bc66..4c0fc23 100644
--- a/libqmenumodel/src/qmenumodel.cpp
+++ b/libqmenumodel/src/qmenumodel.cpp
@@ -23,10 +23,10 @@
#include <QDebug>
/*!
- \qmlclass QMenuModel
+ \qmltype QMenuModel
\brief The QMenuModel class implements the base list model for menus
- \bold {This component is under heavy development.}
+ \b {This component is under heavy development.}
This is a abstracted class used by \l QDBusMenuModel.
*/
diff --git a/libqmenumodel/src/qstateaction.cpp b/libqmenumodel/src/qstateaction.cpp
index 3629fce..5dda39f 100644
--- a/libqmenumodel/src/qstateaction.cpp
+++ b/libqmenumodel/src/qstateaction.cpp
@@ -22,12 +22,12 @@
#include "qdbusactiongroup.h"
/*!
- \qmlclass QStateAction
+ \qmltype QStateAction
\inherits QAction
\brief A QStateAction implementation to be used with \l QDBusActionGroup
- \bold {This component is under heavy development.}
+ \b {This component is under heavy development.}
This class can be used as a proxy for an action that is exported over D-Bus