diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 16501c5b47..3ac04cbd17 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -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 diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 38e17c9f6b..9fa43ad528 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -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("thumbnailaside"); registerPlugin("zoom"); #ifdef HAVE_OPENGL + registerPlugin("invert"); registerPlugin("lookingglass"); registerPlugin("mousemark"); registerPlugin("magnifier"); diff --git a/effects/invert_config.cpp b/effects/invert_config.cpp new file mode 100644 index 0000000000..16df989696 --- /dev/null +++ b/effects/invert_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 "invert_config.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#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(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" diff --git a/effects/invert_config.desktop b/effects/invert_config.desktop new file mode 100644 index 0000000000..b000c8ca05 --- /dev/null +++ b/effects/invert_config.desktop @@ -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]=反轉 + diff --git a/effects/invert_config.h b/effects/invert_config.h new file mode 100644 index 0000000000..4fc43941e1 --- /dev/null +++ b/effects/invert_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__CONFIG_H +#define KWIN__CONFIG_H + +#define KDE3_SUPPORT +#include +#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