Add config dialog for invert

svn path=/trunk/KDE/kdebase/workspace/; revision=736226
This commit is contained in:
Rivo Laks 2007-11-13 18:14:56 +00:00
parent 2a88854a01
commit f8ec94079b
5 changed files with 167 additions and 0 deletions

View file

@ -132,6 +132,7 @@ if(OPENGL_FOUND)
data/circle-edgy.png
DESTINATION ${DATA_INSTALL_DIR}/kwin )
SET(kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources}
invert_config.cpp
lookingglass_config.cpp
lookingglass_config.ui
magnifier_config.cpp
@ -140,6 +141,7 @@ if(OPENGL_FOUND)
mousemark_config.ui
)
install( FILES
invert_config.desktop
lookingglass_config.desktop
magnifier_config.desktop
mousemark_config.desktop

View file

@ -20,6 +20,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "zoom_config.h"
#ifdef HAVE_OPENGL
#include "invert_config.h"
#include "lookingglass_config.h"
#include "mousemark_config.h"
#include "magnifier_config.h"
@ -40,6 +41,7 @@ K_PLUGIN_FACTORY_DEFINITION(EffectFactory,
registerPlugin<KWin::ThumbnailAsideEffectConfig>("thumbnailaside");
registerPlugin<KWin::ZoomEffectConfig>("zoom");
#ifdef HAVE_OPENGL
registerPlugin<KWin::InvertEffectConfig>("invert");
registerPlugin<KWin::LookingGlassEffectConfig>("lookingglass");
registerPlugin<KWin::MouseMarkEffectConfig>("mousemark");
registerPlugin<KWin::MagnifierEffectConfig>("magnifier");

83
effects/invert_config.cpp Normal file
View file

@ -0,0 +1,83 @@
/*****************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
You can Freely distribute this program under the GNU General Public
License. See the file "COPYING" for the exact licensing terms.
******************************************************************/
#include "invert_config.h"
#include <kwineffects.h>
#include <klocale.h>
#include <kdebug.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KGlobalAccel>
#include <QVBoxLayout>
#ifndef KDE_USE_FINAL
KWIN_EFFECT_CONFIG_FACTORY
#endif
namespace KWin
{
InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args) :
KCModule(EffectFactory::componentData(), parent, args)
{
KGlobalAccel::self()->overrideMainComponentData(componentData());
kDebug() ;
QVBoxLayout* layout = new QVBoxLayout(this);
KActionCollection* actionCollection = new KActionCollection( this, KComponentData("kwin") );
KAction* a = static_cast<KAction*>(actionCollection->addAction( "Invert" ));
a->setText( i18n("Toggle Invert effect" ));
a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F6 ));
mShortcutEditor = new KShortcutsEditor(actionCollection, this,
KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed);
connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
layout->addWidget(mShortcutEditor);
layout->addStretch();
load();
}
InvertEffectConfig::~InvertEffectConfig()
{
kDebug() ;
}
void InvertEffectConfig::load()
{
kDebug() ;
KCModule::load();
emit changed(false);
}
void InvertEffectConfig::save()
{
kDebug() ;
KCModule::save();
emit changed(false);
EffectsHandler::sendReloadMessage( "invert" );
}
void InvertEffectConfig::defaults()
{
kDebug() ;
mShortcutEditor->allDefault();
emit changed(true);
}
} // namespace
#include "invert_config.moc"

View file

@ -0,0 +1,39 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_invert
X-KDE-PluginKeyword=invert
Name=Invert
Name[be]=Інвертаваць
Name[bg]=Инвертиране
Name[ca]=Inverteix
Name[de]=Invertieren
Name[el]=Αντιστροφή
Name[es]=Invertir
Name[et]=Teistpidi
Name[fa]=وارونه
Name[he]=הפוך צבעים
Name[ja]=調
Name[kk]=Терістеу
Name[km]=
Name[nb]=Snu om
Name[nds]=Ümdreihen
Name[ne]=
Name[nl]=Omkeren
Name[nn]=Inverter
Name[pa]=
Name[pt]=Inverter
Name[pt_BR]=Inverter
Name[sl]=Obrni
Name[sr]=Извртање
Name[sr@latin]=Izvrtanje
Name[sv]=Invertera
Name[th]=
Name[x-test]=xxInvertxx
Name[zh_CN]=
Name[zh_TW]=

41
effects/invert_config.h Normal file
View file

@ -0,0 +1,41 @@
/*****************************************************************
KWin - the KDE window manager
This file is part of the KDE project.
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
You can Freely distribute this program under the GNU General Public
License. See the file "COPYING" for the exact licensing terms.
******************************************************************/
#ifndef KWIN__CONFIG_H
#define KWIN__CONFIG_H
#define KDE3_SUPPORT
#include <kcmodule.h>
#undef KDE3_SUPPORT
class KShortcutsEditor;
namespace KWin
{
class InvertEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit InvertEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
~InvertEffectConfig();
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private:
KShortcutsEditor* mShortcutEditor;
};
} // namespace
#endif