From 0a80cfd57d271dd44221467efb426675fa470356 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 28 Jun 2011 18:31:12 +0000 Subject: 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 --- src/modules/dcc/voice.cpp | 101 ++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 53 deletions(-) (limited to 'src/modules/dcc/voice.cpp') diff --git a/src/modules/dcc/voice.cpp b/src/modules/dcc/voice.cpp index 2e34df2f..4bf9ad9d 100644 --- a/src/modules/dcc/voice.cpp +++ b/src/modules/dcc/voice.cpp @@ -40,11 +40,11 @@ #include "adpcmcodec.h" #include "gsmcodec.h" -#include -#include +#include +#include #include "kvi_tal_vbox.h" -#include -#include +#include +#include #ifndef COMPILE_ON_WINDOWS #include @@ -119,7 +119,7 @@ static KviDccVoiceCodec * kvi_dcc_voice_get_codec(const char * codecName) KviDccVoiceThread::KviDccVoiceThread(KviWindow * wnd,kvi_socket_t fd,KviDccVoiceThreadOptions * opt) -: KviDccThread(wnd,fd) +: KviDccThread(TQT_TQOBJECT(wnd),fd) { #ifndef COMPILE_DISABLE_DCC_VOICE m_pOpt = opt; @@ -533,7 +533,7 @@ void KviDccVoiceThread::startRecording() // debug("Posting event"); KviThreadDataEvent * e = new KviThreadDataEvent(KVI_DCC_THREAD_EVENT_ACTION); e->setData(new int(KVI_DCC_VOICE_THREAD_ACTION_START_RECORDING)); - postEvent(parent(),e); + postEvent(tqparent(),e); m_bRecording = true; m_bRecordingRequestPending = false; @@ -552,7 +552,7 @@ void KviDccVoiceThread::stopRecording() KviThreadDataEvent * e = new KviThreadDataEvent(KVI_DCC_THREAD_EVENT_ACTION); e->setData(new int(KVI_DCC_VOICE_THREAD_ACTION_STOP_RECORDING)); - postEvent(parent(),e); + postEvent(tqparent(),e); m_bRecording = false; if(!m_bPlaying)closeSoundcard(); @@ -569,7 +569,7 @@ void KviDccVoiceThread::startPlaying() { KviThreadDataEvent * e = new KviThreadDataEvent(KVI_DCC_THREAD_EVENT_ACTION); e->setData(new int(KVI_DCC_VOICE_THREAD_ACTION_START_PLAYING)); - postEvent(parent(),e); + postEvent(tqparent(),e); m_bPlaying = true; } #endif @@ -583,7 +583,7 @@ void KviDccVoiceThread::stopPlaying() KviThreadDataEvent * e = new KviThreadDataEvent(KVI_DCC_THREAD_EVENT_ACTION); e->setData(new int(KVI_DCC_VOICE_THREAD_ACTION_STOP_PLAYING)); - postEvent(parent(),e); + postEvent(tqparent(),e); m_bPlaying = false; if(!m_bRecording)closeSoundcard(); @@ -652,57 +652,52 @@ KviDccVoice::KviDccVoice(KviFrame *pFrm,KviDccDescriptor * dcc,const char * name m_pDescriptor = dcc; m_pSlaveThread = 0; - m_pSplitter = new QSplitter(Qt::Horizontal,this,"splitter"); + m_pSplitter = new TQSplitter(Qt::Horizontal,this,"splitter"); m_pIrcView = new KviIrcView(m_pSplitter,pFrm,this); m_pHBox = new KviTalHBox(this); KviTalVBox * vbox = new KviTalVBox(m_pHBox); - m_pInputLabel = new QLabel(__tr2qs_ctx("Input buffer","dcc"),vbox); - m_pInputLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel); - m_pOutputLabel = new QLabel(__tr2qs_ctx("Output buffer","dcc"),vbox); - m_pOutputLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_pInputLabel = new TQLabel(__tr2qs_ctx("Input buffer","dcc"),vbox); + m_pInputLabel->setFrameStyle(TQFrame::Sunken | TQFrame::Panel); + m_pOutputLabel = new TQLabel(__tr2qs_ctx("Output buffer","dcc"),vbox); + m_pOutputLabel->setFrameStyle(TQFrame::Sunken | TQFrame::Panel); vbox->setSpacing(1); KviTalVBox * vbox2 = new KviTalVBox(m_pHBox); - m_pRecordingLabel = new QLabel(vbox2); + m_pRecordingLabel = new TQLabel(vbox2); m_pRecordingLabel->setPixmap(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_RECORD))); m_pRecordingLabel->setEnabled(false); - m_pRecordingLabel->setFrameStyle(QFrame::Raised | QFrame::Panel); + m_pRecordingLabel->setFrameStyle(TQFrame::Raised | TQFrame::Panel); - m_pPlayingLabel = new QLabel(vbox2); + m_pPlayingLabel = new TQLabel(vbox2); m_pPlayingLabel->setPixmap(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_PLAY))); m_pPlayingLabel->setEnabled(false); - m_pPlayingLabel->setFrameStyle(QFrame::Raised | QFrame::Panel); + m_pPlayingLabel->setFrameStyle(TQFrame::Raised | TQFrame::Panel); vbox2->setSpacing(1); //#warning "The volume slider should be enabled only when receiving data" - m_pVolumeSlider = new QSlider(-100, 0, 10, 0, Qt::Vertical, m_pHBox, "dcc_voice_volume_slider"); + m_pVolumeSlider = new TQSlider(-100, 0, 10, 0, Qt::Vertical, m_pHBox, "dcc_voice_volume_slider"); m_pVolumeSlider->setValue(getMixerVolume()); /* Update the tooltip */ setMixerVolume(m_pVolumeSlider->value()); m_pVolumeSlider->setMaximumWidth(16); m_pVolumeSlider->setMaximumHeight(2*m_pPlayingLabel->height()); - connect(m_pVolumeSlider, SIGNAL(valueChanged(int)), this, SLOT(setMixerVolume(int))); + connect(m_pVolumeSlider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setMixerVolume(int))); - m_pTalkButton = new QToolButton(m_pHBox); + m_pTalkButton = new TQToolButton(m_pHBox); m_pTalkButton->setEnabled(false); m_pTalkButton->setToggleButton(true); -#if QT_VERSION >= 300 - QIconSet iset; - iset.setPixmap(*(g_pIconManager->getBigIcon(KVI_BIGICON_DISCONNECTED)),QIconSet::Large,QIconSet::Normal,QIconSet::Off); - iset.setPixmap(*(g_pIconManager->getBigIcon(KVI_BIGICON_CONNECTED)),QIconSet::Large,QIconSet::Normal,QIconSet::On); + TQIconSet iset; + iset.setPixmap(*(g_pIconManager->getBigIcon(KVI_BIGICON_DISCONNECTED)),TQIconSet::Large,TQIconSet::Normal,TQIconSet::Off); + iset.setPixmap(*(g_pIconManager->getBigIcon(KVI_BIGICON_CONNECTED)),TQIconSet::Large,TQIconSet::Normal,TQIconSet::On); m_pTalkButton->setIconSet(iset); -#else - m_pTalkButton->setOffIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_DISCONNECTED))); - m_pTalkButton->setOnIconSet(*(g_pIconManager->getBigIcon(KVI_BIGICON_CONNECTED))); -#endif m_pTalkButton->setUsesBigPixmap(true); - connect(m_pTalkButton,SIGNAL(toggled(bool)),this,SLOT(startOrStopTalking(bool))); + connect(m_pTalkButton,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(startOrStopTalking(bool))); m_pHBox->setStretchFactor(vbox,1); m_pHBox->setMargin(2); @@ -711,11 +706,11 @@ KviDccVoice::KviDccVoice(KviFrame *pFrm,KviDccDescriptor * dcc,const char * name //setFocusHandler(m_pIrcView,this); m_pMarshal = new KviDccMarshal(this); - connect(m_pMarshal,SIGNAL(error(int)),this,SLOT(handleMarshalError(int))); - connect(m_pMarshal,SIGNAL(connected()),this,SLOT(connected())); - connect(m_pMarshal,SIGNAL(inProgress()),this,SLOT(connectionInProgress())); + connect(m_pMarshal,TQT_SIGNAL(error(int)),this,TQT_SLOT(handleMarshalError(int))); + connect(m_pMarshal,TQT_SIGNAL(connected()),this,TQT_SLOT(connected())); + connect(m_pMarshal,TQT_SIGNAL(inProgress()),this,TQT_SLOT(connectionInProgress())); - m_pUpdateTimer = new QTimer(); + m_pUpdateTimer = new TQTimer(); startConnection(); } @@ -730,7 +725,7 @@ KviDccVoice::~KviDccVoice() m_pSlaveThread = 0; } - KviThreadManager::killPendingEvents(this); + KviThreadManager::killPendingEvents(TQT_TQOBJECT(this)); delete m_pUpdateTimer; // delete m_pDescriptor; @@ -782,7 +777,7 @@ void KviDccVoice::connectionInProgress() } } -const QString & KviDccVoice::target() +const TQString & KviDccVoice::target() { // This may change on the fly... m_szTarget.sprintf("%s@%s:%s", @@ -804,17 +799,17 @@ void KviDccVoice::fillCaptionBuffers() m_szPlainTextCaption = tmp; m_szHtmlActiveCaption.sprintf("%s", - KVI_OPTION_COLOR(KviOption_colorCaptionTextActive).name().ascii(),tmp.ptr()); + TQString(KVI_OPTION_COLOR(KviOption_colorCaptionTextActive).name()).ascii(),tmp.ptr()); m_szHtmlInactiveCaption.sprintf("%s", - KVI_OPTION_COLOR(KviOption_colorCaptionTextInactive).name().ascii(),tmp.ptr()); + TQString(KVI_OPTION_COLOR(KviOption_colorCaptionTextInactive).name()).ascii(),tmp.ptr()); } -QPixmap * KviDccVoice::myIconPtr() +TQPixmap * KviDccVoice::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_DCCVOICE); } -bool KviDccVoice::event(QEvent *e) +bool KviDccVoice::event(TQEvent *e) { if(e->type() == KVI_THREAD_EVENT) { @@ -823,7 +818,7 @@ bool KviDccVoice::event(QEvent *e) case KVI_DCC_THREAD_EVENT_ERROR: { int * err = ((KviThreadDataEvent *)e)->getData(); - QString ssss = KviError::getDescription(*err); + TQString ssss = KviError::getDescription(*err); output(KVI_OUT_DCCERROR,__tr2qs_ctx("ERROR: %Q","dcc"),&(ssss)); delete err; m_pUpdateTimer->stop(); @@ -889,24 +884,24 @@ void KviDccVoice::updateInfo() } } -void KviDccVoice::resizeEvent(QResizeEvent *e) +void KviDccVoice::resizeEvent(TQResizeEvent *e) { - int hght2 = m_pHBox->sizeHint().height(); + int hght2 = m_pHBox->tqsizeHint().height(); m_pHBox->setGeometry(0,0,width(),hght2); m_pSplitter->setGeometry(0,hght2,width(),height() - hght2); } -QSize KviDccVoice::sizeHint() const +TQSize KviDccVoice::tqsizeHint() const { - int w = m_pIrcView->sizeHint().width(); - int w2 = m_pHBox->sizeHint().width(); - QSize ret(w > w2 ? w : w2, m_pIrcView->sizeHint().height() + m_pHBox->sizeHint().height()); + int w = m_pIrcView->tqsizeHint().width(); + int w2 = m_pHBox->tqsizeHint().width(); + TQSize ret(w > w2 ? w : w2, m_pIrcView->tqsizeHint().height() + m_pHBox->tqsizeHint().height()); return ret; } void KviDccVoice::handleMarshalError(int err) { - QString ssss = KviError::getDescription(err); + TQString ssss = KviError::getDescription(err); output(KVI_OUT_DCCERROR,__tr2qs_ctx("DCC Failed: %Q","dcc"),&ssss); m_pTalkButton->setEnabled(false); m_pTalkButton->setOn(false); @@ -928,7 +923,7 @@ void KviDccVoice::connected() } updateCaption(); - connect(m_pUpdateTimer,SIGNAL(timeout()),this,SLOT(updateInfo())); + connect(m_pUpdateTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(updateInfo())); m_pUpdateTimer->start(1000); KviDccVoiceThreadOptions * opt = new KviDccVoiceThreadOptions; @@ -945,7 +940,7 @@ void KviDccVoice::connected() opt->iSampleRate = m_pDescriptor->iSampleRate; m_pSlaveThread = new KviDccVoiceThread(this,m_pMarshal->releaseSocket(),opt); - connect(m_pUpdateTimer,SIGNAL(timeout()),this,SLOT(updateInfo())); + connect(m_pUpdateTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(updateInfo())); m_pSlaveThread->start(); m_pTalkButton->setEnabled(true); @@ -1019,9 +1014,9 @@ void KviDccVoice::setMixerVolume(int vol) ::ioctl(fd, req, &val); ::close(fd); - QString s; + TQString s; s.sprintf(__tr_ctx("Volume: %i","dcc"), -vol); - QToolTip::add(m_pVolumeSlider, s); + TQToolTip::add(m_pVolumeSlider, s); #endif } @@ -1029,7 +1024,7 @@ void KviDccVoice::setMixerVolume(int vol) /* The code below doesn't work. Guess I have to catch some other widget's focusInEvent. Which one ? */ /* The point is to move the volume slider to correct position if for example user switched to * another KVirc window, fired up xmms, changed the volume, and returned to our dcc voice window */ -void KviDccVoice::focusInEvent(QFocusEvent *e) +void KviDccVoice::focusInEvent(TQFocusEvent *e) { // debug("focusInEvent()"); m_pVolumeSlider->setValue(getMixerVolume()); -- cgit v1.2.1