diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index b64b5c2e62..352ea8d9bd 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -81,6 +81,7 @@ set( kwin4_effect_include_directories ) # scripted effects add_subdirectory( fade ) +add_subdirectory( login ) # scripted effects only relevant to desktop if( NOT KWIN_MOBILE_EFFECTS ) @@ -93,7 +94,6 @@ endif( NOT KWIN_MOBILE_EFFECTS ) # Common effects include( dialogparent/CMakeLists.txt ) -include( login/CMakeLists.txt ) include( outline/CMakeLists.txt ) include( presentwindows/CMakeLists.txt ) include( screenedge/CMakeLists.txt ) diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index a762c48a6c..1cc2d91710 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -26,7 +26,6 @@ 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" @@ -62,7 +61,6 @@ 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 0e1f6ef85d..1242620d48 100644 --- a/effects/login/CMakeLists.txt +++ b/effects/login/CMakeLists.txt @@ -1,30 +1 @@ -####################################### -# Effect - -# Source files -set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} - login/login.cpp - ) - -kde4_add_kcfg_files(kwin4_effect_builtins_sources login/loginconfig.kcfgc) - -# .desktop files -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 - ) - -kde4_add_kcfg_files(kwin4_effect_builtins_config_sources login/loginconfig.kcfgc) - -# .desktop files -install( FILES - login/login_config.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) +add_subdirectory(package) diff --git a/effects/login/login.cpp b/effects/login/login.cpp deleted file mode 100644 index 698b03d489..0000000000 --- a/effects/login/login.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2007 Lubos Lunak - -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.h" - -// KConfigSkeleton -#include "loginconfig.h" - -#include - -#include - -namespace KWin -{ - -KWIN_EFFECT(login, LoginEffect) - -LoginEffect::LoginEffect() - : progress(1.0) - , login_window(NULL) -{ - reconfigure(ReconfigureAll); - connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); -} - -void LoginEffect::prePaintScreen(ScreenPrePaintData& data, int time) -{ - if (login_window != NULL) { - if (progress != 1.0) { - progress = qBound(0.0, progress + time / animationTime(2000), 1.0); - if (progress == 1.0) { - login_window->unrefWindow(); - login_window = NULL; - effects->prePaintScreen(data, time); - return; - } - } - } - effects->prePaintScreen(data, time); -} - -void LoginEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) -{ - if (progress != 1.0 && w == login_window) { - w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE); - data.setTranslucent(); - } - effects->prePaintWindow(w, data, time); -} - -void LoginEffect::paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data) -{ - if (w == login_window) { - if (m_fadeToBlack) { - if (progress < 0.5) - data.multiplyBrightness((1.0 - progress * 2)); - if (progress >= 0.5) { - data.multiplyOpacity((1.0 - (progress - 0.5) * 2)); - data.setBrightness(0); - } - } else if (progress < 1.0) { - data.multiplyOpacity((1.0 - progress)); - } - } - - effects->paintWindow(w, mask, region, data); -} - -void LoginEffect::postPaintScreen() -{ - if (login_window != NULL && progress != 1.0) - effects->addRepaintFull(); - effects->postPaintScreen(); -} - -void LoginEffect::reconfigure(ReconfigureFlags) -{ - LoginConfig::self()->readConfig(); - m_fadeToBlack = LoginConfig::fadeToBlack(); -} - -void LoginEffect::slotWindowClosed(EffectWindow* w) -{ - if (isLoginSplash(w)) { - if (login_window) - return; // We already have a window... should never happen. - login_window = w; - login_window->refWindow(); - progress = 0.0; - - effects->addRepaintFull(); - } -} - -bool LoginEffect::isLoginSplash(EffectWindow* w) -{ - // TODO there should be probably a better way (window type?) - // see also fade effect and composite.cpp - if (w->windowClass() == "ksplashx ksplashx" - || w->windowClass() == "ksplashsimple ksplashsimple" - || w->windowClass() == "qt-subapplication ksplashqml") { - return true; - } - return false; -} - -bool LoginEffect::isActive() const -{ - return login_window != NULL; -} - -} // namespace diff --git a/effects/login/login.h b/effects/login/login.h deleted file mode 100644 index 6994232d10..0000000000 --- a/effects/login/login.h +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************** - KWin - the KDE window manager - This file is part of the KDE project. - -Copyright (C) 2007 Lubos Lunak - -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_H -#define KWIN_LOGIN_H - -#include - - -namespace KWin -{ - -class LoginEffect - : public Effect -{ - Q_OBJECT - Q_PROPERTY(bool fadeToBlack READ isFadeToBlack) -public: - LoginEffect(); - virtual void prePaintScreen(ScreenPrePaintData& data, int time); - 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); - virtual bool isActive() const; - - // for properties - bool isFadeToBlack() const { - return m_fadeToBlack; - } -public Q_SLOTS: - void slotWindowClosed(KWin::EffectWindow *w); - -private: - bool isLoginSplash(EffectWindow* w); - double progress; // 0-1 - EffectWindow* login_window; - bool m_fadeToBlack; -}; - -} // namespace - -#endif diff --git a/effects/login/login_config.cpp b/effects/login/login_config.cpp deleted file mode 100644 index b6d8da490a..0000000000 --- a/effects/login/login_config.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************** - 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" - -// KConfigSkeleton -#include "loginconfig.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); - - addConfig(LoginConfig::self(), m_ui); - - load(); -} - -void LoginEffectConfig::save() -{ - KCModule::save(); - EffectsHandler::sendReloadMessage("login"); -} - -} // namespace - -#include "login_config.moc" diff --git a/effects/login/login_config.desktop b/effects/login/login_config.desktop deleted file mode 100644 index db8cb790fe..0000000000 --- a/effects/login/login_config.desktop +++ /dev/null @@ -1,94 +0,0 @@ -[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 -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[vi]=Đăng nhập -Name[wa]=Elodjaedje -Name[x-test]=xxLoginxx -Name[zh_CN]=登录 -Name[zh_TW]=登入 diff --git a/effects/login/login_config.h b/effects/login/login_config.h deleted file mode 100644 index 722626332f..0000000000 --- a/effects/login/login_config.h +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************** - 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(); - -private: - LoginEffectConfigForm* m_ui; -}; - -} // namespace - -#endif diff --git a/effects/login/loginconfig.kcfgc b/effects/login/loginconfig.kcfgc deleted file mode 100644 index 6bfbba2be8..0000000000 --- a/effects/login/loginconfig.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=login.kcfg -ClassName=LoginConfig -NameSpace=KWin -Singleton=true -Mutators=true diff --git a/effects/login/package/CMakeLists.txt b/effects/login/package/CMakeLists.txt new file mode 100644 index 0000000000..5e8c10c9ad --- /dev/null +++ b/effects/login/package/CMakeLists.txt @@ -0,0 +1,6 @@ +install(DIRECTORY contents DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/effects/kwin4_effect_login) +install(FILES metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/effects/kwin4_effect_login) + +install(FILES metadata.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/${KWIN_NAME} + RENAME kwin4_effect_login.desktop) diff --git a/effects/login/package/contents/code/main.js b/effects/login/package/contents/code/main.js new file mode 100644 index 0000000000..98228639a0 --- /dev/null +++ b/effects/login/package/contents/code/main.js @@ -0,0 +1,94 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2007 Lubos Lunak + Copyright (C) 2013 Martin Gräßlin + +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 . +*********************************************************************/ +/*global effect, effects, animate, animationTime, Effect*/ +var loginEffect = { + duration: animationTime(2000), + isFadeToBlack: false, + loadConfig: function () { + "use strict"; + loginEffect.isFadeToBlack = effect.readConfig("FadeToBlack", false); + }, + isLoginSplash: function (window) { + "use strict"; + var windowClass = window.windowClass; + if (windowClass === "ksplashx ksplashx") { + return true; + } + if (windowClass === "ksplashsimple ksplashsimple") { + return true; + } + if (windowClass === "qt-subapplication ksplashqml") { + return true; + } + return false; + }, + fadeOut: function (window) { + "use strict"; + animate({ + window: window, + duration: loginEffect.duration, + type: Effect.Opacity, + from: 1.0, + to: 0.0 + }); + }, + fadeToBlack: function (window) { + "use strict"; + animate({ + window: window, + duration: loginEffect.duration / 2, + animations: [{ + type: Effect.Brightness, + from: 1.0, + to: 0.0 + }, { + type: Effect.Opacity, + from: 1.0, + to: 0.0, + delay: loginEffect.duration / 2 + }, { + // TODO: is there a better way to keep brightness constant? + type: Effect.Brightness, + from: 0.0, + to: 0.0, + delay: loginEffect.duration / 2 + }] + }); + }, + closed: function (window) { + "use strict"; + if (!loginEffect.isLoginSplash(window)) { + return; + } + if (loginEffect.isFadeToBlack === true) { + loginEffect.fadeToBlack(window); + } else { + loginEffect.fadeOut(window); + } + }, + init: function () { + "use strict"; + effect.configChanged.connect(loginEffect.loadConfig); + effects.windowClosed.connect(loginEffect.closed); + loginEffect.loadConfig(); + } +}; +loginEffect.init(); diff --git a/effects/login/login.kcfg b/effects/login/package/contents/config/main.xml similarity index 86% rename from effects/login/login.kcfg rename to effects/login/package/contents/config/main.xml index adefe10203..626a7f074e 100644 --- a/effects/login/login.kcfg +++ b/effects/login/package/contents/config/main.xml @@ -3,8 +3,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - - + + false diff --git a/effects/login/login_config.ui b/effects/login/package/contents/ui/config.ui similarity index 100% rename from effects/login/login_config.ui rename to effects/login/package/contents/ui/config.ui diff --git a/effects/login/login.desktop b/effects/login/package/metadata.desktop similarity index 94% rename from effects/login/login.desktop rename to effects/login/package/metadata.desktop index 2e84d1a954..bd48400ebe 100644 --- a/effects/login/login.desktop +++ b/effects/login/package/metadata.desktop @@ -22,7 +22,7 @@ Name[es]=Acceso Name[et]=Sisselogimine Name[eu]=Saio hasiera Name[fi]=Sisäänkirjautuminen -Name[fr]=Connexion +Name[fr]=Connexion Name[fy]=Ynlogge Name[ga]=Logáil Isteach Name[gl]=Acceso @@ -154,14 +154,18 @@ Comment[zh_CN]=登录时平滑淡入到桌面 Comment[zh_TW]=登入時平順地淡入桌面 Type=Service -X-KDE-ServiceTypes=KWin/Effect -X-KDE-PluginInfo-Author=Lubos Lunak, Kai Uwe Broulik -X-KDE-PluginInfo-Email=l.lunak@kde.org, kde@privat.broulik.de +X-KDE-ServiceTypes=KWin/Effect,KCModule +X-KDE-PluginInfo-Author=Lubos Lunak, Kai Uwe Broulik, Martin Gräßlin +X-KDE-PluginInfo-Email=l.lunak@kde.org, kde@privat.broulik.de, mgraesslin@kde.org X-KDE-PluginInfo-Name=kwin4_effect_login -X-KDE-PluginInfo-Version=0.1.1 +X-KDE-PluginInfo-Version=0.2.0 X-KDE-PluginInfo-Category=Appearance X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-Library=kwin4_effect_builtins X-KDE-Ordering=40 +X-Plasma-API=javascript +X-Plasma-MainScript=code/main.js +X-KDE-PluginKeyword=kwin4_effect_login +X-KDE-Library=kcm_kwin4_effect_genericscripted +X-KDE-ParentComponents=kwin4_effect_login