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/notifier/notifierwindow.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/notifier/notifierwindow.cpp')
-rw-r--r-- | src/modules/notifier/notifierwindow.cpp | 350 |
1 files changed, 175 insertions, 175 deletions
diff --git a/src/modules/notifier/notifierwindow.cpp b/src/modules/notifier/notifierwindow.cpp index d275be23..91583241 100644 --- a/src/modules/notifier/notifierwindow.cpp +++ b/src/modules/notifier/notifierwindow.cpp @@ -24,17 +24,17 @@ #include "kvi_settings.h" #ifdef COMPILE_USE_QT4 - #define QPopupMenu Q3PopupMenu - #define QSimpleRichText Q3SimpleRichText + #define TQPopupMenu Q3PopupMenu + #define TQSimpleRichText Q3SimpleRichText - #include <q3popupmenu.h> - #include <q3simplerichtext.h> + #include <tq3popupmenu.h> + #include <tq3simplerichtext.h> #else - #include <qpopupmenu.h> - #include <qsimplerichtext.h> + #include <tqpopupmenu.h> + #include <tqsimplerichtext.h> #endif - #include <qpainter.h> + #include <tqpainter.h> #include "notifiermessage.h" #include "notifierwindow.h" @@ -50,14 +50,14 @@ #include "kvi_options.h" #include "kvi_userinput.h" -#include <qapplication.h> -#include <qimage.h> -#include <qdesktopwidget.h> -#include <qtooltip.h> -#include <qevent.h> -#include <qpen.h> -#include <qfontmetrics.h> -#include <qregexp.h> +#include <tqapplication.h> +#include <tqimage.h> +#include <tqdesktopwidget.h> +#include <tqtooltip.h> +#include <tqevent.h> +#include <tqpen.h> +#include <tqfontmetrics.h> +#include <tqregexp.h> #include "notifierwindowbody.h" #include "notifierwindowborder.h" @@ -67,20 +67,20 @@ extern KviNotifierWindow * g_pNotifierWindow; KviNotifierWindow::KviNotifierWindow() -: QWidget(0,"kvirc_notifier_window", +: TQWidget(0,"kvirc_notifier_window", #ifdef COMPILE_ON_WINDOWS - Qt::WStyle_Customize | - Qt::WStyle_NoBorder | - Qt::WStyle_Tool | - Qt::WStyle_StaysOnTop) + TQt::WStyle_Customize | + TQt::WStyle_NoBorder | + TQt::WStyle_Tool | + TQt::WStyle_StaysOnTop) #else - Qt::WStyle_Customize | - Qt::WStyle_NoBorder | + TQt::WStyle_Customize | + TQt::WStyle_NoBorder | #ifndef Q_OS_MACX - Qt::WStyle_Tool | - Qt::WX11BypassWM | + TQt::WStyle_Tool | + TQt::WX11BypassWM | #endif - Qt::WStyle_StaysOnTop) + TQt::WStyle_StaysOnTop) #endif { @@ -106,19 +106,19 @@ KviNotifierWindow::KviNotifierWindow() cfg.setGroup("NotifierSkin"); - QString szFamily = cfg.readEntry("TextFontFamily","Arial"); - m_pDefaultFont = new QFont(szFamily,cfg.readIntEntry("TextFontSize",9)); + TQString szFamily = cfg.readEntry("TextFontFamily","Arial"); + m_pDefaultFont = new TQFont(szFamily,cfg.readIntEntry("TextFontSize",9)); szFamily = cfg.readEntry("TitleFontFamily","Arial"); - m_pTitleFont = new QFont(szFamily,cfg.readIntEntry("TitleFontSize",9)); + m_pTitleFont = new TQFont(szFamily,cfg.readIntEntry("TitleFontSize",9)); - m_clrCurText = cfg.readColorEntry("CurTextColor",QColor(40,0,0)); - m_clrHistoricText = cfg.readColorEntry("HistoricTextColor",QColor(125,125,125)); - m_clrTitle = QColor(255,255,255); //cfg.readColorEntry("TitleColor",QColor(0,0,0)); + m_clrCurText = cfg.readColorEntry("CurTextColor",TQColor(40,0,0)); + m_clrHistoricText = cfg.readColorEntry("HistoricTextColor",TQColor(125,125,125)); + m_clrTitle = TQColor(255,255,255); //cfg.readColorEntry("TitleColor",TQColor(0,0,0)); for(int i=0;i<NUM_OLD_COLORS;i++) { KviStr szKey; szKey.sprintf("OldTextColor%d",i + 1); - m_clrOldText[i] = cfg.readColorEntry(szKey.ptr(),QColor(90,90,90)); + m_clrOldText[i] = cfg.readColorEntry(szKey.ptr(),TQColor(90,90,90)); } m_iBlinkTimeout = cfg.readIntEntry("BlinkTimeout",650); @@ -126,24 +126,24 @@ KviNotifierWindow::KviNotifierWindow() m_iInputHeight = cfg.readIntEntry("InputHeight",20); if(m_iInputHeight < 10)m_iInputHeight = 10; - setBackgroundMode(Qt::NoBackground); + setBackgroundMode(TQt::NoBackground); #ifdef COMPILE_USE_QT4 - setFocusPolicy(Qt::NoFocus); + setFocusPolicy(TTQ_NoFocus); #else - setFocusPolicy(QWidget::NoFocus); + setFocusPolicy(TQ_NoFocus); #endif setMouseTracking(true); //setCursor(m_cursor); hide(); - m_pLineEdit = new QLineEdit(this); + m_pLineEdit = new TQLineEdit(this); m_pLineEdit->setGeometry(0,0,0,0); m_pLineEdit->hide(); m_pLineEdit->installEventFilter(this); - connect(m_pLineEdit,SIGNAL(returnPressed()),this,SLOT(returnPressed())); + connect(m_pLineEdit,TQT_SIGNAL(returnPressed()),this,TQT_SLOT(returnPressed())); szFamily = cfg.readEntry("InputFontFamily","Arial"); - m_pLineEdit->setFont(QFont(szFamily,cfg.readIntEntry("InputFontSize",9))); + m_pLineEdit->setFont(TQFont(szFamily,cfg.readIntEntry("InputFontSize",9))); m_bBlinkOn = false; @@ -168,8 +168,8 @@ KviNotifierWindow::KviNotifierWindow() // Positioning the notifier bottom-right int iWidth = m_pixBackground.width(); int iHeight = m_pixBackground.height(); - QDesktopWidget * w = QApplication::desktop(); - QRect r = w->availableGeometry(w->primaryScreen()); //w->screenGeometry(w->primaryScreen()); + TQDesktopWidget * w = TQApplication::desktop(); + TQRect r = w->availableGeometry(w->primaryScreen()); //w->screenGeometry(w->primaryScreen()); /*debug("r.x(),r.y(): %d,%d",r.x(),r.y()); debug("r.width(),r.height(): %d,%d",r.width(),r.height());*/ @@ -183,10 +183,10 @@ KviNotifierWindow::KviNotifierWindow() m_pProgressBar = new KviNotifierWindowProgressBar(m_pWndBorder->progressRect()); // FIXME: Ugly global-font initialization.. - QFontMetrics titleFontMetrics(*m_pTitleFont); + TQFontMetrics titleFontMetrics(*m_pTitleFont); m_pWndBorder->centerTitle(titleFontMetrics.height()); - connect(g_pApp,SIGNAL(reloadImages()),this,SLOT(reloadImages())); + connect(g_pApp,TQT_SIGNAL(reloadImages()),this,TQT_SLOT(reloadImages())); } KviNotifierWindow::~KviNotifierWindow() @@ -216,15 +216,15 @@ void KviNotifierWindow::reloadImages() } -void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime) +void KviNotifierWindow::addMessage(KviWindow * pWnd,const TQString &szImageId,const TQString &szText,unsigned int uMessageTime) { - QPixmap * pIcon; - QString szMessage=szText; - szMessage.replace( QRegExp("\r([^\r])*\r([^\r])+\r"), "\\2" ); + TQPixmap * pIcon; + TQString szMessage=szText; + szMessage.tqreplace( TQRegExp("\r([^\r])*\r([^\r])+\r"), "\\2" ); if(szImageId.isEmpty())pIcon = 0; else pIcon = g_pIconManager->getImage(szImageId); - KviNotifierMessage * m = new KviNotifierMessage(this,pIcon ? new QPixmap(*pIcon) : 0,szMessage); + KviNotifierMessage * m = new KviNotifierMessage(this,pIcon ? new TQPixmap(*pIcon) : 0,szMessage); m_pWndTabs->addMessage(pWnd, m); // Adds a tab about the sender pWnd @@ -289,7 +289,7 @@ void KviNotifierWindow::computeRect() { int iWidth = m_pixBackground.width(); int iHeight = m_pixBackground.height(); - m_pWndBorder->setGeometry(QPoint(x(),y()), QSize(iWidth,iHeight)); + m_pWndBorder->setGeometry(TQPoint(x(),y()), TQSize(iWidth,iHeight)); update(); } @@ -326,21 +326,21 @@ void KviNotifierWindow::doShow(bool bDoAnimate) m_bWriteDown = false; m_bBlinkOn = false; #if (!defined COMPILE_USE_QT4) || !(defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX))) - m_imgDesktop = QPixmap::grabWindow( - QApplication::desktop()->winId(), + m_imgDesktop = TQPixmap(TQPixmap::grabWindow( + TQApplication::desktop()->winId(), m_wndRect.x(), m_wndRect.y(), m_wndRect.width(), - m_wndRect.height()).convertToImage(); + m_wndRect.height())).convertToImage(); #endif - // QPixmap tmp = QPixmap::grabWindow( QApplication::desktop()->winId(),m_wndRect.x(), m_wndRect.y(), m_wndRect.width(), m_wndRect.height()); + // TQPixmap tmp = TQPixmap::grabWindow( TQApplication::desktop()->winId(),m_wndRect.x(), m_wndRect.y(), m_wndRect.width(), m_wndRect.height()); // tmp.save("/root/pix.png","PNG"); m_pixForeground.resize(m_pixBackground.size()); m_imgBuffer.create(m_pixBackground.width(),m_pixBackground.height(),32); if(bDoAnimate) { - m_pShowHideTimer = new QTimer(); - connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); + m_pShowHideTimer = new TQTimer(); + connect(m_pShowHideTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(heartbeat())); m_dOpacity = OPACITY_STEP; m_eState = Showing; m_bCrashShowWorkAround=true; @@ -526,8 +526,8 @@ void KviNotifierWindow::doHide(bool bDoAnimate) hideNow(); } else { //debug ("starting hide animation notifier x() %d and notifier y() % - WBorderx() %d and WBordery() %d and bDoanimate %d",x(),y(),m_pWndBorder->x(),m_pWndBorder->y(),bDoAnimate); - m_pShowHideTimer = new QTimer(); - connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); + m_pShowHideTimer = new TQTimer(); + connect(m_pShowHideTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(heartbeat())); m_dOpacity = 1.0 - OPACITY_STEP; m_eState = Hiding; #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) @@ -545,14 +545,14 @@ void KviNotifierWindow::doHide(bool bDoAnimate) } } -void KviNotifierWindow::showEvent(QShowEvent *e) +void KviNotifierWindow::showEvent(TQShowEvent *e) { computeRect(); setGeometry(m_wndRect); // w_win = w_wndRect } -void KviNotifierWindow::hideEvent(QHideEvent * e) +void KviNotifierWindow::hideEvent(TQHideEvent * e) { if (m_bCrashShowWorkAround) return; stopBlinkTimer(); @@ -572,8 +572,8 @@ void KviNotifierWindow::startBlinking() if(!KVI_OPTION_BOOL(KviOption_boolDisableNotifierFlashing)) { - m_pBlinkTimer = new QTimer(); - connect(m_pBlinkTimer,SIGNAL(timeout()),this,SLOT(blink())); + m_pBlinkTimer = new TQTimer(); + connect(m_pBlinkTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(blink())); m_iBlinkCount = 0; m_pBlinkTimer->start(m_iBlinkTimeout); } @@ -588,12 +588,12 @@ void KviNotifierWindow::startAutoHideTimer() int nSecs = m_tAutoHideAt - m_tStartedAt; if(nSecs < 5)nSecs = 5; - m_pAutoHideTimer = new QTimer(); - connect(m_pAutoHideTimer,SIGNAL(timeout()),this,SLOT(autoHide())); + m_pAutoHideTimer = new TQTimer(); + connect(m_pAutoHideTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(autoHide())); m_pAutoHideTimer->start(nSecs * 1000); - m_pProgressTimer= new QTimer(); - connect(m_pProgressTimer,SIGNAL(timeout()),this,SLOT(progressUpdate())); + m_pProgressTimer= new TQTimer(); + connect(m_pProgressTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(progressUpdate())); m_pProgressTimer->start(60); } @@ -633,23 +633,23 @@ void KviNotifierWindow::markAllMessagesAsHistoric() } -static void blend_images(QImage &buffer,QImage &background,QImage &foreground,double dValue) +static void blend_images(TQImage &buffer,TQImage &background,TQImage &foreground,double dValue) { for(int y = 0;y < buffer.height();y++) { - QRgb * dst = (QRgb *)buffer.scanLine(y); - QRgb * end = dst + buffer.width(); - QRgb * bkg = (QRgb *)background.scanLine(y); - QRgb * fgn = (QRgb *)foreground.scanLine(y); + TQRgb * dst = (TQRgb *)buffer.scanLine(y); + TQRgb * end = dst + buffer.width(); + TQRgb * bkg = (TQRgb *)background.scanLine(y); + TQRgb * fgn = (TQRgb *)foreground.scanLine(y); double dRemaining = 1.0 - dValue; while(dst < end) { - *dst = qRgb( - (int)((qRed(*bkg) * dRemaining) + (qRed(*fgn) * dValue)), - (int)((qGreen(*bkg) * dRemaining) + (qGreen(*fgn) * dValue)), - (int)((qBlue(*bkg) * dRemaining) + (qBlue(*fgn) * dValue)) + *dst = tqRgb( + (int)((tqRed(*bkg) * dRemaining) + (tqRed(*fgn) * dValue)), + (int)((tqGreen(*bkg) * dRemaining) + (tqGreen(*fgn) * dValue)), + (int)((tqBlue(*bkg) * dRemaining) + (tqBlue(*fgn) * dValue)) ); dst++; bkg++; @@ -659,44 +659,44 @@ static void blend_images(QImage &buffer,QImage &background,QImage &foreground,do } } -void KviNotifierWindow::paintEvent(QPaintEvent * e) +void KviNotifierWindow::paintEvent(TQPaintEvent * e) { /* if(m_bBlinkOn) - bitBlt(&m_pixForeground,QPoint(0,0),&m_pixBackgroundHighlighted); + bitBlt(&m_pixForeground,TQPoint(0,0),&m_pixBackgroundHighlighted); else - bitBlt(&m_pixForeground,QPoint(0,0),&m_pixBackground); + bitBlt(&m_pixForeground,TQPoint(0,0),&m_pixBackground); - QPainter p(&m_pixForeground); + TQPainter p(&m_pixForeground); */ redrawWindow(); redrawText(); if(m_dOpacity < 1.0) { - QPainter px(this); + TQPainter px(this); #if defined(COMPILE_USE_QT4) && (defined(COMPILE_ON_WINDOWS) || defined(Q_OS_MACX)) px.drawPixmap(0,0,m_pixForeground); #else - QImage temp_image = m_pixForeground.convertToImage(); + TQImage temp_image = m_pixForeground.convertToImage(); blend_images(m_imgBuffer,m_imgDesktop,temp_image,m_dOpacity); px.drawImage(0,0,m_imgBuffer); #endif px.end(); } else { #ifdef COMPILE_USE_QT4 - QPainter px(this); + TQPainter px(this); px.drawPixmap(0,0,m_pixForeground); #else - bitBlt(this,QPoint(0,0),&m_pixForeground); + bitBlt(this,TQPoint(0,0),&m_pixForeground); #endif } } void KviNotifierWindow::redrawText() { - QPainter p(&m_pixForeground); + TQPainter p(&m_pixForeground); // the current tab KviNotifierWindowTab * tab = m_pWndTabs->currentTab(); @@ -715,19 +715,19 @@ void KviNotifierWindow::redrawText() KviNotifierMessage * last = l->last(); // make sure that we can loop - int iIdx = l->findRef(cur); + int iIdx = l->tqfindRef(cur); if(iIdx == -1) { tab->setCurrentMessage(last); cur = last; - iIdx = l->findRef(cur); + iIdx = l->tqfindRef(cur); } int y = m_pWndBody->textRect().y() + m_pWndBody->textRect().height(); if(m_pLineEdit->isVisible())y -= (m_pLineEdit->height() + 4); - QColorGroup grp = colorGroup(); + TQColorGroup grp = tqcolorGroup(); int idx = iIdx; KviNotifierMessage * m = cur; @@ -738,19 +738,19 @@ void KviNotifierWindow::redrawText() y -= iHeight; if(m->historic()) { - grp.setColor(QColorGroup::Text,m_clrHistoricText); + grp.setColor(TQColorGroup::Text,m_clrHistoricText); } else { if(m == last) - grp.setColor(QColorGroup::Text,m_clrCurText); + grp.setColor(TQColorGroup::Text,m_clrCurText); else { int iClrIdx = l->count() - (idx + 2); if(iClrIdx < 0)iClrIdx = 0; else if(iClrIdx >= NUM_OLD_COLORS)iClrIdx = (NUM_OLD_COLORS - 1); - grp.setColor(QColorGroup::Text,m_clrOldText[iClrIdx]); + grp.setColor(TQColorGroup::Text,m_clrOldText[iClrIdx]); } } int iMaxY = y > m_pWndBody->textRect().y() ? y : m_pWndBody->textRect().y(); - QRect clip(m_pWndBody->textRect().x() + 20,iMaxY,m_pWndBody->textRect().width() - 20,iHeight); + TQRect clip(m_pWndBody->textRect().x() + 20,iMaxY,m_pWndBody->textRect().width() - 20,iHeight); m->text()->draw(&p,m_pWndBody->textRect().x() + 20,y,clip,grp); // if(y > m_pWndBody->textRect().y()) @@ -762,21 +762,21 @@ void KviNotifierWindow::redrawText() idx--; } - p.setPen(QPen(m_clrTitle)); + p.setPen(TQPen(m_clrTitle)); p.setFont(*m_pTitleFont); - QString title; - KviQString::sprintf(title,"[%d/%d]",iIdx + 1,l->count()); + TQString title; + KviTQString::sprintf(title,"[%d/%d]",iIdx + 1,l->count()); if(tab->window()) { title += " "; title += tab->window()->plainTextCaption(); } - p.drawText(m_pWndBorder->titleRect(),Qt::AlignLeft | Qt::SingleLine,title); + p.drawText(m_pWndBorder->titleRect(),TQt::AlignLeft | TQt::SingleLine,title); p.end(); } -void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e) +void KviNotifierWindow::mouseMoveEvent(TQMouseEvent * e) { //debug ("move on x,y: %d,%d", e->pos().x(), e->pos().y()); @@ -786,8 +786,8 @@ void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e) if(checkResizing(e->pos())) goto sartelo; /* ### MOUSE-MOVE-EVENT -> m_pWndBorder ### */ - if (m_pWndBorder->captionRect().contains(e->pos())) { - if (m_pWndBorder->closeRect().contains(e->pos())) { + if (m_pWndBorder->captionRect().tqcontains(e->pos())) { + if (m_pWndBorder->closeRect().tqcontains(e->pos())) { m_pWndBorder->setCloseIcon(WDG_ICON_OVER); } else { m_pWndBorder->setCloseIcon(WDG_ICON_OUT); @@ -798,14 +798,14 @@ void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e) if(m_pWndTabs->currentTab()) { /* ### MOUSE-MOVE-EVENT -> m_pWndTabs ### */ - if (m_pWndTabs->rect().contains(e->pos())) { + if (m_pWndTabs->rect().tqcontains(e->pos())) { m_pWndTabs->mouseMoveEvent(e); goto sartelo; } /* ### MOUSE-MOVE-EVENT -> m_pWndBody ### */ - if (m_pWndBody->rect().contains(e->pos())) { - if (m_pWndBody->rctWriteIcon().contains(e->pos())) { + if (m_pWndBody->rect().tqcontains(e->pos())) { + if (m_pWndBody->rctWriteIcon().tqcontains(e->pos())) { m_pWndBody->setWriteIcon(WDG_ICON_ON); } else { m_pWndBody->setWriteIcon(WDG_ICON_OFF); @@ -822,7 +822,7 @@ sartelo: } if(m_bDragging) { - setCursor(Qt::SizeAllCursor); + setCursor(TQt::SizeAllCursor); int w = m_wndRect.width(); int h = m_wndRect.height(); @@ -842,7 +842,7 @@ sartelo: } -void KviNotifierWindow::mousePressEvent(QMouseEvent * e) +void KviNotifierWindow::mousePressEvent(TQMouseEvent * e) { // stop blinking first of all :) @@ -867,15 +867,15 @@ void KviNotifierWindow::mousePressEvent(QMouseEvent * e) if(checkResizing(m_pntClick)) goto sartelo; - if(m_pWndTabs->rect().contains(e->pos())) + if(m_pWndTabs->rect().tqcontains(e->pos())) { m_pWndTabs->mousePressEvent(e); goto sartelo; } - if(m_pWndBorder->captionRect().contains(e->pos())) { + if(m_pWndBorder->captionRect().tqcontains(e->pos())) { //debug ("Clicked on m_pWndBorder->rect()"); - if(m_pWndBorder->closeRect().contains(e->pos())) { + if(m_pWndBorder->closeRect().tqcontains(e->pos())) { //debug ("\tClicked on m_pWndBorder->closeRect()"); m_bCloseDown = true; m_pWndBorder->setCloseIcon(WDG_ICON_CLICKED); @@ -892,24 +892,24 @@ void KviNotifierWindow::mousePressEvent(QMouseEvent * e) //debug ("x,y: %d,%d - width,height: %d,%d", m_pWndBorder->rect().x(),m_pWndBorder->rect().y(),m_pWndBorder->rect().width(),m_pWndBorder->rect().height()); - if (m_pWndBorder->rect().contains(e->pos())) { + if (m_pWndBorder->rect().tqcontains(e->pos())) { if(m_pWndTabs->currentTab()) { //debug ("Clicked on m_pWndBody->textRect()"); - if(m_pWndBody->rctWriteIcon().contains(e->pos())) + if(m_pWndBody->rctWriteIcon().tqcontains(e->pos())) { m_pWndBody->setWriteIcon(WDG_ICON_CLICKED); showLineEdit(!(m_pLineEdit->isVisible())); } - if(m_pWndBody->rctPrevIcon().contains(e->pos()) && m_pWndBody->prevIconState()!=WDG_ICON_OFF) + if(m_pWndBody->rctPrevIcon().tqcontains(e->pos()) && m_pWndBody->prevIconState()!=WDG_ICON_OFF) { m_bPrevDown = true; m_pWndBody->setPrevIcon(WDG_ICON_CLICKED); prevButtonClicked(); } - if(m_pWndBody->rctNextIcon().contains(e->pos()) && m_pWndBody->nextIconState()!=WDG_ICON_OFF) + if(m_pWndBody->rctNextIcon().tqcontains(e->pos()) && m_pWndBody->nextIconState()!=WDG_ICON_OFF) { m_bNextDown = true; m_pWndBody->setNextIcon(WDG_ICON_CLICKED); @@ -926,7 +926,7 @@ sartelo: } -void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) +void KviNotifierWindow::mouseReleaseEvent(TQMouseEvent * e) { m_bWriteDown = false; m_bNextDown = false; @@ -943,13 +943,13 @@ void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) if(m_bDragging) { m_bDragging = false; - if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); + if(TQApplication::overrideCursor()) TQApplication::restoreOverrideCursor(); return; } - if(m_pWndBorder->captionRect().contains(e->pos())) { + if(m_pWndBorder->captionRect().tqcontains(e->pos())) { - if(m_pWndBorder->closeRect().contains(e->pos())) { + if(m_pWndBorder->closeRect().tqcontains(e->pos())) { //debug ("hide now from release event"); hideNow(); } else { @@ -958,7 +958,7 @@ void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) } - if(m_pWndTabs->rect().contains(e->pos())) + if(m_pWndTabs->rect().tqcontains(e->pos())) { m_pWndTabs->mouseReleaseEvent(e); } @@ -967,11 +967,11 @@ void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) } -void KviNotifierWindow::mouseDoubleClickEvent(QMouseEvent * e) +void KviNotifierWindow::mouseDoubleClickEvent(TQMouseEvent * e) { - if(!m_pWndBody->textRect().contains(e->pos())) + if(!m_pWndBody->textRect().tqcontains(e->pos())) { - QWidget::mouseDoubleClickEvent(e); + TQWidget::mouseDoubleClickEvent(e); return; } @@ -984,31 +984,31 @@ void KviNotifierWindow::mouseDoubleClickEvent(QMouseEvent * e) delayedRaise(tab->window()); } -void KviNotifierWindow::keyPressEvent(QKeyEvent * e) +void KviNotifierWindow::keyPressEvent(TQKeyEvent * e) { - if (e->key()==Qt::Key_Shift) { + if (e->key()==TQt::Key_Shift) { m_bKeyShiftPressed = true; return; } - if (e->key()==Qt::Key_Left && m_bKeyShiftPressed) { + if (e->key()==TQt::Key_Left && m_bKeyShiftPressed) { m_pWndTabs->prev(); return; } - if (e->key()==Qt::Key_Right && m_bKeyShiftPressed) { + if (e->key()==TQt::Key_Right && m_bKeyShiftPressed) { m_pWndTabs->next(); return; } - if (e->key()==Qt::Key_Escape) { + if (e->key()==TQt::Key_Escape) { hideNow(); return; } } -void KviNotifierWindow::keyReleaseEvent(QKeyEvent * e) +void KviNotifierWindow::keyReleaseEvent(TQKeyEvent * e) { - if (e->key()==Qt::Key_Shift) { + if (e->key()==TQt::Key_Shift) { m_bKeyShiftPressed = false; } } @@ -1016,7 +1016,7 @@ void KviNotifierWindow::keyReleaseEvent(QKeyEvent * e) void KviNotifierWindow::delayedRaise(KviWindow * pWnd) { m_pWindowToRaise = pWnd; - QTimer::singleShot(0,this,SLOT(delayedRaiseSlot())); + TQTimer::singleShot(0,this,TQT_SLOT(delayedRaiseSlot())); } void KviNotifierWindow::delayedRaiseSlot() @@ -1030,33 +1030,33 @@ void KviNotifierWindow::delayedRaiseSlot() m_pWindowToRaise->frame()->show(); m_pWindowToRaise->frame()->raise(); - //((QWidget *)(m_pWindowToRaise->frame()))->setActiveWindow(); + //((TQWidget *)(m_pWindowToRaise->frame()))->setActiveWindow(); m_pWindowToRaise->frame()->setFocus(); } m_pWindowToRaise->delayedAutoRaise(); } -bool KviNotifierWindow::checkResizing(QPoint e) +bool KviNotifierWindow::checkResizing(TQPoint e) { if (e.y()<WDG_BORDER_THICKNESS) { if (e.x()<WDG_BORDER_THICKNESS) { //// UP LEFT CORNER //// - setCursor(Qt::SizeFDiagCursor); + setCursor(TQt::SizeFDiagCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_UPSX; } } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) { //// UP RIGHT CORNER //// - setCursor(Qt::SizeBDiagCursor); + setCursor(TQt::SizeBDiagCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_UPDX; } } else { //// UP SIDE //// - setCursor(Qt::SizeVerCursor); + setCursor(TQt::SizeVerCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_UP; @@ -1064,21 +1064,21 @@ bool KviNotifierWindow::checkResizing(QPoint e) } else if (e.y() > (size().height()-WDG_BORDER_THICKNESS)) { if (e.x()<WDG_BORDER_THICKNESS) { //// DOWN LEFT CORNER //// - setCursor(Qt::SizeBDiagCursor); + setCursor(TQt::SizeBDiagCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_DWNSX; } } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) { //// DOWN RIGHT CORNER //// - setCursor(Qt::SizeFDiagCursor); + setCursor(TQt::SizeFDiagCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_DWNDX; } } else { //// DOWN SIDE //// - setCursor(Qt::SizeVerCursor); + setCursor(TQt::SizeVerCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_DWN; @@ -1087,14 +1087,14 @@ bool KviNotifierWindow::checkResizing(QPoint e) } else { if (e.x()<WDG_BORDER_THICKNESS) { //// LEFT SIZE //// - setCursor(Qt::SizeHorCursor); + setCursor(TQt::SizeHorCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_SX; } } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) { //// RIGHT SIZE //// - setCursor(Qt::SizeHorCursor); + setCursor(TQt::SizeHorCursor); if (m_bLeftButtonIsPressed) { m_bResizing = true; m_whereResizing = WDG_DX; @@ -1111,9 +1111,9 @@ bool KviNotifierWindow::checkResizing(QPoint e) -void KviNotifierWindow::resize(QPoint p, bool up) +void KviNotifierWindow::resize(TQPoint p, bool up) { - //QPoint aux = mapToGlobal(p); + //TQPoint aux = mapToGlobal(p); if (m_whereResizing==WDG_UPSX || m_whereResizing==WDG_SX || m_whereResizing==WDG_DWNSX) { if ((x() + width() - cursor().pos().x()) < WDG_MIN_WIDTH) @@ -1162,7 +1162,7 @@ void KviNotifierWindow::redrawWindow() m_pProgressBar->setHeight(m_pWndBorder->bodyRect().height() + m_pWndBorder->tabsRect().height()); } - QPainter paint; + TQPainter paint; if(m_bBlinkOn) { m_pWndBorder->touch(); @@ -1191,27 +1191,27 @@ void KviNotifierWindow::redrawWindow() } inline void KviNotifierWindow::setCursor(int cur) { - if (m_cursor.shape() != cur) { - if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); + if (m_cursor.tqshape() != cur) { + if(TQApplication::overrideCursor()) TQApplication::restoreOverrideCursor(); m_cursor.setShape((Qt::CursorShape)cur); - QApplication::setOverrideCursor(m_cursor); + TQApplication::setOverrideCursor(m_cursor); } else if (cur==-1) - if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); + if(TQApplication::overrideCursor()) TQApplication::restoreOverrideCursor(); } -void KviNotifierWindow::enterEvent(QEvent * e) +void KviNotifierWindow::enterEvent(TQEvent * e) { #ifdef COMPILE_USE_QT4 if(!m_pShowHideTimer) { - m_pShowHideTimer = new QTimer(); - connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); + m_pShowHideTimer = new TQTimer(); + connect(m_pShowHideTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(heartbeat())); } m_eState = FocusingOn; m_pShowHideTimer->start(40); #endif } -void KviNotifierWindow::leaveEvent(QEvent * e) +void KviNotifierWindow::leaveEvent(TQEvent * e) { // Leaving the widget area, restore default cursor m_pWndBorder->resetIcons(); @@ -1220,21 +1220,21 @@ void KviNotifierWindow::leaveEvent(QEvent * e) setCursor(-1); #ifdef COMPILE_USE_QT4 if(!m_pShowHideTimer) { - m_pShowHideTimer = new QTimer(); - connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); + m_pShowHideTimer = new TQTimer(); + connect(m_pShowHideTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(heartbeat())); } m_eState = FocusingOff; m_pShowHideTimer->start(40); #endif } -void KviNotifierWindow::contextPopup(const QPoint &pos) +void KviNotifierWindow::contextPopup(const TQPoint &pos) { if(!m_pContextPopup) { - m_pContextPopup = new QPopupMenu(this); - connect(m_pContextPopup,SIGNAL(aboutToShow()),this,SLOT(fillContextPopup())); - m_pDisablePopup = new QPopupMenu(this); + m_pContextPopup = new TQPopupMenu(this); + connect(m_pContextPopup,TQT_SIGNAL(aboutToShow()),this,TQT_SLOT(fillContextPopup())); + m_pDisablePopup = new TQPopupMenu(this); } m_pContextPopup->popup(pos); @@ -1244,19 +1244,19 @@ void KviNotifierWindow::fillContextPopup() { m_pContextPopup->clear(); - m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CLOSE)),__tr2qs_ctx("Hide","notifier"),this,SLOT(hideNow())); + m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_CLOSE)),__tr2qs_ctx("Hide","notifier"),this,TQT_SLOT(hideNow())); m_pContextPopup->insertSeparator(); m_pDisablePopup->clear(); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("1 Minute","notifier"),this,SLOT(disableFor1Minute())); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("5 Minutes","notifier"),this,SLOT(disableFor5Minutes())); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("15 Minutes","notifier"),this,SLOT(disableFor15Minutes())); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("30 Minutes","notifier"),this,SLOT(disableFor30Minutes())); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("1 Hour","notifier"),this,SLOT(disableFor60Minutes())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("1 Minute","notifier"),this,TQT_SLOT(disableFor1Minute())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("5 Minutes","notifier"),this,TQT_SLOT(disableFor5Minutes())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("15 Minutes","notifier"),this,TQT_SLOT(disableFor15Minutes())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("30 Minutes","notifier"),this,TQT_SLOT(disableFor30Minutes())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TIME)),__tr2qs_ctx("1 Hour","notifier"),this,TQT_SLOT(disableFor60Minutes())); m_pDisablePopup->insertSeparator(); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),__tr2qs_ctx("Until KVIrc is Restarted","notifier"),this,SLOT(disableUntilKVIrcRestarted())); - m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),__tr2qs_ctx("Permanently (Until Explicitly Enabled)","notifier"),this,SLOT(disablePermanently())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TQUIT)),__tr2qs_ctx("Until KVIrc is Restarted","notifier"),this,TQT_SLOT(disableUntilKVIrcRestarted())); + m_pDisablePopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TQUIT)),__tr2qs_ctx("Permanently (Until Explicitly Enabled)","notifier"),this,TQT_SLOT(disablePermanently())); - m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)),__tr2qs_ctx("Disable","notifier"),m_pDisablePopup); + m_pContextPopup->insertItem(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_TQUIT)),__tr2qs_ctx("Disable","notifier"),m_pDisablePopup); } void KviNotifierWindow::disableFor15Minutes() @@ -1316,7 +1316,7 @@ void KviNotifierWindow::disablePermanently() hideNow(); } -void KviNotifierWindow::wheelEvent(QWheelEvent * e) +void KviNotifierWindow::wheelEvent(TQWheelEvent * e) { if(e->delta() > 0)prevButtonClicked(); else nextButtonClicked(); @@ -1346,12 +1346,12 @@ void KviNotifierWindow::showLineEdit(bool bShow) //if(m_pLineEdit->isVisible())return; if(!m_pWndTabs->currentMessage())return; if(!m_pWndTabs->currentTab()->window())return; - QToolTip::remove(m_pLineEdit); - QString tip = __tr2qs_ctx("Write text or commands to window","notifier"); + TQToolTip::remove(m_pLineEdit); + TQString tip = __tr2qs_ctx("Write text or commands to window","notifier"); tip += " \""; tip += m_pWndTabs->currentTab()->window()->plainTextCaption(); tip += "\""; - QToolTip::add(m_pLineEdit,tip); + TQToolTip::add(m_pLineEdit,tip); m_pLineEdit->setGeometry(m_pWndBody->textRect().x(),m_pWndBody->textRect().y() + m_pWndBody->textRect().height() - m_iInputHeight,m_pWndBody->textRect().width(),m_iInputHeight); m_pLineEdit->show(); m_pLineEdit->setFocus(); @@ -1367,11 +1367,11 @@ void KviNotifierWindow::showLineEdit(bool bShow) } } -bool KviNotifierWindow::eventFilter(QObject * pEdit,QEvent * e) +bool KviNotifierWindow::eventFilter(TQObject * pEdit,TQEvent * e) { - if(pEdit != (QObject *)m_pLineEdit)return false; // huh ? + if(pEdit != (TQObject *)m_pLineEdit)return false; // huh ? if(!m_pLineEdit->isVisible())return false; - if(e->type() == QEvent::MouseButtonPress) + if(e->type() == TQEvent::MouseButtonPress) { bool bWasBlinkOn = m_bBlinkOn; m_bBlinkOn = false; @@ -1383,9 +1383,9 @@ bool KviNotifierWindow::eventFilter(QObject * pEdit,QEvent * e) if(bWasBlinkOn)update(); return true; } - if(e->type() == QEvent::KeyPress) + if(e->type() == TQEvent::KeyPress) { - if(((QKeyEvent *)e)->key() == Qt::Key_Escape) + if(((TQKeyEvent *)e)->key() == TQt::Key_Escape) { hideNow(); return true; @@ -1403,16 +1403,16 @@ void KviNotifierWindow::returnPressed() if(!tab->currentMessage())return; if(!tab->window())return; - QString txt = m_pLineEdit->text(); + TQString txt = m_pLineEdit->text(); if(txt.isEmpty())return; - QString html = txt; - html.replace("<","<"); - html.replace(">",">"); + TQString html = txt; + html.tqreplace("<","<"); + html.tqreplace(">",">"); KviStr tmp(KviStr::Format,"%d",KVI_SMALLICON_OWNPRIVMSG); addMessage(tab->window(),tmp.ptr(),html,0); //m_pCurrentFocusedWindowTab on place of m_pCurrentMessage->window() m_pLineEdit->setText(""); - KviUserInput::parse(txt,tab->window(),QString::null,1); + KviUserInput::parse(txt,tab->window(),TQString(),1); } void KviNotifierWindow::progressUpdate() @@ -1420,7 +1420,7 @@ void KviNotifierWindow::progressUpdate() double dProgress = m_qtStartedAt.elapsed()/(m_tAutoHideAt - m_tStartedAt); dProgress/=1000; m_pProgressBar->setProgress(dProgress); - QPainter p(this); + TQPainter p(this); m_pProgressBar->draw(&p); } #include "m_notifierwindow.moc" |