From c8a9ab0993ead54bf455d82641a75099d3e2d65b Mon Sep 17 00:00:00 2001 From: Alexandre Lision <alexandre.lision@savoirfairelinux.com> Date: Mon, 19 Jan 2015 13:41:52 -0500 Subject: [PATCH] Remove dbus from qtwrapper When compiling for OSX (or any system other than Linux) we won't use dbus. This commit removes the need to include QtDBus module. --- CMakeLists.txt | 6 +++++- INSTALL | 14 +++++--------- cmake/FindRing.cmake | 2 +- cmake/LibRingClientConfig.cmake.in | 11 ++++++++++- src/accountmodel.cpp | 1 + src/audio/settings.cpp | 3 +++ src/callmodel.cpp | 2 ++ src/dbus/metatypes.h | 10 ++++++++++ src/historymodel.cpp | 4 ++++ src/qtwrapper/callmanager_wrap.h | 1 - src/qtwrapper/configurationmanager_wrap.h | 1 - src/qtwrapper/conversions_wrap.hpp | 2 ++ src/qtwrapper/instancemanager.cpp | 1 - src/qtwrapper/instancemanager_wrap.h | 1 + src/qtwrapper/presencemanager_wrap.h | 1 - src/qtwrapper/videomanager_wrap.h | 1 - src/ringtonemodel.cpp | 1 + 17 files changed, 45 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de93c879..cf32fca2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ FIND_PACKAGE(Ring REQUIRED) IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/src/qtwrapper) ADD_DEFINITIONS(-DENABLE_LIBWRAP=true) # Use native calls (no dbus) + ADD_DEFINITIONS(-Wno-unknown-pragmas) SET(ENABLE_QT5 true) # Use Qt5 SET(ENABLE_LIBWRAP true) MESSAGE("Compiling for OS X: LibWrap enabled, Qt5 enabled.") @@ -401,7 +402,10 @@ IF(NOT ${ENABLE_STATIC} MATCHES false) ENDIF() IF(${ENABLE_QT5} MATCHES true) - QT5_USE_MODULES(ringclient Core DBus) + QT5_USE_MODULES(ringclient Core) + IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + QT5_USE_MODULES(ringclient DBus) + ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") ENDIF(${ENABLE_QT5} MATCHES true) IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") diff --git a/INSTALL b/INSTALL index 6f49cab8..11bdc508 100644 --- a/INSTALL +++ b/INSTALL @@ -21,7 +21,7 @@ To install the appplication, type the following commands in a console, while in make -j3 sudo make install -To generate a source tarball (sflphone-cliend-kde.tar.xz), just execute release.sh +To generate a source tarball (ring-cliend-kde.tar.xz), just execute release.sh Explaination ================== @@ -50,21 +50,17 @@ OS X Install # Install necessary tools: brew install dbus cmake -brew install qt5 --with-d-bus +brew install qt5 export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.3.2/ -# First make sure you have built sflphone daemon for OS X. You currently need some special -# care, but as the port matures, that should get fixed. - -cd ~/sflphone-kde/src/lib/ -install_name_tool -id @executable_path/libsflphone.0.dylib libsflphone.0.dylib +# First make sure you have built ring daemon for OS X. mkdir build && cd build cmake .. [-DCMAKE_BUILD_TYPE=Debug for compiling with debug symbols] make -install_name_tool -change @rpath/libsflphone.0.dylib @executable_path/libsflphone.0.dylib libqtsflphone.1.4.1.dylib -install_name_tool -id @executable_path/libqtsflphone.1.4.1.dylib libqtsflphone.1.4.1.dylib +install_name_tool -change @rpath/libring.0.dylib @executable_path/libring.0.dylib libringclient.1.4.1.dylib +install_name_tool -id @executable_path/libringclient.1.4.1.dylib libringclient.1.4.1.dylib # You can now use thes libraries in a QtCreator project. Don't forget to copy both dylibs inside # your .app/Contents/MacOS/ diff --git a/cmake/FindRing.cmake b/cmake/FindRing.cmake index 74d18248..81b63b63 100644 --- a/cmake/FindRing.cmake +++ b/cmake/FindRing.cmake @@ -11,7 +11,7 @@ ELSE() Add -DRING_BUILD_DIR or -DCMAKE_INSTALL_PREFIX") ENDIF() -SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib") +SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib;.so;.dll") FIND_LIBRARY(ring_BIN NAMES ring PATHS ${RING_BUILD_DIR}/.libs PATHS ${CMAKE_INSTALL_PREFIX}/libexec ) diff --git a/cmake/LibRingClientConfig.cmake.in b/cmake/LibRingClientConfig.cmake.in index a4afb959..1b494642 100644 --- a/cmake/LibRingClientConfig.cmake.in +++ b/cmake/LibRingClientConfig.cmake.in @@ -5,4 +5,13 @@ INCLUDE(GNUInstallDirs) SET(LIB_RING_CLIENT_INCLUDE_DIR ${INCLUDE_INSTALL_DIR}/libringclient/) STRING(REPLACE "${CMAKE_LIBRARY_ARCHITECTURE}" "" SANE_LIBRARY_PATH "${CMAKE_INSTALL_FULL_LIBDIR}" ) -SET(LIB_RING_CLIENT_LIBRARY ${SANE_LIBRARY_PATH}/libringclient.so) \ No newline at end of file + +IF(DEFINED ${ENABLE_STATIC}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.la;.lib") +ELSE() + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib;.so;.dll") +ENDIF() + +FIND_LIBRARY(LIB_RING_CLIENT_LIBRARY NAMES ringclient + PATHS ${RING_BUILD_DIR}/.libs + PATHS ${CMAKE_INSTALL_PREFIX}/libexec ) diff --git a/src/accountmodel.cpp b/src/accountmodel.cpp index 78469157..e980d816 100644 --- a/src/accountmodel.cpp +++ b/src/accountmodel.cpp @@ -21,6 +21,7 @@ //Qt #include <QtCore/QObject> +#include <QtCore/QCoreApplication> //Ring library #include "dbus/configurationmanager.h" diff --git a/src/audio/settings.cpp b/src/audio/settings.cpp index bd18600c..0055304f 100644 --- a/src/audio/settings.cpp +++ b/src/audio/settings.cpp @@ -17,6 +17,9 @@ ***************************************************************************/ #include "settings.h" +//Qt include +#include <QUrl> + //Ring #include "dbus/configurationmanager.h" #include "dbus/callmanager.h" diff --git a/src/callmodel.cpp b/src/callmodel.cpp index f6fa6850..c7e516e1 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -19,7 +19,9 @@ //Qt #include <QtCore/QDebug> +#include <QtCore/QCoreApplication> #include <QtGui/QDragEnterEvent> +#include <QtCore/QMimeData> //Ring library #include "call.h" diff --git a/src/dbus/metatypes.h b/src/dbus/metatypes.h index ba3c85fb..86a19349 100644 --- a/src/dbus/metatypes.h +++ b/src/dbus/metatypes.h @@ -23,7 +23,10 @@ #include <QtCore/QMap> #include <QVector> #include <QtCore/QString> + +#ifndef ENABLE_LIBWRAP #include <QtDBus/QtDBus> +#endif #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" typedef QMap<QString, QString> MapStringString; @@ -42,6 +45,7 @@ Q_DECLARE_METATYPE(VectorInt) Q_DECLARE_METATYPE(VectorString) Q_DECLARE_METATYPE(MapStringVectorString) +#ifndef ENABLE_LIBWRAP static bool dbus_metaTypeInit = false; inline void registerCommTypes() { qDBusRegisterMetaType<MapStringString>(); @@ -53,6 +57,12 @@ inline void registerCommTypes() { qDBusRegisterMetaType<MapStringVectorString>(); dbus_metaTypeInit = true; } +#else +inline void registerCommTypes() { + +} +#endif + #pragma GCC diagnostic pop #endif diff --git a/src/historymodel.cpp b/src/historymodel.cpp index f762ffcb..d532dc00 100644 --- a/src/historymodel.cpp +++ b/src/historymodel.cpp @@ -20,6 +20,10 @@ //C include #include <time.h> +//Qt include +#include <QMimeData> +#include <QCoreApplication> + //Ring lib #include "mime.h" #include "dbus/callmanager.h" diff --git a/src/qtwrapper/callmanager_wrap.h b/src/qtwrapper/callmanager_wrap.h index e27b8a91..5a29bd06 100644 --- a/src/qtwrapper/callmanager_wrap.h +++ b/src/qtwrapper/callmanager_wrap.h @@ -25,7 +25,6 @@ #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QVariant> -#include <QtDBus/QtDBus> #include <ring.h> #include "../dbus/metatypes.h" diff --git a/src/qtwrapper/configurationmanager_wrap.h b/src/qtwrapper/configurationmanager_wrap.h index 360b72f8..d565b13a 100644 --- a/src/qtwrapper/configurationmanager_wrap.h +++ b/src/qtwrapper/configurationmanager_wrap.h @@ -25,7 +25,6 @@ #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QVariant> -#include <QtDBus/QtDBus> #include <future> diff --git a/src/qtwrapper/conversions_wrap.hpp b/src/qtwrapper/conversions_wrap.hpp index e28115db..39cf326e 100644 --- a/src/qtwrapper/conversions_wrap.hpp +++ b/src/qtwrapper/conversions_wrap.hpp @@ -24,6 +24,8 @@ #include "../dbus/metatypes.h" +#define Q_NOREPLY + inline MapStringString convertMap(const std::map<std::string, std::string>& m) { MapStringString temp; for (const auto& x : m) { diff --git a/src/qtwrapper/instancemanager.cpp b/src/qtwrapper/instancemanager.cpp index bf33856c..7178f451 100644 --- a/src/qtwrapper/instancemanager.cpp +++ b/src/qtwrapper/instancemanager.cpp @@ -24,7 +24,6 @@ #include "videomanager.h" #endif //ENABLE_VIDEO - static int ringFlags = 0; InstanceInterface::InstanceInterface() : m_pTimer(nullptr) diff --git a/src/qtwrapper/instancemanager_wrap.h b/src/qtwrapper/instancemanager_wrap.h index eac6472a..c9621e44 100644 --- a/src/qtwrapper/instancemanager_wrap.h +++ b/src/qtwrapper/instancemanager_wrap.h @@ -25,6 +25,7 @@ #include <QString> #include <QStringList> #include <QVariant> +#include <QTimer> #include "ring.h" #include "../dbus/metatypes.h" diff --git a/src/qtwrapper/presencemanager_wrap.h b/src/qtwrapper/presencemanager_wrap.h index b68904f0..062e277c 100644 --- a/src/qtwrapper/presencemanager_wrap.h +++ b/src/qtwrapper/presencemanager_wrap.h @@ -25,7 +25,6 @@ #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QVariant> -#include <QtDBus/QtDBus> #include <ring.h> diff --git a/src/qtwrapper/videomanager_wrap.h b/src/qtwrapper/videomanager_wrap.h index b6aff490..5d7c3c46 100644 --- a/src/qtwrapper/videomanager_wrap.h +++ b/src/qtwrapper/videomanager_wrap.h @@ -25,7 +25,6 @@ #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QVariant> -#include <QtDBus/QtDBus> #include <ring.h> #include "../dbus/metatypes.h" diff --git a/src/ringtonemodel.cpp b/src/ringtonemodel.cpp index 20e06181..2bcbc2fd 100644 --- a/src/ringtonemodel.cpp +++ b/src/ringtonemodel.cpp @@ -19,6 +19,7 @@ //Qt #include <QtCore/QTimer> +#include <QtCore/QFileInfo> //Ring #include "dbus/configurationmanager.h" -- GitLab