[vlc-devel] commit: Win32: add support for media keys and remotes in Qt. ( 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 13:55:03 2010 +0100| [82a0f2998f14dd58f5cdf122c04dcda37830b540] | committer: Geoffroy Couprie
Win32: add support for media keys and remotes in Qt.
Tested with an Apple remote v1, and a HP media center remote. I don't know how to get the "menu" message" from the remote.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=82a0f2998f14dd58f5cdf122c04dcda37830b540
---
modules/gui/qt4/main_interface.cpp | 43 +++++++++++++++++++++++++++++++++
modules/gui/qt4/main_interface.hpp | 46 ++++++++++++++++++++++++++++++++++++
modules/gui/qt4/util/qvlcapp.hpp | 17 -------------
3 files changed, 89 insertions(+), 17 deletions(-)
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 02f5ee8..6f50b7d 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -587,6 +587,10 @@ 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, mute(), ActionsManager::getInstance( p_intf ), toggleMuteAudio() );
+ CONNECT( this, volumeUp(), ActionsManager::getInstance( p_intf ), AudioUp() );
+ CONNECT( this, volumeDown(), ActionsManager::getInstance( p_intf ), AudioDown() );
}
}
else
@@ -603,6 +607,8 @@ bool MainInterface::winEvent ( MSG * msg, long * result )
//We received the taskbarbuttoncreated, now we can really create th buttons
createTaskBarButtons();
}
+
+ short cmd;
switch( msg->message )
{
case WM_COMMAND:
@@ -622,6 +628,43 @@ 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:
+ emit playPauseSignal();
+ break;
+ case APPCOMMAND_MEDIA_PLAY:
+ emit play();
+ break;
+ case APPCOMMAND_MEDIA_PAUSE:
+ emit pause();
+ break;
+ case APPCOMMAND_MEDIA_PREVIOUSTRACK:
+ emit prevSignal();
+ break;
+ case APPCOMMAND_MEDIA_NEXTTRACK:
+ emit nextSignal();
+ break;
+ case APPCOMMAND_MEDIA_STOP:
+ emit stop();
+ break;
+ case APPCOMMAND_VOLUME_DOWN:
+ emit volumeDown();
+ break;
+ case APPCOMMAND_VOLUME_UP:
+ emit volumeUp();
+ break;
+ case APPCOMMAND_VOLUME_MUTE:
+ emit mute();
+ break;
+ default:
+ msg_Dbg( p_intf, "unknown APPCOMMAND = %d", cmd);
+ break;
+ }
+ break;
}
return false;
}
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index 95be81e..3315665 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -227,8 +227,54 @@ signals:
void minimalViewToggled( bool );
void fullscreenInterfaceToggled( bool );
void playPauseSignal();
+ void play();
+ void pause();
+ void stop();
+ void volumeUp();
+ void volumeDown();
+ void mute();
void prevSignal();
void nextSignal();
};
+#ifdef WIN32
+#define WM_APPCOMMAND 0x0319
+
+#define APPCOMMAND_VOLUME_MUTE 8
+#define APPCOMMAND_VOLUME_DOWN 9
+#define APPCOMMAND_VOLUME_UP 10
+#define APPCOMMAND_MEDIA_NEXTTRACK 11
+#define APPCOMMAND_MEDIA_PREVIOUSTRACK 12
+#define APPCOMMAND_MEDIA_STOP 13
+#define APPCOMMAND_MEDIA_PLAY_PAUSE 14
+#define APPCOMMAND_LAUNCH_MEDIA_SELECT 16
+#define APPCOMMAND_BASS_DOWN 19
+#define APPCOMMAND_BASS_BOOST 20
+#define APPCOMMAND_BASS_UP 21
+#define APPCOMMAND_TREBLE_DOWN 22
+#define APPCOMMAND_TREBLE_UP 23
+#define APPCOMMAND_MICROPHONE_VOLUME_MUTE 24
+#define APPCOMMAND_MICROPHONE_VOLUME_DOWN 25
+#define APPCOMMAND_MICROPHONE_VOLUME_UP 26
+#define APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE 43
+#define APPCOMMAND_MIC_ON_OFF_TOGGLE 44
+#define APPCOMMAND_MEDIA_PLAY 46
+#define APPCOMMAND_MEDIA_PAUSE 47
+#define APPCOMMAND_MEDIA_RECORD 48
+#define APPCOMMAND_MEDIA_FAST_FORWARD 49
+#define APPCOMMAND_MEDIA_REWIND 50
+#define APPCOMMAND_MEDIA_CHANNEL_UP 51
+#define APPCOMMAND_MEDIA_CHANNEL_DOWN 52
+
+#define FAPPCOMMAND_MOUSE 0x8000
+#define FAPPCOMMAND_KEY 0
+#define FAPPCOMMAND_OEM 0x1000
+#define FAPPCOMMAND_MASK 0xF000
+
+#define GET_APPCOMMAND_LPARAM(lParam) ((short)(HIWORD(lParam) & ~FAPPCOMMAND_MASK))
+#define GET_DEVICE_LPARAM(lParam) ((WORD)(HIWORD(lParam) & FAPPCOMMAND_MASK))
+#define GET_MOUSEORKEY_LPARAM GET_DEVICE_LPARAM
+#define GET_FLAGS_LPARAM(lParam) (LOWORD(lParam))
+#define GET_KEYSTATE_LPARAM(lParam) GET_FLAGS_LPARAM(lParam)
+#endif
#endif
diff --git a/modules/gui/qt4/util/qvlcapp.hpp b/modules/gui/qt4/util/qvlcapp.hpp
index 3144ad9..bfd8a90 100644
--- a/modules/gui/qt4/util/qvlcapp.hpp
+++ b/modules/gui/qt4/util/qvlcapp.hpp
@@ -61,23 +61,6 @@ public:
}
#endif
-#if defined(Q_WS_WIN)
-#define THBN_CLICKED 0x1800
-protected:
- virtual bool winEventFilter( MSG *msg, long *result )
- {
- switch( msg->message )
- {
- case 0x0319: /* WM_APPCOMMAND 0x0319 */
- DefWindowProc( msg->hwnd, msg->message,
- msg->wParam, msg->lParam );
- break;
- }
- return false;
- }
-#endif
-
-
signals:
void quitSignal();
More information about the vlc-devel
mailing list