From 797bece86188cdfbdc18cf3dfcbf15f931c018f7 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Tue, 13 Nov 2007 21:50:00 +0000 Subject: [PATCH] Add config dialog for trackmouse. It doesn't let you configure anything yet, just shows which keys activate the effect. But hopefully one day it will be configurable as well. svn path=/trunk/KDE/kdebase/workspace/; revision=736297 --- effects/CMakeLists.txt | 2 + effects/configs_builtins.cpp | 2 + effects/trackmouse_config.cpp | 76 +++++++++++++++++++++++++++++++ effects/trackmouse_config.desktop | 37 +++++++++++++++ effects/trackmouse_config.h | 38 ++++++++++++++++ 5 files changed, 155 insertions(+) create mode 100644 effects/trackmouse_config.cpp create mode 100644 effects/trackmouse_config.desktop create mode 100644 effects/trackmouse_config.h diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 69b73e5c0d..e990f68d8e 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -140,6 +140,7 @@ if(OPENGL_FOUND) mousemark_config.cpp mousemark_config.ui sharpen_config.cpp + trackmouse_config.cpp ) install( FILES invert_config.desktop @@ -147,6 +148,7 @@ if(OPENGL_FOUND) magnifier_config.desktop mousemark_config.desktop sharpen_config.desktop + trackmouse_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) endif(OPENGL_FOUND) diff --git a/effects/configs_builtins.cpp b/effects/configs_builtins.cpp index ff8498e940..0e22980471 100644 --- a/effects/configs_builtins.cpp +++ b/effects/configs_builtins.cpp @@ -25,6 +25,7 @@ License. See the file "COPYING" for the exact licensing terms. #include "mousemark_config.h" #include "magnifier_config.h" #include "sharpen_config.h" +#include "trackmouse_config.h" #endif #include @@ -47,6 +48,7 @@ K_PLUGIN_FACTORY_DEFINITION(EffectFactory, registerPlugin("mousemark"); registerPlugin("magnifier"); registerPlugin("sharpen"); + registerPlugin("trackmouse"); #endif ) K_EXPORT_PLUGIN(EffectFactory("kwin")) diff --git a/effects/trackmouse_config.cpp b/effects/trackmouse_config.cpp new file mode 100644 index 0000000000..f7a2a7c561 --- /dev/null +++ b/effects/trackmouse_config.cpp @@ -0,0 +1,76 @@ +/***************************************************************** + 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 "trackmouse_config.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#ifndef KDE_USE_FINAL +KWIN_EFFECT_CONFIG_FACTORY +#endif +namespace KWin +{ + +TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantList& args) : + KCModule(EffectFactory::componentData(), parent, args) + { + KGlobalAccel::self()->overrideMainComponentData(componentData()); + kDebug() ; + + QVBoxLayout* layout = new QVBoxLayout(this); + QLabel* label = new QLabel(i18n("Hold Ctrl+Meta keys to see where the mouse cursor is."), this); + layout->addWidget(label); + + layout->addStretch(); + + load(); + } + +TrackMouseEffectConfig::~TrackMouseEffectConfig() + { + kDebug() ; + } + +void TrackMouseEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + emit changed(false); + } + +void TrackMouseEffectConfig::save() + { + kDebug() ; + KCModule::save(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "trackmouse" ); + } + +void TrackMouseEffectConfig::defaults() + { + kDebug() ; + emit changed(true); + } + + +} // namespace + +#include "trackmouse_config.moc" diff --git a/effects/trackmouse_config.desktop b/effects/trackmouse_config.desktop new file mode 100644 index 0000000000..3319ee047e --- /dev/null +++ b/effects/trackmouse_config.desktop @@ -0,0 +1,37 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_builtins +X-KDE-ParentComponents=kwin4_effect_trackmouse +X-KDE-PluginKeyword=trackmouse + +Name=Track Mouse +Name[be]=Адследжваць мыш +Name[bg]=Мишка +Name[de]=Mausspur +Name[el]=Ανίχνευση ποντικιού +Name[es]=Seguir el ratón +Name[et]=Hiire jälgimine +Name[fa]=ردگیری موشی +Name[he]=עקבות עכבר +Name[ja]=トラックマウス +Name[kk]=Тышқандың ізі +Name[km]=ដាន​កណ្តុរ​ +Name[ko]=마우스 추적 +Name[nb]=Spor mus +Name[nds]=Muusspoor +Name[ne]=ट्रयाक माउस +Name[nl]=Muis volgen +Name[nn]=Følg mus +Name[pa]=ਮਾਊਸ ਟਰੈਕ +Name[pt]=Seguir o Rato +Name[pt_BR]=Seguir o Mouse +Name[sr]=Праћење миша +Name[sr@latin]=Praćenje miša +Name[sv]=Musspår +Name[vi]=Vết chuột +Name[x-test]=xxTrack Mousexx +Name[zh_CN]=跟踪鼠标 +Name[zh_TW]=追蹤滑鼠 diff --git a/effects/trackmouse_config.h b/effects/trackmouse_config.h new file mode 100644 index 0000000000..9998725d46 --- /dev/null +++ b/effects/trackmouse_config.h @@ -0,0 +1,38 @@ +/***************************************************************** + 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_TRACKMOUSE_CONFIG_H +#define KWIN_TRACKMOUSE_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +class KShortcutsEditor; + +namespace KWin +{ + +class TrackMouseEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit TrackMouseEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + ~TrackMouseEffectConfig(); + + public slots: + virtual void save(); + virtual void load(); + virtual void defaults(); + }; + +} // namespace + +#endif