]> git.sesse.net Git - vlc/commitdiff
Win32: add support for play and pause buttons in media keys (different from a plya...
authorGeoffroy Couprie <geal@videolan.org>
Sat, 16 Jan 2010 15:39:22 +0000 (16:39 +0100)
committerGeoffroy Couprie <geal@videolan.org>
Sat, 16 Jan 2010 17:47:40 +0000 (18:47 +0100)
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/main_interface.cpp

index 919f154a0c91b31b7045b1b9a620ca469b664db2..1650d4e90c33d15cec13bfe6e1e5fc4cf1c7cdca 100644 (file)
@@ -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" );
index b8f4f5e8f786327a01fb6a4106c79e58c3a1d74f..9355f4bdc19de3893f22ebf254aede868001581c 100644 (file)
@@ -268,6 +268,8 @@ private:
     void notifyRepeatLoop();
 public slots:
     void togglePlayPause();
+    void play();
+    void pause();
     void toggleRandom();
     void stop();
     void next();
index 6f50b7dcef1c00d43a8c6c7a65a038c48145b1cd..862fbe2b1c9942d95d7ed94221801260a0479620 100644 (file)
@@ -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: