From 2473ab1cf217a989849190cbfa47fe312698adb9 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 18 Nov 2009 17:12:26 +0000 Subject: Added additional keyboard shortcuts to MediaPlayer These shortcuts are used for pausing video playback while in full-screen mode, and for exiting full-screen mode. They are for non-QWERTY mobile devices, which lack keys mapping to the previously existing shortcut keycodes. Reviewed-by: Frans Englich --- demos/qmediaplayer/mediaplayer.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index a396c70..4e0da3f 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -73,14 +73,23 @@ void MediaVideoWidget::mouseDoubleClickEvent(QMouseEvent *e) void MediaVideoWidget::keyPressEvent(QKeyEvent *e) { - if (e->key() == Qt::Key_Space && !e->modifiers()) { - m_player->playPause(); - e->accept(); - return; - } else if (e->key() == Qt::Key_Escape && !e->modifiers()) { - setFullScreen(false); - e->accept(); - return; + if(!e->modifiers()) { + // On non-QWERTY Symbian key-based devices, there is no space key. + // The zero key typically is marked with a space character. + if (e->key() == Qt::Key_Space || e->key() == Qt::Key_0) { + m_player->playPause(); + e->accept(); + return; + } + + // On Symbian devices, there is no key which maps to Qt::Key_Escape + // On devices which lack a backspace key (i.e. non-QWERTY devices), + // the 'C' key maps to Qt::Key_Backspace + else if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Backspace) { + setFullScreen(false); + e->accept(); + return; + } } Phonon::VideoWidget::keyPressEvent(e); } -- cgit v0.12