From 2ebcae816b0124bcb47d261e8182b6b6d3647b9c Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 10:52:20 +0200 Subject: Make libqmenumodel a shared library. --- libqmenumodel/src/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt index 373d11b..af08b1f 100644 --- a/libqmenumodel/src/CMakeLists.txt +++ b/libqmenumodel/src/CMakeLists.txt @@ -10,11 +10,15 @@ set(QMENUMODEL_SRC qstateaction.cpp ) -add_library(qmenumodel STATIC +add_library(qmenumodel SHARED ${QMENUMODEL_SRC} ) -set_target_properties(qmenumodel PROPERTIES COMPILE_FLAGS -fPIC) +set_target_properties(qmenumodel PROPERTIES + COMPILE_FLAGS -fPIC + SOVERSION 0 + VERSION 0.1.1 +) include_directories( ${GLIB_INCLUDE_DIRS} -- cgit v1.2.3 From 1fec6fd6a8dc1b50098c62701416b149be57198f Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 11:13:55 +0200 Subject: Install the shared library and dev headers. --- libqmenumodel/src/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt index af08b1f..435b412 100644 --- a/libqmenumodel/src/CMakeLists.txt +++ b/libqmenumodel/src/CMakeLists.txt @@ -26,3 +26,18 @@ include_directories( qt5_use_modules(qmenumodel Core Widgets) +install(TARGETS qmenumodel LIBRARY DESTINATION lib${LIB_SUFFIX}) + +set(QMENUMODEL_HEADERS + dbus-enums.h + qdbusactiongroup.h + qdbusmenumodel.h + qdbusobject.h + qmenumodel.h + qstateaction.h +) + +install(FILES ${QMENUMODEL_HEADERS} + DESTINATION include/qmenumodel +) + -- cgit v1.2.3 From 0186c4ae77edeeb5ccbb9fd889c2fae625cd9f13 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 11:43:21 +0200 Subject: Add a pkgconfig file for developers. --- libqmenumodel/src/CMakeLists.txt | 18 +++++++++++++----- libqmenumodel/src/qmenumodel.pc.in | 13 +++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 libqmenumodel/src/qmenumodel.pc.in (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt index 435b412..e3d65a1 100644 --- a/libqmenumodel/src/CMakeLists.txt +++ b/libqmenumodel/src/CMakeLists.txt @@ -10,11 +10,12 @@ set(QMENUMODEL_SRC qstateaction.cpp ) -add_library(qmenumodel SHARED +set(SHAREDLIBNAME qmenumodel) +add_library(${SHAREDLIBNAME} SHARED ${QMENUMODEL_SRC} ) -set_target_properties(qmenumodel PROPERTIES +set_target_properties(${SHAREDLIBNAME} PROPERTIES COMPILE_FLAGS -fPIC SOVERSION 0 VERSION 0.1.1 @@ -24,9 +25,9 @@ include_directories( ${GLIB_INCLUDE_DIRS} ) -qt5_use_modules(qmenumodel Core Widgets) +qt5_use_modules(${SHAREDLIBNAME} Core Widgets) -install(TARGETS qmenumodel LIBRARY DESTINATION lib${LIB_SUFFIX}) +install(TARGETS ${SHAREDLIBNAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) set(QMENUMODEL_HEADERS dbus-enums.h @@ -37,7 +38,14 @@ set(QMENUMODEL_HEADERS qstateaction.h ) +set(INCLUDEDIR qmenumodel) install(FILES ${QMENUMODEL_HEADERS} - DESTINATION include/qmenumodel + 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/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@ + -- cgit v1.2.3 From a7852eabec9bcce2f93b30b9ea1c88ca2ab8d790 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 12:37:52 +0200 Subject: Cosmetics: remove trailing spaces. --- libqmenumodel/src/qdbusmenumodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/qdbusmenumodel.h b/libqmenumodel/src/qdbusmenumodel.h index fdf23f7..767451a 100644 --- a/libqmenumodel/src/qdbusmenumodel.h +++ b/libqmenumodel/src/qdbusmenumodel.h @@ -37,7 +37,7 @@ class QDBusMenuModel : public QMenuModel, public QDBusObject public: QDBusMenuModel(QObject *parent=0); - ~QDBusMenuModel(); + ~QDBusMenuModel(); Q_SIGNALS: void busTypeChanged(DBusEnums::BusType type); -- cgit v1.2.3 From fa5d7c1aa69ee8b4cf49c5e3cfe291e2f503f815 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 13:44:24 +0200 Subject: =?UTF-8?q?Call=20g=5Ftype=5Finit()=20in=20the=20constructor=20for?= =?UTF-8?q?=20QDBusObject.=20This=20ensures=20it=20is=20always=20called=20?= =?UTF-8?q?where=20needed:=20clients=20don=E2=80=99t=20need=20to=20invoke?= =?UTF-8?q?=20it=20themselves.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libqmenumodel/QMenuModel/plugin.cpp | 5 ----- libqmenumodel/src/qdbusobject.cpp | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'libqmenumodel') 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 */ -extern "C" { -#include -} - #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(uri, 0, 1, "QMenuModel", "QMenuModel is a interface"); qmlRegisterUncreatableType(uri, 0, 1, "QStateAction", diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp index 63be580..ba348ad 100644 --- a/libqmenumodel/src/qdbusobject.cpp +++ b/libqmenumodel/src/qdbusobject.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho */ +extern "C" { +#include +} + #include "qdbusobject.h" #include @@ -73,6 +77,7 @@ QDBusObject::QDBusObject() m_busType(DBusEnums::None), m_status(DBusEnums::Disconnected) { + g_type_init(); qRegisterMetaType("DBusEnums::ConnectionStatus"); } -- cgit v1.2.3 From 07c325213712202f6398f62e8dbdc915b7da72e6 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 13:45:00 +0200 Subject: Ensure libqmenumodel is linked against libglib and libgio. --- libqmenumodel/src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt index e3d65a1..8edb3e1 100644 --- a/libqmenumodel/src/CMakeLists.txt +++ b/libqmenumodel/src/CMakeLists.txt @@ -23,6 +23,12 @@ set_target_properties(${SHAREDLIBNAME} PROPERTIES include_directories( ${GLIB_INCLUDE_DIRS} + ${GIO_INCLUDE_DIRS} +) + +target_link_libraries(${SHAREDLIBNAME} + ${GLIB_LDFLAGS} + ${GIO_LDFLAGS} ) qt5_use_modules(${SHAREDLIBNAME} Core Widgets) -- cgit v1.2.3 From bc7eb612da5fb089c84840e8a1fc4bc0f20784ad Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 16:25:10 +0200 Subject: Use the Q_EMIT keyword to emit signals. --- libqmenumodel/src/qdbusobject.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp index ba348ad..4ee568f 100644 --- a/libqmenumodel/src/qdbusobject.cpp +++ b/libqmenumodel/src/qdbusobject.cpp @@ -100,7 +100,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 +115,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 +130,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 +138,7 @@ void QDBusObject::setStatus(DBusEnums::ConnectionStatus status) { if (m_status != status) { m_status = status; - statusChanged(m_status); + Q_EMIT statusChanged(m_status); } } -- cgit v1.2.3 From d2ec6532acec6b555ec43354e3f1ed30bd7501c1 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Mon, 8 Oct 2012 16:25:49 +0200 Subject: Ensure the model is set before advertising the status as 'Connected'. --- libqmenumodel/src/qdbusobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp index 4ee568f..ecb8ee9 100644 --- a/libqmenumodel/src/qdbusobject.cpp +++ b/libqmenumodel/src/qdbusobject.cpp @@ -180,8 +180,8 @@ void QDBusObject::onServiceAppeared(GDBusConnection *connection, const gchar *, { QDBusObject *self = reinterpret_cast(data); - self->setStatus(DBusEnums::Connected); self->serviceAppear(connection); + self->setStatus(DBusEnums::Connected); } void QDBusObject::onServiceVanished(GDBusConnection *connection, const gchar *, gpointer data) -- cgit v1.2.3