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/dcc/chat.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/dcc/chat.cpp')
-rw-r--r-- | src/modules/dcc/chat.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/modules/dcc/chat.cpp b/src/modules/dcc/chat.cpp index 715d17b9..09778d76 100644 --- a/src/modules/dcc/chat.cpp +++ b/src/modules/dcc/chat.cpp @@ -63,8 +63,8 @@ #include "kvi_mirccntrl.h" #endif -#include <qsplitter.h> -#include <qevent.h> +#include <tqsplitter.h> +#include <tqevent.h> #include "kvi_tal_vbox.h" @@ -89,7 +89,7 @@ extern KviDccBroker * g_pDccBroker; KviDccChat::KviDccChat(KviFrame *pFrm,KviDccDescriptor * dcc,const char * name) : KviDccWindow(KVI_WINDOW_TYPE_DCCCHAT,pFrm,name,dcc) { - m_pTopSplitter = new QSplitter(Qt::Horizontal,this,"top_splitter"); + m_pTopSplitter = new TQSplitter(Qt::Horizontal,this,"top_splitter"); KviThemedLabel * dummy; dummy = new KviThemedLabel(m_pTopSplitter,"dummy_label"); KviTalVBox * box = new KviTalVBox(m_pTopSplitter); @@ -98,9 +98,9 @@ KviDccChat::KviDccChat(KviFrame *pFrm,KviDccDescriptor * dcc,const char * name) createCryptControllerButton(box); #endif - m_pSplitter = new QSplitter(Qt::Horizontal,this,"splitter"); + m_pSplitter = new TQSplitter(Qt::Horizontal,this,"splitter"); m_pIrcView = new KviIrcView(m_pSplitter,pFrm,this); - connect(m_pIrcView,SIGNAL(rightClicked()),this,SLOT(textViewRightClicked())); + connect(m_pIrcView,TQT_SIGNAL(rightClicked()),this,TQT_SLOT(textViewRightClicked())); m_pInput = new KviInput(this); //setFocusHandler(m_pInput,this); @@ -110,12 +110,12 @@ KviDccChat::KviDccChat(KviFrame *pFrm,KviDccDescriptor * dcc,const char * name) if(KVI_OPTION_BOOL(KviOption_boolAutoLogDccChat))m_pIrcView->startLogging(); 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())); #ifdef COMPILE_SSL_SUPPORT - connect(m_pMarshal,SIGNAL(startingSSLHandshake()),this,SLOT(startingSSLHandshake())); - connect(m_pMarshal,SIGNAL(sslError(const char *)),this,SLOT(sslError(const char *))); + connect(m_pMarshal,TQT_SIGNAL(startingSSLHandshake()),this,TQT_SLOT(startingSSLHandshake())); + connect(m_pMarshal,TQT_SIGNAL(sslError(const char *)),this,TQT_SLOT(sslError(const char *))); #endif m_pSlaveThread = 0; @@ -132,7 +132,7 @@ KviDccChat::~KviDccChat() delete m_pSlaveThread; m_pSlaveThread = 0; } - KviThreadManager::killPendingEvents(this); + KviThreadManager::killPendingEvents(TQT_TQOBJECT(this)); } void KviDccChat::textViewRightClicked() @@ -215,13 +215,13 @@ void KviDccChat::connectionInProgress() } } - QString port = !m_pDescriptor->szFakePort.isEmpty() ? m_pDescriptor->szFakePort : QString(m_pMarshal->localPort()); + TQString port = !m_pDescriptor->szFakePort.isEmpty() ? m_pDescriptor->szFakePort : TQString(m_pMarshal->localPort()); //FIXME: #warning "OPTION FOR SENDING 127.0.0.1 and so on (not an unsigned number)" struct in_addr a; if(kvi_stringIpToBinaryIp(ip.ptr(),&a))ip.setNum(htonl(a.s_addr)); - QString szReq = QString("PRIVMSG %1 :%2DCC %3 chat %4 %5").arg(m_pDescriptor->szNick).arg((char)0x01).arg(m_pDescriptor->szType).arg(ip.ptr()).arg(port); + TQString szReq = TQString("PRIVMSG %1 :%2DCC %3 chat %4 %5").tqarg(m_pDescriptor->szNick).tqarg((char)0x01).tqarg(m_pDescriptor->szType).tqarg(ip.ptr()).tqarg(port); if(m_pDescriptor->isZeroPortRequest()) { @@ -250,12 +250,12 @@ void KviDccChat::startingSSLHandshake() void KviDccChat::sslError(const char * msg) { #ifdef COMPILE_SSL_SUPPORT - if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatError,this,QString(msg),m_pDescriptor->idString())) + if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatError,this,TQString(msg),m_pDescriptor->idString())) output(KVI_OUT_DCCERROR,__tr2qs_ctx("[SSL ERROR]: %s","dcc"),msg); #endif } -const QString & KviDccChat::target() +const TQString & KviDccChat::target() { // This may change on the fly... m_szTarget = m_pDescriptor->szNick; @@ -268,23 +268,23 @@ const QString & KviDccChat::target() void KviDccChat::fillCaptionBuffers() { - QString tmp = QString("DCC %1 %2@%3:%4").arg( + TQString tmp = TQString("DCC %1 %2@%3:%4").tqarg( #ifdef COMPILE_SSL_SUPPORT - m_pDescriptor->bIsSSL ? "SChat" : "Chat").arg( + m_pDescriptor->bIsSSL ? "SChat" : "Chat").tqarg( #else - "Chat").arg( + "Chat").tqarg( #endif - m_pDescriptor->szNick).arg(m_pDescriptor->szIp).arg(m_pDescriptor->szPort); + m_pDescriptor->szNick).tqarg(m_pDescriptor->szIp).tqarg(m_pDescriptor->szPort); m_szPlainTextCaption = tmp; m_szHtmlActiveCaption.sprintf("<nobr><font color=\"%s\"><b>%s</b></font></nobr>", - KVI_OPTION_COLOR(KviOption_colorCaptionTextActive).name().ascii(),tmp.utf8().data()); + TQString(KVI_OPTION_COLOR(KviOption_colorCaptionTextActive).name()).ascii(),tmp.utf8().data()); m_szHtmlInactiveCaption.sprintf("<nobr><font color=\"%s\"><b>%s</b></font></nobr>", - KVI_OPTION_COLOR(KviOption_colorCaptionTextInactive).name().ascii(),tmp.utf8().data()); + TQString(KVI_OPTION_COLOR(KviOption_colorCaptionTextInactive).name()).ascii(),tmp.utf8().data()); } -QPixmap * KviDccChat::myIconPtr() +TQPixmap * KviDccChat::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_DCCMSG); } @@ -295,7 +295,7 @@ void KviDccChat::getBaseLogFileName(KviStr &buffer) buffer.sprintf("%s_%s_%s",m_pDescriptor->szNick.utf8().data(),m_pDescriptor->szIp.utf8().data(),m_pDescriptor->szPort.utf8().data()); } -void KviDccChat::ownMessage(const QString &text) +void KviDccChat::ownMessage(const TQString &text) { if(!m_pSlaveThread) { @@ -303,7 +303,7 @@ void KviDccChat::ownMessage(const QString &text) return; } - KviQCString szData = encodeText(text); + KviTQCString szData = encodeText(text); const char * d = szData.data(); if(!d)return; @@ -331,7 +331,7 @@ void KviDccChat::ownMessage(const QString &text) { KviStr buf(KviStr::Format,"%s\r\n",encrypted.ptr()); m_pSlaveThread->sendRawData(buf.ptr(),buf.len()); - QString encr = decodeText(encrypted.ptr()); + TQString encr = decodeText(encrypted.ptr()); m_pFrm->firstConsole()->outputPrivmsg(this,KVI_OUT_OWNPRIVMSG, m_pDescriptor->szLocalNick.utf8().data(),m_pDescriptor->szLocalUser.utf8().data(), m_pDescriptor->szLocalHost.utf8().data(),encr,KviConsole::NoNotifications); @@ -339,7 +339,7 @@ void KviDccChat::ownMessage(const QString &text) break; default: // also case KviCryptEngine::EncryptError { - QString szErr = cryptSessionInfo()->pEngine->lastError(); + TQString szErr = cryptSessionInfo()->pEngine->lastError(); output(KVI_OUT_SYSTEMERROR, __tr2qs_ctx("The crypto engine was not able to encrypt the current message (%Q): %Q, no data was sent to the remote end","dcc"), &text,&szErr); @@ -350,7 +350,7 @@ void KviDccChat::ownMessage(const QString &text) } else { d++; //eat the escape code KviStr buf(KviStr::Format,"%s\r\n",d); - QString tmp = text.right(text.length() - 1); + TQString tmp = text.right(text.length() - 1); m_pSlaveThread->sendRawData(buf.ptr(),buf.len()); m_pFrm->firstConsole()->outputPrivmsg(this,KVI_OUT_OWNPRIVMSG, m_pDescriptor->szLocalNick.utf8().data(),m_pDescriptor->szLocalUser.utf8().data(), @@ -367,18 +367,18 @@ void KviDccChat::ownMessage(const QString &text) m_pDescriptor->szLocalHost.utf8().data(),text,KviConsole::NoNotifications); } -const QString & KviDccChat::localNick() +const TQString & KviDccChat::localNick() { // FIXME: This is just a complete HACK m_szLocalNick = m_pDescriptor->szLocalNick; return m_szLocalNick; } -void KviDccChat::ownAction(const QString &text) +void KviDccChat::ownAction(const TQString &text) { if(m_pSlaveThread) { - KviQCString szData = encodeText(text); + KviTQCString szData = encodeText(text); const char * d = szData.data(); if(!d)return; KviStr buf(KviStr::Format,"%cACTION %s%c\r\n",0x01,d,0x01); @@ -389,7 +389,7 @@ void KviDccChat::ownAction(const QString &text) } } -bool KviDccChat::event(QEvent *e) +bool KviDccChat::event(TQEvent *e) { if(e->type() == KVI_THREAD_EVENT) { @@ -398,7 +398,7 @@ bool KviDccChat::event(QEvent *e) case KVI_DCC_THREAD_EVENT_ERROR: { int * err = ((KviThreadDataEvent<int> *)e)->getData(); - QString szErr = KviError::getDescription(*err); + TQString szErr = KviError::getDescription(*err); if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatError,this,szErr,m_pDescriptor->idString())) output(KVI_OUT_DCCERROR,__tr2qs_ctx("ERROR: %Q","dcc"),&szErr); KVS_TRIGGER_EVENT_1(KviEvent_OnDCCChatDisconnected,this,m_pDescriptor->idString()); @@ -430,7 +430,7 @@ bool KviDccChat::event(QEvent *e) case KviCryptEngine::DecryptOkWasEncrypted: case KviCryptEngine::DecryptOkWasEncoded: case KviCryptEngine::DecryptOkWasPlainText: - if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatMessage,this,QString(decryptedStuff.ptr()),m_pDescriptor->idString())) + if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatMessage,this,TQString(decryptedStuff.ptr()),m_pDescriptor->idString())) { m_pFrm->firstConsole()->outputPrivmsg(this,KVI_OUT_DCCCHATMSG, m_pDescriptor->szNick.utf8().data(),m_pDescriptor->szUser.utf8().data(), @@ -442,7 +442,7 @@ bool KviDccChat::event(QEvent *e) default: // also case KviCryptEngine::DecryptError { - QString szErr = cinf->pEngine->lastError(); + TQString szErr = cinf->pEngine->lastError(); output(KVI_OUT_SYSTEMERROR, __tr2qs_ctx("The following message appears to be encrypted, but the crypto engine failed to decode it: %Q","dcc"), &szErr); @@ -453,7 +453,7 @@ bool KviDccChat::event(QEvent *e) } else { #endif // FIXME! - if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatMessage,this,QString(d.ptr()),m_pDescriptor->idString())) + if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatMessage,this,TQString(d.ptr()),m_pDescriptor->idString())) m_pFrm->firstConsole()->outputPrivmsg(this,KVI_OUT_DCCCHATMSG, m_pDescriptor->szNick.utf8().data(),m_pDescriptor->szUser.utf8().data(), m_pDescriptor->szHost.utf8().data(),d.ptr()); @@ -470,25 +470,25 @@ bool KviDccChat::event(QEvent *e) return KviWindow::event(e); } -void KviDccChat::resizeEvent(QResizeEvent *e) +void KviDccChat::resizeEvent(TQResizeEvent *e) { int hght = m_pInput->heightHint(); - int hght2 = m_pTopSplitter->sizeHint().height(); + int hght2 = m_pTopSplitter->tqsizeHint().height(); m_pTopSplitter->setGeometry(0,0,width(),hght2); m_pSplitter->setGeometry(0,hght2,width(),height() - (hght + hght2)); m_pInput->setGeometry(0,height() - hght,width(),hght); } -QSize KviDccChat::sizeHint() const +TQSize KviDccChat::tqsizeHint() const { - QSize ret(m_pIrcView->sizeHint().width(), - m_pIrcView->sizeHint().height() + m_pInput->heightHint()); + TQSize ret(m_pIrcView->tqsizeHint().width(), + m_pIrcView->tqsizeHint().height() + m_pInput->heightHint()); return ret; } void KviDccChat::handleMarshalError(int err) { - QString szErr = KviError::getDescription(err); + TQString szErr = KviError::getDescription(err); if(!KVS_TRIGGER_EVENT_2_HALTED(KviEvent_OnDCCChatError,this,szErr,m_pDescriptor->idString())) output(KVI_OUT_DCCERROR,__tr2qs_ctx("DCC %Q failed: %Q","dcc"),&(m_pDescriptor->szType),&szErr); } @@ -537,7 +537,7 @@ void KviDccChat::connected() KviDccChatThread::KviDccChatThread(KviWindow *wnd,kvi_socket_t fd) -: KviDccThread(wnd,fd) +: KviDccThread(TQT_TQOBJECT(wnd),fd) { m_pOutBuffers = new KviPointerList<KviDataBuffer>; m_pOutBuffers->setAutoDelete(true); @@ -714,7 +714,7 @@ bool KviDccChatThread::handleIncomingData(KviDccThreadIncomingData * data,bool b kvi_free(data->buffer); data->buffer = end = aux = 0; } - postEvent(parent(),e); + postEvent(tqparent(),e); } else aux++; // debug("PASSING CHAR %c",*aux); } @@ -732,7 +732,7 @@ bool KviDccChatThread::handleIncomingData(KviDccThreadIncomingData * data,bool b data->iLen = 0; kvi_free(data->buffer); data->buffer = 0; - postEvent(parent(),e); + postEvent(tqparent(),e); } } return true; |