diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/addon/packaddondialog.h | 2 | ||||
| -rw-r--r-- | src/modules/notifier/libkvinotifier.cpp | 61 | ||||
| -rw-r--r-- | src/modules/notifier/notifiermessage.cpp | 5 | ||||
| -rw-r--r-- | src/modules/notifier/notifiermessage.h | 14 | ||||
| -rw-r--r-- | src/modules/notifier/notifierwindow.cpp | 453 | ||||
| -rw-r--r-- | src/modules/notifier/notifierwindowtab.cpp | 95 | ||||
| -rw-r--r-- | src/modules/notifier/notifierwindowtab.h | 78 |
7 files changed, 406 insertions, 302 deletions
diff --git a/src/modules/addon/packaddondialog.h b/src/modules/addon/packaddondialog.h index 7ba157322..cd20d289c 100644 --- a/src/modules/addon/packaddondialog.h +++ b/src/modules/addon/packaddondialog.h @@ -61,7 +61,7 @@ class KviPackAddonDialog : public QWizard Q_OBJECT public: /** - * \brief Create the wizard object + * \brief Creates the wizard object * \param pParent The parent widget * \return KviPackAddonDialog */ diff --git a/src/modules/notifier/libkvinotifier.cpp b/src/modules/notifier/libkvinotifier.cpp index ec7658059..dea18518f 100644 --- a/src/modules/notifier/libkvinotifier.cpp +++ b/src/modules/notifier/libkvinotifier.cpp @@ -111,7 +111,6 @@ kvi_time_t g_tNotifierDisabledUntil = 0; notifier.message -t=10 This message will be shown only for 10 seconds [/example] */ - static bool notifier_kvs_cmd_message(KviKvsModuleCommandCall * c) { QString szMessage; @@ -138,13 +137,13 @@ static bool notifier_kvs_cmd_message(KviKvsModuleCommandCall * c) } } c->switches()->getAsStringIfExisting('i',"icon",szIco); - kvs_int_t uTime=KVI_OPTION_UINT(KviOption_uintNotifierAutoHideTime); + kvs_int_t uTime = KVI_OPTION_UINT(KviOption_uintNotifierAutoHideTime); if(c->hasSwitch('t',"timeout")) { - KviKvsVariant *time=c->getSwitch('t',"timeout"); - if(time) + KviKvsVariant * pTime = c->getSwitch('t',"timeout"); + if(pTime) { - bool bOk=time->asInteger(uTime); + bool bOk = pTime->asInteger(uTime); if(!bOk) { uTime = 0; @@ -182,10 +181,10 @@ static bool notifier_kvs_cmd_message(KviKvsModuleCommandCall * c) @seealso: [cmd]notifier.show[/cmd] [cmd]notifier.message[/cmd] [fnc]$notifier.isEnabled[/fnc] */ - static bool notifier_kvs_cmd_hide(KviKvsModuleCommandCall * c) { - if(g_pNotifierWindow) g_pNotifierWindow->doHide(!(c->hasSwitch('n',"notanimated"))); + if(g_pNotifierWindow) + g_pNotifierWindow->doHide(!(c->hasSwitch('n',"notanimated"))); return true; } @@ -212,17 +211,19 @@ static bool notifier_kvs_cmd_hide(KviKvsModuleCommandCall * c) @seealso: [cmd]notifier.hide[/cmd] [cmd]notifier.message[/cmd] [fnc]$notifier.isEnabled[/fnc] */ - static bool notifier_kvs_cmd_show(KviKvsModuleCommandCall * c) { - if(!g_pNotifierWindow)return true; - if(!g_pNotifierWindow->countTabs())return true; + if(!g_pNotifierWindow) + return true; + if(!g_pNotifierWindow->countTabs()) + return true; g_pNotifierWindow->setDisableHideOnMainWindowGotAttention(true); g_pNotifierWindow->doShow(!(c->hasSwitch('n',"noanim"))); return true; } + /* @doc: notifier.isEnabled @type: @@ -246,21 +247,19 @@ static bool notifier_kvs_cmd_show(KviKvsModuleCommandCall * c) instead.. but again [b]DON'T do it[/b] :)[br] */ - static bool notifier_kvs_fnc_isEnabled(KviKvsModuleFunctionCall * c) { bool bCheck; if(!KVI_OPTION_BOOL(KviOption_boolEnableNotifier)) - bCheck=false; + bCheck = false; else - bCheck=g_tNotifierDisabledUntil < kvi_unixTime(); + bCheck = g_tNotifierDisabledUntil < kvi_unixTime(); c->returnValue()->setBoolean(bCheck); return true; } static bool notifier_module_init(KviModule * m) { - KVSM_REGISTER_SIMPLE_COMMAND(m,"message",notifier_kvs_cmd_message); KVSM_REGISTER_SIMPLE_COMMAND(m,"show",notifier_kvs_cmd_show); KVSM_REGISTER_SIMPLE_COMMAND(m,"hide",notifier_kvs_cmd_hide); @@ -284,37 +283,29 @@ static bool notifier_module_can_unload(KviModule *) return (!g_pNotifierWindow); } -typedef struct _NotifierMessageSupaDupaParameterStruct +static bool notifier_module_ctrl(KviModule *, const char * pcOperation, void * pParam) { - KviWindow * pWindow; - QString szIcon; - QString szMessage; - unsigned int uMessageLifetime; // 0 means no hide -} NotifierMessageSupaDupaParameterStruct; + if(!kvi_strEqualCI("notifier::message",pcOperation)) + return false; -static bool notifier_module_ctrl(KviModule *,const char *operation,void *param) -{ - if(kvi_strEqualCI("notifier::message",operation)) - { - NotifierMessageSupaDupaParameterStruct * p = (NotifierMessageSupaDupaParameterStruct *)param; - if(!p)return false; + KviNotifierMessageParam * p = (KviNotifierMessageParam *)pParam; + if(!p) + return false; - if(!g_pNotifierWindow) - g_pNotifierWindow = new KviNotifierWindow(); + if(!g_pNotifierWindow) + g_pNotifierWindow = new KviNotifierWindow(); - g_pNotifierWindow->addMessage(p->pWindow,p->szIcon,p->szMessage,p->uMessageLifetime); - g_pNotifierWindow->doShow(KVI_OPTION_BOOL(KviOption_boolNotifierFading)? true : false); + g_pNotifierWindow->addMessage(p->pWindow,p->szIcon,p->szMessage,p->uMessageLifetime); + g_pNotifierWindow->doShow(KVI_OPTION_BOOL(KviOption_boolNotifierFading) ? true : false); - return true; - } - return false; + return true; } KVIRC_MODULE( "Notifier", "4.0.0", - "Copyright (C) 2005:\n" \ - " Iacopo Palazzi (iakko at siena dot linux dot it)", + "Copyright (C) 2005 Iacopo Palazzi (iakko at siena dot linux dot it)\n" \ + " 2010 Elvio Basello (hell at hellvis69 dot netsons dot org)", "KVIrc Client - Taskbar Notifier", notifier_module_init, notifier_module_can_unload, diff --git a/src/modules/notifier/notifiermessage.cpp b/src/modules/notifier/notifiermessage.cpp index a5d69a1cd..d46a38956 100644 --- a/src/modules/notifier/notifiermessage.cpp +++ b/src/modules/notifier/notifiermessage.cpp @@ -32,7 +32,7 @@ #include <QRect> #include <QResizeEvent> -KviNotifierMessage::KviNotifierMessage(QPixmap * pPixmap, const QString &szText) +KviNotifierMessage::KviNotifierMessage(QPixmap * pPixmap, const QString & szText) { m_pLabel0 = 0; m_pLabel1 = 0; @@ -63,7 +63,7 @@ KviNotifierMessage::~KviNotifierMessage() void KviNotifierMessage::updateGui() { - bool bShowImages=KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages); + bool bShowImages = KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages); if(m_pLabel0) delete m_pLabel0; @@ -96,5 +96,4 @@ void KviNotifierMessage::updateGui() m_pHBox->addWidget(m_pLabel0); } m_pHBox->addWidget(m_pLabel1); - } diff --git a/src/modules/notifier/notifiermessage.h b/src/modules/notifier/notifiermessage.h index 51b16d739..518a15098 100644 --- a/src/modules/notifier/notifiermessage.h +++ b/src/modules/notifier/notifiermessage.h @@ -57,15 +57,15 @@ public: ~KviNotifierMessage(); private: /// The message text - QString m_szText; + QString m_szText; /// The message icon (can be null) - QPixmap * m_pPixmap; + QPixmap * m_pPixmap; /// Layout for the labels - QHBoxLayout * m_pHBox; + QHBoxLayout * m_pHBox; /// Label for the message icon - QLabel * m_pLabel0; + QLabel * m_pLabel0; /// Label for the message text - QLabel * m_pLabel1; + QLabel * m_pLabel1; public: /** * \brief Returns the original irc message @@ -74,9 +74,9 @@ public: inline QString text() const { return m_szText; }; /** * \brief Returns the message icon - * \return QPixmap* + * \return QPixmap * */ - inline QPixmap* pixmap() const { return m_pPixmap; }; + inline QPixmap * pixmap() const { return m_pPixmap; }; /** * \brief Updates the aspect of this message * \return void diff --git a/src/modules/notifier/notifierwindow.cpp b/src/modules/notifier/notifierwindow.cpp index a6f2dd59c..41bb0d92e 100644 --- a/src/modules/notifier/notifierwindow.cpp +++ b/src/modules/notifier/notifierwindow.cpp @@ -55,16 +55,16 @@ extern KviNotifierWindow * g_pNotifierWindow; KviNotifierWindow::KviNotifierWindow() : QWidget(0, #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - Qt::FramelessWindowHint | - Qt::Tool | - Qt::WindowStaysOnTopHint) + Qt::FramelessWindowHint | + Qt::Tool | + Qt::WindowStaysOnTopHint) #else - Qt::FramelessWindowHint | + Qt::FramelessWindowHint | #ifndef COMPILE_ON_MAC - Qt::Tool | - Qt::X11BypassWindowManagerHint | + Qt::Tool | + Qt::X11BypassWindowManagerHint | #endif - Qt::WindowStaysOnTopHint) + Qt::WindowStaysOnTopHint) #endif { setObjectName("kvirc_notifier_window"); @@ -106,13 +106,14 @@ KviNotifierWindow::KviNotifierWindow() m_bDisableHideOnMainWindowGotAttention = false; // Positioning the notifier bottom-right - QDesktopWidget * w = QApplication::desktop(); - QRect r = w->availableGeometry(w->primaryScreen()); + QDesktopWidget * pDesktop = QApplication::desktop(); + QRect r = pDesktop->availableGeometry(pDesktop->primaryScreen()); - m_wndRect.setRect( r.x() + r.width() - (WDG_MIN_WIDTH + SPACING), - r.y() + r.height() - (WDG_MIN_HEIGHT + SPACING), - WDG_MIN_WIDTH, - WDG_MIN_HEIGHT ); + m_wndRect.setRect( + r.x() + r.width() - (WDG_MIN_WIDTH + SPACING), + r.y() + r.height() - (WDG_MIN_HEIGHT + SPACING), + WDG_MIN_WIDTH, + WDG_MIN_HEIGHT); m_pWndTabs = new QTabWidget(this); m_pWndTabs->setUsesScrollButtons(true); @@ -171,39 +172,41 @@ void KviNotifierWindow::updateGui() } -void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,const QString &szText,unsigned int uMessageTime) +void KviNotifierWindow::addMessage(KviWindow * pWnd, const QString & szImageId, const QString & szText, unsigned int uMessageTime) { QPixmap * pIcon; - QString szMessage=szText; + QString szMessage = szText; szMessage.replace( QRegExp("\r([^\r])*\r([^\r])+\r"), "\\2" ); - if(szImageId.isEmpty())pIcon = 0; - else pIcon = g_pIconManager->getImage(szImageId); + if(szImageId.isEmpty()) + pIcon = 0; + else + pIcon = g_pIconManager->getImage(szImageId); - KviNotifierMessage * m = new KviNotifierMessage(pIcon ? new QPixmap(*pIcon) : 0,szMessage); + KviNotifierMessage * pMessage = new KviNotifierMessage(pIcon ? new QPixmap(*pIcon) : 0,szMessage); //search for an existing tab - KviNotifierWindowTab *tab=0, *tmp=0; - for(int i=0; i<m_pWndTabs->count();++i) + KviNotifierWindowTab * pTab = 0, * pTmp = 0; + for(int i=0; i < m_pWndTabs->count();++i) { - tmp=(KviNotifierWindowTab*)m_pWndTabs->widget(i); - if(tmp->wnd() == pWnd) + pTmp = (KviNotifierWindowTab*)m_pWndTabs->widget(i); + if(pTmp->wnd() == pWnd) { - tab=tmp; + pTab = pTmp; break; } } - if(!tab) + if(!pTab) { - tab = new KviNotifierWindowTab(pWnd, m_pWndTabs); + pTab = new KviNotifierWindowTab(pWnd, m_pWndTabs); } //if the notifier is already visible, don't steal the focus from the current tab! //the user could be writing a message on it (bug #678) if(!isVisible()) - m_pWndTabs->setCurrentWidget(tab); + m_pWndTabs->setCurrentWidget(pTab); - tab->appendMessage(m); + pTab->appendMessage(pMessage); if(!isActiveWindow()) startBlinking(); @@ -225,7 +228,8 @@ void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,con if(pWnd) { - if(pWnd->hasAttention())m_bDisableHideOnMainWindowGotAttention = true; + if(pWnd->hasAttention()) + m_bDisableHideOnMainWindowGotAttention = true; } if(isVisible()) @@ -234,21 +238,24 @@ void KviNotifierWindow::addMessage(KviWindow * pWnd,const QString &szImageId,con void KviNotifierWindow::stopShowHideTimer() { - if(!m_pShowHideTimer)return; + if(!m_pShowHideTimer) + return; delete m_pShowHideTimer; m_pShowHideTimer = 0; } void KviNotifierWindow::stopBlinkTimer() { - if(!m_pBlinkTimer)return; + if(!m_pBlinkTimer) + return; delete m_pBlinkTimer; m_pBlinkTimer = 0; } void KviNotifierWindow::stopAutoHideTimer() { - if(!m_pAutoHideTimer)return; + if(!m_pAutoHideTimer) + return; delete m_pAutoHideTimer; m_pAutoHideTimer = 0; m_pProgressBar->setValue(0); @@ -258,7 +265,6 @@ void KviNotifierWindow::stopAutoHideTimer() // We also lack the code for MacOSX and Qt-only-X11 compilation. #if COMPILE_KDE_SUPPORT - #include <kwindowsystem.h> static bool active_window_is_full_screen() @@ -267,8 +273,7 @@ void KviNotifierWindow::stopAutoHideTimer() KWindowInfo wi = KWindowSystem::windowInfo(activeId, NET::WMState); return (wi.valid() && wi.hasState(NET::FullScreen)); } - -#else //!COMPILE_KDE_SUPPORT +#else // COMPILE_KDE_SUPPORT #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) #include <windows.h> @@ -300,8 +305,7 @@ void KviNotifierWindow::stopAutoHideTimer() } #endif //COMPILE_ON_WINDOWS || COMPILE_ON_MINGW -#endif //!COMPILE_KDE_SUPPORT - +#endif // COMPILE_KDE_SUPPORT void KviNotifierWindow::doShow(bool bDoAnimate) { @@ -309,18 +313,17 @@ void KviNotifierWindow::doShow(bool bDoAnimate) return; kvi_time_t tNow = kvi_unixTime(); - if(g_tNotifierDisabledUntil > tNow)return; + if(g_tNotifierDisabledUntil > tNow) + return; g_tNotifierDisabledUntil = 0; #if defined(COMPILE_KDE_SUPPORT) || defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - if(KVI_OPTION_BOOL(KviOption_boolDontShowNotifierIfActiveWindowIsFullScreen)) { // check if the active window is full screen if(active_window_is_full_screen()) return; } - #endif //COMPILE_KDE_SUPPORT || COMPILE_ON_WINDOWS || COMPILE_ON_MINGW switch(m_eState) @@ -353,11 +356,11 @@ void KviNotifierWindow::doShow(bool bDoAnimate) connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); m_dOpacity = OPACITY_STEP; m_eState = Showing; - m_bCrashShowWorkAround=true; + m_bCrashShowWorkAround = true; setWindowOpacity(m_dOpacity); show(); m_pShowHideTimer->start(40); - m_bCrashShowWorkAround=false; + m_bCrashShowWorkAround = false; } else { m_dOpacity = 1.0; m_eState = Visible; @@ -373,11 +376,14 @@ void KviNotifierWindow::doShow(bool bDoAnimate) bool KviNotifierWindow::shouldHideIfMainWindowGotAttention() { - if(m_bDisableHideOnMainWindowGotAttention)return false; - KviNotifierWindowTab * t = (KviNotifierWindowTab*) m_pWndTabs->currentWidget(); - if(!t)return false; - if(!t->wnd())return false; - return t->wnd()->hasAttention(); + if(m_bDisableHideOnMainWindowGotAttention) + return false; + KviNotifierWindowTab * pTab = (KviNotifierWindowTab *) m_pWndTabs->currentWidget(); + if(!pTab) + return false; + if(!pTab->wnd()) + return false; + return pTab->wnd()->hasAttention(); } void KviNotifierWindow::heartbeat() @@ -392,8 +398,10 @@ void KviNotifierWindow::heartbeat() case Visible: stopShowHideTimer(); m_dOpacity = 1.0; - if(!isVisible())show(); - else update(); + if(!isVisible()) + show(); + else + update(); break; case Showing: // if the main window got attention while @@ -415,7 +423,8 @@ void KviNotifierWindow::heartbeat() startAutoHideTimer(); } - if(!isVisible())show(); //!!! + if(!isVisible()) + show(); setWindowOpacity(m_dOpacity); update(); @@ -423,12 +432,12 @@ void KviNotifierWindow::heartbeat() break; case FocusingOn: targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency); - targetOpacity/=100; - bIncreasing = targetOpacity>m_dOpacity; + targetOpacity /= 100; + bIncreasing = targetOpacity > m_dOpacity; m_dOpacity += bIncreasing? OPACITY_STEP : -(OPACITY_STEP); - if( (bIncreasing && (m_dOpacity >= targetOpacity) ) || - (!bIncreasing && (m_dOpacity <= targetOpacity) ) + if((bIncreasing && (m_dOpacity >= targetOpacity)) || + (!bIncreasing && (m_dOpacity <= targetOpacity)) ) { m_dOpacity = targetOpacity; @@ -440,12 +449,12 @@ void KviNotifierWindow::heartbeat() break; case FocusingOff: targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency); - targetOpacity/=100; - bIncreasing = targetOpacity>m_dOpacity; + targetOpacity /= 100; + bIncreasing = targetOpacity > m_dOpacity; m_dOpacity += bIncreasing ? OPACITY_STEP : -(OPACITY_STEP); //qDebug("%f %f %i %i",m_dOpacity,targetOpacity,bIncreasing,(m_dOpacity >= targetOpacity)); - if( (bIncreasing && (m_dOpacity >= targetOpacity) ) || - (!bIncreasing && (m_dOpacity <= targetOpacity) ) + if((bIncreasing && (m_dOpacity >= targetOpacity)) || + (!bIncreasing && (m_dOpacity <= targetOpacity)) ) { m_dOpacity = targetOpacity; @@ -458,8 +467,10 @@ void KviNotifierWindow::heartbeat() case Hiding: m_dOpacity -= OPACITY_STEP; setWindowOpacity(m_dOpacity); - if(m_dOpacity <= 0.0)hideNow(); - else update(); + if(m_dOpacity <= 0.0) + hideNow(); + else + update(); break; } } @@ -482,17 +493,20 @@ void KviNotifierWindow::doHide(bool bDoAnimate) { case Hiding: // already hiding up - if(!bDoAnimate)hideNow(); + if(!bDoAnimate) + hideNow(); return; break; case Hidden: // already hidden - if(isVisible())hideNow(); // !!! + if(isVisible()) + hideNow(); return; break; case Showing: // ops.. hiding! - if(!bDoAnimate)hideNow(); + if(!bDoAnimate) + hideNow(); else { // continue animating, but hide m_eState = Hiding; @@ -532,7 +546,8 @@ void KviNotifierWindow::showEvent(QShowEvent *) void KviNotifierWindow::hideEvent(QHideEvent *) { - if (m_bCrashShowWorkAround) return; + if(m_bCrashShowWorkAround) + return; stopBlinkTimer(); stopShowHideTimer(); stopAutoHideTimer(); @@ -559,10 +574,12 @@ void KviNotifierWindow::startAutoHideTimer() { stopAutoHideTimer(); m_tStartedAt = kvi_unixTime(); - if(m_tAutoHideAt <= m_tStartedAt)return; + if(m_tAutoHideAt <= m_tStartedAt) + return; - int nSecs = m_tAutoHideAt - m_tStartedAt; - if(nSecs < 5)nSecs = 5; + int iSecs = m_tAutoHideAt - m_tStartedAt; + if(iSecs < 5) + iSecs = 5; m_pAutoHideTimer = new QTimer(); connect(m_pAutoHideTimer,SIGNAL(timeout()),this,SLOT(progressUpdate())); @@ -591,81 +608,77 @@ void KviNotifierWindow::blink() update(); } -void KviNotifierWindow::paintEvent(QPaintEvent *e) +void KviNotifierWindow::paintEvent(QPaintEvent * e) { - QPainter *p = new QPainter(this); + QPainter * pPaint = new QPainter(this); - if(m_wndRect.width()!=m_pWndBorder->width() || m_wndRect.height()!=m_pWndBorder->height()) - m_pWndBorder->resize( m_wndRect.size() ); + if(m_wndRect.width() != m_pWndBorder->width() || m_wndRect.height() != m_pWndBorder->height()) + m_pWndBorder->resize(m_wndRect.size()); if(m_bBlinkOn) { - m_pWndBorder->draw(p,true); + m_pWndBorder->draw(pPaint,true); } else { - m_pWndBorder->draw(p); + m_pWndBorder->draw(pPaint); } - p->setPen(KVI_OPTION_COLOR(KviOption_colorNotifierTitleForeground)); - p->setFont(KVI_OPTION_FONT(KviOption_fontNotifierTitle)); + pPaint->setPen(KVI_OPTION_COLOR(KviOption_colorNotifierTitleForeground)); + pPaint->setFont(KVI_OPTION_FONT(KviOption_fontNotifierTitle)); - QString title = "KVIrc - "; - KviNotifierWindowTab *tab = (KviNotifierWindowTab *)m_pWndTabs->currentWidget(); - if(tab) + QString szTitle = "KVIrc - "; + KviNotifierWindowTab * pTab = (KviNotifierWindowTab *)m_pWndTabs->currentWidget(); + if(pTab) { - if(tab->wnd()) + if(pTab->wnd()) { - title += tab->wnd()->plainTextCaption(); + szTitle += pTab->wnd()->plainTextCaption(); } else { - title += "notifier"; + szTitle += "notifier"; } } else { - title += "notifier"; + szTitle += "notifier"; } - p->drawText(m_pWndBorder->titleRect(),Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,title); + pPaint->drawText(m_pWndBorder->titleRect(),Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine,szTitle); - delete p; + delete pPaint; e->ignore(); } void KviNotifierWindow::mouseMoveEvent(QMouseEvent * e) { - //qDebug("move on x,y: %d,%d", e->pos().x(), e->pos().y()); - - if (!m_bLeftButtonIsPressed) { - - if(checkResizing(e->pos())) goto sartelo; + if(!m_bLeftButtonIsPressed) + { + 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().contains(e->pos())) + { + if(m_pWndBorder->closeRect().contains(e->pos())) m_pWndBorder->setCloseIcon(WDG_ICON_OVER); - } else { + else m_pWndBorder->setCloseIcon(WDG_ICON_OUT); - } goto sartelo; } - /* ### END ### */ sartelo: - update(); - + update(); } if(m_bDragging) { setCursor(Qt::SizeAllCursor); - int w = m_wndRect.width(); - int h = m_wndRect.height(); + int iW = m_wndRect.width(); + int iH = m_wndRect.height(); - m_wndRect.setX( m_pntPos.x() + cursor().pos().x() - m_pntDrag.x() ); - m_wndRect.setY( m_pntPos.y() + cursor().pos().y() - m_pntDrag.y() ); + m_wndRect.setX(m_pntPos.x() + cursor().pos().x() - m_pntDrag.x()); + m_wndRect.setY(m_pntPos.y() + cursor().pos().y() - m_pntDrag.y()); - m_wndRect.setWidth(w); - m_wndRect.setHeight(h); + m_wndRect.setWidth(iW); + m_wndRect.setHeight(iH); setGeometry(m_wndRect); - } else if (m_bResizing) + } else if(m_bResizing) { resize(e->pos()); } @@ -689,40 +702,39 @@ void KviNotifierWindow::mousePressEvent(QMouseEvent * e) { contextPopup(mapToGlobal(e->pos())); return; - } else if(e->button() == Qt::LeftButton) { + } else if(e->button() == Qt::LeftButton) + { m_bLeftButtonIsPressed = true; } - if(checkResizing(m_pntClick)) goto sartelo; + if(checkResizing(m_pntClick)) + update(); - if(m_pWndBorder->captionRect().contains(e->pos())) { - //qDebug("Clicked on m_pWndBorder->rect()"); - if(m_pWndBorder->closeRect().contains(e->pos())) { - //qDebug("\tClicked on m_pWndBorder->closeRect()"); + if(m_pWndBorder->captionRect().contains(e->pos())) + { + if(m_pWndBorder->closeRect().contains(e->pos())) + { m_bCloseDown = true; m_pWndBorder->setCloseIcon(WDG_ICON_CLICKED); - goto sartelo; + update(); } - if( !m_bResizing) { + if(!m_bResizing) + { m_bDragging = true; m_pntDrag = cursor().pos(); m_pntPos = pos(); - goto sartelo; + update(); } } - //qDebug("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())) { - goto sartelo; - } - - if(bWasBlinkOn) goto sartelo; else return; - -sartelo: - update(); + if(m_pWndBorder->rect().contains(e->pos())) + update(); + if(bWasBlinkOn) + update(); + else + return; } void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) @@ -737,19 +749,17 @@ void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) if(m_bDragging) { m_bDragging = false; - if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); + if(QApplication::overrideCursor()) + QApplication::restoreOverrideCursor(); return; } - if(m_pWndBorder->captionRect().contains(e->pos())) { - - if(m_pWndBorder->closeRect().contains(e->pos())) { - //qDebug("hide now from release event"); + if(m_pWndBorder->captionRect().contains(e->pos())) + { + if(m_pWndBorder->closeRect().contains(e->pos())) hideNow(); - } else { + else update(); - } - } setCursor(-1); @@ -757,7 +767,8 @@ void KviNotifierWindow::mouseReleaseEvent(QMouseEvent * e) void KviNotifierWindow::keyPressEvent(QKeyEvent * e) { - if (e->key()==Qt::Key_Escape) { + if(e->key() == Qt::Key_Escape) + { hideNow(); return; } @@ -765,63 +776,80 @@ void KviNotifierWindow::keyPressEvent(QKeyEvent * e) bool KviNotifierWindow::checkResizing(QPoint e) { - if (e.y()<WDG_BORDER_THICKNESS) { - if (e.x()<WDG_BORDER_THICKNESS) { + if(e.y() < WDG_BORDER_THICKNESS) + { + if(e.x() < WDG_BORDER_THICKNESS) + { //// UP LEFT CORNER //// setCursor(Qt::SizeFDiagCursor); - if (m_bLeftButtonIsPressed) { + if (m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_UPSX; } - } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) { + } else if(e.x() > (size().width()-WDG_BORDER_THICKNESS)) + { //// UP RIGHT CORNER //// setCursor(Qt::SizeBDiagCursor); - if (m_bLeftButtonIsPressed) { + if (m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_UPDX; } } else { //// UP SIDE //// setCursor(Qt::SizeVerCursor); - if (m_bLeftButtonIsPressed) { + if (m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_UP; - } } - } else if (e.y() > (size().height()-WDG_BORDER_THICKNESS)) { - if (e.x()<WDG_BORDER_THICKNESS) { + } + } + } else if(e.y() > (size().height()-WDG_BORDER_THICKNESS)) + { + if(e.x() < WDG_BORDER_THICKNESS) + { //// DOWN LEFT CORNER //// setCursor(Qt::SizeBDiagCursor); - if (m_bLeftButtonIsPressed) { + if(m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_DWNSX; } - } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) { + } else if(e.x() > (size().width()-WDG_BORDER_THICKNESS)) + { //// DOWN RIGHT CORNER //// setCursor(Qt::SizeFDiagCursor); - if (m_bLeftButtonIsPressed) { + if(m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_DWNDX; } } else { //// DOWN SIDE //// setCursor(Qt::SizeVerCursor); - if (m_bLeftButtonIsPressed) { + if(m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_DWN; } } } else { - if (e.x()<WDG_BORDER_THICKNESS) { + if(e.x() < WDG_BORDER_THICKNESS) + { //// LEFT SIZE //// setCursor(Qt::SizeHorCursor); - if (m_bLeftButtonIsPressed) { + if(m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_SX; } - } else if (e.x() > (size().width()-WDG_BORDER_THICKNESS)) { + } else if(e.x() > (size().width()-WDG_BORDER_THICKNESS)) + { //// RIGHT SIZE //// setCursor(Qt::SizeHorCursor); - if (m_bLeftButtonIsPressed) { + if(m_bLeftButtonIsPressed) + { m_bResizing = true; m_whereResizing = WDG_DX; } @@ -835,31 +863,35 @@ bool KviNotifierWindow::checkResizing(QPoint e) return m_bResizing; } -void KviNotifierWindow::resize(QPoint , bool) +void KviNotifierWindow::resize(QPoint, bool) { - if (m_whereResizing==WDG_UPSX || m_whereResizing==WDG_SX || m_whereResizing==WDG_DWNSX) { - if ((x() + width() - cursor().pos().x()) < WDG_MIN_WIDTH) + if(m_whereResizing == WDG_UPSX || m_whereResizing == WDG_SX || m_whereResizing == WDG_DWNSX) + { + if((x() + width() - cursor().pos().x()) < WDG_MIN_WIDTH) m_wndRect.setLeft(x() + width() - WDG_MIN_WIDTH); else m_wndRect.setLeft(cursor().pos().x()); } - if (m_whereResizing == WDG_UPSX || m_whereResizing == WDG_UP || m_whereResizing == WDG_UPDX) { - if (y()+height()-cursor().pos().y() < WDG_MIN_HEIGHT) + if(m_whereResizing == WDG_UPSX || m_whereResizing == WDG_UP || m_whereResizing == WDG_UPDX) + { + if(y()+height()-cursor().pos().y() < WDG_MIN_HEIGHT) m_wndRect.setTop(y() + height() - WDG_MIN_HEIGHT); else m_wndRect.setTop(cursor().pos().y()); } - if (m_whereResizing == WDG_DX || m_whereResizing == WDG_UPDX || m_whereResizing == WDG_DWNDX) { - if ((cursor().pos().x() - x()) > WDG_MIN_WIDTH) + if(m_whereResizing == WDG_DX || m_whereResizing == WDG_UPDX || m_whereResizing == WDG_DWNDX) + { + if((cursor().pos().x() - x()) > WDG_MIN_WIDTH) m_wndRect.setRight(cursor().pos().x()); else m_wndRect.setRight(x() + WDG_MIN_WIDTH); } - if (m_whereResizing == WDG_DWN || m_whereResizing == WDG_DWNDX || m_whereResizing == WDG_DWNSX) { - if ((cursor().pos().y() - y()) > WDG_MIN_HEIGHT) + if(m_whereResizing == WDG_DWN || m_whereResizing == WDG_DWNDX || m_whereResizing == WDG_DWNSX) + { + if((cursor().pos().y() - y()) > WDG_MIN_HEIGHT) m_wndRect.setBottom(cursor().pos().y()); else m_wndRect.setBottom(y() + WDG_MIN_HEIGHT); @@ -869,19 +901,25 @@ void KviNotifierWindow::resize(QPoint , bool) setGeometry(m_wndRect); } -inline void KviNotifierWindow::setCursor(int cur) +inline void KviNotifierWindow::setCursor(int iCur) { - if (m_cursor.shape() != cur) { - if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); - m_cursor.setShape((Qt::CursorShape)cur); + if(m_cursor.shape() != iCur) + { + if(QApplication::overrideCursor()) + QApplication::restoreOverrideCursor(); + m_cursor.setShape((Qt::CursorShape)iCur); QApplication::setOverrideCursor(m_cursor); - } else if (cur==-1) - if(QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); + } else if(iCur == -1) + { + if(QApplication::overrideCursor()) + QApplication::restoreOverrideCursor(); + } } void KviNotifierWindow::enterEvent(QEvent *) { - if(!m_pShowHideTimer) { + if(!m_pShowHideTimer) + { m_pShowHideTimer = new QTimer(); connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); } @@ -893,19 +931,23 @@ void KviNotifierWindow::leaveEvent(QEvent *) { // Leaving the widget area, restore default cursor m_pWndBorder->resetIcons(); - if (!m_bResizing) setCursor(-1); - if(!m_pShowHideTimer) { + if(!m_bResizing) + setCursor(-1); + + if(!m_pShowHideTimer) + { m_pShowHideTimer = new QTimer(); connect(m_pShowHideTimer,SIGNAL(timeout()),this,SLOT(heartbeat())); } - if (m_eState!=Hidden) + + if(m_eState!=Hidden) { m_eState = FocusingOff; m_pShowHideTimer->start(40); } } -void KviNotifierWindow::contextPopup(const QPoint &pos) +void KviNotifierWindow::contextPopup(const QPoint & pos) { if(!m_pContextPopup) { @@ -1002,29 +1044,35 @@ void KviNotifierWindow::showLineEdit(bool bShow) { if(bShow) { - if(m_pLineEdit->isVisible())return; - if(!((KviNotifierWindowTab *)m_pWndTabs->currentWidget())->wnd())return; - m_pLineEdit->setToolTip("");; - QString tip = __tr2qs_ctx("Write text or commands to window","notifier"); - tip += " \""; - tip += ((KviNotifierWindowTab *)m_pWndTabs->currentWidget())->wnd()->plainTextCaption(); - tip += "\""; - m_pLineEdit->setToolTip(tip); + if(m_pLineEdit->isVisible()) + return; + if(!((KviNotifierWindowTab *)m_pWndTabs->currentWidget())->wnd()) + return; + m_pLineEdit->setToolTip(""); + + QString szTip = __tr2qs_ctx("Write text or commands to window","notifier"); + szTip += " \""; + szTip += ((KviNotifierWindowTab *)m_pWndTabs->currentWidget())->wnd()->plainTextCaption(); + szTip += "\""; + m_pLineEdit->setToolTip(szTip); m_pLineEdit->show(); m_pLineEdit->setFocus(); activateWindow(); } else { - if(!m_pLineEdit->isVisible())return; + if(!m_pLineEdit->isVisible()) + return; m_pLineEdit->hide(); setFocus(); update(); } } -bool KviNotifierWindow::eventFilter(QObject * pEdit,QEvent * e) +bool KviNotifierWindow::eventFilter(QObject * pEdit, QEvent * e) { - if(pEdit != (QObject *)m_pLineEdit)return false; // huh ? - if(!m_pLineEdit->isVisible())return false; + if(pEdit != (QObject *)m_pLineEdit) + return false; // huh ? + if(!m_pLineEdit->isVisible()) + return false; if(e->type() == QEvent::MouseButtonPress) { bool bWasBlinkOn = m_bBlinkOn; @@ -1034,7 +1082,8 @@ bool KviNotifierWindow::eventFilter(QObject * pEdit,QEvent * e) stopBlinkTimer(); activateWindow(); m_pLineEdit->setFocus(); - if(bWasBlinkOn)update(); + if(bWasBlinkOn) + update(); return true; } if(e->type() == QEvent::KeyPress) @@ -1050,30 +1099,34 @@ bool KviNotifierWindow::eventFilter(QObject * pEdit,QEvent * e) void KviNotifierWindow::returnPressed() { - if(!m_pLineEdit->isVisible())return; + if(!m_pLineEdit->isVisible()) + return; - KviNotifierWindowTab * tab = (KviNotifierWindowTab *) m_pWndTabs->currentWidget(); - if(!tab)return; - if(!tab->wnd())return; + KviNotifierWindowTab * pTab = (KviNotifierWindowTab *) m_pWndTabs->currentWidget(); + if(!pTab) + return; + if(!pTab->wnd()) + return; - QString txt = m_pLineEdit->text(); - if(txt.isEmpty())return; - QString html = txt; - html.replace("<","<"); - html.replace(">",">"); - KviStr tmp(KviStr::Format,"%d",KVI_SMALLICON_OWNPRIVMSG); + QString szTxt = m_pLineEdit->text(); + if(szTxt.isEmpty()) + return; + QString szHtml = szTxt; + szHtml.replace("<","<"); + szHtml.replace(">",">"); + KviStr szTmp(KviStr::Format,"%d",KVI_SMALLICON_OWNPRIVMSG); - addMessage(tab->wnd(),tmp.ptr(),html,0); + addMessage(pTab->wnd(),szTmp.ptr(),szHtml,0); m_pLineEdit->setText(""); - KviUserInput::parse(txt,tab->wnd(),QString(),1); + KviUserInput::parse(szTxt,pTab->wnd(),QString(),1); } void KviNotifierWindow::progressUpdate() { kvi_time_t now = kvi_unixTime(); - int iProgress = (int) (100/(m_tAutoHideAt - m_tStartedAt)*(now - m_tStartedAt)); + int iProgress = (int)(100/(m_tAutoHideAt - m_tStartedAt)*(now - m_tStartedAt)); m_pProgressBar->setValue(iProgress); - if(now>=m_tAutoHideAt) + if(now >= m_tAutoHideAt) { m_tAutoHideAt = 0; stopAutoHideTimer(); @@ -1081,14 +1134,14 @@ void KviNotifierWindow::progressUpdate() } } -void KviNotifierWindow::slotTabCloseRequested(int index) +void KviNotifierWindow::slotTabCloseRequested(int iIndex) { if(m_pWndTabs) { - KviNotifierWindowTab *tab = (KviNotifierWindowTab*) m_pWndTabs->widget(index); - m_pWndTabs->removeTab(index); - if(tab) - tab->deleteLater(); + KviNotifierWindowTab * pTab = (KviNotifierWindowTab *) m_pWndTabs->widget(iIndex); + m_pWndTabs->removeTab(iIndex); + if(pTab) + pTab->deleteLater(); if(m_pWndTabs->count()==0) hideNow(); diff --git a/src/modules/notifier/notifierwindowtab.cpp b/src/modules/notifier/notifierwindowtab.cpp index aa7f19223..8ac220a84 100644 --- a/src/modules/notifier/notifierwindowtab.cpp +++ b/src/modules/notifier/notifierwindowtab.cpp @@ -38,6 +38,9 @@ #include <QScrollBar> #include <QResizeEvent> #include <QPainter> +#include <QTabWidget> +#include <QVBoxLayout> +#include <QWidget> #ifdef COMPILE_PSEUDO_TRANSPARENCY #include <QPixmap> @@ -46,23 +49,23 @@ extern KviNotifierWindow * g_pNotifierWindow; -KviNotifierWindowTab::KviNotifierWindowTab(KviWindow * pWnd, QTabWidget *parent) - : QScrollArea(parent) +KviNotifierWindowTab::KviNotifierWindowTab(KviWindow * pWnd, QTabWidget * pParent) +: QScrollArea(pParent) { m_pWnd = pWnd; if(m_pWnd) { - m_label = m_pWnd->windowName(); + m_szLabel = m_pWnd->windowName(); connect(pWnd,SIGNAL(windowNameChanged()),this,SLOT(labelChanged())); connect(pWnd,SIGNAL(destroyed()),this,SLOT(closeMe())); } else { - m_label = (QString)"----"; + m_szLabel = "----"; } - if(parent) + if(pParent) { - m_pParent=parent; - m_pParent->addTab(this, m_label); + m_pParent = pParent; + m_pParent->addTab(this, m_szLabel); } setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -71,7 +74,7 @@ KviNotifierWindowTab::KviNotifierWindowTab(KviWindow * pWnd, QTabWidget *parent) if(verticalScrollBar()) connect(verticalScrollBar(),SIGNAL(rangeChanged(int, int)),this, SLOT(scrollRangeChanged(int, int))); - QPalette pal=palette(); + QPalette pal = palette(); pal.setColor(backgroundRole(), Qt::transparent); setPalette(pal); @@ -92,17 +95,17 @@ KviNotifierWindowTab::~KviNotifierWindowTab() m_pVWidget->deleteLater(); } -void KviNotifierWindowTab::appendMessage(KviNotifierMessage * m) +void KviNotifierWindowTab::appendMessage(KviNotifierMessage * pMessage) { - m_pVBox->addWidget(m); - m->setFixedWidth(viewport()->width()); + m_pVBox->addWidget(pMessage); + pMessage->setFixedWidth(viewport()->width()); while(m_pVBox->count() > MAX_MESSAGES_IN_WINDOW) { - QLayoutItem* tmp=m_pVBox->takeAt(0); - KviNotifierMessage* tmp2=(KviNotifierMessage*)tmp->widget(); - if(tmp2) - tmp2->deleteLater(); + QLayoutItem * pTmp = m_pVBox->takeAt(0); + KviNotifierMessage * pTmp2 = (KviNotifierMessage*)pTmp->widget(); + if(pTmp2) + pTmp2->deleteLater(); } } @@ -110,10 +113,10 @@ void KviNotifierWindowTab::updateGui() { for(int i=0; i<m_pVBox->count(); ++i) { - QLayoutItem* tmp=m_pVBox->itemAt(i); - KviNotifierMessage* tmp2=(KviNotifierMessage*)tmp->widget(); - if(tmp2) - tmp2->updateGui(); + QLayoutItem * pTmp = m_pVBox->itemAt(i); + KviNotifierMessage * pTmp2 = (KviNotifierMessage*)pTmp->widget(); + if(pTmp2) + pTmp2->updateGui(); } } @@ -126,18 +129,21 @@ void KviNotifierWindowTab::scrollRangeChanged(int, int) void KviNotifierWindowTab::labelChanged() { - if(!m_pWnd || !m_pParent)return; + if(!m_pWnd || !m_pParent) + return; - int i = m_pParent->indexOf(this); - m_label = m_pWnd->windowName(); - if(i>-1) - m_pParent->setTabText (i, m_label); + int iIdx = m_pParent->indexOf(this); + m_szLabel = m_pWnd->windowName(); + if(iIdx > -1) + m_pParent->setTabText(iIdx, m_szLabel); } void KviNotifierWindowTab::mouseDoubleClickEvent(QMouseEvent *) { - if(!m_pWnd || !g_pNotifierWindow)return; - if(!g_pApp->windowExists(m_pWnd))return; + if(!m_pWnd || !g_pNotifierWindow) + return; + if(!g_pApp->windowExists(m_pWnd)) + return; g_pNotifierWindow->hideNow(); @@ -158,10 +164,10 @@ void KviNotifierWindowTab::closeMe() //our window has been closed if(m_pParent && g_pNotifierWindow) { - int index = m_pParent->indexOf(this); - if(index!=-1) + int iIdx = m_pParent->indexOf(this); + if(iIdx != -1) { - g_pNotifierWindow->slotTabCloseRequested(index); + g_pNotifierWindow->slotTabCloseRequested(iIdx); } } } @@ -171,19 +177,19 @@ void KviNotifierWindowTab::resizeEvent(QResizeEvent *) if(m_pVBox) { int iWidth = viewport()->width(); - KviNotifierMessage* m; - for(int i=0;i<m_pVBox->count(); i++) + KviNotifierMessage * pMessage; + for(int i=0; i < m_pVBox->count(); i++) { - m = (KviNotifierMessage*)m_pVBox->itemAt(i)->widget(); - if(m) - m->setFixedWidth(iWidth); + pMessage = (KviNotifierMessage *)m_pVBox->itemAt(i)->widget(); + if(pMessage) + pMessage->setFixedWidth(iWidth); } } } void KviNotifierWindowTab::paintEvent(QPaintEvent * e) { - QPainter *p = new QPainter(viewport()); + QPainter * pPainter = new QPainter(viewport()); //make sure you clean your widget with a transparent // color before doing any rendering @@ -193,27 +199,28 @@ void KviNotifierWindowTab::paintEvent(QPaintEvent * e) #ifdef COMPILE_PSEUDO_TRANSPARENCY if(KVI_OPTION_BOOL(KviOption_boolUseCompositingForTransparency) && g_pApp->supportsCompositing()) { - p->save(); - p->setCompositionMode(QPainter::CompositionMode_Source); - QColor col=KVI_OPTION_COLOR(KviOption_colorGlobalTransparencyFade); + pPainter->save(); + pPainter->setCompositionMode(QPainter::CompositionMode_Source); + QColor col = KVI_OPTION_COLOR(KviOption_colorGlobalTransparencyFade); col.setAlphaF((float)((float)KVI_OPTION_UINT(KviOption_uintGlobalTransparencyChildFadeFactor) / (float)100)); - p->fillRect(e->rect(), col); - p->restore(); + pPainter->fillRect(e->rect(), col); + pPainter->restore(); } else if(g_pShadedChildGlobalDesktopBackground) { QPoint pnt = mapToGlobal(e->rect().topLeft()); - p->drawTiledPixmap(e->rect(),*(g_pShadedChildGlobalDesktopBackground), pnt); + pPainter->drawTiledPixmap(e->rect(),*(g_pShadedChildGlobalDesktopBackground), pnt); } else { #endif QPixmap * pPix = KVI_OPTION_PIXMAP(KviOption_pixmapNotifierBackground).pixmap(); - if(pPix) KviPixmapUtils::drawPixmapWithPainter(p,pPix,KVI_OPTION_UINT(KviOption_uintNotifierPixmapAlign),e->rect(),e->rect().width(),e->rect().height()); - else p->fillRect(e->rect(),KVI_OPTION_COLOR(KviOption_colorNotifierBackground)); + if(pPix) + KviPixmapUtils::drawPixmapWithPainter(pPainter,pPix,KVI_OPTION_UINT(KviOption_uintNotifierPixmapAlign),e->rect(),e->rect().width(),e->rect().height()); + else pPainter->fillRect(e->rect(),KVI_OPTION_COLOR(KviOption_colorNotifierBackground)); #ifdef COMPILE_PSEUDO_TRANSPARENCY } #endif - delete p; + delete pPainter; e->ignore(); } diff --git a/src/modules/notifier/notifierwindowtab.h b/src/modules/notifier/notifierwindowtab.h index 6ba63b782..0e6edcdbe 100644 --- a/src/modules/notifier/notifierwindowtab.h +++ b/src/modules/notifier/notifierwindowtab.h @@ -24,42 +24,96 @@ // //============================================================================= +/** +* \file notifierwindowtab.h +* \author Fabio Bas +* \brief Defines the tab page for the notifier object +*/ + #include "notifiermessage.h" #include "kvi_settings.h" -#include <QTabWidget> #include <QScrollArea> -#include <QVBoxLayout> -#include <QWidget> +class QVBoxLayout; +class QWidget; +class QTabWidget; class QPainter; class KviWindow; -class KviNotifierWindowTab : public QScrollArea // this class defines an object for every single tab about the tabs area +/** +* \class KviNotifierWindowTab +* \brief Defines an object for every single tab about the tabs area +*/ +class KviNotifierWindowTab : public QScrollArea { Q_OBJECT public: - KviNotifierWindowTab(KviWindow *, QTabWidget*); + /** + * \brief Creates the tab object + * \param pWnd The name of the window represented by the tab + * \param pParent The parent area container + * \return KviNotifierWindowTab + */ + KviNotifierWindowTab(KviWindow * pWnd, QTabWidget * pParent); + + /** + * \brief Destroys the tab object + */ ~KviNotifierWindowTab(); private: - QString m_label; - KviWindow * m_pWnd; - QTabWidget * m_pParent; - QVBoxLayout * m_pVBox; - QWidget * m_pVWidget; + QString m_szLabel; + KviWindow * m_pWnd; + QTabWidget * m_pParent; + QVBoxLayout * m_pVBox; + QWidget * m_pVWidget; public: - void appendMessage(KviNotifierMessage * m); + /** + * \brief Appends the given message to the window + * \param pMessage The message received to append + * \return void + */ + void appendMessage(KviNotifierMessage * pMessage); + + /** + * \brief Updates the GUI + * \return void + */ void updateGui(); - inline QString label() const { return m_label; }; + + /** + * \brief Returns the name of the current window + * \return QString + */ + inline QString label() const { return m_szLabel; }; + + /** + * \brief Returns the pointer of the current window + * \return KviWindow * + */ inline KviWindow * wnd() const { return m_pWnd; }; protected: virtual void mouseDoubleClickEvent(QMouseEvent * e); virtual void resizeEvent(QResizeEvent * e); virtual void paintEvent(QPaintEvent * e); private slots: + /** + * \brief Emitted when the scrollbar range is changed + * \return void + */ void scrollRangeChanged(int, int); + + /** + * \brief Emitted when the window changes its name + * \return void + */ void labelChanged(); + + /** + * \brief Emitted when the window is being destroyed + * \return void + */ void closeMe(); }; |
