From f016495c804b439c174f6c2964558726b167f671 Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Tue, 13 Nov 2007 19:43:13 +0000 Subject: [PATCH] Add config dialog for videorecord svn path=/trunk/KDE/kdebase/workspace/; revision=736260 --- effects/CMakeLists.txt | 3 +- effects/videorecord_config.cpp | 88 ++++++++++++++++++++++++++++++ effects/videorecord_config.desktop | 41 ++++++++++++++ effects/videorecord_config.h | 41 ++++++++++++++ 4 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 effects/videorecord_config.cpp create mode 100644 effects/videorecord_config.desktop create mode 100644 effects/videorecord_config.h diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index ba16786b76..69b73e5c0d 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -186,7 +186,8 @@ macro_log_feature(CAPTURY_FOUND "Capseo framework" "libcaptury is a framework re macro_bool_to_01( CAPTURY_FOUND HAVE_CAPTURY ) if( HAVE_CAPTURY ) KWIN4_ADD_EFFECT(videorecord videorecord.cpp) + KWIN4_ADD_EFFECT_CONFIG(videorecord videorecord_config.cpp) target_link_libraries(kwin4_effect_videorecord ${CAPTURY_LDFLAGS}) - install( FILES videorecord.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) + install( FILES videorecord.desktop videorecord_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kwin ) endif( HAVE_CAPTURY ) diff --git a/effects/videorecord_config.cpp b/effects/videorecord_config.cpp new file mode 100644 index 0000000000..8112b575d2 --- /dev/null +++ b/effects/videorecord_config.cpp @@ -0,0 +1,88 @@ +/***************************************************************** + 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 "videorecord_config.h" + +#include + +#include +#include +#include +#include +#include +#include + +#include +#ifndef KDE_USE_FINAL +KWIN_EFFECT_CONFIG_FACTORY +#endif +K_PLUGIN_FACTORY_DEFINITION(EffectFactory, + registerPlugin("videorecord"); + ) +K_EXPORT_PLUGIN(EffectFactory("kwin")) + +namespace KWin +{ + +VideoRecordEffectConfig::VideoRecordEffectConfig(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( "VideoRecord" )); + a->setText( i18n("Toggle Video Recording" )); + a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); + + mShortcutEditor = new KShortcutsEditor(actionCollection, this, + KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); + connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed())); + layout->addWidget(mShortcutEditor); + + layout->addStretch(); + + load(); + } + +VideoRecordEffectConfig::~VideoRecordEffectConfig() + { + kDebug() ; + } + +void VideoRecordEffectConfig::load() + { + kDebug() ; + KCModule::load(); + + emit changed(false); + } + +void VideoRecordEffectConfig::save() + { + kDebug() ; + KCModule::save(); + + emit changed(false); + EffectsHandler::sendReloadMessage( "videorecord" ); + } + +void VideoRecordEffectConfig::defaults() + { + kDebug() ; + mShortcutEditor->allDefault(); + emit changed(true); + } + + +} // namespace + +#include "videorecord_config.moc" diff --git a/effects/videorecord_config.desktop b/effects/videorecord_config.desktop new file mode 100644 index 0000000000..2e3cc6b8ba --- /dev/null +++ b/effects/videorecord_config.desktop @@ -0,0 +1,41 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KCModule + +X-KDE-Library=kcm_kwin4_effect_videorecord +X-KDE-ParentComponents=kwin4_effect_videorecord +X-KDE-PluginKeyword=videorecord + +Name=Video Record +Name[ar]=تسجيل المرئيات +Name[be]=Відэазапіс +Name[bg]=Запис на звук +Name[ca]=Gravador de vídeo +Name[csb]=Nagranié wideò +Name[de]=Video-Aufnahme +Name[el]=Εγγραφή βίντεο +Name[es]=Grabación de vídeo +Name[et]=Videosalvestus +Name[fa]=ضبط ویدیو +Name[he]=הקלטת סרט +Name[it]=Registra video +Name[ja]=ビデオレコーダー +Name[kk]=Бейне жазып алу +Name[km]=កំណត់​ត្រា​វីដេអូ +Name[ko]=동영상 녹화 +Name[nb]=Videoopptak +Name[nds]=Video opnehmen +Name[ne]=भिडियो रेकर्ड +Name[nl]=Video-opname +Name[nn]=Videoopptak +Name[pa]=ਵੀਡਿਓ ਰਿਕਾਰਡ +Name[pt]=Gravação de Vídeo +Name[pt_BR]=Gravar Vídeo +Name[sr]=Видеоснимање +Name[sr@latin]=Videosnimanje +Name[sv]=Videoinspelning +Name[vi]=Thu ảnh động +Name[x-test]=xxVideo Recordxx +Name[zh_CN]=视频录制 +Name[zh_TW]=影像錄影 diff --git a/effects/videorecord_config.h b/effects/videorecord_config.h new file mode 100644 index 0000000000..0c4dea6d31 --- /dev/null +++ b/effects/videorecord_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_VIDEORECORD_CONFIG_H +#define KWIN_VIDEORECORD_CONFIG_H + +#define KDE3_SUPPORT +#include +#undef KDE3_SUPPORT + +class KShortcutsEditor; + +namespace KWin +{ + +class VideoRecordEffectConfig : public KCModule + { + Q_OBJECT + public: + explicit VideoRecordEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + ~VideoRecordEffectConfig(); + + public slots: + virtual void save(); + virtual void load(); + virtual void defaults(); + + private: + KShortcutsEditor* mShortcutEditor; + }; + +} // namespace + +#endif