aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier.tilloy@canonical.com>2012-10-15 12:40:44 +0000
committerTarmac <>2012-10-15 12:40:44 +0000
commit5999e7a42962140b6479995d77a178186b6b2fcc (patch)
tree3927d59c3a5edf7362bb4de937ae11fe7291b029 /libqmenumodel
parent46b559bd4b2229332c1858939be765939fc6fb05 (diff)
parent4366f70b6d6f5f1788353dd74df15e616365d25b (diff)
downloadqmenumodel-5999e7a42962140b6479995d77a178186b6b2fcc.tar.gz
qmenumodel-5999e7a42962140b6479995d77a178186b6b2fcc.tar.bz2
qmenumodel-5999e7a42962140b6479995d77a178186b6b2fcc.zip
Expose a C++ library, and separate into 3 binary packages:
- libqmenumodel0: C++ library - libqmenumodel-dev: development headers for the C++ library - qmenumodel-qml: QML module. Approved by Renato Araujo Oliveira Filho, jenkins.
Diffstat (limited to 'libqmenumodel')
-rw-r--r--libqmenumodel/QMenuModel/plugin.cpp5
-rw-r--r--libqmenumodel/src/CMakeLists.txt39
-rw-r--r--libqmenumodel/src/qdbusmenumodel.h2
-rw-r--r--libqmenumodel/src/qdbusobject.cpp11
-rw-r--r--libqmenumodel/src/qmenumodel.pc.in13
5 files changed, 56 insertions, 14 deletions
diff --git a/libqmenumodel/QMenuModel/plugin.cpp b/libqmenumodel/QMenuModel/plugin.cpp
index 26650eb..ee05fff 100644
--- a/libqmenumodel/QMenuModel/plugin.cpp
+++ b/libqmenumodel/QMenuModel/plugin.cpp
@@ -17,10 +17,6 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
-extern "C" {
-#include <glib-object.h>
-}
-
#include "plugin.h"
#include "qmenumodel.h"
#include "qdbusmenumodel.h"
@@ -31,7 +27,6 @@ extern "C" {
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",
diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt
index 373d11b..8edb3e1 100644
--- a/libqmenumodel/src/CMakeLists.txt
+++ b/libqmenumodel/src/CMakeLists.txt
@@ -10,15 +10,48 @@ set(QMENUMODEL_SRC
qstateaction.cpp
)
-add_library(qmenumodel STATIC
+set(SHAREDLIBNAME qmenumodel)
+add_library(${SHAREDLIBNAME} SHARED
${QMENUMODEL_SRC}
)
-set_target_properties(qmenumodel PROPERTIES COMPILE_FLAGS -fPIC)
+set_target_properties(${SHAREDLIBNAME} PROPERTIES
+ COMPILE_FLAGS -fPIC
+ SOVERSION 0
+ VERSION 0.1.1
+)
include_directories(
${GLIB_INCLUDE_DIRS}
+ ${GIO_INCLUDE_DIRS}
+)
+
+target_link_libraries(${SHAREDLIBNAME}
+ ${GLIB_LDFLAGS}
+ ${GIO_LDFLAGS}
)
-qt5_use_modules(qmenumodel Core Widgets)
+qt5_use_modules(${SHAREDLIBNAME} Core Widgets)
+
+install(TARGETS ${SHAREDLIBNAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+set(QMENUMODEL_HEADERS
+ dbus-enums.h
+ qdbusactiongroup.h
+ qdbusmenumodel.h
+ qdbusobject.h
+ qmenumodel.h
+ qstateaction.h
+)
+
+set(INCLUDEDIR qmenumodel)
+install(FILES ${QMENUMODEL_HEADERS}
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${INCLUDEDIR}
+)
+
+set(PCFILE qmenumodel.pc)
+configure_file(${PCFILE}.in ${CMAKE_CURRENT_BINARY_DIR}/${PCFILE} @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PCFILE}
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
+)
diff --git a/libqmenumodel/src/qdbusmenumodel.h b/libqmenumodel/src/qdbusmenumodel.h
index 5beb3b9..6943613 100644
--- a/libqmenumodel/src/qdbusmenumodel.h
+++ b/libqmenumodel/src/qdbusmenumodel.h
@@ -33,7 +33,7 @@ class QDBusMenuModel : public QMenuModel, public QDBusObject
public:
QDBusMenuModel(QObject *parent=0);
- ~QDBusMenuModel();
+ ~QDBusMenuModel();
Q_SIGNALS:
void busTypeChanged(DBusEnums::BusType type);
diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp
index 929aec0..5a5a14b 100644
--- a/libqmenumodel/src/qdbusobject.cpp
+++ b/libqmenumodel/src/qdbusobject.cpp
@@ -78,6 +78,7 @@ QDBusObject::QDBusObject()
m_busType(DBusEnums::None),
m_status(DBusEnums::Disconnected)
{
+ g_type_init();
qRegisterMetaType<DBusEnums::ConnectionStatus>("DBusEnums::ConnectionStatus");
}
@@ -100,7 +101,7 @@ void QDBusObject::setBusType(DBusEnums::BusType type)
if (m_status != DBusEnums::Disconnected)
disconnect();
m_busType = type;
- busTypeChanged(m_busType);
+ Q_EMIT busTypeChanged(m_busType);
}
}
@@ -115,7 +116,7 @@ void QDBusObject::setBusName(const QString &busName)
if (m_status != DBusEnums::Disconnected)
disconnect();
m_busName = busName;
- busNameChanged(m_busName);
+ Q_EMIT busNameChanged(m_busName);
}
}
@@ -130,7 +131,7 @@ void QDBusObject::setObjectPath(const QString &objectPath)
if (m_status != DBusEnums::Disconnected)
disconnect();
m_objectPath = objectPath;
- objectPathChanged(m_objectPath);
+ Q_EMIT objectPathChanged(m_objectPath);
}
}
@@ -138,7 +139,7 @@ void QDBusObject::setStatus(DBusEnums::ConnectionStatus status)
{
if (m_status != status) {
m_status = status;
- statusChanged(m_status);
+ Q_EMIT statusChanged(m_status);
}
}
@@ -180,8 +181,8 @@ void QDBusObject::onServiceAppeared(GDBusConnection *connection, const gchar *,
{
QDBusObject *self = reinterpret_cast<QDBusObject*>(data);
- self->setStatus(DBusEnums::Connected);
self->serviceAppear(connection);
+ self->setStatus(DBusEnums::Connected);
}
void QDBusObject::onServiceVanished(GDBusConnection *connection, const gchar *, gpointer data)
diff --git a/libqmenumodel/src/qmenumodel.pc.in b/libqmenumodel/src/qmenumodel.pc.in
new file mode 100644
index 0000000..1c410bc
--- /dev/null
+++ b/libqmenumodel/src/qmenumodel.pc.in
@@ -0,0 +1,13 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: qmenumodel
+Description: Qt binding for GMenuModel.
+Version: 0.1
+
+Requires.private: QtCore QtWidgets gio-2.0
+Libs: -L${libdir} -l@SHAREDLIBNAME@
+Cflags: -I${includedir}/@INCLUDEDIR@
+