diff options
Diffstat (limited to 'src/kvirc/ui/kvi_statusbar.cpp')
-rw-r--r-- | src/kvirc/ui/kvi_statusbar.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/src/kvirc/ui/kvi_statusbar.cpp b/src/kvirc/ui/kvi_statusbar.cpp index df20a225..6aad95bb 100644 --- a/src/kvirc/ui/kvi_statusbar.cpp +++ b/src/kvirc/ui/kvi_statusbar.cpp @@ -27,7 +27,7 @@ #include "kvi_statusbar.h" #include "kvi_frame.h" -#include <qlabel.h> +#include <tqlabel.h> #include "kvi_iconmanager.h" #include "kvi_window.h" @@ -41,16 +41,16 @@ #include "kvi_statusbarapplet.h" #include "kvi_dynamictooltip.h" -#include <qpainter.h> -#include <qstyle.h> -#include <qlayout.h> -#include <qtimer.h> -#include <qcursor.h> +#include <tqpainter.h> +#include <tqstyle.h> +#include <tqlayout.h> +#include <tqtimer.h> +#include <tqcursor.h> #include "kvi_tal_popupmenu.h" -#include <qpixmap.h> +#include <tqpixmap.h> #ifdef COMPILE_USE_QT4 - #include <qevent.h> + #include <tqevent.h> #endif // This class COULD be derived also from KStatusBar but in fact @@ -61,7 +61,7 @@ #include "kvi_time.h" #include "kvi_qstring.h" -#include <qfont.h> +#include <tqfont.h> /* IDEAS: @@ -73,7 +73,7 @@ KviStatusBar::KviStatusBar(KviFrame * pFrame) -: QStatusBar(pFrame) +: TQStatusBar(pFrame) { setProperty("name","statusbar"); @@ -86,7 +86,7 @@ KviStatusBar::KviStatusBar(KviFrame * pFrame) m_pClickedApplet = 0; - m_pAppletDescriptors = new KviPointerHashTable<QString,KviStatusBarAppletDescriptor>; + m_pAppletDescriptors = new KviPointerHashTable<TQString,KviStatusBarAppletDescriptor>; m_pAppletDescriptors->setAutoDelete(true); KviStatusBarClock::selfRegister(this); @@ -103,28 +103,28 @@ KviStatusBar::KviStatusBar(KviFrame * pFrame) m_pMessageTimer = 0; - m_pMessageLabel = new QLabel("<b>[x]</b> x",this,"msgstatuslabel"); + m_pMessageLabel = new TQLabel("<b>[x]</b> x",this,"msgstatuslabel"); m_pMessageLabel->setMargin(1); #ifdef COMPILE_USE_QT4 - m_pMessageLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + m_pMessageLabel->tqsetAlignment(TQt::AlignVCenter | TQt::AlignLeft); #else - m_pMessageLabel->setAlignment(SingleLine | Qt::AlignVCenter | Qt::AlignLeft); + m_pMessageLabel->tqsetAlignment(SingleLine | TQt::AlignVCenter | TQt::AlignLeft); #endif m_pMessageLabel->setMinimumWidth(350); m_iLastMinimumHeight = 0; m_bStopLayoutOnAddRemove = true; - connect(m_pFrame,SIGNAL(activeContextChanged()),this,SLOT(setPermanentMessage())); - connect(m_pFrame,SIGNAL(activeContextStateChanged()),this,SLOT(setPermanentMessage())); - connect(m_pFrame,SIGNAL(activeConnectionUserModeChanged()),this,SLOT(setPermanentMessage())); - connect(m_pFrame,SIGNAL(activeConnectionNickNameChanged()),this,SLOT(setPermanentMessage())); + connect(m_pFrame,TQT_SIGNAL(activeContextChanged()),this,TQT_SLOT(setPermanentMessage())); + connect(m_pFrame,TQT_SIGNAL(activeContextStateChanged()),this,TQT_SLOT(setPermanentMessage())); + connect(m_pFrame,TQT_SIGNAL(activeConnectionUserModeChanged()),this,TQT_SLOT(setPermanentMessage())); + connect(m_pFrame,TQT_SIGNAL(activeConnectionNickNameChanged()),this,TQT_SLOT(setPermanentMessage())); setPermanentMessage(); m_bStopLayoutOnAddRemove = false; m_pToolTip = new KviDynamicToolTip(this); - connect(m_pToolTip,SIGNAL(tipRequest(KviDynamicToolTip *,const QPoint &)),this,SLOT(tipRequest(KviDynamicToolTip *,const QPoint &))); + connect(m_pToolTip,TQT_SIGNAL(tipRequest(KviDynamicToolTip *,const TQPoint &)),this,TQT_SLOT(tipRequest(KviDynamicToolTip *,const TQPoint &))); updateLayout(); } @@ -154,11 +154,11 @@ void KviStatusBar::load() { KviStr prefix(KviStr::Format,"Applet%d",i); KviStr tmp(KviStr::Format,"%s_InternalName",prefix.ptr()); - QString szInternalName = cfg.readEntry(tmp.ptr(),""); + TQString szInternalName = cfg.readEntry(tmp.ptr(),""); if(!szInternalName.isEmpty()) { tmp.sprintf("%s_PreloadModule",prefix.ptr()); - QString szPreloadModule = cfg.readEntry(tmp.ptr(),""); + TQString szPreloadModule = cfg.readEntry(tmp.ptr(),""); if(!szPreloadModule.isEmpty()) g_pModuleManager->getModule(szPreloadModule.utf8().data()); @@ -204,13 +204,13 @@ void KviStatusBar::save() #define SPACING 3 #define RICHTEXTLABELTRICK 2 -void KviStatusBar::layoutChildren() +void KviStatusBar::tqlayoutChildren() { int x = width() - HMARGIN; int h = height() - (VMARGIN * 2); for(KviStatusBarApplet * a = m_pAppletList->last();a;a = m_pAppletList->prev()) { - int w = a->sizeHint().width(); + int w = a->tqsizeHint().width(); x -= w; a->setGeometry(x,VMARGIN,w,h); x -= SPACING; @@ -219,29 +219,29 @@ void KviStatusBar::layoutChildren() m_pMessageLabel->setGeometry(HMARGIN,VMARGIN,x - HMARGIN,h - RICHTEXTLABELTRICK); } -void KviStatusBar::resizeEvent(QResizeEvent * e) +void KviStatusBar::resizeEvent(TQResizeEvent * e) { - layoutChildren(); + tqlayoutChildren(); } -bool KviStatusBar::event(QEvent * e) +bool KviStatusBar::event(TQEvent * e) { - if(e->type() == QEvent::LayoutHint) + if(e->type() == TQEvent::LayoutHint) { updateLayout(); - return false; // send to parents too! + return false; // send to tqparents too! } - return QStatusBar::event(e); + return TQStatusBar::event(e); } void KviStatusBar::recalcMinimumHeight() { int s = 18; - int h = m_pMessageLabel->sizeHint().height(); + int h = m_pMessageLabel->tqsizeHint().height(); if(h > s)s = h; for(KviStatusBarApplet * a = m_pAppletList->last();a;a = m_pAppletList->prev()) { - h = a->sizeHint().height(); + h = a->tqsizeHint().height(); if(h > s)s = h; } s += (VMARGIN * 2) + RICHTEXTLABELTRICK; @@ -249,22 +249,22 @@ void KviStatusBar::recalcMinimumHeight() { m_iLastMinimumHeight = s; setMinimumHeight(s); - QLayout * l = layout(); + TQLayout * l = tqlayout(); if(l) - if(l->inherits("QBoxLayout")) - ((QBoxLayout *)l)->addStrut(s); - // FIXME: do QMainWindow need setUpLayout() here ? + if(l->inherits(TQBOXLAYOUT_OBJECT_NAME_STRING)) + ((TQBoxLayout *)l)->addStrut(s); + // FIXME: do TQMainWindow need setUpLayout() here ? } } bool KviStatusBar::appletExists(KviStatusBarApplet * pApplet) { - return (m_pAppletList->findRef(pApplet) != -1); + return (m_pAppletList->tqfindRef(pApplet) != -1); } -KviStatusBarApplet * KviStatusBar::appletAt(const QPoint &pnt,bool bBestMatch) +KviStatusBarApplet * KviStatusBar::appletAt(const TQPoint &pnt,bool bBestMatch) { - QPoint local = mapFromGlobal(pnt); + TQPoint local = mapFromGlobal(pnt); if(bBestMatch) { for(KviStatusBarApplet * a = m_pAppletList->first();a;a = m_pAppletList->next()) @@ -287,16 +287,16 @@ KviStatusBarApplet * KviStatusBar::appletAt(const QPoint &pnt,bool bBestMatch) return 0; } -void KviStatusBar::tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt) +void KviStatusBar::tipRequest(KviDynamicToolTip *pTip,const TQPoint &pnt) { KviStatusBarApplet * a = appletAt(mapToGlobal(pnt)); - QString szTip; - QRect r; + TQString szTip; + TQRect r; if(a) { szTip = "<table width=\"100%\"><tr><td bgcolor=\"#303030\" align=\"center\"><font color=\"#ffffff\"><b>" + a->descriptor()->visibleName() + "</b></font></td></tr>"; - QString szTipx = a->tipText(a->mapFromGlobal(mapToGlobal(pnt))); + TQString szTipx = a->tipText(a->mapFromGlobal(mapToGlobal(pnt))); if(!szTipx.isEmpty()) { szTip += "<tr><td>"; @@ -307,12 +307,12 @@ void KviStatusBar::tipRequest(KviDynamicToolTip *pTip,const QPoint &pnt) szTip += "<tr><td align=\"center\"><font color=\"#808080\" size=\"-1\">"; szTip += __tr2qs("<b>Shift+Drag</b> or <b>Ctrl+Drag</b> to move the applet around<br><b>Right click</b> to see the other options"); szTip += "</font></td></tr></table>"; - r = QRect(a->x(),a->y(),a->width(),a->height()); + r = TQRect(a->x(),a->y(),a->width(),a->height()); } else { szTip = "<center>"; szTip += __tr2qs("<b>Right click</b> to add/remove applets"); szTip += "</center>"; - r = QRect(m_pMessageLabel->x(),m_pMessageLabel->y(),m_pMessageLabel->width(),m_pMessageLabel->height()); + r = TQRect(m_pMessageLabel->x(),m_pMessageLabel->y(),m_pMessageLabel->width(),m_pMessageLabel->height()); } pTip->tip(r,szTip); } @@ -322,9 +322,9 @@ KviTalPopupMenu * KviStatusBar::contextPopup() if(!m_pContextPopup) { m_pContextPopup = new KviTalPopupMenu(this); - connect(m_pContextPopup,SIGNAL(aboutToShow()),this,SLOT(contextPopupAboutToShow())); + connect(m_pContextPopup,TQT_SIGNAL(aboutToShow()),this,TQT_SLOT(contextPopupAboutToShow())); } - m_pClickedApplet = appletAt(QCursor::pos()); + m_pClickedApplet = appletAt(TQCursor::pos()); return m_pContextPopup; } @@ -336,30 +336,30 @@ void KviStatusBar::contextPopupAboutToShow() if(appletExists(m_pClickedApplet)) { - QString app = m_pClickedApplet->descriptor()->visibleName(); + TQString app = m_pClickedApplet->descriptor()->visibleName(); - QString tmp; - KviQString::sprintf(tmp,"<center><b>%Q</b></center>",&app); + TQString tmp; + KviTQString::sprintf(tmp,"<center><b>%Q</b></center>",&app); #ifndef COMPILE_USE_QT4 - // FIXME: This is not supported under Qt4.. :( - QLabel * l = new QLabel(tmp,m_pContextPopup); - l->setFrameStyle(QFrame::Raised | QFrame::StyledPanel); + // FIXME: This is not supported under TQt4.. :( + TQLabel * l = new TQLabel(tmp,m_pContextPopup); + l->setFrameStyle(TQFrame::Raised | TQFrame::StyledPanel); m_pContextPopup->insertItem(l); #endif m_pClickedApplet->fillContextPopup(m_pContextPopup); - KviQString::sprintf(tmp,__tr2qs("Remove %Q"),&app); + KviTQString::sprintf(tmp,__tr2qs("Remove %Q"),&app); m_pContextPopup->insertSeparator(); - m_pContextPopup->insertItem(tmp,this,SLOT(removeClickedApplet())); + m_pContextPopup->insertItem(tmp,this,TQT_SLOT(removeClickedApplet())); } if(!m_pAppletsPopup) { m_pAppletsPopup = new KviTalPopupMenu(this); - connect(m_pAppletsPopup,SIGNAL(aboutToShow()),this,SLOT(appletsPopupAboutToShow())); - connect(m_pAppletsPopup,SIGNAL(activated(int)),this,SLOT(appletsPopupActivated(int))); + connect(m_pAppletsPopup,TQT_SIGNAL(aboutToShow()),this,TQT_SLOT(appletsPopupAboutToShow())); + connect(m_pAppletsPopup,TQT_SIGNAL(activated(int)),this,TQT_SLOT(appletsPopupActivated(int))); } m_pContextPopup->insertItem(__tr2qs("Add Applet"),m_pAppletsPopup); @@ -380,11 +380,11 @@ void KviStatusBar::appletsPopupAboutToShow() // FIXME: could we cache the module results in some way ? g_pModuleManager->loadModulesByCaps("statusbarapplet"); - KviPointerHashTableIterator<QString,KviStatusBarAppletDescriptor> it(*m_pAppletDescriptors); + KviPointerHashTableIterator<TQString,KviStatusBarAppletDescriptor> it(*m_pAppletDescriptors); while(KviStatusBarAppletDescriptor * d = it.current()) { int id; - QPixmap * pix = d->icon(); + TQPixmap * pix = d->icon(); if(pix)id = m_pAppletsPopup->insertItem(*pix,d->visibleName()); else id = m_pAppletsPopup->insertItem(d->visibleName()); m_pAppletsPopup->setItemParameter(id,d->id()); @@ -392,9 +392,9 @@ void KviStatusBar::appletsPopupAboutToShow() } } -KviStatusBarApplet * KviStatusBar::createApplet(const QString &szInternalName) +KviStatusBarApplet * KviStatusBar::createApplet(const TQString &szInternalName) { - KviStatusBarAppletDescriptor * d = m_pAppletDescriptors->find(szInternalName); + KviStatusBarAppletDescriptor * d = m_pAppletDescriptors->tqfind(szInternalName); if(!d)return 0; return d->create(this); } @@ -412,14 +412,14 @@ void KviStatusBar::appletsPopupActivated(int id) if(!m_pAppletsPopup)return; int par = m_pAppletsPopup->itemParameter(id); - KviPointerHashTableIterator<QString,KviStatusBarAppletDescriptor> it(*m_pAppletDescriptors); + KviPointerHashTableIterator<TQString,KviStatusBarAppletDescriptor> it(*m_pAppletDescriptors); while(KviStatusBarAppletDescriptor * d = it.current()) { if(par == d->id()) { if(m_pClickedApplet) { - int idx = m_pAppletList->findRef(m_pClickedApplet); + int idx = m_pAppletList->tqfindRef(m_pClickedApplet); if(idx != -1) { // try to put the new applet just after the clicked one @@ -444,7 +444,7 @@ void KviStatusBar::appletsPopupActivated(int id) void KviStatusBar::registerAppletDescriptor(KviStatusBarAppletDescriptor * d) { - m_pAppletDescriptors->replace(d->internalName(),d); + m_pAppletDescriptors->tqreplace(d->internalName(),d); } void KviStatusBar::registerApplet(KviStatusBarApplet * a) @@ -463,42 +463,42 @@ void KviStatusBar::unregisterApplet(KviStatusBarApplet * a) } -void KviStatusBar::paintEvent(QPaintEvent * e) +void KviStatusBar::paintEvent(TQPaintEvent * e) { - // avoid the ugly rectangle around the widgets painted by QStatusBar -// QPainter p(this); -// style().drawPrimitive(QStyle::PE_Panel,&p,rect(),colorGroup(),QStyle::Style_Raised,QStyleOption(1,1)); - //QStatusBar::paintEvent(e); - //qDrawWinPanel(&p,0,0,width(),height(),colorGroup(),false,0); + // avoid the ugly rectangle around the widgets painted by TQStatusBar +// TQPainter p(this); +// style().drawPrimitive(TQStyle::PE_Panel,&p,rect(),tqcolorGroup(),TQStyle::Style_Raised,TQStyleOption(1,1)); + //TQStatusBar::paintEvent(e); + //qDrawWinPanel(&p,0,0,width(),height(),tqcolorGroup(),false,0); } -void KviStatusBar::mousePressEvent(QMouseEvent * e) +void KviStatusBar::mousePressEvent(TQMouseEvent * e) { m_pClickedApplet = 0; if(e->button() & Qt::RightButton) { - contextPopup()->popup(QCursor::pos()); + contextPopup()->popup(TQCursor::pos()); return; } - if((e->button() & Qt::LeftButton) && (e->state() & (Qt::ShiftButton | Qt::ControlButton))) + if((e->button() & Qt::LeftButton) && (e->state() & (TQt::ShiftButton | TQt::ControlButton))) { // move! m_pClickedApplet = appletAt(mapToGlobal(e->pos())); if(!m_pClickedApplet)return; m_pClickedApplet->select(); #ifdef COMPILE_USE_QT4 - g_pApp->setOverrideCursor(Qt::SizeAllCursor); + g_pApp->setOverrideCursor(TQt::SizeAllCursor); #else g_pApp->setOverrideCursor(sizeAllCursor); #endif } } -void KviStatusBar::mouseMoveEvent(QMouseEvent * e) +void KviStatusBar::mouseMoveEvent(TQMouseEvent * e) { if(!m_pClickedApplet)return; if(!appletExists(m_pClickedApplet))return; - QPoint g = mapToGlobal(e->pos()); + TQPoint g = mapToGlobal(e->pos()); KviStatusBarApplet * a = appletAt(g,true); if(a == m_pClickedApplet)return; // move! @@ -518,17 +518,17 @@ void KviStatusBar::mouseMoveEvent(QMouseEvent * e) } m_pAppletList->removeRef(m_pClickedApplet); - int idx = m_pAppletList->findRef(a); + int idx = m_pAppletList->tqfindRef(a); if(idx == -1)m_pAppletList->append(m_pClickedApplet); // uhg ? else { - QPoint p = a->mapFromGlobal(g); + TQPoint p = a->mapFromGlobal(g); if(p.x() > (a->width() / 2))idx++; // just after m_pAppletList->insert(idx,m_pClickedApplet); } - layoutChildren(); + tqlayoutChildren(); } -void KviStatusBar::mouseReleaseEvent(QMouseEvent * e) +void KviStatusBar::mouseReleaseEvent(TQMouseEvent * e) { if(e->button() & Qt::LeftButton) { @@ -585,8 +585,8 @@ void KviStatusBar::showFirstMessageInQueue() if(!m_pMessageTimer) { - m_pMessageTimer = new QTimer(this); - QObject::connect(m_pMessageTimer,SIGNAL(timeout()),this,SLOT(messageTimerFired())); + m_pMessageTimer = new TQTimer(this); + TQObject::connect(m_pMessageTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(messageTimerFired())); } else { m_pMessageTimer->stop(); } @@ -602,7 +602,7 @@ void KviStatusBar::setPermanentMessage() KviIrcContext * c = m_pFrame->activeContext(); - QString txt = "<nobr>"; + TQString txt = "<nobr>"; if(c) { |