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/notifiermessage.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/notifiermessage.cpp')
| -rw-r--r-- | src/modules/notifier/notifiermessage.cpp | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/src/modules/notifier/notifiermessage.cpp b/src/modules/notifier/notifiermessage.cpp index 2dec0919e..a5d69a1cd 100644 --- a/src/modules/notifier/notifiermessage.cpp +++ b/src/modules/notifier/notifiermessage.cpp @@ -34,18 +34,43 @@ KviNotifierMessage::KviNotifierMessage(QPixmap * pPixmap, const QString &szText) { - bool bShowImages=KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages); + m_pLabel0 = 0; + m_pLabel1 = 0; + m_szText=szText; m_pPixmap=pPixmap; - m_pHBox = new QHBoxLayout(this); - m_pHBox->setSpacing(SPACING); - m_pHBox->setMargin(SPACING); - //QByteArray utf8 = szText.toUtf8(); //if(utf8.data()) // qDebug("NOTIFIER TEXT MESSAGE: \n%s\n",utf8.data()); + m_pHBox = new QHBoxLayout(this); + m_pHBox->setSpacing(SPACING); + m_pHBox->setMargin(SPACING); + + updateGui(); +} + +KviNotifierMessage::~KviNotifierMessage() +{ + if(m_pLabel0) + m_pLabel0->deleteLater(); + if(m_pLabel1) + m_pLabel1->deleteLater(); + if(m_pHBox) + m_pHBox->deleteLater(); +} + +void KviNotifierMessage::updateGui() +{ + bool bShowImages=KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages); + + if(m_pLabel0) + delete m_pLabel0; + + if(m_pLabel1) + delete m_pLabel1; + if(bShowImages) { m_pLabel0 = new QLabel(this); @@ -56,28 +81,20 @@ KviNotifierMessage::KviNotifierMessage(QPixmap * pPixmap, const QString &szText) m_pLabel0 = 0; } - m_pLabel1 = new QLabel(this); m_pLabel1->setTextFormat(Qt::RichText); m_pLabel1->setText(KviHtmlGenerator::convertToHtml(m_szText)); m_pLabel1->setWordWrap(true); - + m_pLabel1->setFont(KVI_OPTION_FONT(KviOption_fontNotifier)); + QPalette pal = m_pLabel1->palette(); + pal.setColor(QPalette::WindowText, KVI_OPTION_COLOR(KviOption_colorNotifierForeground)); + m_pLabel1->setPalette(pal); + if(bShowImages) { m_pHBox->setStretch(1,99); m_pHBox->addWidget(m_pLabel0); } m_pHBox->addWidget(m_pLabel1); -} -KviNotifierMessage::~KviNotifierMessage() -{ - if(m_pLabel0) - m_pLabel0->deleteLater(); - if(m_pLabel1) - m_pLabel1->deleteLater(); - if(m_pHBox) - m_pHBox->deleteLater(); } - - |
