More configuration options for effects. Most of the code
by Christian Nitschkowski <segfault_ii@web.de>. svn path=/trunk/KDE/kdebase/workspace/; revision=736161
This commit is contained in:
parent
e8dffc8f3a
commit
ce20cf0625
30 changed files with 1393 additions and 24 deletions
|
@ -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)
|
||||
|
|
|
@ -3,15 +3,23 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Bernhard Loos <nhuh.put@web.de>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
You can Freely distribute this program under the GNU General Public
|
||||
License. See the file "COPYING" for the exact licensing terms.
|
||||
******************************************************************/
|
||||
|
||||
#include <config-X11.h>
|
||||
|
||||
#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 <kwineffects.h>
|
||||
|
@ -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<KWin::ShadowEffectConfig>("shadow");
|
||||
registerPlugin<KWin::PresentWindowsEffectConfig>("presentwindows");
|
||||
registerPlugin<KWin::DesktopGridEffectConfig>("desktopgrid");
|
||||
registerPlugin<KWin::MakeTransparentEffectConfig>("maketransparent");
|
||||
registerPlugin<KWin::ZoomEffectConfig>("zoom");
|
||||
)
|
||||
K_PLUGIN_FACTORY_DEFINITION(EffectFactory,
|
||||
registerPlugin<KWin::DesktopGridEffectConfig>("desktopgrid");
|
||||
registerPlugin<KWin::DimInactiveEffectConfig>("diminactive");
|
||||
registerPlugin<KWin::MakeTransparentEffectConfig>("maketransparent");
|
||||
registerPlugin<KWin::PresentWindowsEffectConfig>("presentwindows");
|
||||
registerPlugin<KWin::ShadowEffectConfig>("shadow");
|
||||
registerPlugin<KWin::ThumbnailAsideEffectConfig>("thumbnailaside");
|
||||
registerPlugin<KWin::ZoomEffectConfig>("zoom");
|
||||
#ifdef HAVE_OPENGL
|
||||
registerPlugin<KWin::LookingGlassEffectConfig>("lookingglass");
|
||||
registerPlugin<KWin::MouseMarkEffectConfig>("mousemark");
|
||||
registerPlugin<KWin::MagnifierEffectConfig>("magnifier");
|
||||
#endif
|
||||
)
|
||||
K_EXPORT_PLUGIN(EffectFactory("kwin"))
|
||||
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
You can Freely distribute this program under the GNU General Public
|
||||
License. See the file "COPYING" for the exact licensing terms.
|
||||
******************************************************************/
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
|
||||
#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 );
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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
|
||||
};
|
||||
|
|
102
effects/diminactive_config.cpp
Normal file
102
effects/diminactive_config.cpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kwineffects.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <KActionCollection>
|
||||
#include <kaction.h>
|
||||
#include <KShortcutsEditor>
|
||||
#include <KGlobalAccel>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
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"
|
10
effects/diminactive_config.desktop
Normal file
10
effects/diminactive_config.desktop
Normal file
|
@ -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
|
46
effects/diminactive_config.h
Normal file
46
effects/diminactive_config.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kcmodule.h>
|
||||
#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
|
110
effects/diminactive_config.ui
Normal file
110
effects/diminactive_config.ui
Normal file
|
@ -0,0 +1,110 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWin::DimInactiveEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::DimInactiveEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>250</width>
|
||||
<height>200</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>&Strength</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinStrength</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="sliderStrength" >
|
||||
<property name="minimum" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinStrength" >
|
||||
<property name="minimum" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkPanel" >
|
||||
<property name="text" >
|
||||
<string>Apply effect to &Panels</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkGroup" >
|
||||
<property name="text" >
|
||||
<string>Apply effect to &Groups</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>spinStrength</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>sliderStrength</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>193</x>
|
||||
<y>52</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>128</x>
|
||||
<y>46</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>sliderStrength</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>spinStrength</receiver>
|
||||
<slot>setValue(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>69</x>
|
||||
<y>45</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>200</x>
|
||||
<y>42</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kactioncollection.h>
|
||||
#include <kaction.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <kmessagebox.h>
|
||||
|
||||
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()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kwinshadereffect.h>
|
||||
|
||||
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
|
||||
|
|
116
effects/lookingglass_config.cpp
Normal file
116
effects/lookingglass_config.cpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kwineffects.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <KActionCollection>
|
||||
#include <kaction.h>
|
||||
#include <KShortcutsEditor>
|
||||
#include <KGlobalAccel>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
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"
|
10
effects/lookingglass_config.desktop
Normal file
10
effects/lookingglass_config.desktop
Normal file
|
@ -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
|
49
effects/lookingglass_config.h
Normal file
49
effects/lookingglass_config.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kcmodule.h>
|
||||
#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
|
48
effects/lookingglass_config.ui
Normal file
48
effects/lookingglass_config.ui
Normal file
|
@ -0,0 +1,48 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWin::LookingGlassEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::LookingGlassEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>&Radius</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>radiusSpin</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="radiusSpin" >
|
||||
<property name="maximum" >
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="KShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KShortcutsEditor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global" >kshortcutseditor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kaction.h>
|
||||
#include <kactioncollection.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kstandardaction.h>
|
||||
|
||||
#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 )
|
||||
|
|
116
effects/magnifier_config.cpp
Normal file
116
effects/magnifier_config.cpp
Normal file
|
@ -0,0 +1,116 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kwineffects.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <KActionCollection>
|
||||
#include <kaction.h>
|
||||
#include <KShortcutsEditor>
|
||||
#include <KGlobalAccel>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
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"
|
10
effects/magnifier_config.desktop
Normal file
10
effects/magnifier_config.desktop
Normal file
|
@ -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
|
49
effects/magnifier_config.h
Normal file
49
effects/magnifier_config.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kcmodule.h>
|
||||
#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
|
80
effects/magnifier_config.ui
Normal file
80
effects/magnifier_config.ui
Normal file
|
@ -0,0 +1,80 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWin::MagnifierEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::MagnifierEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupSize" >
|
||||
<property name="title" >
|
||||
<string>Size</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>&Width</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="spinWidth" >
|
||||
<property name="suffix" >
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>&Height</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinHeight</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="spinHeight" >
|
||||
<property name="suffix" >
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KShortcutsEditor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global" >kshortcutseditor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2006 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
You can Freely distribute this program under the GNU General Public
|
||||
License. See the file "COPYING" for the exact licensing terms.
|
||||
|
|
112
effects/mousemark_config.cpp
Normal file
112
effects/mousemark_config.cpp
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kwineffects.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <KActionCollection>
|
||||
#include <kaction.h>
|
||||
#include <KShortcutsEditor>
|
||||
#include <KGlobalAccel>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
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"
|
10
effects/mousemark_config.desktop
Normal file
10
effects/mousemark_config.desktop
Normal file
|
@ -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
|
49
effects/mousemark_config.h
Normal file
49
effects/mousemark_config.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kcmodule.h>
|
||||
#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
|
79
effects/mousemark_config.ui
Normal file
79
effects/mousemark_config.ui
Normal file
|
@ -0,0 +1,79 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWin::MouseMarkEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::MouseMarkEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Appearance</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>&Width</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="spinWidth" >
|
||||
<property name="suffix" >
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>&Color</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>comboColors</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="comboColors" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KShortcutsEditor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global" >kshortcutseditor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kactioncollection.h>
|
||||
#include <kaction.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <klocale.h>
|
||||
|
||||
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 )
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
You can Freely distribute this program under the GNU General Public
|
||||
License. See the file "COPYING" for the exact licensing terms.
|
||||
|
|
118
effects/thumbnailaside_config.cpp
Normal file
118
effects/thumbnailaside_config.cpp
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kwineffects.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <KActionCollection>
|
||||
#include <kaction.h>
|
||||
#include <KShortcutsEditor>
|
||||
#include <KGlobalAccel>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
|
||||
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"
|
10
effects/thumbnailaside_config.desktop
Normal file
10
effects/thumbnailaside_config.desktop
Normal file
|
@ -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
|
49
effects/thumbnailaside_config.h
Normal file
49
effects/thumbnailaside_config.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Christian Nitschkowski <christian.nitschkowski@kdemail.net>
|
||||
|
||||
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 <kcmodule.h>
|
||||
#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
|
109
effects/thumbnailaside_config.ui
Normal file
109
effects/thumbnailaside_config.ui
Normal file
|
@ -0,0 +1,109 @@
|
|||
<ui version="4.0" >
|
||||
<class>KWin::ThumbnailAsideEffectConfigForm</class>
|
||||
<widget class="QWidget" name="KWin::ThumbnailAsideEffectConfigForm" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Appearance</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Maximal &Width</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinWidth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="spinWidth" >
|
||||
<property name="suffix" >
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>500</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>200</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>&Spacing</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinSpacing</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="spinSpacing" >
|
||||
<property name="suffix" >
|
||||
<string> px</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>&Opacity</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>spinOpacity</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QSpinBox" name="spinOpacity" >
|
||||
<property name="suffix" >
|
||||
<string> %</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KShortcutsEditor" native="1" name="editor" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KShortcutsEditor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global" >kshortcutseditor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue