From 0adf0a1b49eb2a76b760db57f2db1d8f30eaa626 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Mon, 12 Nov 2007 15:11:00 +0000 Subject: [PATCH] Add zoom config dialog (just keyboard shortcuts) svn path=/trunk/KDE/kdebase/workspace/; revision=735761 --- effects/CMakeLists.txt | 2 + effects/configs_builtins.cpp | 2 + effects/zoom_config.cpp | 87 ++++++++++++++++++++++++++++++++++++ effects/zoom_config.desktop | 39 ++++++++++++++++ effects/zoom_config.h | 41 +++++++++++++++++ 5 files changed, 171 insertions(+) create mode 100644 effects/zoom_config.cpp create mode 100644 effects/zoom_config.desktop create mode 100644 effects/zoom_config.h diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 4fc2b1f27d..b3a85d8fff 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -61,12 +61,14 @@ KWIN4_ADD_EFFECT_CONFIG( builtins shadow_config.cpp desktopgrid_config.cpp maketransparent_config.cpp + zoom_config.cpp configs_builtins.cpp) install( FILES presentwindows_config.desktop shadow_config.desktop desktopgrid_config.desktop maketransparent_config.desktop + zoom_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) if(OPENGL_FOUND) diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index 0df228a717..585f19b4ed 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -12,6 +12,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "presentwindows_config.h" #include "desktopgrid_config.h" #include "maketransparent_config.h" +#include "zoom_config.h" #include @@ -23,6 +24,7 @@ K_PLUGIN_FACTORY_DEFINITION(EffectFactory, registerPlugin("presentwindows"); registerPlugin("desktopgrid"); registerPlugin("maketransparent"); + registerPlugin("zoom"); ) K_EXPORT_PLUGIN(EffectFactory("kwin")) diff --git a/effects/zoom_config.cpp b/effects/zoom_config.cpp new file mode 100644 index 0000000000..896822806e --- /dev/null +++ b/effects/zoom_config.cpp @@ -0,0 +1,87 @@ +/***************************************************************** + 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 "zoom_config.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#ifndef KDE_USE_FINAL +KWIN_EFFECT_CONFIG_FACTORY +#endif +namespace KWin +{ + +ZoomEffectConfig::ZoomEffectConfig(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; + a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ZoomIn )); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal)); + a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ZoomOut )); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ActualSize )); + a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + + mShortcutEditor = new KShortcutsEditor(actionCollection, this, + KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); + connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed())); + layout->addWidget(mShortcutEditor); + + layout->addStretch(); + + load(); + } + +ZoomEffectConfig::~ZoomEffectConfig() + { + kDebug() ; + } + +void ZoomEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + emit changed(false); + } + +void ZoomEffectConfig::save() + { + kDebug() ; + KCModule::save(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "zoom" ); + } + +void ZoomEffectConfig::defaults() + { + kDebug() ; + mShortcutEditor->allDefault(); + emit changed(true); + } + + +} // namespace + +#include "zoom_config.moc" diff --git a/effects/zoom_config.desktop b/effects/zoom_config.desktop new file mode 100644 index 0000000000..d346c10365 --- /dev/null +++ b/effects/zoom_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_zoom +X-KDE-PluginKeyword=zoom + +Name=Zoom +Name[ar]=تكبير +Name[be]=Маштабаванне +Name[bg]=Мащабиране +Name[cs]=Zvětšení +Name[de]=Vergrößerung +Name[el]=Εστίαση +Name[es]=Ampliación +Name[et]=Suurendus +Name[fa]=بزرگ‌نمایی +Name[ga]=Súmáil +Name[he]=התקרבות +Name[ja]=ズーム +Name[kk]=Ұлғайту/кішрейту +Name[km]=ពង្រីក +Name[ko]=확대/축소 +Name[nb]=Forstørre/-minske +Name[nds]=Ansichtgrött +Name[ne]=जुम गर्नुहोस् +Name[nl]=Zoomen +Name[nn]=Forstørr +Name[pa]=ਜ਼ੂਮ +Name[pt]=Ampliação +Name[sl]=Povečaj +Name[sr]=Увеличање +Name[sr@latin]=Uveličanje +Name[vi]=Thu/Phóng +Name[x-test]=xxZoomxx +Name[zh_CN]=缩放 +Name[zh_TW]=縮放 diff --git a/effects/zoom_config.h b/effects/zoom_config.h new file mode 100644 index 0000000000..e181a22ac3 --- /dev/null +++ b/effects/zoom_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_ZOOM_CONFIG_H +#define KWIN_ZOOM_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +class KShortcutsEditor; + +namespace KWin +{ + +class ZoomEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit ZoomEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + ~ZoomEffectConfig(); + + public slots: + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + KShortcutsEditor* mShortcutEditor; + }; + +} // namespace + +#endif