mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
kwin: implement configuration interface for dimscreen effect
should probably use widget other than KLineEdit for it tho Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
9a00dcda13
commit
3669928057
10 changed files with 264 additions and 13 deletions
|
@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include "diminactive/diminactive_config.h"
|
#include "diminactive/diminactive_config.h"
|
||||||
|
#include "dimscreen/dimscreen_config.h"
|
||||||
#include "presentwindows/presentwindows_config.h"
|
#include "presentwindows/presentwindows_config.h"
|
||||||
#include "resize/resize_config.h"
|
#include "resize/resize_config.h"
|
||||||
#include "showfps/showfps_config.h"
|
#include "showfps/showfps_config.h"
|
||||||
|
@ -41,6 +42,7 @@ namespace KWin
|
||||||
|
|
||||||
KWIN_EFFECT_CONFIG_MULTIPLE(builtins,
|
KWIN_EFFECT_CONFIG_MULTIPLE(builtins,
|
||||||
KWIN_EFFECT_CONFIG_SINGLE(diminactive, DimInactiveEffectConfig)
|
KWIN_EFFECT_CONFIG_SINGLE(diminactive, DimInactiveEffectConfig)
|
||||||
|
KWIN_EFFECT_CONFIG_SINGLE(dimscreen, DimScreenEffectConfig)
|
||||||
KWIN_EFFECT_CONFIG_SINGLE(presentwindows, PresentWindowsEffectConfig)
|
KWIN_EFFECT_CONFIG_SINGLE(presentwindows, PresentWindowsEffectConfig)
|
||||||
KWIN_EFFECT_CONFIG_SINGLE(resize, ResizeEffectConfig)
|
KWIN_EFFECT_CONFIG_SINGLE(resize, ResizeEffectConfig)
|
||||||
KWIN_EFFECT_CONFIG_SINGLE(showfps, ShowFpsEffectConfig)
|
KWIN_EFFECT_CONFIG_SINGLE(showfps, ShowFpsEffectConfig)
|
||||||
|
|
|
@ -7,10 +7,16 @@ set(kwin4_effect_builtins_sources
|
||||||
effects/diminactive/diminactive.cpp
|
effects/diminactive/diminactive.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_kcfg_files(kwin4_effect_builtins_sources effects/diminactive/diminactiveconfig.kcfgc)
|
kde4_add_kcfg_files(
|
||||||
|
kwin4_effect_builtins_sources
|
||||||
|
effects/diminactive/diminactiveconfig.kcfgc
|
||||||
|
)
|
||||||
|
|
||||||
# .desktop files
|
# .desktop files
|
||||||
install(FILES effects/diminactive/diminactive.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin)
|
install(
|
||||||
|
FILES effects/diminactive/diminactive.desktop
|
||||||
|
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin
|
||||||
|
)
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Config
|
# Config
|
||||||
|
@ -21,7 +27,13 @@ set(kwin4_effect_builtins_config_sources
|
||||||
effects/diminactive/diminactive_config.cpp
|
effects/diminactive/diminactive_config.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_kcfg_files(kwin4_effect_builtins_config_sources effects/diminactive/diminactiveconfig.kcfgc)
|
kde4_add_kcfg_files(
|
||||||
|
kwin4_effect_builtins_config_sources
|
||||||
|
effects/diminactive/diminactiveconfig.kcfgc
|
||||||
|
)
|
||||||
|
|
||||||
# .desktop files
|
# .desktop files
|
||||||
install(FILES effects/diminactive/diminactive_config.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin)
|
install(
|
||||||
|
FILES effects/diminactive/diminactive_config.desktop
|
||||||
|
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin
|
||||||
|
)
|
||||||
|
|
|
@ -7,5 +7,34 @@ set(kwin4_effect_builtins_sources
|
||||||
effects/dimscreen/dimscreen.cpp
|
effects/dimscreen/dimscreen.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kde4_add_kcfg_files(
|
||||||
|
kwin4_effect_builtins_sources
|
||||||
|
effects/dimscreen/dimscreenconfig.kcfgc
|
||||||
|
)
|
||||||
|
|
||||||
# .desktop files
|
# .desktop files
|
||||||
install(FILES effects/dimscreen/dimscreen.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin)
|
install(
|
||||||
|
FILES effects/dimscreen/dimscreen.desktop
|
||||||
|
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Config
|
||||||
|
|
||||||
|
# Source files
|
||||||
|
set(kwin4_effect_builtins_config_sources
|
||||||
|
${kwin4_effect_builtins_config_sources}
|
||||||
|
effects/dimscreen/dimscreen_config.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
kde4_add_kcfg_files(
|
||||||
|
kwin4_effect_builtins_config_sources
|
||||||
|
effects/dimscreen/dimscreenconfig.kcfgc
|
||||||
|
)
|
||||||
|
|
||||||
|
# .desktop files
|
||||||
|
install(
|
||||||
|
FILES effects/dimscreen/dimscreen_config.desktop
|
||||||
|
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}/kwin
|
||||||
|
)
|
|
@ -17,7 +17,9 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
#include "dimscreen.h"
|
#include "dimscreen.h"
|
||||||
|
#include "dimscreenconfig.h"
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -28,12 +30,6 @@ DimScreenEffect::DimScreenEffect()
|
||||||
, mDeactivateAnimation(false)
|
, mDeactivateAnimation(false)
|
||||||
, mWindow(nullptr)
|
, mWindow(nullptr)
|
||||||
{
|
{
|
||||||
mCheck << "kdesu kdesu";
|
|
||||||
mCheck << "kdesudo kdesudo";
|
|
||||||
mCheck << "polkit-kde-manager polkit-kde-manager";
|
|
||||||
mCheck << "polkit-kde-authentication-agent-1 polkit-kde-authentication-agent-1";
|
|
||||||
mCheck << "pinentry pinentry";
|
|
||||||
|
|
||||||
reconfigure(ReconfigureAll);
|
reconfigure(ReconfigureAll);
|
||||||
connect(
|
connect(
|
||||||
effects, SIGNAL(windowActivated(KWin::EffectWindow*)),
|
effects, SIGNAL(windowActivated(KWin::EffectWindow*)),
|
||||||
|
@ -43,6 +39,11 @@ DimScreenEffect::DimScreenEffect()
|
||||||
|
|
||||||
void DimScreenEffect::reconfigure(ReconfigureFlags)
|
void DimScreenEffect::reconfigure(ReconfigureFlags)
|
||||||
{
|
{
|
||||||
|
mWindowClasses.clear();
|
||||||
|
DimScreenConfig::self()->readConfig();
|
||||||
|
foreach (const QString &windowClass, DimScreenConfig::windowClasses()) {
|
||||||
|
mWindowClasses << QString::fromLatin1("%1 %2").arg(windowClass).arg(windowClass);
|
||||||
|
}
|
||||||
mTimeline.setDuration(animationTime(250));
|
mTimeline.setDuration(animationTime(250));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ void DimScreenEffect::slotWindowActivated(EffectWindow *w)
|
||||||
if (!w) {
|
if (!w) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mCheck.contains(w->windowClass())) {
|
if (mWindowClasses.contains(w->windowClass())) {
|
||||||
mActivated = true;
|
mActivated = true;
|
||||||
mActivateAnimation = true;
|
mActivateAnimation = true;
|
||||||
mDeactivateAnimation = false;
|
mDeactivateAnimation = false;
|
||||||
|
|
|
@ -49,7 +49,7 @@ private:
|
||||||
bool mDeactivateAnimation;
|
bool mDeactivateAnimation;
|
||||||
QTimeLine mTimeline;
|
QTimeLine mTimeline;
|
||||||
EffectWindow* mWindow;
|
EffectWindow* mWindow;
|
||||||
QStringList mCheck;
|
QStringList mWindowClasses;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
12
kwin/effects/dimscreen/dimscreen.kcfg
Normal file
12
kwin/effects/dimscreen/dimscreen.kcfg
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
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" >
|
||||||
|
<kcfgfile name="kwinrc"/>
|
||||||
|
<group name="Effect-DimScreen">
|
||||||
|
<entry name="WindowClasses" type="StringList">
|
||||||
|
<default>kdesu,kdesudo,polkit-kde-manager,polkit-kde-authentication-agent-1,pinentry</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
</kcfg>
|
61
kwin/effects/dimscreen/dimscreen_config.cpp
Normal file
61
kwin/effects/dimscreen/dimscreen_config.cpp
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/********************************************************************
|
||||||
|
KWin - the KDE window manager
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
Copyright (C) 2024 Ivailo Monev <xakepa10@gmail.com>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#include "dimscreen_config.h"
|
||||||
|
#include "dimscreenconfig.h"
|
||||||
|
|
||||||
|
#include <kwineffects.h>
|
||||||
|
|
||||||
|
#include <kdebug.h>
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
KWIN_EFFECT_CONFIG_FACTORY
|
||||||
|
|
||||||
|
DimScreenEffectConfigForm::DimScreenEffectConfigForm(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
DimScreenEffectConfig::DimScreenEffectConfig(QWidget *parent, const QVariantList &args)
|
||||||
|
: KCModule(EffectFactory::componentData(), parent, args)
|
||||||
|
{
|
||||||
|
m_ui = new DimScreenEffectConfigForm(this);
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
layout->addWidget(m_ui);
|
||||||
|
|
||||||
|
addConfig(DimScreenConfig::self(), m_ui);
|
||||||
|
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DimScreenEffectConfig::save()
|
||||||
|
{
|
||||||
|
KCModule::save();
|
||||||
|
EffectsHandler::sendReloadMessage("dimscreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#include "moc_dimscreen_config.cpp"
|
77
kwin/effects/dimscreen/dimscreen_config.desktop
Normal file
77
kwin/effects/dimscreen/dimscreen_config.desktop
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Service
|
||||||
|
X-KDE-ServiceTypes=KCModule
|
||||||
|
|
||||||
|
X-KDE-Library=kcm_kwin4_effect_builtins
|
||||||
|
X-KDE-ParentComponents=kwin4_effect_dimscreen
|
||||||
|
X-KDE-PluginKeyword=dimscreen
|
||||||
|
|
||||||
|
Name=Dim Screen for Administrator Mode
|
||||||
|
Name[af]=Verdof vir Administrateurmodus
|
||||||
|
Name[ar]=يعتم الشاشة لنمط المدير
|
||||||
|
Name[ast]=Aclarar la pantalla nel mou alministrador
|
||||||
|
Name[bg]=Затъмняване на екрана в администраторски режим
|
||||||
|
Name[bs]=Priguši ekran za administratorski režim
|
||||||
|
Name[ca]=Enfosqueix la pantalla pel mode administrador
|
||||||
|
Name[ca@valencia]=Enfosqueix la pantalla pel mode administrador
|
||||||
|
Name[cs]=Ztmavit obrazovku v administrátorském režimu
|
||||||
|
Name[da]=Dæmp skærmen til administratortilstand
|
||||||
|
Name[de]=Bildschirm für Systemverwaltungsmodus abdunkeln
|
||||||
|
Name[el]=Σκίαση οθόνης σε λειτουργία διαχειριστή
|
||||||
|
Name[en_GB]=Dim Screen for Administrator Mode
|
||||||
|
Name[eo]=Malheligi la ekranon en administra reĝimo
|
||||||
|
Name[es]=Oscurecer la pantalla en el modo administrador
|
||||||
|
Name[et]=Tuhm ekraan administraatori režiimis
|
||||||
|
Name[eu]=Ilundu leihoa administratzaile modurako
|
||||||
|
Name[fi]=Himmennä näyttö pääkäyttäjätilassa
|
||||||
|
Name[fy]=Yn administratormodus it skerm dimme
|
||||||
|
Name[ga]=Doiléirigh an Scáileán i Mód an Riarthóra
|
||||||
|
Name[gl]=Escurecer a pantalla no modo de administración
|
||||||
|
Name[gu]=સંચાલક સ્થિતિ માટે ઝાંખો સ્ક્રિન
|
||||||
|
Name[he]=עמעום מסך למצב מנהל
|
||||||
|
Name[hi]=प्रबंधक मोड के लिए स्क्रीन मंद करें
|
||||||
|
Name[hne]=प्रसासक मोड बर स्क्रीन ल धुंधला कर देव
|
||||||
|
Name[hr]=Priguši zaslon za administrativni način
|
||||||
|
Name[hu]=Halványított képernyő rendszergazdai módban
|
||||||
|
Name[ia]=Schermo Dim pro modo de administrator
|
||||||
|
Name[id]=Layar Dim Untuk Mode Administrator
|
||||||
|
Name[is]=Dimma skjá fyrir kerfisstjóraham
|
||||||
|
Name[kk]=Әкімші режімде экранды күңгірттеп көрсету
|
||||||
|
Name[km]=បន្ថយពន្លឺអេក្រង់ សម្រាប់របៀបជាអ្នកគ្រប់គ្រង
|
||||||
|
Name[kn]=ನಿರ್ವಾಹಕ ವಿಧಾನದಲ್ಲಿ (ಅ ಡ್ಮಿನಿಸ್ಟ್ರೇಟರ್ ಮೋಡ್) ತೆರೆಯನ್ನು ಮಂಕಾಗಿಸು
|
||||||
|
Name[ko]=관리자 모드에서 화면 어둡게 하기
|
||||||
|
Name[lt]=Užtemdomas ekraną administratoriaus veiksenai
|
||||||
|
Name[lv]=Aptumšināt ekrānu, pieprasot administratora tiesības
|
||||||
|
Name[mk]=Го затемнува екранот за администраторски режим
|
||||||
|
Name[ml]=അഡ്മിനിസ്ട്രേറ്റര് മോഡില് സ്ക്രീന് തെളിച്ചം കുറയ്ക്കല്
|
||||||
|
Name[mr]=प्रशासक पद्धती करिता गडद स्क्रीन
|
||||||
|
Name[nb]=Demp skjermen i administratormodus
|
||||||
|
Name[nds]=In Systeemplegerbedrief Schirm bedüüstern
|
||||||
|
Name[nl]=Scherm dimmen voor administratormodus
|
||||||
|
Name[nn]=Mørklegg skjermen i administratormodus
|
||||||
|
Name[pa]=ਪਰਸ਼ਾਸ਼ਕੀ ਮੋਡ ਵਿੱਚ ਸਕਰੀਨ ਡਿਮ ਕਰੋ
|
||||||
|
Name[pl]=Przyciemnienie ekranu dla trybu administratora
|
||||||
|
Name[pt]=Escurecer o Ecrã para o Modo de Administração
|
||||||
|
Name[pt_BR]=Escurecer a tela no modo administrador
|
||||||
|
Name[ro]=Împăienjenește ecranul pentru Regimul administrator
|
||||||
|
Name[ru]=Затемнение экрана при административной задаче
|
||||||
|
Name[si]=පරිපාලක ප්රකාරයේදී තිර දීප්තිය අඩු කරන්න
|
||||||
|
Name[sk]=Stmaviť obrazovku v administrátorskom režime
|
||||||
|
Name[sl]=Potemnitev za način skrbnika
|
||||||
|
Name[sr]=Пригушен екран за администраторски режим
|
||||||
|
Name[sr@ijekavian]=Пригушен екран за администраторски режим
|
||||||
|
Name[sr@ijekavianlatin]=Prigušen ekran za administratorski režim
|
||||||
|
Name[sr@latin]=Prigušen ekran za administratorski režim
|
||||||
|
Name[sv]=Dämpa skärmen vid administratörsläge
|
||||||
|
Name[ta]=Dim Screen for Administrator Mode
|
||||||
|
Name[te]=నిర్వాహక రీతికొరకు తెరను డిమ్ చేస్తుంది
|
||||||
|
Name[th]=ทำให้หน้าจอมืดลงสำหรับใช้ในโหมดผู้บริหารระบบ
|
||||||
|
Name[tr]=Yönetici Kipinde Ekranı Dondur
|
||||||
|
Name[ug]=باشقۇرغۇچى ھالىتىدە ئېكراننى تۇتۇقلاشتۇر
|
||||||
|
Name[uk]=Тьмяний екран для режиму адміністратора
|
||||||
|
Name[vi]=Làm tối màn hình cho chế độ quản trị
|
||||||
|
Name[wa]=Fé pus noere li waitroûle pol môde Manaedjeu
|
||||||
|
Name[x-test]=xxDim Screen for Administrator Modexx
|
||||||
|
Name[zh_CN]=进入管理员模式时暗淡屏幕
|
||||||
|
Name[zh_TW]=在管理者模式下將螢幕變暗
|
||||||
|
|
52
kwin/effects/dimscreen/dimscreen_config.h
Normal file
52
kwin/effects/dimscreen/dimscreen_config.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/********************************************************************
|
||||||
|
KWin - the KDE window manager
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
Copyright (C) 2024 Ivailo Monev <xakepa10@gmail.com>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*********************************************************************/
|
||||||
|
|
||||||
|
#ifndef KWIN_DIMSCREEN_CONFIG_H
|
||||||
|
#define KWIN_DIMSCREEN_CONFIG_H
|
||||||
|
|
||||||
|
#include <kcmodule.h>
|
||||||
|
|
||||||
|
#include "ui_dimscreen_config.h"
|
||||||
|
|
||||||
|
namespace KWin
|
||||||
|
{
|
||||||
|
|
||||||
|
class DimScreenEffectConfigForm : public QWidget, public Ui::DimScreenEffectConfigForm
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DimScreenEffectConfigForm(QWidget *parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
class DimScreenEffectConfig : public KCModule
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DimScreenEffectConfig(QWidget *parent = 0, const QVariantList &args = QVariantList());
|
||||||
|
|
||||||
|
virtual void save();
|
||||||
|
|
||||||
|
private:
|
||||||
|
DimScreenEffectConfigForm* m_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif
|
5
kwin/effects/dimscreen/dimscreenconfig.kcfgc
Normal file
5
kwin/effects/dimscreen/dimscreenconfig.kcfgc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
File=dimscreen.kcfg
|
||||||
|
ClassName=DimScreenConfig
|
||||||
|
NameSpace=KWin
|
||||||
|
Singleton=true
|
||||||
|
Mutators=true
|
Loading…
Add table
Reference in a new issue