diff options
| author | 2010-06-12 12:59:48 +0000 | |
|---|---|---|
| committer | 2010-06-12 12:59:48 +0000 | |
| commit | d2161d19d2f896da64aa1e8e3d0d6d84099611e7 (patch) | |
| tree | 98f632a3c580349ebfef5916390ddb4a51a1c997 /src/modules/notifier/notifierwindowtab.cpp | |
| parent | kvi_ircconnection.cpp: Improve warning in line 978f. (diff) | |
| download | KVIrc-d2161d19d2f896da64aa1e8e3d0d6d84099611e7.tar.gz KVIrc-d2161d19d2f896da64aa1e8e3d0d6d84099611e7.tar.bz2 KVIrc-d2161d19d2f896da64aa1e8e3d0d6d84099611e7.zip | |
reworked a bit the notifier to fix #809 and to give it a bit better looking
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4448 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/notifier/notifierwindowtab.cpp')
| -rw-r--r-- | src/modules/notifier/notifierwindowtab.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/modules/notifier/notifierwindowtab.cpp b/src/modules/notifier/notifierwindowtab.cpp index e4a29cf7e..aa7f19223 100644 --- a/src/modules/notifier/notifierwindowtab.cpp +++ b/src/modules/notifier/notifierwindowtab.cpp @@ -28,6 +28,7 @@ #include "notifierwindow.h" #include "notifiersettings.h" +#include "kvi_app.h" #include "kvi_config.h" #include "kvi_locale.h" #include "kvi_frame.h" @@ -36,6 +37,12 @@ #include <QScrollBar> #include <QResizeEvent> +#include <QPainter> + +#ifdef COMPILE_PSEUDO_TRANSPARENCY + #include <QPixmap> + extern QPixmap * g_pShadedChildGlobalDesktopBackground; +#endif extern KviNotifierWindow * g_pNotifierWindow; @@ -99,6 +106,17 @@ void KviNotifierWindowTab::appendMessage(KviNotifierMessage * m) } } +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(); + } +} + void KviNotifierWindowTab::scrollRangeChanged(int, int) { //this is the autoscroll @@ -163,6 +181,42 @@ void KviNotifierWindowTab::resizeEvent(QResizeEvent *) } } +void KviNotifierWindowTab::paintEvent(QPaintEvent * e) +{ + QPainter *p = new QPainter(viewport()); + + //make sure you clean your widget with a transparent + // color before doing any rendering + // note the usage of a composition mode Source + // it's important! + + #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); + col.setAlphaF((float)((float)KVI_OPTION_UINT(KviOption_uintGlobalTransparencyChildFadeFactor) / (float)100)); + p->fillRect(e->rect(), col); + p->restore(); + } else if(g_pShadedChildGlobalDesktopBackground) + { + QPoint pnt = mapToGlobal(e->rect().topLeft()); + p->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)); + #ifdef COMPILE_PSEUDO_TRANSPARENCY + } + #endif + + delete p; + e->ignore(); +} + #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES #include "m_notifierwindowtab.moc" #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES |
