diff --git a/CMakeLists.txt b/CMakeLists.txt index d796aef90..b9cd9fdf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ SET( TOMAHAWK_VERSION_PATCH 99 ) # build options option(BUILD_GUI "Build Tomahawk with GUI" ON) option(BUILD_RELEASE "Generate TOMAHAWK_VERSION without GIT info" OFF) +option(BUILD_GUI_QML"Build Tomahawk with QML Support" OFF) + # generate version string @@ -71,6 +73,11 @@ ELSE() MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" ) LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" ) ENDIF() +IF( BUILD_GUI_QML ) + MESSAGE( STATUS "Building Tomahawk QML version ***" ) + LIST(APPEND NEEDED_QT4_COMPONENTS "QtDeclarative" ) +ENDIF() + IF( BUILD_GUI AND UNIX AND NOT APPLE ) FIND_PACKAGE( X11 ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 68cbe3cee..43d79f943 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -238,7 +238,7 @@ IF(QCA2_FOUND) SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${QCA2_LIBRARIES} ) ENDIF(QCA2_FOUND) -TARGET_LINK_LIBRARIES( tomahawk +SET( tomahawkLinkLibraries ${LINK_LIBRARIES} ${TOMAHAWK_LIBRARIES} ${PHONON_LIBS} @@ -251,6 +251,13 @@ TARGET_LINK_LIBRARIES( tomahawk ${TAGLIB_LIBRARIES} ) +TARGET_LINK_LIBRARIES( tomahawk ${tomahawkLinkLibraries} ) + +IF( BUILD_GUI_QML ) + # sic! add_subdirectory would make it harder to reuse ${final_src} + INCLUDE( active/CMakeLists.txt ) +ENDIF() + IF( APPLE ) IF(HAVE_SPARKLE) MESSAGE("Sparkle Found, installing framekwork in bundle") diff --git a/src/main.cpp b/src/main.cpp index 2919968e7..a3e8287bc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,10 @@ main( int argc, char *argv[] ) AEInstallEventHandler( 'GURL', 'GURL', h, 0, false ); #endif +#ifdef TOUCHMAHAWK + QApplication::setGraphicsSystem( "raster" ); +#endif + TomahawkApp a( argc, argv ); KDSingleApplicationGuard guard( &a, KDSingleApplicationGuard::AutoKillOtherInstances ); QObject::connect( &guard, SIGNAL( instanceStarted( KDSingleApplicationGuard::Instance ) ), &a, SLOT( instanceStarted( KDSingleApplicationGuard::Instance ) ) ); diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 8dce6460a..644aeefc8 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -69,6 +69,10 @@ #include #endif +#ifdef TOUCHMAHAWK + #include "active/tomahawkwindowdeclarative.h" +#endif + // should go to a plugin actually #ifdef GLOOX_FOUND #include "xmppbot/xmppbot.h" @@ -222,7 +226,15 @@ TomahawkApp::init() m_mainwindow = new TomahawkWindow(); m_mainwindow->setWindowTitle( "Tomahawk" ); m_mainwindow->setObjectName( "TH_Main_Window" ); + +#ifndef TOUCHMAHAWK m_mainwindow->show(); +#else + m_declarativeWindow = new TomahawkWindowDeclarative(); + m_declarativeWindow->setWindowTitle( "Touch-ma-hawk" ); + m_declarativeWindow->show(); +#endif // TOUCHMAHAWK + } #endif diff --git a/src/tomahawkapp.h b/src/tomahawkapp.h index c06d023ce..af934880b 100644 --- a/src/tomahawkapp.h +++ b/src/tomahawkapp.h @@ -68,6 +68,10 @@ namespace Tomahawk class TomahawkWindow; #endif +#ifdef TOUCHMAHAWK +class TomahawkWindowDeclarative; +#endif + // this also acts as a a container for important top-level objects // that other parts of the app need to find @@ -90,6 +94,10 @@ public: TomahawkWindow* mainWindow() const { return m_mainwindow; } #endif +#ifdef TOUCHMAHAWK + TomahawkWindowDeclarative* declarativeWindow() const { return m_declarativeWindow; } +#endif + void enableScriptResolver( const QString& scriptPath ); void disableScriptResolver( const QString& scriptPath ); Tomahawk::ExternalResolver* resolverForPath( const QString& scriptPath ); @@ -139,6 +147,10 @@ private: TomahawkWindow* m_mainwindow; #endif +#ifdef TOUCHMAHAWK + TomahawkWindowDeclarative* m_declarativeWindow; +#endif + bool m_headless; QxtHttpServerConnector m_connector; diff --git a/src/tomahawktrayicon.cpp b/src/tomahawktrayicon.cpp index e7990921d..46c53eb34 100644 --- a/src/tomahawktrayicon.cpp +++ b/src/tomahawktrayicon.cpp @@ -42,6 +42,11 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent ) m_contextMenu = new QMenu(); setContextMenu( m_contextMenu ); +#ifdef TOUCHMAHAWK + connect(m_contextMenu->addAction( tr("Show Desktop Gui") ), SIGNAL( triggered() ), parent, SLOT( show() ) ); + m_contextMenu->addSeparator(); +#endif TOUCHMAHAWK + m_playPauseAction = m_contextMenu->addAction( tr( "Play" ) ); //m_pauseAction = m_contextMenu->addAction( tr( "Pause" ) ); m_stopAction = m_contextMenu->addAction( tr( "Stop" ) ); @@ -179,7 +184,14 @@ TomahawkTrayIcon::onActivated( QSystemTrayIcon::ActivationReason reason ) { case QSystemTrayIcon::Trigger: { - TomahawkWindow* mainwindow = APP->mainWindow(); + QMainWindow* mainwindow = 0; + + #ifndef TOUCHMAHAWK + mainwindow = APP->mainWindow(); + #else + mainwindow = (QMainWindow*) APP->declarativeWindow(); + #endif + if ( mainwindow->isVisible() ) { mainwindow->hide();