From 8c981bff3219e5ebe3f0aa96af657dbb77d2fba2 Mon Sep 17 00:00:00 2001 From: Voker57 Date: Mon, 4 Aug 2008 16:54:26 +0000 Subject: Added Phonon cmake module from KDE4, now using it. git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2177 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/modules/snd/CMakeLists.txt | 2 ++ src/modules/snd/libkvisnd.cpp | 32 ++++++++++++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src/modules') diff --git a/src/modules/snd/CMakeLists.txt b/src/modules/snd/CMakeLists.txt index fcb3c60b0..6e287b597 100644 --- a/src/modules/snd/CMakeLists.txt +++ b/src/modules/snd/CMakeLists.txt @@ -1,5 +1,7 @@ # CMakeLists for src/modules/snd +INCLUDE_DIRECTORIES(${PHONON_INCLUDE_DIR}) + IF(WIN32) LIST(APPEND LIBS -lwinmm) ENDIF() diff --git a/src/modules/snd/libkvisnd.cpp b/src/modules/snd/libkvisnd.cpp index d6208d6d1..4152f59f6 100644 --- a/src/modules/snd/libkvisnd.cpp +++ b/src/modules/snd/libkvisnd.cpp @@ -37,15 +37,10 @@ #include #ifdef COMPILE_PHONON_SUPPORT - #ifdef COMPILE_KDE_SUPPORT - #include - #include - #include - #else //!COMPILE_KDE_SUPPORT - #include - #endif //!COMPILE_KDE_SUPPORT - Phonon::MediaObject * g_pPhononPlayer=0; - #include + #include + #include + Phonon::MediaObject * g_pPhononPlayer=0; + #include #endif //!COMPILE_PHONON_SUPPORT #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) @@ -98,6 +93,7 @@ KviSoundPlayer::KviSoundPlayer() m_pSoundSystemDict = new KviPointerHashTable(17,false); m_pSoundSystemDict->setAutoDelete(true); #ifdef COMPILE_PHONON_SUPPORT + qDebug("Inserting phonon"); m_pSoundSystemDict->insert("phonon",new SoundSystemRoutine(KVI_PTR2MEMBER(KviSoundPlayer::playPhonon))); #endif //!COMPILE_PHONON_SUPPORT #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) @@ -230,12 +226,12 @@ void KviSoundPlayer::detectSoundSystem() #ifdef COMPILE_PHONON_SUPPORT bool KviSoundPlayer::playPhonon(const QString &szFileName) { - if(isMuted()) return true; + if(isMuted()) return true; if(!g_pPhononPlayer) g_pPhononPlayer= Phonon::createPlayer(Phonon::MusicCategory); - if(g_pPhononPlayer->state()!=Phonon::ErrorState) - { + if(g_pPhononPlayer->state()!=Phonon::ErrorState) + { g_pPhononPlayer->setCurrentSource(QUrl(szFileName)); - g_pPhononPlayer->play(); + g_pPhononPlayer->play(); } return true; } @@ -590,12 +586,12 @@ void KviSoundThread::run() KviPhononSoundThread::KviPhononSoundThread(const QString &szFileName) : KviSoundThread(szFileName) { - if(!g_pPhononPlayer) - { + if(!g_pPhononPlayer) + { g_pPhononPlayer = Phonon::createPlayer(Phonon::MusicCategory); - } else { - if(g_pPhononPlayer->state()!=Phonon::ErrorState) - g_pPhononPlayer->setCurrentSource(QUrl(szFileName)); + } else { + if(g_pPhononPlayer->state()!=Phonon::ErrorState) + g_pPhononPlayer->setCurrentSource(QUrl(szFileName)); } } -- cgit v1.3.1-10-gc9f91