Add config dialog for sharpen

svn path=/trunk/KDE/kdebase/workspace/; revision=736229
This commit is contained in:
Rivo Laks 2007-11-13 18:21:49 +00:00
parent 620c22cad2
commit a10061ed6f
5 changed files with 164 additions and 0 deletions

View file

@ -139,12 +139,14 @@ if(OPENGL_FOUND)
magnifier_config.ui
mousemark_config.cpp
mousemark_config.ui
sharpen_config.cpp
)
install( FILES
invert_config.desktop
lookingglass_config.desktop
magnifier_config.desktop
mousemark_config.desktop
sharpen_config.desktop
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
endif(OPENGL_FOUND)

View file

@ -24,6 +24,7 @@ License. See the file "COPYING" for the exact licensing terms.
#include "lookingglass_config.h"
#include "mousemark_config.h"
#include "magnifier_config.h"
#include "sharpen_config.h"
#endif
#include <kwineffects.h>
@ -45,6 +46,7 @@ K_PLUGIN_FACTORY_DEFINITION(EffectFactory,
registerPlugin<KWin::LookingGlassEffectConfig>("lookingglass");
registerPlugin<KWin::MouseMarkEffectConfig>("mousemark");
registerPlugin<KWin::MagnifierEffectConfig>("magnifier");
registerPlugin<KWin::SharpenEffectConfig>("sharpen");
#endif
)
K_EXPORT_PLUGIN(EffectFactory("kwin"))

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 "sharpen_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
{
SharpenEffectConfig::SharpenEffectConfig(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( "Sharpen" ));
a->setText( i18n("Toggle Sharpen effect" ));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
mShortcutEditor = new KShortcutsEditor(actionCollection, this,
KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed);
connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
layout->addWidget(mShortcutEditor);
layout->addStretch();
load();
}
SharpenEffectConfig::~SharpenEffectConfig()
{
kDebug() ;
}
void SharpenEffectConfig::load()
{
kDebug() ;
KCModule::load();
emit changed(false);
}
void SharpenEffectConfig::save()
{
kDebug() ;
KCModule::save();
emit changed(false);
EffectsHandler::sendReloadMessage( "sharpen" );
}
void SharpenEffectConfig::defaults()
{
kDebug() ;
mShortcutEditor->allDefault();
emit changed(true);
}
} // namespace
#include "sharpen_config.moc"

View file

@ -0,0 +1,36 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
ServiceTypes=KCModule
X-KDE-Library=kcm_kwin4_effect_builtins
X-KDE-ParentComponents=kwin4_effect_sharpen
X-KDE-PluginKeyword=sharpen
Name=Sharpen
Name[bg]=Отчетливост
Name[ca]=Aguditza
Name[de]=Schärfen
Name[el]=Όξυνση
Name[et]=Teravdus
Name[fa]=تیز کردن
Name[he]=חדד
Name[ja]=
Name[kk]=Өткір қылу
Name[km]=
Name[ko]=
Name[nb]=Skjerpe
Name[nds]=Scharp maken
Name[ne]=ि
Name[nl]=Verscherpen
Name[nn]=Oppskarping
Name[pa]=
Name[pt]=Aumento de Detalhe
Name[pt_BR]=Nitidez
Name[sl]=Izostri
Name[sr]=Изоштравање
Name[sr@latin]=Izoštravanje
Name[sv]=Skärpa
Name[x-test]=xxSharpenxx
Name[zh_CN]=
Name[zh_TW]=

41
effects/sharpen_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_SHARPEN_CONFIG_H
#define KWIN_SHARPEN_CONFIG_H
#define KDE3_SUPPORT
#include <kcmodule.h>
#undef KDE3_SUPPORT
class KShortcutsEditor;
namespace KWin
{
class SharpenEffectConfig : public KCModule
{
Q_OBJECT
public:
explicit SharpenEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
~SharpenEffectConfig();
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private:
KShortcutsEditor* mShortcutEditor;
};
} // namespace
#endif