[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    Re: [PATCH] global shortcuts for kscd
From:       Martin =?iso-8859-15?q?K=F6bele?= <martin () mkoebele ! de>
Date:       2005-04-29 11:36:00
Message-ID: 200504290736.11937.martin () mkoebele ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


On April 28, 2005 23:12, Aaron Seigo wrote:
> On April 28, 2005 18:39, Martin Köbele wrote:
> > If there are no objections I would commit it. Who is currently the
> > maintainer of kscd?
>
> first, the "local" shortcuts should be retained for when the window has
> focus. they are convenient and many users are used to them. there is no
> reason to remove them.

ok, now we have global and 'local' shortcuts which are also stored in 
different sections in kscdrc to keep them apart.



> second, how do these global shortcuts work when running JuK or amaroK at
> the same time with their default global shortcuts? (sorry, don't have time
> to test right now =/ )
JuK has CTRL-ALT-SHIFT shortcuts for the global shortcuts. amaroK uses the WIN 
keys as well. Right now there is only one collision between kscd and amarok: 
WIN+B. I guess the user would have to adjust either amarok or kscd in this 
point.


> > I am also thinking of OSD support for kscd. Or is anybody already working
> > on it?
> i don't believe anyone is.
> what do you have in mind exactly?
a passive popup if the track/volume is changed. Similar to amaroK's OSD.

>
> it would be Nice to not duplicate what JuK and/or amaroK have already done.
> it would be Good to find someway to share code for this between the various
> player apps for the obvious reasons of sanity. =)
maybe it would be good, yes ;)


Attached new patch. If there are no objections, I would commit it. What about 
a port to 3.4.1?

Martin

["globalShortcuts.diff" (text/x-diff)]

? Doxyfile
? globalShortcuts.diff
? kscd.kdevelop
? kscd.kdevelop.pcs
? kscd.kdevses
Index: kscd.cpp
===================================================================
RCS file: /home/kde/kdemultimedia/kscd/kscd.cpp,v
retrieving revision 1.309
diff -u -p -r1.309 kscd.cpp
--- kscd.cpp	3 Apr 2005 21:31:34 -0000	1.309
+++ kscd.cpp	29 Apr 2005 11:31:17 -0000
@@ -59,7 +59,6 @@
 #include <kuniqueapplication.h>
 #include <kglobalsettings.h>
 #include <kcmoduleloader.h>
-
 #include <kconfigdialog.h>
 
 #include "docking.h"
@@ -170,7 +169,8 @@ KSCD::KSCD( QWidget *parent, const char 
   action = new KAction(i18n("Previous"), Key_B, this, SLOT(prevClicked()), \
m_actions, "Previous");  action = new KAction(i18n("Next"), Key_N, this, \
SLOT(nextClicked()), m_actions, "Next");  action = KStdAction::quit(this, \
                SLOT(quitClicked()), m_actions);
-  action = KStdAction::keyBindings(this, SLOT(configureKeys()), m_actions);
+  action = KStdAction::keyBindings(this, SLOT(configureKeys()), m_actions, \
"options_configure_shortcuts"); +  action = KStdAction::keyBindings(this, \
SLOT(configureGlobalKeys()), m_actions, "options_configure_globals");  action = \
KStdAction::preferences(this, SLOT(showConfig()), m_actions);  action = new \
KAction(i18n("Loop"), Key_L, this, SLOT(loopClicked()), m_actions, "Loop");  action = \
new KAction(i18n("Eject"), CTRL + Key_E, this, SLOT(ejectClicked()), m_actions, \
"Eject"); @@ -178,15 +178,18 @@ KSCD::KSCD( QWidget *parent, const char 
 	KShortcut increaseVolume = action->shortcut();
 	increaseVolume.append( KKey( Key_Equal ) );
 	action->setShortcut( increaseVolume );
-
   action = new KAction(i18n("Decrease Volume"), Key_Minus, this, SLOT(decVolume()), \
m_actions, "DecVolume");  action = new KAction(i18n("Options"), CTRL + Key_T, this, \
SLOT(showConfig()), m_actions, "Options");  action = new KAction(i18n("Shuffle"), \
Key_R, this, SLOT(randomSelected()), m_actions, "Shuffle");  action = new \
KAction(i18n("CDDB"), CTRL + Key_D, this, SLOT(CDDialogSelected()), m_actions, \
                "CDDB");
-
-  setupPopups();
-
+  
   m_actions->readShortcutSettings("Shortcuts");
+  
+  m_actions->action( "options_configure_globals" )->setText( i18n( "Configure \
&Global Shortcuts..." ) ); +  
+  initGlobalShortcuts();
+  
+  setupPopups();
 
   if (Prefs::looping())
   {
@@ -211,6 +214,31 @@ KSCD::~KSCD()
     delete m_cd;
 } // ~KSCD
 
+
+void KSCD::initGlobalShortcuts() {
+
+  m_globalAccel = new KGlobalAccel( this );
+  
+  m_globalAccel->insert("Next", i18n("Next"), 0, KKey("WIN+N"), KKey("WIN+Right"),
+                        this, SLOT(nextClicked()));
+  m_globalAccel->insert("Previous", i18n("Previous"), 0, KKey("WIN+B"), \
KKey("WIN+Left"), +                        this, SLOT(prevClicked()));
+  m_globalAccel->insert("Play/Pause", i18n("Play/Pause"), 0, KKey("WIN+P"), 0,
+                        this, SLOT(playClicked()));
+  m_globalAccel->insert("Stop", i18n("Stop"), 0, KKey("WIN+S"), 0,
+                        this, SLOT(stopClicked()));
+  m_globalAccel->insert("IncVolume", i18n("Increase Volume"), 0, KKey("WIN+Plus"), \
KKey("WIN+Up"), +                        this, SLOT(incVolume()));
+  m_globalAccel->insert("DecVolume", i18n("Decrease Volume"), 0, KKey("WIN+Minus"), \
KKey("WIN+Down"), +                        this, SLOT(decVolume()));
+  m_globalAccel->insert("Shuffle", i18n("Shuffle"), 0, KKey("WIN+R"), 0,
+                        this, SLOT(incVolume()));
+  
+  m_globalAccel->setConfigGroup( "GlobalShortcuts" );
+  m_globalAccel->readSettings( kapp->config() );
+  m_globalAccel->updateConnections();
+}
+
 bool KSCD::digitalPlayback() {
 #if defined(BUILD_CDDA)
         return !(Prefs::audioSystem().isEmpty());
@@ -299,8 +327,7 @@ void KSCD::setIcons()
   infoPB->setIconSet(SmallIconSet("run"));
 }
 
-void
-KSCD::setupPopups()
+void KSCD::setupPopups()
 {
     QPopupMenu* mainPopup   = new QPopupMenu(this);
     infoPB->setPopup(mainPopup);
@@ -322,7 +349,9 @@ KSCD::setupPopups()
     infoPopup->insertItem("Yahoo!", 11);
 
     m_actions->action(KStdAction::name(KStdAction::Preferences))->plug(mainPopup);
-    m_actions->action(KStdAction::name(KStdAction::KeyBindings))->plug(mainPopup);
+    //NEW add the shortcut dialogs
+    m_actions->action("options_configure_globals")->plug(mainPopup);
+    m_actions->action("options_configure_shortcuts")->plug(mainPopup);
     mainPopup->insertSeparator();
 
     mainPopup->insertItem(i18n("Artist Information"), infoPopup);
@@ -736,6 +765,11 @@ void KSCD::configureKeys()
     KKeyDialog::configure(m_actions, this);
 }
 
+void KSCD::configureGlobalKeys()
+{
+  KKeyDialog::configure(m_globalAccel, true, this, true);
+}
+
 void KSCD::setDevicePaths()
 {
     if (!m_cd->setDevice(Prefs::cdDevice(), Prefs::volume(), \
                Prefs::digitalPlayback()))
Index: kscd.h
===================================================================
RCS file: /home/kde/kdemultimedia/kscd/kscd.h,v
retrieving revision 1.120
diff -u -p -r1.120 kscd.h
--- kscd.h	25 Mar 2005 20:19:53 -0000	1.120
+++ kscd.h	29 Apr 2005 11:31:17 -0000
@@ -57,6 +57,7 @@ class KCompactDisc;
 #include <kprocess.h>
 #include <krandomsequence.h>
 #include <dcopobject.h>
+#include <kglobalaccel.h>
 
 class CDDBDlg;
 class DockWidget;
@@ -223,10 +224,12 @@ private:
     QStringList     playlist;
     KCDDB::Client*  cddb;
     KActionCollection* m_actions;
+    KGlobalAccel* m_globalAccel;
     KToggleAction* m_togglePopupsAction;
     KVolumeControl* m_volume;
     DockWidget* m_dockWidget;
     void lookupDevice();
+    void initGlobalShortcuts();
 public slots:
     void lookupCDDB();
 
@@ -242,6 +245,7 @@ private slots:
     void trayOpening();
     void configDone();
     void configureKeys();
+    void configureGlobalKeys();
     void setIcons();
 
     void timeSliderPressed();


[Attachment #8 (application/pgp-signature)]

_______________________________________________
kde-multimedia mailing list
kde-multimedia@kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic