1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

Add basic support for loading a qml gui

This commit is contained in:
Dominik Schmidt
2011-09-03 16:27:03 +02:00
parent 700e53eb2c
commit fca061d9bc
6 changed files with 56 additions and 2 deletions

View File

@@ -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 )

View File

@@ -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")

View File

@@ -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 ) ) );

View File

@@ -69,6 +69,10 @@
#include <QMessageBox>
#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

View File

@@ -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;

View File

@@ -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();