diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/modules/snd/libkvisnd.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/snd/libkvisnd.cpp')
-rw-r--r-- | src/modules/snd/libkvisnd.cpp | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/src/modules/snd/libkvisnd.cpp b/src/modules/snd/libkvisnd.cpp index bf0d2eab..70ade834 100644 --- a/src/modules/snd/libkvisnd.cpp +++ b/src/modules/snd/libkvisnd.cpp @@ -34,13 +34,13 @@ #include "kvi_locale.h" #include "kvi_qstring.h" -#include <qsound.h> +#include <tqsound.h> #ifdef COMPILE_ON_WINDOWS #include <mmsystem.h> #else //!COMPILE_ON_WINDOWS - #include <qfile.h> + #include <tqfile.h> #include <unistd.h> #include <errno.h> @@ -78,12 +78,12 @@ static KviSoundPlayer * g_pSoundPlayer = 0; KviSoundPlayer::KviSoundPlayer() -: QObject() +: TQObject() { m_pThreadList = new KviPointerList<KviSoundThread>; m_pThreadList->setAutoDelete(true); - m_pSoundSystemDict = new KviPointerHashTable<QString,SoundSystemRoutine>(17,false); + m_pSoundSystemDict = new KviPointerHashTable<TQString,SoundSystemRoutine>(17,false); m_pSoundSystemDict->setAutoDelete(true); #ifdef COMPILE_ON_WINDOWS @@ -103,13 +103,8 @@ KviSoundPlayer::KviSoundPlayer() #endif //COMPILE_ARTS_SUPPORT #endif //!COMPILE_ON_WINDOWS -#if QT_VERSION >= 0x030100 - if(QSound::isAvailable()) - m_pSoundSystemDict->insert("qt",new SoundSystemRoutine(KVI_PTR2MEMBER(KviSoundPlayer::playQt))); -#else - if(QSound::available()) - m_pSoundSystemDict->insert("qt",new SoundSystemRoutine(KVI_PTR2MEMBER(KviSoundPlayer::playQt))); -#endif + if(TQSound::isAvailable()) + m_pSoundSystemDict->insert("qt",new SoundSystemRoutine(KVI_PTR2MEMBER(KviSoundPlayer::playTQt))); m_pSoundSystemDict->insert("null",new SoundSystemRoutine(KVI_PTR2MEMBER(KviSoundPlayer::playNull))); @@ -132,9 +127,9 @@ KviSoundPlayer::~KviSoundPlayer() g_pSoundPlayer = 0; } -void KviSoundPlayer::getAvailableSoundSystems(QStringList *l) +void KviSoundPlayer::getAvailableSoundSystems(TQStringList *l) { - KviPointerHashTableIterator<QString,SoundSystemRoutine> it(*m_pSoundSystemDict); + KviPointerHashTableIterator<TQString,SoundSystemRoutine> it(*m_pSoundSystemDict); while(it.current()) { l->append(it.currentKey()); @@ -158,7 +153,7 @@ void KviSoundPlayer::unregisterSoundThread(KviSoundThread * t) m_pThreadList->removeRef(t); } -bool KviSoundPlayer::event(QEvent * e) +bool KviSoundPlayer::event(TQEvent * e) { if(e->type() == KVI_THREAD_EVENT) { @@ -167,7 +162,7 @@ bool KviSoundPlayer::event(QEvent * e) delete (KviSoundThread *)t; return true; } - return QObject::event(e); + return TQObject::event(e); } @@ -206,11 +201,7 @@ void KviSoundPlayer::detectSoundSystem() KVI_OPTION_STRING(KviOption_stringSoundSystem) = "oss"; #endif -#if QT_VERSION >= 0x030100 - if(QSound::isAvailable()) -#else - if(QSound::available()) -#endif + if(TQSound::isAvailable()) { KVI_OPTION_STRING(KviOption_stringSoundSystem) = "qt"; return; @@ -221,7 +212,7 @@ void KviSoundPlayer::detectSoundSystem() } #ifdef COMPILE_ON_WINDOWS - bool KviSoundPlayer::playWinmm(const QString &szFileName) + bool KviSoundPlayer::playWinmm(const TQString &szFileName) { if(isMuted()) return true; sndPlaySound(szFileName.local8Bit().data(),SND_ASYNC | SND_NODEFAULT); @@ -230,7 +221,7 @@ void KviSoundPlayer::detectSoundSystem() #else //!COMPILE_ON_WINDOWS #ifdef COMPILE_OSS_SUPPORT #ifdef COMPILE_AUDIOFILE_SUPPORT - bool KviSoundPlayer::playOssAudiofile(const QString &szFileName) + bool KviSoundPlayer::playOssAudiofile(const TQString &szFileName) { if(isMuted()) return true; KviOssAudiofileSoundThread * t = new KviOssAudiofileSoundThread(szFileName); @@ -242,7 +233,7 @@ void KviSoundPlayer::detectSoundSystem() return true; } #endif //COMPILE_AUDIOFILE_SUPPORT - bool KviSoundPlayer::playOss(const QString &szFileName) + bool KviSoundPlayer::playOss(const TQString &szFileName) { if(isMuted()) return true; KviOssSoundThread * t = new KviOssSoundThread(szFileName); @@ -255,7 +246,7 @@ void KviSoundPlayer::detectSoundSystem() } #endif //COMPILE_OSS_SUPPORT #ifdef COMPILE_ESD_SUPPORT - bool KviSoundPlayer::playEsd(const QString &szFileName) + bool KviSoundPlayer::playEsd(const TQString &szFileName) { if(isMuted()) return true; KviEsdSoundThread * t = new KviEsdSoundThread(szFileName); @@ -268,7 +259,7 @@ void KviSoundPlayer::detectSoundSystem() } #endif //COMPILE_ESD_SUPPORT #ifdef COMPILE_ARTS_SUPPORT - bool KviSoundPlayer::playArts(const QString &szFileName) + bool KviSoundPlayer::playArts(const TQString &szFileName) { if(isMuted()) return true; KviArtsSoundThread * t = new KviArtsSoundThread(szFileName); @@ -282,31 +273,31 @@ void KviSoundPlayer::detectSoundSystem() #endif //COMPILE_ARTS_SUPPORT #endif //!COMPILE_ON_WINDOWS -bool KviSoundPlayer::playQt(const QString &szFileName) +bool KviSoundPlayer::playTQt(const TQString &szFileName) { if(isMuted()) return true; - QSound::play(szFileName); + TQSound::play(szFileName); return true; } -bool KviSoundPlayer::playNull(const QString &szFileName) +bool KviSoundPlayer::playNull(const TQString &szFileName) { // null sound system return true; } -bool KviSoundPlayer::play(const QString &szFileName) +bool KviSoundPlayer::play(const TQString &szFileName) { if(isMuted()) return true; - SoundSystemRoutine * r = m_pSoundSystemDict->find(KVI_OPTION_STRING(KviOption_stringSoundSystem)); + SoundSystemRoutine * r = m_pSoundSystemDict->tqfind(KVI_OPTION_STRING(KviOption_stringSoundSystem)); if(!r) { - if(KviQString::equalCI(KVI_OPTION_STRING(KviOption_stringSoundSystem),"unknown")) + if(KviTQString::equalCI(KVI_OPTION_STRING(KviOption_stringSoundSystem),"unknown")) { detectSoundSystem(); - r = m_pSoundSystemDict->find(KVI_OPTION_STRING(KviOption_stringSoundSystem)); + r = m_pSoundSystemDict->tqfind(KVI_OPTION_STRING(KviOption_stringSoundSystem)); if(!r)return false; } else { return false; @@ -319,7 +310,7 @@ bool KviSoundPlayer::play(const QString &szFileName) -KviSoundThread::KviSoundThread(const QString &szFileName) +KviSoundThread::KviSoundThread(const TQString &szFileName) : KviThread() { g_pSoundPlayer->registerSoundThread(this); @@ -347,7 +338,7 @@ void KviSoundThread::run() #ifndef COMPILE_ON_WINDOWS #ifdef COMPILE_OSS_SUPPORT #ifdef COMPILE_AUDIOFILE_SUPPORT - KviOssAudiofileSoundThread::KviOssAudiofileSoundThread(const QString &szFileName) + KviOssAudiofileSoundThread::KviOssAudiofileSoundThread(const TQString &szFileName) : KviSoundThread(szFileName) { } @@ -373,7 +364,7 @@ void KviSoundThread::run() buffer = kvi_malloc(int(BUFFER_FRAMES * frameSize)); int audiofd_c = open("/dev/dsp", O_WRONLY | O_EXCL | O_NDELAY); - QFile audiofd; + TQFile audiofd; audiofd.open(IO_WriteOnly,audiofd_c); if(audiofd_c < 0) @@ -422,7 +413,7 @@ void KviSoundThread::run() #endif //COMPILE_AUDIOFILE_SUPPORT - KviOssSoundThread::KviOssSoundThread(const QString &szFileName) + KviOssSoundThread::KviOssSoundThread(const TQString &szFileName) : KviSoundThread(szFileName) { } @@ -435,7 +426,7 @@ void KviSoundThread::run() { #define OSS_BUFFER_SIZE 16384 - QFile f(m_szFileName); + TQFile f(m_szFileName); int fd = -1; char buf[OSS_BUFFER_SIZE]; int iDataLen = 0; @@ -515,7 +506,7 @@ void KviSoundThread::run() #ifdef COMPILE_ESD_SUPPORT - KviEsdSoundThread::KviEsdSoundThread(const QString &szFileName) + KviEsdSoundThread::KviEsdSoundThread(const TQString &szFileName) : KviSoundThread(szFileName) { } @@ -535,7 +526,7 @@ void KviSoundThread::run() #ifdef COMPILE_ARTS_SUPPORT - KviArtsSoundThread::KviArtsSoundThread(const QString &szFileName) + KviArtsSoundThread::KviArtsSoundThread(const TQString &szFileName) : KviSoundThread(szFileName) { } @@ -589,7 +580,7 @@ void KviSoundThread::run() static bool snd_kvs_cmd_play(KviKvsModuleCommandCall * c) { - QString szFile; + TQString szFile; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("file name",KVS_PT_STRING,0,szFile) KVSM_PARAMETERS_END(c) @@ -610,7 +601,7 @@ static bool snd_kvs_cmd_play(KviKvsModuleCommandCall * c) static bool snd_kvs_cmd_autodetect(KviKvsModuleCommandCall * c) { g_pSoundPlayer->detectSoundSystem(); - if(KviQString::equalCI(KVI_OPTION_STRING(KviOption_stringSoundSystem),"null")) + if(KviTQString::equalCI(KVI_OPTION_STRING(KviOption_stringSoundSystem),"null")) { c->window()->outputNoFmt(KVI_OUT_SYSTEMERROR,__tr2qs("Sorry , I can't find a sound system to use on this machine")); } else { @@ -715,8 +706,8 @@ static bool snd_module_ctrl(KviModule * m,const char * operation,void * param) { if(kvi_strEqualCI(operation,"getAvailableSoundSystems")) { - // we expect param to be a pointer to QStringList - QStringList *l=(QStringList *)param; + // we expect param to be a pointer to TQStringList + TQStringList *l=(TQStringList *)param; g_pSoundPlayer->getAvailableSoundSystems(l); return true; } |