diff --git a/CMakeLists.txt b/CMakeLists.txt index 08ec998..b5ab0c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ###################################################################################### diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 2ff5b94..1ef8d42 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -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 diff --git a/app/PlaYUVerAppAdaptor.h b/app/PlaYUVerAppAdaptor.h index 55a0b23..e85f531 100644 --- a/app/PlaYUVerAppAdaptor.h +++ b/app/PlaYUVerAppAdaptor.h @@ -25,6 +25,10 @@ #ifndef __PlaYUVerAppAdaptor_H__ #define __PlaYUVerAppAdaptor_H__ +#include +#include +#include +#include #include #include diff --git a/app/main.cpp b/app/main.cpp index 94ddd34..274c42e 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -25,13 +25,11 @@ #include "config.h" #include "lib/PlaYUVerDefs.h" #include -#include -#include -#include -#include -#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(); } diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 3269bf0..933ca2e 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -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() ) ); diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index feb498c..487ab7b 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -33,7 +33,6 @@ #endif #include #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 { diff --git a/config.h.in b/config.h.in index 8e7c4a0..fd3f5b0 100644 --- a/config.h.in +++ b/config.h.in @@ -45,6 +45,9 @@ #define QT_VERSION_PLAYUVER 4 #endif +/* QtDBus */ +#cmakedefine USE_QTDBUS + #cmakedefine PLAYUVER_THREADED_MODULES /* OpenCV */