From d2161d19d2f896da64aa1e8e3d0d6d84099611e7 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 12 Jun 2010 12:59:48 +0000 Subject: 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 --- src/modules/notifier/notifierwindowtab.cpp | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'src/modules/notifier/notifierwindowtab.cpp') 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 #include +#include + +#ifdef COMPILE_PSEUDO_TRANSPARENCY + #include + 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; icount(); ++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 -- cgit v1.3.1-10-gc9f91