[vlc-devel] commit: Win32: add support for play and pause buttons in media keys ( different from a plya/pause unique button (Geoffroy Couprie )
git version control
git at videolan.org
Sat Jan 16 18:47:50 CET 2010
vlc | branch: master | Geoffroy Couprie <geal at videolan.org> | Sat Jan 16 16:39:22 2010 +0100| [583e321513a7dc00309c1032dc90e2d5145053b6] | committer: Geoffroy Couprie
Win32: add support for play and pause buttons in media keys (different from a plya/pause unique button
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=583e321513a7dc00309c1032dc90e2d5145053b6
---
modules/gui/qt4/input_manager.cpp | 22 ++++++++++++++++++++++
modules/gui/qt4/input_manager.hpp | 2 ++
modules/gui/qt4/main_interface.cpp | 4 ++--
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 919f154..1650d4e 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -1058,6 +1058,28 @@ void MainInputManager::togglePlayPause()
getIM()->togglePlayPause();
}
+void MainInputManager::play()
+{
+ /* No input, play */
+ if( !p_input )
+ playlist_Play( THEPL );
+ else
+ {
+ if( PLAYING_S != var_GetInteger( p_input, "state" ) )
+ {
+ getIM()->togglePlayPause();
+ }
+ }
+}
+
+void MainInputManager::pause()
+{
+ if(p_input && PLAYING_S == var_GetInteger( p_input, "state" ) )
+ {
+ getIM()->togglePlayPause();
+ }
+}
+
void MainInputManager::toggleRandom()
{
var_ToggleBool( THEPL, "random" );
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index b8f4f5e..9355f4b 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -268,6 +268,8 @@ private:
void notifyRepeatLoop();
public slots:
void togglePlayPause();
+ void play();
+ void pause();
void toggleRandom();
void stop();
void next();
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 6f50b7d..862fbe2 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -587,7 +587,8 @@ void MainInterface::createTaskBarButtons()
CONNECT( this, playPauseSignal(), THEMIM, togglePlayPause() );
CONNECT( this, prevSignal(), THEMIM, prev() );
CONNECT( this, nextSignal(), THEMIM, next() );
- CONNECT( this, play(), ActionsManager::getInstance( p_intf ), play() );
+ CONNECT( this, play(), THEMIM, play() );
+ CONNECT( this, pause(), THEMIM, pause() );
CONNECT( this, mute(), ActionsManager::getInstance( p_intf ), toggleMuteAudio() );
CONNECT( this, volumeUp(), ActionsManager::getInstance( p_intf ), AudioUp() );
CONNECT( this, volumeDown(), ActionsManager::getInstance( p_intf ), AudioDown() );
@@ -630,7 +631,6 @@ bool MainInterface::winEvent ( MSG * msg, long * result )
break;
case WM_APPCOMMAND:
cmd = GET_APPCOMMAND_LPARAM(msg->lParam);
- msg_Err( p_intf, "button pressed = %d", cmd);
switch(cmd)
{
case APPCOMMAND_MEDIA_PLAY_PAUSE:
More information about the vlc-devel
mailing list