Commit 82a0f299 authored by Geoffroy Couprie's avatar 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.
parent 9fa5378b
......@@ -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;
}
......
......@@ -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
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment