Add Qt DBus as optional dependency in order to be compatible with windows

This commit is contained in:
2014-12-02 20:01:35 +00:00
parent 7abedc9607
commit e41ca8d949
7 changed files with 63 additions and 37 deletions
+38 -26
View File
@@ -42,6 +42,44 @@ OPTION( USE_QT4 "Build with QT4" OFF )
ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.")
ADD_FEATURE_INFO(WErrors PLAYUVER_WERROR "Warnings as errors" )
#####################################################################################
# Qt library
######################################################################################
IF( USE_QT4 )
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT4" )
FIND_PACKAGE( Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtWebKit )
FIND_PACKAGE( Qt4 COMPONENTS QtDBus )
IF( NOT QT4_FOUND )
SET(USE_QT4 FALSE)
ELSE()
INCLUDE( ${QT_USE_FILE} )
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
SET( QT_LINKER_LIBS ${QT_LIBRARIES} )
ENDIF()
ENDIF()
IF( NOT USE_QT4 )
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT5" )
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets )
# # FIND_PACKAGE( Qt5 COMPONENTS DBus )
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets )
LIST(APPEND QT_MODULES Core Gui Widgets )
IF( ${Qt5DBus_FOUND} )
SET( USE_QTDBUS ${Qt5DBus_FOUND} )
LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
LIST(APPEND QT_MODULES DBus )
ENDIF()
INCLUDE_DIRECTORIES( ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}" )
ENDIF()
######################################################################################
# Dependencies
######################################################################################
@@ -64,32 +102,6 @@ IF( WIN32 )
INCLUDE( cmake/Win32.cmake )
ENDIF()
#####################################################################################
# Qt library
######################################################################################
IF( USE_QT4 )
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT4" )
FIND_PACKAGE( Qt4 REQUIRED QtCore QtGui QtNetwork QtWebKit )
IF( NOT QT4_FOUND )
SET(USE_QT4 FALSE)
ELSE()
INCLUDE( ${QT_USE_FILE} )
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
SET( QT_LINKER_LIBS ${QT_LIBRARIES} )
ENDIF()
ENDIF()
IF( NOT USE_QT4 )
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT5" )
FIND_PACKAGE( Qt5 REQUIRED Core Gui Widgets DBus )
INCLUDE_DIRECTORIES( ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
# Add compiler flags for building executables (-fPIE)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}" )
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus )
LIST(APPEND QT_MODULES Core Gui Widgets )
ENDIF()
######################################################################################
# Configuration
######################################################################################
+4 -1
View File
@@ -15,7 +15,6 @@ set(plaYUver_App_SRCS
PlaYUVerAppModuleIf.cpp
GridManager.cpp
Settings.cpp
PlaYUVerAppAdaptor.cpp
# Dialogs
AboutDialog.cpp
ConfigureFormatDialog.cpp
@@ -31,6 +30,10 @@ set(plaYUver_App_SRCS
WidgetFrameNumber.cpp
)
IF( USE_QTDBUS )
LIST( APPEND plaYUver_App_SRCS PlaYUVerAppAdaptor.cpp )
ENDIF()
set(plaYUver_App_UI "" )
set(plaYUver_App_RCC
+4
View File
@@ -25,6 +25,10 @@
#ifndef __PlaYUVerAppAdaptor_H__
#define __PlaYUVerAppAdaptor_H__
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusReply>
#include <QtDBus>
#include <QtCore>
+7 -6
View File
@@ -25,13 +25,11 @@
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#include <QApplication>
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QDBusMessage>
#include <QDBusReply>
#include "PlaYUVerAppAdaptor.h"
#include "plaYUVerApp.h"
#include "SubWindowHandle.h"
#ifdef USE_QTDBUS
#include "PlaYUVerAppAdaptor.h"
#endif
#ifdef USE_FERVOR
#include "fvupdater.h"
#endif
@@ -53,6 +51,7 @@ int main( int argc, char *argv[] )
QApplication::setOrganizationName( "pixlra" );
QApplication::setOrganizationDomain( "playuver.pixlra" );
#ifdef USE_QTDBUS
/**
* use dbus, if available
* allows for resuse of running Kate instances
@@ -128,6 +127,8 @@ int main( int argc, char *argv[] )
/**
* if we arrive here, we need to start a new playuver instance!
*/
QDBusConnection::sessionBus().registerService( PLAYUVER_DBUS_SESSION_NAME );
#endif
plaYUVerApp mainwindow;
mainwindow.show();
mainwindow.parseArgs( argc, argv );
@@ -136,7 +137,7 @@ int main( int argc, char *argv[] )
FvUpdater::sharedUpdater()->SetDependencies(DEPENDENCIES_STRING);
#endif
QDBusConnection::sessionBus().registerService( PLAYUVER_DBUS_SESSION_NAME );
return application.exec();
}
+6 -3
View File
@@ -27,6 +27,9 @@
#ifdef USE_FERVOR
#include "fvupdater.h"
#endif
#ifdef USE_QTDBUS
#include "PlaYUVerAppAdaptor.h"
#endif
#include "plaYUVerApp.h"
#include "DialogSubWindowSelector.h"
@@ -43,13 +46,13 @@ plaYUVerApp::plaYUVerApp()
setWindowModality( Qt::ApplicationModal );
// dbus
// DBus
#ifdef USE_QTDBUS
m_pDBusAdaptor = new PlaYUVerAppAdaptor(this);
#endif
mdiArea = new PlaYUVerMdiArea;
setCentralWidget( mdiArea );
//mdiArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
//mdiArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
mdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder );
connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( chageSubWindowSelection() ) );
+1 -1
View File
@@ -33,7 +33,6 @@
#endif
#include <QMainWindow>
#include "lib/PlaYUVerDefs.h"
#include "PlaYUVerAppAdaptor.h"
#include "SubWindowHandle.h"
#include "ModulesHandle.h"
#include "PropertiesSidebar.h"
@@ -45,6 +44,7 @@ namespace plaYUVer
{
class PlaYUVerStream;
class PlaYUVerAppAdaptor;
class plaYUVerApp: public QMainWindow
{
+3
View File
@@ -45,6 +45,9 @@
#define QT_VERSION_PLAYUVER 4
#endif
/* QtDBus */
#cmakedefine USE_QTDBUS
#cmakedefine PLAYUVER_THREADED_MODULES
/* OpenCV */