From a10061ed6ff406141634a7e2262b1b45b5af89c2 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Tue, 13 Nov 2007 18:21:49 +0000 Subject: [PATCH] Add config dialog for sharpen svn path=/trunk/KDE/kdebase/workspace/; revision=736229 --- effects/CMakeLists.txt | 2 + effects/configs_builtins.cpp | 2 + effects/sharpen_config.cpp | 83 ++++++++++++++++++++++++++++++++++ effects/sharpen_config.desktop | 36 +++++++++++++++ effects/sharpen_config.h | 41 +++++++++++++++++ 5 files changed, 164 insertions(+) create mode 100644 effects/sharpen_config.cpp create mode 100644 effects/sharpen_config.desktop create mode 100644 effects/sharpen_config.h diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 3ac04cbd17..ba16786b76 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -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) diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 9fa43ad528..ff8498e940 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -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 @@ -45,6 +46,7 @@ K_PLUGIN_FACTORY_DEFINITION(EffectFactory, registerPlugin("lookingglass"); registerPlugin("mousemark"); registerPlugin("magnifier"); + registerPlugin("sharpen"); #endif ) K_EXPORT_PLUGIN(EffectFactory("kwin")) diff --git a/effects/sharpen_config.cpp b/effects/sharpen_config.cpp new file mode 100644 index 0000000000..432a3618fa --- /dev/null +++ b/effects/sharpen_config.cpp @@ -0,0 +1,83 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Rivo Laks + +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 + +#include +#include +#include +#include +#include +#include + +#include +#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(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" diff --git a/effects/sharpen_config.desktop b/effects/sharpen_config.desktop new file mode 100644 index 0000000000..e12bc79367 --- /dev/null +++ b/effects/sharpen_config.desktop @@ -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]=讓輪廓更分明 diff --git a/effects/sharpen_config.h b/effects/sharpen_config.h new file mode 100644 index 0000000000..f031c86e12 --- /dev/null +++ b/effects/sharpen_config.h @@ -0,0 +1,41 @@ +/***************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2007 Rivo Laks + +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 +#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