X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fstatusbarmessagelabel.cpp;h=42eef766691fb9ad5cc08f75b4a83faa8bc2c0c1;hb=90c8ac359ff96d1ef622c9caef86dba0c70408bc;hp=814d6ef0d05779fdbf45fad33a99b8042eb4ea43;hpb=fec4b6aba639dac658d35475512c6f232c8aebe3;p=kdenlive diff --git a/src/statusbarmessagelabel.cpp b/src/statusbarmessagelabel.cpp index 814d6ef0..42eef766 100644 --- a/src/statusbarmessagelabel.cpp +++ b/src/statusbarmessagelabel.cpp @@ -21,11 +21,13 @@ ***************************************************************************/ #include "statusbarmessagelabel.h" +#include "kdenlivesettings.h" #include #include #include #include +#include #include #include @@ -43,12 +45,13 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget* parent) : m_closeButton(0) { setMinimumHeight(KIconLoader::SizeSmall); - QPalette palette; palette.setColor(QPalette::Background, Qt::transparent); setPalette(palette); - + m_hidetimer.setSingleShot(true); + m_hidetimer.setInterval(5000); connect(&m_timer, SIGNAL(timeout()), this, SLOT(timerDone())); + connect(&m_hidetimer, SIGNAL(timeout()), this, SLOT(closeErrorMessage())); m_closeButton = new QPushButton(i18nc("@action:button", "Close"), this); m_closeButton->hide(); @@ -63,6 +66,7 @@ void StatusBarMessageLabel::setMessage(const QString& text, MessageType type) { if ((text == m_text) && (type == m_type)) { + if (type == ErrorMessage) KNotification::event("ErrorMessage", m_text); return; } @@ -90,11 +94,13 @@ void StatusBarMessageLabel::setMessage(const QString& text, iconName = "dialog-ok"; // "ok" icon should probably be "dialog-success", but we don't have that icon in KDE 4.0 m_closeButton->hide(); + m_hidetimer.stop(); break; case InformationMessage: iconName = "dialog-information"; m_closeButton->hide(); + m_hidetimer.start(); break; case ErrorMessage: @@ -102,6 +108,8 @@ void StatusBarMessageLabel::setMessage(const QString& text, m_timer.start(100); m_state = Illuminate; m_closeButton->hide(); + KNotification::event("ErrorMessage", m_text); + m_hidetimer.stop(); break; case MltError: @@ -110,11 +118,13 @@ void StatusBarMessageLabel::setMessage(const QString& text, m_state = Illuminate; updateCloseButtonPosition(); m_closeButton->show(); + m_hidetimer.stop(); break; case DefaultMessage: default: m_closeButton->hide(); + m_hidetimer.stop(); break; } @@ -147,8 +157,7 @@ void StatusBarMessageLabel::paintEvent(QPaintEvent* /* event */) QColor backgroundColor; if (m_state == Default || m_illumination < 0) backgroundColor = palette().window().color(); else { - KColorScheme scheme(palette().currentColorGroup(), KColorScheme::Window); - backgroundColor = scheme.background(KColorScheme::NegativeBackground).color(); + backgroundColor = KStatefulBrush(KColorScheme::Window, KColorScheme::NegativeBackground, KSharedConfig::openConfig(KdenliveSettings::colortheme())).brush(this).color(); } if (m_state == Desaturate && m_illumination > 0) { backgroundColor.setAlpha(m_illumination * 2);