PanelConfigView respects contrast effect settings

This commit is contained in:
Sebastian Kügler 2014-02-06 03:52:56 +01:00
parent 62de49128e
commit 15e4d93102
2 changed files with 13 additions and 5 deletions

View File

@ -48,11 +48,8 @@ PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *pa
setFlags(Qt::FramelessWindowHint); setFlags(Qt::FramelessWindowHint);
KWindowEffects::enableBlurBehind(winId(), true); KWindowEffects::enableBlurBehind(winId(), true);
if (qGray(m_theme.color(Plasma::Theme::BackgroundColor).rgb()) > 127) { updateContrast();
KWindowEffects::enableBackgroundContrast(winId(), true, 0.30, 1.9, 1.7); connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelConfigView::updateContrast);
} else {
KWindowEffects::enableBackgroundContrast(winId(), true, 0.45, 0.45, 1.7);
}
engine()->rootContext()->setContextProperty("panel", panelView); engine()->rootContext()->setContextProperty("panel", panelView);
engine()->rootContext()->setContextProperty("configDialog", this); engine()->rootContext()->setContextProperty("configDialog", this);
@ -70,6 +67,14 @@ void PanelConfigView::init()
syncGeometry(); syncGeometry();
} }
void PanelConfigView::updateContrast()
{
KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(),
m_theme.backgroundContrast(),
m_theme.backgroundIntensity(),
m_theme.backgroundSaturation());
}
void PanelConfigView::showAddWidgetDialog() void PanelConfigView::showAddWidgetDialog()
{ {
QAction *addWidgetAction = m_containment->actions()->action("add widgets"); QAction *addWidgetAction = m_containment->actions()->action("add widgets");

View File

@ -56,6 +56,9 @@ protected:
protected Q_SLOTS: protected Q_SLOTS:
void syncGeometry(); void syncGeometry();
private Q_SLOTS:
void updateContrast();
private: private:
Plasma::Containment *m_containment; Plasma::Containment *m_containment;
PanelView *m_panelView; PanelView *m_panelView;