diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index ba3b52e77f..0bd2592f6d 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -26,6 +26,7 @@ along with this program. If not, see . #include "dashboard/dashboard_config.h" #include "desktopgrid/desktopgrid_config.h" #include "diminactive/diminactive_config.h" +#include "login/login_config.h" #include "magiclamp/magiclamp_config.h" #include "translucency/translucency_config.h" #include "presentwindows/presentwindows_config.h" @@ -65,6 +66,7 @@ KWIN_EFFECT_CONFIG_MULTIPLE(builtins, KWIN_EFFECT_CONFIG_SINGLE(dashboard, DashboardEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(desktopgrid, DesktopGridEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(diminactive, DimInactiveEffectConfig) + KWIN_EFFECT_CONFIG_SINGLE(login, LoginEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(magiclamp, MagicLampEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(presentwindows, PresentWindowsEffectConfig) KWIN_EFFECT_CONFIG_SINGLE(resize, ResizeEffectConfig) diff --git a/effects/login/CMakeLists.txt b/effects/login/CMakeLists.txt index a7cbbf3ce0..a60ad04efb 100644 --- a/effects/login/CMakeLists.txt +++ b/effects/login/CMakeLists.txt @@ -10,3 +10,17 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} install( FILES login/login.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) + +####################################### +# Config + +# Source files +set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources} + login/login_config.cpp + login/login_config.ui + ) + +# .desktop files +install( FILES + login/login_config.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) \ No newline at end of file diff --git a/effects/login/login.cpp b/effects/login/login.cpp index e1d934e236..e4f8fdd17d 100644 --- a/effects/login/login.cpp +++ b/effects/login/login.cpp @@ -22,6 +22,8 @@ along with this program. If not, see . #include +#include + namespace KWin { @@ -31,6 +33,7 @@ LoginEffect::LoginEffect() : progress(1.0) , login_window(NULL) { + reconfigure(ReconfigureAll); connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*))); } @@ -61,8 +64,19 @@ void LoginEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int void LoginEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) { - if (w == login_window && progress != 1.0) - data.opacity *= (1.0 - progress); + if (w == login_window) { + if (m_fadeToBlack) { + if (progress < 0.5) + data.brightness *= (1.0 - progress * 2); + if (progress >= 0.5) { + data.opacity *= (1.0 - (progress - 0.5) * 2); + data.brightness = 0; + } + } else if (progress < 1.0) { + data.opacity *= (1.0 - progress); + } + } + effects->paintWindow(w, mask, region, data); } @@ -73,6 +87,12 @@ void LoginEffect::postPaintScreen() effects->postPaintScreen(); } +void LoginEffect::reconfigure(ReconfigureFlags) +{ + KConfigGroup conf = effects->effectConfig("Login"); + m_fadeToBlack = (conf.readEntry("FadeToBlack", true)); +} + void LoginEffect::slotWindowClosed(EffectWindow* w) { if (isLoginSplash(w)) { @@ -81,6 +101,7 @@ void LoginEffect::slotWindowClosed(EffectWindow* w) login_window = w; login_window->refWindow(); progress = 0.0; + effects->addRepaintFull(); } } diff --git a/effects/login/login.desktop b/effects/login/login.desktop index 76c716bf70..1cb215ef93 100644 --- a/effects/login/login.desktop +++ b/effects/login/login.desktop @@ -1,89 +1,5 @@ [Desktop Entry] Name=Login -Name[af]=Aanteken -Name[ar]=ولوج -Name[ast]=Accesu -Name[be]=Уваход -Name[be@latin]=Uvachod -Name[bg]=Вход -Name[bn]=লগ-ইন -Name[bn_IN]=লগ-ইন করুন -Name[bs]=Prijava -Name[ca]=Entrada -Name[ca@valencia]=Entrada -Name[cs]=Přihlášení -Name[csb]=Logòwanié -Name[da]=Login -Name[de]=Anmelden -Name[el]=Σύνδεση -Name[en_GB]=Login -Name[eo]=Ensaluto -Name[es]=Acceso -Name[et]=Sisselogimine -Name[eu]=Saio hasiera -Name[fi]=Sisäänkirjautuminen -Name[fr]=Connexion -Name[fy]=Ynlogge -Name[ga]=Logáil Isteach -Name[gl]=Acceso -Name[gu]=પ્રવેશ -Name[he]=כניסה -Name[hi]=लॉगइन -Name[hne]=लागइन -Name[hr]=Prijava -Name[hsb]=Přizjewjenje -Name[hu]=Bejelentkezés -Name[ia]=Accesso de identification -Name[id]=Log Masuk -Name[is]=Innskráning -Name[it]=Accesso -Name[ja]=ログイン -Name[kk]=Кіру -Name[km]=ចូល -Name[kn]=ಪ್ರವೇಶಿಸು (ಲಾಗಿನ್) -Name[ko]=로그인 -Name[ku]=Têketin -Name[lt]=Prisijungti -Name[lv]=Pieteikties -Name[mai]=लागिन -Name[mk]=Најавување -Name[ml]=അകത്തുകയറുക -Name[mr]=दाखलन -Name[nb]=Logg inn -Name[nds]=Anmellen -Name[ne]=लगइन गर्नुहोस् -Name[nl]=Aanmelden -Name[nn]=Innlogging -Name[oc]=Connexion -Name[or]=ଲଗଇନ -Name[pa]=ਲਾਗਇਨ -Name[pl]=Logowanie -Name[pt]=Arranque -Name[pt_BR]=Início de sessão -Name[ro]=Autentificare -Name[ru]=Вход в систему -Name[se]=Sisačáliheapmi -Name[si]=පිවිසුම -Name[sk]=Prihlásenie -Name[sl]=Prijava -Name[sr]=Пријава -Name[sr@ijekavian]=Пријава -Name[sr@ijekavianlatin]=Prijava -Name[sr@latin]=Prijava -Name[sv]=Inloggning -Name[ta]=நுழைக -Name[te]=లాగిన్ -Name[tg]=Воридот -Name[th]=ลงบันทึกเข้าระบบ -Name[tr]=Giriş -Name[ug]=تىزىمغا كىر -Name[uk]=Вхід -Name[uz]=Kirish -Name[uz@cyrillic]=Кириш -Name[wa]=Elodjaedje -Name[x-test]=xxLoginxx -Name[zh_CN]=登录 -Name[zh_TW]=登入 Icon=preferences-system-windows-effect-login Comment=Smoothly fade to the desktop when logging in Comment[ar]=اظهار سطح المكتب بنعومة عند الولوج @@ -153,10 +69,10 @@ Comment[zh_TW]=登入時平順地淡入桌面 Type=Service X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Lubos Lunak -X-KDE-PluginInfo-Email=l.lunak@kde.org +X-KDE-PluginInfo-Author=Lubos Lunak, Kai Uwe Broulik +X-KDE-PluginInfo-Email=l.lunak@kde.org, kde@privat.broulik.de X-KDE-PluginInfo-Name=kwin4_effect_login -X-KDE-PluginInfo-Version=0.1.0 +X-KDE-PluginInfo-Version=0.1.1 X-KDE-PluginInfo-Category=Appearance X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL diff --git a/effects/login/login.h b/effects/login/login.h index b1735a328f..67b4d7ec9f 100644 --- a/effects/login/login.h +++ b/effects/login/login.h @@ -37,6 +37,7 @@ public: virtual void postPaintScreen(); virtual void prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time); virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data); + virtual void reconfigure(ReconfigureFlags); public Q_SLOTS: void slotWindowClosed(EffectWindow *w); @@ -45,6 +46,7 @@ private: bool isLoginSplash(EffectWindow* w); double progress; // 0-1 EffectWindow* login_window; + bool m_fadeToBlack; }; } // namespace diff --git a/effects/login/login_config.cpp b/effects/login/login_config.cpp new file mode 100644 index 0000000000..e8e070092d --- /dev/null +++ b/effects/login/login_config.cpp @@ -0,0 +1,81 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2010 Martin Gräßlin + Copyright (C) 2011 Kai Uwe Broulik + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#include "login_config.h" +#include + +#include + +#include + +namespace KWin +{ + +KWIN_EFFECT_CONFIG_FACTORY + +LoginEffectConfigForm::LoginEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +LoginEffectConfig::LoginEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) +{ + m_ui = new LoginEffectConfigForm(this); + + QVBoxLayout* layout = new QVBoxLayout(this); + + layout->addWidget(m_ui); + + connect(m_ui->fadetoblackBox, SIGNAL(stateChanged(int)), this, SLOT(changed())); + + load(); +} + +void LoginEffectConfig::load() +{ + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig("Login"); + m_ui->fadetoblackBox->setChecked(conf.readEntry("FadeToBlack", true)); + + emit changed(false); +} + +void LoginEffectConfig::save() +{ + KConfigGroup conf = EffectsHandler::effectConfig("Login"); + conf.writeEntry("FadeToBlack", m_ui->fadetoblackBox->isChecked()); + + conf.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage("login"); +} + +void LoginEffectConfig::defaults() +{ + m_ui->fadetoblackBox->setChecked(true); + emit changed(true); +} + +} // namespace + +#include "login_config.moc" \ No newline at end of file diff --git a/effects/login/login_config.desktop b/effects/login/login_config.desktop new file mode 100644 index 0000000000..f20f47aca8 --- /dev/null +++ b/effects/login/login_config.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Service +X-KDE-ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_login +X-KDE-PluginKeyword=login + +Name=Login \ No newline at end of file diff --git a/effects/login/login_config.h b/effects/login/login_config.h new file mode 100644 index 0000000000..892154a184 --- /dev/null +++ b/effects/login/login_config.h @@ -0,0 +1,57 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2010 Martin Gräßlin + Copyright (C) 2011 Kai Uwe Broulik + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ + +#ifndef KWIN_LOGIN_CONFIG_H +#define KWIN_LOGIN_CONFIG_H + +#include + +#include "ui_login_config.h" + + +namespace KWin +{ + +class LoginEffectConfigForm : public QWidget, public Ui::LoginEffectConfigForm +{ + Q_OBJECT +public: + explicit LoginEffectConfigForm(QWidget* parent = 0); +}; + +class LoginEffectConfig : public KCModule +{ + Q_OBJECT +public: + explicit LoginEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + +public slots: + virtual void save(); + virtual void load(); + virtual void defaults(); + +private: + LoginEffectConfigForm* m_ui; +}; + +} // namespace + +#endif \ No newline at end of file diff --git a/effects/login/login_config.ui b/effects/login/login_config.ui new file mode 100644 index 0000000000..c45845ae8f --- /dev/null +++ b/effects/login/login_config.ui @@ -0,0 +1,38 @@ + + + KWin::LoginEffectConfigForm + + + + 0 + 0 + 400 + 160 + + + + + + + Fade to black (fullscreen splash screens only) + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + \ No newline at end of file