Add zoom config dialog (just keyboard shortcuts)

svn path=/trunk/KDE/kdebase/workspace/; revision=735761
This commit is contained in:
Rivo Laks 2007-11-12 15:11:00 +00:00
parent 5d6ff26ec6
commit 0adf0a1b49
5 changed files with 171 additions and 0 deletions

View file

@ -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)

View file

@ -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 <kwineffects.h>
@ -23,6 +24,7 @@ K_PLUGIN_FACTORY_DEFINITION(EffectFactory, registerPlugin<KWin::ShadowEffectConf
registerPlugin<KWin::PresentWindowsEffectConfig>("presentwindows");
registerPlugin<KWin::DesktopGridEffectConfig>("desktopgrid");
registerPlugin<KWin::MakeTransparentEffectConfig>("maketransparent");
registerPlugin<KWin::ZoomEffectConfig>("zoom");
)
K_EXPORT_PLUGIN(EffectFactory("kwin"))

87
effects/zoom_config.cpp Normal file
View file

@ -0,0 +1,87 @@
/*****************************************************************
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 "zoom_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
{
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"

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_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]=

41
effects/zoom_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_ZOOM_CONFIG_H
#define KWIN_ZOOM_CONFIG_H
#define KDE3_SUPPORT
#include <kcmodule.h>
#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