aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src
diff options
context:
space:
mode:
Diffstat (limited to 'libqmenumodel/src')
-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
4 files changed, 56 insertions, 9 deletions
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@
+