diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index b3a85d8fff..16501c5b47 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -10,7 +10,17 @@ macro(KWIN4_ADD_EFFECT name) endmacro(KWIN4_ADD_EFFECT) macro(KWIN4_ADD_EFFECT_CONFIG name) - kde4_add_plugin(kcm_kwin4_effect_${name} ${ARGN}) + set(kwin4_effect_ui ) #empty + set(kwin4_effect_src ) #empty + foreach(file ${ARGN}) + if(file MATCHES \\.ui) + set(kwin4_effect_ui ${kwin4_effect_ui} ${file}) + else(file MATCHES \\.ui) + set(kwin4_effect_src ${kwin4_effect_src} ${file}) + endif(file MATCHES \\.ui) + endforeach(file) + kde4_add_ui_files(kwin4_effect_src ${kwin4_effect_ui}) + kde4_add_plugin(kcm_kwin4_effect_${name} ${kwin4_effect_src}) target_link_libraries(kcm_kwin4_effect_${name} kwineffects ${KDE4_KDEUI_LIBS}) install(TARGETS kcm_kwin4_effect_${name} DESTINATION ${PLUGIN_INSTALL_DIR}) endmacro(KWIN4_ADD_EFFECT_CONFIG) @@ -19,7 +29,7 @@ include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/lib ) - install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) +install( FILES kwineffect.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) ### builtins - most important, ready-to-use effects # sources @@ -56,18 +66,24 @@ install( FILES DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) # config modules -KWIN4_ADD_EFFECT_CONFIG( builtins +SET(kwin4_effect_builtins_config_sources + desktopgrid_config.cpp + diminactive_config.cpp + diminactive_config.ui + maketransparent_config.cpp presentwindows_config.cpp shadow_config.cpp - desktopgrid_config.cpp - maketransparent_config.cpp + thumbnailaside_config.cpp + thumbnailaside_config.ui zoom_config.cpp configs_builtins.cpp) install( FILES + desktopgrid_config.desktop + diminactive_config.desktop + maketransparent_config.desktop presentwindows_config.desktop shadow_config.desktop - desktopgrid_config.desktop - maketransparent_config.desktop + thumbnailaside_config.desktop zoom_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) @@ -115,6 +131,19 @@ if(OPENGL_FOUND) data/circle.png data/circle-edgy.png DESTINATION ${DATA_INSTALL_DIR}/kwin ) + SET(kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources} + lookingglass_config.cpp + lookingglass_config.ui + magnifier_config.cpp + magnifier_config.ui + mousemark_config.cpp + mousemark_config.ui + ) + install( FILES + lookingglass_config.desktop + magnifier_config.desktop + mousemark_config.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) endif(OPENGL_FOUND) # showfps, showpaint - need both xrender and opengl @@ -131,6 +160,7 @@ endif( OPENGL_FOUND AND X11_Xrender_FOUND ) # add the plugin KWIN4_ADD_EFFECT(builtins ${kwin4_effect_builtins_sources}) +KWIN4_ADD_EFFECT_CONFIG(builtins ${kwin4_effect_builtins_config_sources}) # link to xrender if necessary # note that libkwineffects already links to opengl, so no need to add this here if (X11_Xrender_FOUND) diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 585f19b4ed..0bd3cda513 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -3,15 +3,23 @@ This file is part of the KDE project. Copyright (C) 2007 Bernhard Loos +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. ******************************************************************/ +#include + #include "shadow_config.h" #include "presentwindows_config.h" #include "desktopgrid_config.h" #include "maketransparent_config.h" +#include "diminactive_config.h" +#include "magnifier_config.h" +#include "mousemark_config.h" +#include "lookingglass_config.h" +#include "thumbnailaside_config.h" #include "zoom_config.h" #include @@ -20,11 +28,18 @@ License. See the file "COPYING" for the exact licensing terms. #ifndef KDE_USE_FINAL KWIN_EFFECT_CONFIG_FACTORY #endif -K_PLUGIN_FACTORY_DEFINITION(EffectFactory, registerPlugin("shadow"); - registerPlugin("presentwindows"); - registerPlugin("desktopgrid"); - registerPlugin("maketransparent"); - registerPlugin("zoom"); - ) +K_PLUGIN_FACTORY_DEFINITION(EffectFactory, + registerPlugin("desktopgrid"); + registerPlugin("diminactive"); + registerPlugin("maketransparent"); + registerPlugin("presentwindows"); + registerPlugin("shadow"); + registerPlugin("thumbnailaside"); + registerPlugin("zoom"); +#ifdef HAVE_OPENGL + registerPlugin("lookingglass"); + registerPlugin("mousemark"); + registerPlugin("magnifier"); +#endif + ) K_EXPORT_PLUGIN(EffectFactory("kwin")) - diff --git a/effects/diminactive.cpp b/effects/diminactive.cpp index 974b580379..50634e894e 100644 --- a/effects/diminactive.cpp +++ b/effects/diminactive.cpp @@ -3,11 +3,13 @@ This file is part of the KDE project. Copyright (C) 2007 Lubos Lunak +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. ******************************************************************/ +#include #include "diminactive.h" @@ -18,8 +20,11 @@ KWIN_EFFECT( diminactive, DimInactiveEffect ) DimInactiveEffect::DimInactiveEffect() { - dim_panels = false; // TODO config option - dim_by_group = true; // TODO config option + KConfigGroup conf = EffectsHandler::effectConfig("DimInactive"); + + dim_panels = conf.readEntry("DimPanels", false); + dim_by_group = conf.readEntry("DimByGroup", true); + dim_strength = conf.readEntry("Strength", 25); active = effects->activeWindow(); } @@ -43,8 +48,8 @@ void DimInactiveEffect::paintWindow( EffectWindow* w, int mask, QRegion region, dim = true; if( dim ) { - data.brightness *= 0.75; - data.saturation *= 0.75; + data.brightness *= (1.0 - (dim_strength / 100.0)); + data.saturation *= (1.0 - (dim_strength / 100.0)); } effects->paintWindow( w, mask, region, data ); } diff --git a/effects/diminactive.h b/effects/diminactive.h index cca9355433..c0facee262 100644 --- a/effects/diminactive.h +++ b/effects/diminactive.h @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2007 Lubos Lunak +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. @@ -27,6 +28,7 @@ class DimInactiveEffect virtual void windowActivated( EffectWindow* c ); private: EffectWindow* active; + int dim_strength; // reduce saturation and brightness by this percentage bool dim_panels; // do/don't dim also all panels bool dim_by_group; // keep visible all windows from the active window's group or only the active window }; diff --git a/effects/diminactive_config.cpp b/effects/diminactive_config.cpp new file mode 100644 index 0000000000..a48221a090 --- /dev/null +++ b/effects/diminactive_config.cpp @@ -0,0 +1,102 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "diminactive_config.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +KWIN_EFFECT_CONFIG_FACTORY + +namespace KWin +{ + +DimInactiveEffectConfigForm::DimInactiveEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +DimInactiveEffectConfig::DimInactiveEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + kDebug() ; + + m_ui = new DimInactiveEffectConfigForm(this); + + QGridLayout* layout = new QGridLayout(this); + + layout->addWidget(m_ui, 0, 0); + + connect(m_ui->spinStrength, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->checkPanel, SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(m_ui->checkGroup, SIGNAL(toggled(bool)), this, SLOT(changed())); + + load(); + } + +void DimInactiveEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig("DimInactive"); + + int strength = conf.readEntry("Strength", 25); + bool panel = conf.readEntry("DimPanels", false); + bool group = conf.readEntry("DimByGroup", true); + m_ui->spinStrength->setValue(strength); + m_ui->checkPanel->setChecked(panel); + m_ui->checkGroup->setChecked(group); + + emit changed(false); + } + +void DimInactiveEffectConfig::save() + { + kDebug(); + + KConfigGroup conf = EffectsHandler::effectConfig("DimInactive"); + + conf.writeEntry("Strength", m_ui->spinStrength->value()); + conf.writeEntry("DimPanels", m_ui->checkPanel->isChecked()); + conf.writeEntry("DimByGroup", m_ui->checkGroup->isChecked()); + + conf.sync(); + + KCModule::save(); + emit changed(false); + EffectsHandler::sendReloadMessage( "diminactive" ); + } + +void DimInactiveEffectConfig::defaults() + { + kDebug() ; + m_ui->spinStrength->setValue(25); + m_ui->checkPanel->setChecked(false); + m_ui->checkGroup->setChecked(true); + emit changed(true); + } + + +} // namespace + +#include "diminactive_config.moc" diff --git a/effects/diminactive_config.desktop b/effects/diminactive_config.desktop new file mode 100644 index 0000000000..78f3fda3a2 --- /dev/null +++ b/effects/diminactive_config.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_diminactive +X-KDE-PluginKeyword=diminactive + +Name=Dim Inactive diff --git a/effects/diminactive_config.h b/effects/diminactive_config.h new file mode 100644 index 0000000000..cdc32010fe --- /dev/null +++ b/effects/diminactive_config.h @@ -0,0 +1,46 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#ifndef KWIN_DIMINACTIVE_CONFIG_H +#define KWIN_DIMINACTIVE_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +#include "ui_diminactive_config.h" + +namespace KWin +{ + +class DimInactiveEffectConfigForm : public QWidget, public Ui::DimInactiveEffectConfigForm +{ + Q_OBJECT + public: + explicit DimInactiveEffectConfigForm(QWidget* parent); +}; + +class DimInactiveEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit DimInactiveEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + DimInactiveEffectConfigForm* m_ui; + }; + +} // namespace + +#endif diff --git a/effects/diminactive_config.ui b/effects/diminactive_config.ui new file mode 100644 index 0000000000..3964186b95 --- /dev/null +++ b/effects/diminactive_config.ui @@ -0,0 +1,110 @@ + + KWin::DimInactiveEffectConfigForm + + + + 0 + 0 + 250 + 200 + + + + Form + + + + + + + + &Strength + + + spinStrength + + + + + + + 1 + + + 100 + + + 25 + + + Qt::Horizontal + + + + + + + 1 + + + 100 + + + 25 + + + + + + + + + Apply effect to &Panels + + + + + + + Apply effect to &Groups + + + + + + + + + spinStrength + valueChanged(int) + sliderStrength + setValue(int) + + + 193 + 52 + + + 128 + 46 + + + + + sliderStrength + valueChanged(int) + spinStrength + setValue(int) + + + 69 + 45 + + + 200 + 42 + + + + + diff --git a/effects/lookingglass.cpp b/effects/lookingglass.cpp index 7f2e08b0c8..f9c8b7d007 100644 --- a/effects/lookingglass.cpp +++ b/effects/lookingglass.cpp @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2007 Rivo Laks +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. @@ -15,9 +16,11 @@ License. See the file "COPYING" for the exact licensing terms. #include #include +#include #include #include +#include namespace KWin { @@ -31,7 +34,11 @@ LookingGlassEffect::LookingGlassEffect() : QObject(), ShaderEffect("lookingglass zoom = 1.0f; target_zoom = 1.0f; - KActionCollection* actionCollection = new KActionCollection( this ); + KConfigGroup conf = EffectsHandler::effectConfig("LookingGlass"); + actionCollection = new KActionCollection( this ); + actionCollection->setConfigGlobal(true); + actionCollection->setConfigGroup("LookingGlass"); + KAction* a; a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ZoomIn, this, SLOT( zoomIn()))); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus)); @@ -39,7 +46,15 @@ LookingGlassEffect::LookingGlassEffect() : QObject(), ShaderEffect("lookingglass a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ActualSize, this, SLOT( toggle()))); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); - radius = 200; // TODO config option + radius = conf.readEntry("Radius", 200); + + kDebug(1212) << QString("Radius from config: %1").arg(radius) << endl; + + actionCollection->readSettings(); + } + +LookingGlassEffect::~LookingGlassEffect() + { } void LookingGlassEffect::toggle() diff --git a/effects/lookingglass.h b/effects/lookingglass.h index 086c63e919..31de0261af 100644 --- a/effects/lookingglass.h +++ b/effects/lookingglass.h @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2007 Rivo Laks +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. @@ -13,6 +14,8 @@ License. See the file "COPYING" for the exact licensing terms. #include +class KActionCollection; + namespace KWin { @@ -24,6 +27,7 @@ class LookingGlassEffect : public QObject, public ShaderEffect Q_OBJECT public: LookingGlassEffect(); + virtual ~LookingGlassEffect(); virtual void mouseChanged( const QPoint& pos, const QPoint& old, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ); @@ -39,6 +43,7 @@ class LookingGlassEffect : public QObject, public ShaderEffect double zoom; double target_zoom; int radius; + KActionCollection* actionCollection; }; } // namespace diff --git a/effects/lookingglass_config.cpp b/effects/lookingglass_config.cpp new file mode 100644 index 0000000000..7f11f4e26c --- /dev/null +++ b/effects/lookingglass_config.cpp @@ -0,0 +1,116 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "lookingglass_config.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +KWIN_EFFECT_CONFIG_FACTORY + +namespace KWin +{ + +LookingGlassEffectConfigForm::LookingGlassEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + kDebug() ; + + m_ui = new LookingGlassEffectConfigForm(this); + + QGridLayout* layout = new QGridLayout(this); + + layout->addWidget(m_ui, 0, 0); + + connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed())); + connect(m_ui->radiusSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); + + // Shortcut config + KGlobalAccel::self()->overrideMainComponentData(componentData()); + m_actionCollection = new KActionCollection( this, componentData() ); + m_actionCollection->setConfigGroup("LookingGlass"); + m_actionCollection->setConfigGlobal(true); + + KAction* a; + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomIn, this, SLOT( zoomIn()))); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus)); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomOut, this, SLOT( zoomOut()))); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ActualSize, this, SLOT( toggle()))); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + + //m_ui->editor->addCollection(m_actionCollection); + + load(); + } + +void LookingGlassEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig("LookingGlass"); + +// m_ui->editor->readSettings(&conf); + + int radius = conf.readEntry("Radius", 200); + m_ui->radiusSpin->setValue(radius); + + m_actionCollection->readSettings(); + m_ui->editor->addCollection(m_actionCollection); + + emit changed(false); + } + +void LookingGlassEffectConfig::save() + { + kDebug() << "Saving config of LookingGlass" ; + //KCModule::save(); + + KConfigGroup conf = EffectsHandler::effectConfig("LookingGlass"); + + conf.writeEntry("Radius", m_ui->radiusSpin->value()); + + m_actionCollection->writeSettings(); + + conf.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "lookingglass" ); + } + +void LookingGlassEffectConfig::defaults() + { + kDebug() ; + m_ui->radiusSpin->setValue(200); + emit changed(true); + } + + +} // namespace + +#include "lookingglass_config.moc" diff --git a/effects/lookingglass_config.desktop b/effects/lookingglass_config.desktop new file mode 100644 index 0000000000..1d8730c3a2 --- /dev/null +++ b/effects/lookingglass_config.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_lookingglass +X-KDE-PluginKeyword=lookingglass + +Name=Looking Glass diff --git a/effects/lookingglass_config.h b/effects/lookingglass_config.h new file mode 100644 index 0000000000..d44caee001 --- /dev/null +++ b/effects/lookingglass_config.h @@ -0,0 +1,49 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#ifndef KWIN_LOOKINGGLASS_CONFIG_H +#define KWIN_LOOKINGGLASS_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +#include "ui_lookingglass_config.h" + +class KActionCollection; + +namespace KWin +{ + +class LookingGlassEffectConfigForm : public QWidget, public Ui::LookingGlassEffectConfigForm +{ + Q_OBJECT + public: + explicit LookingGlassEffectConfigForm(QWidget* parent); +}; + +class LookingGlassEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit LookingGlassEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + LookingGlassEffectConfigForm* m_ui; + KActionCollection* m_actionCollection; + }; + +} // namespace + +#endif diff --git a/effects/lookingglass_config.ui b/effects/lookingglass_config.ui new file mode 100644 index 0000000000..2e4dc10207 --- /dev/null +++ b/effects/lookingglass_config.ui @@ -0,0 +1,48 @@ + + KWin::LookingGlassEffectConfigForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + &Radius + + + radiusSpin + + + + + + + 500 + + + + + + + + + + + KShortcutsEditor + QWidget +
kshortcutseditor.h
+ 1 +
+
+ + +
diff --git a/effects/magnifier.cpp b/effects/magnifier.cpp index 58bacdfc5e..7b89345ed8 100644 --- a/effects/magnifier.cpp +++ b/effects/magnifier.cpp @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2006 Lubos Lunak +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. @@ -14,6 +15,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include +#include #include #ifdef HAVE_OPENGL @@ -31,6 +33,8 @@ MagnifierEffect::MagnifierEffect() : zoom( 1 ) , target_zoom( 1 ) { + KConfigGroup conf = EffectsHandler::effectConfig("Magnifier"); + KActionCollection* actionCollection = new KActionCollection( this ); KAction* a; a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ZoomIn, this, SLOT( zoomIn()))); @@ -39,7 +43,11 @@ MagnifierEffect::MagnifierEffect() a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ActualSize, this, SLOT( toggle()))); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); - magnifier_size = QSize( 200, 200 ); // TODO config option + + int width, height; + width = conf.readEntry("Width", 200); + height = conf.readEntry("Height", 200); + magnifier_size = QSize( width, height ); } void MagnifierEffect::prePaintScreen( ScreenPrePaintData& data, int time ) diff --git a/effects/magnifier_config.cpp b/effects/magnifier_config.cpp new file mode 100644 index 0000000000..266ce25c83 --- /dev/null +++ b/effects/magnifier_config.cpp @@ -0,0 +1,116 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "magnifier_config.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +KWIN_EFFECT_CONFIG_FACTORY + +namespace KWin +{ + +MagnifierEffectConfigForm::MagnifierEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + kDebug() ; + + m_ui = new MagnifierEffectConfigForm(this); + + QGridLayout* layout = new QGridLayout(this); + + layout->addWidget(m_ui, 0, 0); + + connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed())); + connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed())); + + // Shortcut config + KGlobalAccel::self()->overrideMainComponentData(componentData()); + m_actionCollection = new KActionCollection( this, componentData() ); + m_actionCollection->setConfigGroup("Magnifier"); + m_actionCollection->setConfigGlobal(true); + + KAction* a; + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomIn, this, SLOT( zoomIn()))); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus)); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomOut, this, SLOT( zoomOut()))); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ActualSize, this, SLOT( toggle()))); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + + load(); + } + +void MagnifierEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig("Magnifier"); + + int width = conf.readEntry("Width", 200); + int height = conf.readEntry("Height", 200); + m_ui->spinWidth->setValue(width); + m_ui->spinHeight->setValue(height); + + m_actionCollection->readSettings(); + m_ui->editor->addCollection(m_actionCollection); + + emit changed(false); + } + +void MagnifierEffectConfig::save() + { + kDebug() << "Saving config of Magnifier" ; + //KCModule::save(); + + KConfigGroup conf = EffectsHandler::effectConfig("Magnifier"); + + conf.writeEntry("Width", m_ui->spinWidth->value()); + conf.writeEntry("Height", m_ui->spinHeight->value()); + + m_actionCollection->writeSettings(); + + conf.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "magnifier" ); + } + +void MagnifierEffectConfig::defaults() + { + kDebug() ; + m_ui->spinWidth->setValue(200); + m_ui->spinHeight->setValue(200); + emit changed(true); + } + + +} // namespace + +#include "magnifier_config.moc" diff --git a/effects/magnifier_config.desktop b/effects/magnifier_config.desktop new file mode 100644 index 0000000000..48aea56d0d --- /dev/null +++ b/effects/magnifier_config.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_magnifier +X-KDE-PluginKeyword=magnifier + +Name=Magnifier diff --git a/effects/magnifier_config.h b/effects/magnifier_config.h new file mode 100644 index 0000000000..f03c42ed5c --- /dev/null +++ b/effects/magnifier_config.h @@ -0,0 +1,49 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#ifndef KWIN_MAGNIFIER_CONFIG_H +#define KWIN_MAGNIFIER_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +#include "ui_magnifier_config.h" + +class KActionCollection; + +namespace KWin +{ + +class MagnifierEffectConfigForm : public QWidget, public Ui::MagnifierEffectConfigForm +{ + Q_OBJECT + public: + explicit MagnifierEffectConfigForm(QWidget* parent); +}; + +class MagnifierEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit MagnifierEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + MagnifierEffectConfigForm* m_ui; + KActionCollection* m_actionCollection; + }; + +} // namespace + +#endif diff --git a/effects/magnifier_config.ui b/effects/magnifier_config.ui new file mode 100644 index 0000000000..9dcb97710b --- /dev/null +++ b/effects/magnifier_config.ui @@ -0,0 +1,80 @@ + + KWin::MagnifierEffectConfigForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Size + + + + + + &Width + + + spinWidth + + + + + + + px + + + 500 + + + + + + + &Height + + + spinHeight + + + + + + + px + + + 500 + + + + + + + + + + + + + + KShortcutsEditor + QWidget +
kshortcutseditor.h
+ 1 +
+
+ + +
diff --git a/effects/mousemark.cpp b/effects/mousemark.cpp index 65de6fd707..a0de241886 100644 --- a/effects/mousemark.cpp +++ b/effects/mousemark.cpp @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2006 Lubos Lunak +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. diff --git a/effects/mousemark_config.cpp b/effects/mousemark_config.cpp new file mode 100644 index 0000000000..16187268c6 --- /dev/null +++ b/effects/mousemark_config.cpp @@ -0,0 +1,112 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "mousemark_config.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +KWIN_EFFECT_CONFIG_FACTORY + +namespace KWin +{ + +MouseMarkEffectConfigForm::MouseMarkEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + kDebug() ; + + m_ui = new MouseMarkEffectConfigForm(this); + + QGridLayout* layout = new QGridLayout(this); + + layout->addWidget(m_ui, 0, 0); + + connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed())); + connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed())); + + // Shortcut config + KGlobalAccel::self()->overrideMainComponentData(componentData()); + m_actionCollection = new KActionCollection( this, componentData() ); + m_actionCollection->setConfigGroup("MouseMark"); + m_actionCollection->setConfigGlobal(true); + + KAction* a = static_cast< KAction* >( m_actionCollection->addAction( "ClearMouseMarks" )); + a->setText( i18n( "Clear Mouse Marks" )); + a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 )); + + load(); + } + +void MouseMarkEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig("MouseMark"); + + int width = conf.readEntry("LineWidth", 200); + QColor color = conf.readEntry("Color", QColor(255, 0, 0)); + m_ui->spinWidth->setValue(width); + //m_ui->spinHeight->setValue(height); + + m_actionCollection->readSettings(); + m_ui->editor->addCollection(m_actionCollection); + + emit changed(false); + } + +void MouseMarkEffectConfig::save() + { + kDebug() << "Saving config of MouseMark" ; + //KCModule::save(); + + KConfigGroup conf = EffectsHandler::effectConfig("MouseMark"); + + conf.writeEntry("LineWidth", m_ui->spinWidth->value()); + //conf.writeEntry("Color", m_ui->spinHeight->value()); + + m_actionCollection->writeSettings(); + + conf.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "magnifier" ); + } + +void MouseMarkEffectConfig::defaults() + { + kDebug() ; + m_ui->spinWidth->setValue(3); + //m_ui->spinHeight->setValue(200); + emit changed(true); + } + + +} // namespace + +#include "mousemark_config.moc" diff --git a/effects/mousemark_config.desktop b/effects/mousemark_config.desktop new file mode 100644 index 0000000000..1c142fce6a --- /dev/null +++ b/effects/mousemark_config.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_mousemark +X-KDE-PluginKeyword=mousemark + +Name=Mouse Mark diff --git a/effects/mousemark_config.h b/effects/mousemark_config.h new file mode 100644 index 0000000000..0b40c8b674 --- /dev/null +++ b/effects/mousemark_config.h @@ -0,0 +1,49 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#ifndef KWIN_MOUSEMARK_CONFIG_H +#define KWIN_MOUSEMARK_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +#include "ui_mousemark_config.h" + +class KActionCollection; + +namespace KWin +{ + +class MouseMarkEffectConfigForm : public QWidget, public Ui::MouseMarkEffectConfigForm +{ + Q_OBJECT + public: + explicit MouseMarkEffectConfigForm(QWidget* parent); +}; + +class MouseMarkEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit MouseMarkEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + MouseMarkEffectConfigForm* m_ui; + KActionCollection* m_actionCollection; + }; + +} // namespace + +#endif diff --git a/effects/mousemark_config.ui b/effects/mousemark_config.ui new file mode 100644 index 0000000000..0719f0bf5b --- /dev/null +++ b/effects/mousemark_config.ui @@ -0,0 +1,79 @@ + + KWin::MouseMarkEffectConfigForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Appearance + + + + + + &Width + + + spinWidth + + + + + + + px + + + 1 + + + 10 + + + 3 + + + + + + + &Color + + + comboColors + + + + + + + + + + + + + + + + + KShortcutsEditor + QWidget +
kshortcutseditor.h
+ 1 +
+
+ + +
diff --git a/effects/thumbnailaside.cpp b/effects/thumbnailaside.cpp index 53f72a4e93..2e850de9d0 100644 --- a/effects/thumbnailaside.cpp +++ b/effects/thumbnailaside.cpp @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2007 Lubos Lunak +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. @@ -12,6 +13,7 @@ License. See the file "COPYING" for the exact licensing terms. #include #include +#include #include namespace KWin @@ -21,14 +23,17 @@ KWIN_EFFECT( thumbnailaside, ThumbnailAsideEffect ) ThumbnailAsideEffect::ThumbnailAsideEffect() { + KConfigGroup conf = EffectsHandler::effectConfig("ThumbnailAside"); + KActionCollection* actionCollection = new KActionCollection( this ); KAction* a = (KAction*)actionCollection->addAction( "ToggleCurrentThumbnail" ); a->setText( i18n("Toggle Thumbnail for Current Window" )); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F9)); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail())); - maxwidth = 200; - spacing = 10; // TODO config options? - opacity = 0.5; + + maxwidth = conf.readEntry("MaxWidth", 200); + spacing = conf.readEntry("Spacing", 10); + opacity = conf.readEntry("Opacity", 50) / 100.0; } void ThumbnailAsideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data ) diff --git a/effects/thumbnailaside.h b/effects/thumbnailaside.h index 7c071fe1ca..1b99ceaa42 100644 --- a/effects/thumbnailaside.h +++ b/effects/thumbnailaside.h @@ -3,6 +3,7 @@ This file is part of the KDE project. Copyright (C) 2007 Lubos Lunak +Copyright (C) 2007 Christian Nitschkowski You can Freely distribute this program under the GNU General Public License. See the file "COPYING" for the exact licensing terms. diff --git a/effects/thumbnailaside_config.cpp b/effects/thumbnailaside_config.cpp new file mode 100644 index 0000000000..0b2b8b4945 --- /dev/null +++ b/effects/thumbnailaside_config.cpp @@ -0,0 +1,118 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#include "thumbnailaside_config.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +KWIN_EFFECT_CONFIG_FACTORY + +namespace KWin +{ + +ThumbnailAsideEffectConfigForm::ThumbnailAsideEffectConfigForm(QWidget* parent) : QWidget(parent) +{ + setupUi(this); +} + +ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + kDebug() ; + + m_ui = new ThumbnailAsideEffectConfigForm(this); + + QGridLayout* layout = new QGridLayout(this); + + layout->addWidget(m_ui, 0, 0); + + connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed())); + connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->spinSpacing, SIGNAL(valueChanged(int)), this, SLOT(changed())); + connect(m_ui->spinOpacity, SIGNAL(valueChanged(int)), this, SLOT(changed())); + + // Shortcut config + KGlobalAccel::self()->overrideMainComponentData(componentData()); + m_actionCollection = new KActionCollection( this, componentData() ); + m_actionCollection->setConfigGroup("ThumbnailAside"); + m_actionCollection->setConfigGlobal(true); + + KAction* a = (KAction*)m_actionCollection->addAction( "ToggleCurrentThumbnail" ); + a->setText( i18n("Toggle Thumbnail for Current Window" )); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F9)); + + load(); + } + +void ThumbnailAsideEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + KConfigGroup conf = EffectsHandler::effectConfig("ThumbnailAside"); + + int width = conf.readEntry("MaxWidth", 200); + int spacing = conf.readEntry("Spacing", 10); + int opacity = conf.readEntry("Opacity", 50); + m_ui->spinWidth->setValue(width); + m_ui->spinSpacing->setValue(spacing); + m_ui->spinOpacity->setValue(opacity); + + m_actionCollection->readSettings(); + m_ui->editor->addCollection(m_actionCollection); + + emit changed(false); + } + +void ThumbnailAsideEffectConfig::save() + { + kDebug() << "Saving config of ThumbnailAside" ; + //KCModule::save(); + + KConfigGroup conf = EffectsHandler::effectConfig("ThumbnailAside"); + + conf.writeEntry("MaxWidth", m_ui->spinWidth->value()); + conf.writeEntry("Spacing", m_ui->spinSpacing->value()); + conf.writeEntry("Opacity", m_ui->spinOpacity->value()); + + m_actionCollection->writeSettings(); + + conf.sync(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "thumbnailaside" ); + } + +void ThumbnailAsideEffectConfig::defaults() + { + kDebug() ; + m_ui->spinWidth->setValue(200); + m_ui->spinSpacing->setValue(10); + m_ui->spinOpacity->setValue(50); + emit changed(true); + } + + +} // namespace + +#include "thumbnailaside_config.moc" diff --git a/effects/thumbnailaside_config.desktop b/effects/thumbnailaside_config.desktop new file mode 100644 index 0000000000..f918781e2c --- /dev/null +++ b/effects/thumbnailaside_config.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_thumbnailaside +X-KDE-PluginKeyword=thumbnailaside + +Name=Thumbnail Aside diff --git a/effects/thumbnailaside_config.h b/effects/thumbnailaside_config.h new file mode 100644 index 0000000000..cf69f18eea --- /dev/null +++ b/effects/thumbnailaside_config.h @@ -0,0 +1,49 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Christian Nitschkowski + +You can Freely distribute this program under the GNU General Public +License. See the file "COPYING" for the exact licensing terms. +******************************************************************/ + +#ifndef KWIN_THUMBNAILASIDE_CONFIG_H +#define KWIN_THUMBNAILASIDE_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +#include "ui_thumbnailaside_config.h" + +class KActionCollection; + +namespace KWin +{ + +class ThumbnailAsideEffectConfigForm : public QWidget, public Ui::ThumbnailAsideEffectConfigForm +{ + Q_OBJECT + public: + explicit ThumbnailAsideEffectConfigForm(QWidget* parent); +}; + +class ThumbnailAsideEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit ThumbnailAsideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + ThumbnailAsideEffectConfigForm* m_ui; + KActionCollection* m_actionCollection; + }; + +} // namespace + +#endif diff --git a/effects/thumbnailaside_config.ui b/effects/thumbnailaside_config.ui new file mode 100644 index 0000000000..7459c9887d --- /dev/null +++ b/effects/thumbnailaside_config.ui @@ -0,0 +1,109 @@ + + KWin::ThumbnailAsideEffectConfigForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Appearance + + + + + + Maximal &Width + + + spinWidth + + + + + + + px + + + 500 + + + 200 + + + + + + + &Spacing + + + spinSpacing + + + + + + + px + + + 30 + + + 10 + + + + + + + &Opacity + + + spinOpacity + + + + + + + % + + + 100 + + + 50 + + + + + + + + + + + + + + KShortcutsEditor + QWidget +
kshortcutseditor.h
+ 1 +
+
+ + +