mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 16:29:43 +01:00
Add multimedia key support on windows and linux
This commit is contained in:
parent
838b802846
commit
e74ec6ba79
@ -410,6 +410,54 @@ TomahawkWindow::hideEvent( QHideEvent* e )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::keyPressEvent( QKeyEvent* e )
|
||||
{
|
||||
bool accept = true;
|
||||
#if ! defined ( Q_WS_MAC )
|
||||
#define KEY_PRESSED Q_FUNC_INFO << "Multimedia Key Pressed: "
|
||||
|
||||
switch( e->key() )
|
||||
{
|
||||
case Qt::Key_MediaPlay:
|
||||
tLog() << KEY_PRESSED << "Play";
|
||||
AudioEngine::instance()->play();
|
||||
break;
|
||||
case Qt::Key_MediaStop:
|
||||
tLog() << KEY_PRESSED << "Stop";
|
||||
AudioEngine::instance()->stop();
|
||||
break;
|
||||
case Qt::Key_MediaPrevious:
|
||||
tLog() << KEY_PRESSED << "Previous";
|
||||
AudioEngine::instance()->previous();
|
||||
break;
|
||||
case Qt::Key_MediaNext:
|
||||
tLog() << KEY_PRESSED << "Next";
|
||||
AudioEngine::instance()->next();
|
||||
break;
|
||||
case Qt::Key_MediaPause:
|
||||
tLog() << KEY_PRESSED << "Pause";
|
||||
AudioEngine::instance()->pause();
|
||||
break;
|
||||
case Qt::Key_MediaTogglePlayPause:
|
||||
tLog() << KEY_PRESSED << "PlayPause";
|
||||
AudioEngine::instance()->playPause();
|
||||
break;
|
||||
case Qt::Key_MediaRecord:
|
||||
default:
|
||||
accept = false;
|
||||
}
|
||||
#else
|
||||
accept = false;
|
||||
#endif
|
||||
|
||||
if(accept)
|
||||
e->accept();
|
||||
|
||||
QMainWindow::keyPressEvent( e );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkWindow::showSettingsDialog()
|
||||
{
|
||||
|
@ -73,6 +73,7 @@ protected:
|
||||
void closeEvent( QCloseEvent* e );
|
||||
void showEvent( QShowEvent* e );
|
||||
void hideEvent( QHideEvent* e );
|
||||
void keyPressEvent( QKeyEvent* e );
|
||||
|
||||
public slots:
|
||||
void createAutomaticPlaylist( QString );
|
||||
|
Loading…
x
Reference in New Issue
Block a user