summaryrefslogtreecommitdiffstats
path: root/noatun/modules/keyz
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /noatun/modules/keyz
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun/modules/keyz')
-rw-r--r--noatun/modules/keyz/Makefile.am14
-rw-r--r--noatun/modules/keyz/keyz.cpp189
-rw-r--r--noatun/modules/keyz/keyz.h48
-rw-r--r--noatun/modules/keyz/keyz.plugin69
4 files changed, 320 insertions, 0 deletions
diff --git a/noatun/modules/keyz/Makefile.am b/noatun/modules/keyz/Makefile.am
new file mode 100644
index 00000000..61c9f1bd
--- /dev/null
+++ b/noatun/modules/keyz/Makefile.am
@@ -0,0 +1,14 @@
+INCLUDES= -I$(top_srcdir)/noatun/library -I$(kde_includes)/arts $(all_includes)
+kde_module_LTLIBRARIES = noatun_keyz.la
+
+noatun_keyz_la_SOURCES = keyz.cpp
+
+noatun_keyz_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+noatun_keyz_la_LIBADD = $(LIB_KFILE) $(top_builddir)/noatun/library/libnoatun.la
+
+noatun_keyz_la_METASOURCES = AUTO
+
+noinst_HEADERS = keyz.h
+
+noatun_modules_keyz_DATA = keyz.plugin
+noatun_modules_keyzdir = $(kde_datadir)/noatun
diff --git a/noatun/modules/keyz/keyz.cpp b/noatun/modules/keyz/keyz.cpp
new file mode 100644
index 00000000..7b32cf98
--- /dev/null
+++ b/noatun/modules/keyz/keyz.cpp
@@ -0,0 +1,189 @@
+#include <noatun/engine.h>
+#include <noatun/player.h>
+#include <noatun/app.h>
+#include <noatun/playlist.h>
+
+#include <qlayout.h>
+
+#include <kglobalaccel.h>
+#include <kkeydialog.h>
+#include <klocale.h>
+#include <qclipboard.h>
+
+#include "keyz.h"
+
+extern "C"
+{
+ KDE_EXPORT Plugin *create_plugin()
+ {
+ return new Keyz();
+ }
+}
+
+KGlobalAccel * Keyz::s_accel = 0L;
+
+Keyz::Keyz() : QObject( 0L, "Keyz" ), Plugin(), preMuteVol(0)
+{
+ NOATUNPLUGINC(Keyz);
+ Player *player = napp->player();
+
+ if ( !s_accel )
+ {
+ s_accel = new KGlobalAccel( this, "noatunglobalaccel" );
+ s_accel->insert( "PlayPause", i18n("Play/Pause"), QString::null,
+ CTRL+ALT+Key_P, KKey::QtWIN+CTRL+Key_P,
+ player, SLOT( playpause() ));
+ s_accel->insert( "Stop", i18n("Stop Playing"), QString::null,
+ CTRL+ALT+Key_S, KKey::QtWIN+CTRL+Key_S,
+ player, SLOT( stop() ));
+ s_accel->insert( "Back", i18n("Back"), QString::null,
+ CTRL+ALT+Key_Left, KKey::QtWIN+CTRL+Key_Left,
+ player, SLOT( back() ));
+ s_accel->insert( "Forward", i18n("Forward"), QString::null,
+ CTRL+ALT+Key_Right, KKey::QtWIN+CTRL+Key_Right,
+ player, SLOT( forward() ));
+ s_accel->insert( "Playlist", i18n("Show/Hide Playlist"), QString::null,
+ CTRL+ALT+Key_L, KKey::QtWIN+CTRL+Key_L,
+ player, SLOT( toggleListView() ));
+ s_accel->insert( "OpenFile", i18n("Open File to Play"), QString::null,
+ CTRL+ALT+Key_O, KKey::QtWIN+CTRL+Key_O,
+ napp, SLOT( fileOpen() ));
+ s_accel->insert( "Effects", i18n("Effects Configuration"), QString::null,
+ CTRL+ALT+Key_E, KKey::QtWIN+CTRL+Key_E,
+ napp, SLOT( effectView() ));
+ s_accel->insert( "Preferences", i18n("Preferences"), QString::null,
+ CTRL+ALT+Key_F, KKey::QtWIN+CTRL+Key_F,
+ napp, SLOT( preferences() ));
+ s_accel->insert( "VolumeUp", i18n("Volume Up"), QString::null,
+ CTRL+ALT+SHIFT+Key_Up, KKey::QtWIN+CTRL+SHIFT+Key_Up,
+ this, SLOT( slotVolumeUp() ));
+ s_accel->insert( "VolumeDown", i18n("Volume Down"), QString::null,
+ CTRL+ALT+SHIFT+Key_Down, KKey::QtWIN+CTRL+SHIFT+Key_Down,
+ this, SLOT( slotVolumeDown() ));
+ s_accel->insert( "Mute", i18n("Mute"), QString::null,
+ CTRL+ALT+Key_M, KKey::QtWIN+CTRL+Key_M,
+ this, SLOT( slotMute() ));
+ s_accel->insert( "SeekForward", i18n("Seek Forward"), QString::null,
+ CTRL+ALT+SHIFT+Key_Right, KKey::QtWIN+CTRL+SHIFT+Key_Right,
+ this, SLOT( slotForward() ));
+ s_accel->insert( "SeekBackward", i18n("Seek Backward"), QString::null,
+ CTRL+ALT+SHIFT+Key_Left, KKey::QtWIN+CTRL+SHIFT+Key_Left,
+ this, SLOT( slotBackward() ));
+ s_accel->insert( "NextSection", i18n("Next Section"), QString::null,
+ 0, 0,
+ this, SLOT( slotNextSection() ));
+ s_accel->insert( "PrevSection", i18n("Previous Section"), QString::null,
+ 0, 0,
+ this, SLOT( slotPrevSection() ));
+ s_accel->insert( "CopyTitle", i18n("Copy Song Title to Clipboard"), QString::null,
+ CTRL+ALT+Key_C, KKey::QtWIN+CTRL+Key_C,
+ this, SLOT( slotCopyTitle() ));
+
+ s_accel->insert( "ToggleGUI", i18n("Show/Hide Main Window"), QString::null,
+ CTRL+ALT+Key_W, KKey::QtWIN+CTRL+Key_W,
+ napp, SLOT( toggleInterfaces() ));
+
+ s_accel->readSettings();
+ s_accel->updateConnections();
+ }
+
+ new KeyzPrefs(this);
+}
+
+Keyz::~Keyz()
+{
+ delete s_accel;
+ s_accel = 0L;
+}
+
+void Keyz::slotVolumeUp()
+{
+ int vol = napp->player()->volume();
+ if ( vol >= 100 )
+ return;
+
+ napp->player()->setVolume( vol + 4 );
+}
+
+void Keyz::slotVolumeDown()
+{
+ int vol = napp->player()->volume();
+ if ( vol <= 0 )
+ return;
+
+ napp->player()->setVolume( vol - 4 );
+}
+
+void Keyz::slotForward()
+{
+ napp->player()->skipTo( QMIN(napp->player()->getLength(), napp->player()->getTime() + 3000) ); // + 3 seconds
+}
+
+void Keyz::slotBackward()
+{
+ napp->player()->skipTo( QMAX( 0, napp->player()->getTime() - 3000 )); // - 3 seconds
+}
+
+void Keyz::slotNextSection()
+{
+ Playlist *list = napp->playlist();
+ if ( list ) {
+ PlaylistItem item = list->nextSection();
+ if ( !item.isNull() )
+ napp->player()->play( item );
+ }
+}
+
+void Keyz::slotPrevSection()
+{
+ Playlist *list = napp->playlist();
+ if ( list ) {
+ PlaylistItem item = list->previousSection();
+ if ( !item.isNull() )
+ napp->player()->play( item );
+ }
+}
+
+void Keyz::slotCopyTitle()
+{
+ if (napp->player()->current())
+ KApplication::kApplication()->clipboard()->setText(napp->player()->current().title());
+}
+
+
+void Keyz::slotMute()
+{
+ int vol = napp->player()->volume();
+
+ if ( vol <= 0 ) // already muted
+ {
+ vol = preMuteVol;
+ }
+ else // we should mute
+ {
+ preMuteVol = vol;
+ vol = 0;
+ }
+
+ napp->player()->setVolume( vol );
+}
+
+///////////////////////////////////////////////////////////////////
+
+KeyzPrefs::KeyzPrefs( QObject *parent ) :
+ CModule( i18n("Keyz"), i18n("Shortcut Configuration"), "key_bindings",
+ parent )
+{
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ m_chooser = new KKeyChooser( Keyz::accel(), this );
+ layout->addWidget( m_chooser );
+}
+
+void KeyzPrefs::save()
+{
+ m_chooser->commitChanges();
+ Keyz::accel()->updateConnections();
+ Keyz::accel()->writeSettings();
+}
+
+#include "keyz.moc"
diff --git a/noatun/modules/keyz/keyz.h b/noatun/modules/keyz/keyz.h
new file mode 100644
index 00000000..929e6c67
--- /dev/null
+++ b/noatun/modules/keyz/keyz.h
@@ -0,0 +1,48 @@
+#ifndef KEYZ_H
+#define KEYZ_H
+
+#include <noatun/pref.h>
+#include <noatun/plugin.h>
+
+class Keyz : public QObject, public Plugin
+{
+ Q_OBJECT
+ NOATUNPLUGIND
+
+public:
+ Keyz();
+ ~Keyz();
+
+ static KGlobalAccel *accel() { return s_accel; }
+
+public slots:
+void slotVolumeUp();
+ void slotVolumeDown();
+ void slotMute();
+
+ void slotForward();
+ void slotBackward();
+ void slotNextSection();
+ void slotPrevSection();
+ void slotCopyTitle();
+
+private:
+ static KGlobalAccel *s_accel;
+ int preMuteVol;
+};
+
+
+class KeyzPrefs : public CModule
+{
+ Q_OBJECT
+
+public:
+ KeyzPrefs( QObject *parent );
+ virtual void save();
+
+private:
+ class KKeyChooser* m_chooser;
+
+};
+
+#endif // KEYZ_H
diff --git a/noatun/modules/keyz/keyz.plugin b/noatun/modules/keyz/keyz.plugin
new file mode 100644
index 00000000..41560e86
--- /dev/null
+++ b/noatun/modules/keyz/keyz.plugin
@@ -0,0 +1,69 @@
+Filename=noatun_keyz.la
+Author=Carsten Pfeiffer
+Site=http://noatun.kde.org/
+Email=pfeiffer@kde.org
+Type=other
+License=Artistic
+Name=Keyz
+Name[af]=Keys
+Name[cs]=Klávesy
+Name[de]=Tasten
+Name[eo]=Klavkombinoj
+Name[he]=מקשים
+Name[hi]=के-ईवायज़ेड
+Name[nds]=Tasten
+Name[ru]=Клавишки
+Name[sv]=Tangentisar
+Name[ta]=விசைகள்
+Name[xh]=Izitshixo
+Name[zu]=Izikhiye
+Comment=Global shortcuts for most operations
+Comment[bg]=Управление чрез бързи клавиши на повечето операции
+Comment[bs]=Globalne kratice za većinu operacija
+Comment[ca]=Dreceres globals per a la majoria d'operacions
+Comment[cs]=Globální zkratky pro většinu operací
+Comment[cy]=Byrlwybrau Eang i'r rhan fwyaf o weithredoedd
+Comment[da]=Globale genveje til de fleste operationer
+Comment[de]=Globale Kurzbefehle für die meisten Vorgänge
+Comment[el]=Καθολικές συντομεύσεις για τις περισσότερες λειτουργίες
+Comment[eo]=Mallokaj klavkombinoj por multaj operacioj
+Comment[es]=Accesos directos globales para la mayoría de las operaciones
+Comment[et]=Enamiku tegevuste globaalsed kiirklahvid
+Comment[eu]=Laisterbide globalak eragiketa gehienetarako
+Comment[fa]=میان‌برهای سراسری برای اغلب عملیاتها
+Comment[fi]=Yleiset pikavalinnat lähes kaikille toiminnoille
+Comment[fr]=Raccourcis pour l'essentiel des opérations
+Comment[ga]=Aicearraí comhchoiteanna d'fhormhór na n-oibríochtaí
+Comment[gl]=Atallos globais para a maioría das operacións
+Comment[he]=קיצורי דרך גלובליים לרוב הפעולות
+Comment[hu]=Globális billentyűparancsok a legtöbb művelethez
+Comment[is]=Altækir flýtilyklar fyrir flest allt
+Comment[it]=Scorciatoie globali per le operazioni comuni
+Comment[ja]=ほとんどの操作に使われるグローバルショートカット
+Comment[kk]=Көп операциялардың жалпы-жүйелік перне тірсесімдері
+Comment[km]=ផ្លូវកាត់​សកល​សម្រាប់​ប្រតិបត្តិការ​ភាគ​ច្រើន
+Comment[ko]=대부분 작업에 대한 전역 단축키
+Comment[lt]=Bendri spartieji klavišai daugumai operacijų
+Comment[mk]=Глобални кратенки за повеќето операции
+Comment[nb]=Globale snarveier for de fleste operasjoner
+Comment[nds]=Globaal Tastkombinatschonen för de mehrsten Akschonen
+Comment[ne]=धेरै सञ्चालनका लागि विश्वव्यापी सर्टकट
+Comment[nl]=Globale snelkoppelingen voor de meeste handelingen
+Comment[nn]=Globale snøggtastar for dei fleste operasjonar
+Comment[pl]=Globalne skróty dla większości operacji
+Comment[pt]=Atalhos globais para a maioria das operações
+Comment[pt_BR]=Atalhos globais para a maioria das operações
+Comment[ro]=Acceleratori globali pentru operaţii uzuale
+Comment[ru]=Привязки клавиш для большинства действий
+Comment[sk]=Globálne skratky pre väčšinu operácií
+Comment[sl]=Globalne bližnjice za večino operacij
+Comment[sr]=Глобалне пречице за већину операција
+Comment[sr@Latn]=Globalne prečice za većinu operacija
+Comment[sv]=Globala snabbtangenter för de flesta operationerna
+Comment[ta]=பல செயலுகளுக்கான உலகளாவிய குறுக்குவழிகள்
+Comment[th]=ปุ่มพิมพ์ลัดส่วนกลางสำหรับปฏิบัติการส่วนใหญ่
+Comment[tr]=Pek çok İşlemler için Genel Kısayollar
+Comment[uk]=Глобальні скорочення для більшості дій
+Comment[zh_CN]=大多数操作的全局快捷键
+Comment[zh_HK]=大部分操作的通用捷徑
+Comment[zh_TW]=給一般大部分操作使用的全域快速鍵