diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-10-15 19:00:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-28 20:00:40 +0100 |
commit | 06285084ea92dc8900ba195db5379501e0173c53 (patch) | |
tree | 755ab3f57407d8bc280dfaede52b45685cdd7d2f /Source/WebCore | |
parent | 36321b9aaeedef1232d464d3dd7d03f39b7f7f37 (diff) |
Support HTML5 media context menu items
Support most of the items WebCore populates the context menu with when
the user right clicks an HTML5 audio or video element.
Change-Id: I331a3271f68075fe70d914e2675620f617d53b42
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/page/ContextMenuController.cpp | 7 | ||||
-rw-r--r-- | Source/WebCore/platform/LocalizedStrings.cpp | 7 | ||||
-rw-r--r-- | Source/WebCore/platform/LocalizedStrings.h | 5 | ||||
-rw-r--r-- | Source/WebCore/platform/qt/LocalizedStringsQt.cpp | 35 |
4 files changed, 47 insertions, 7 deletions
diff --git a/Source/WebCore/page/ContextMenuController.cpp b/Source/WebCore/page/ContextMenuController.cpp index a7152259a..e5fa989e5 100644 --- a/Source/WebCore/page/ContextMenuController.cpp +++ b/Source/WebCore/page/ContextMenuController.cpp @@ -775,7 +775,7 @@ void ContextMenuController::populate() ContextMenuItem CopyMediaLinkItem(ActionType, ContextMenuItemTagCopyMediaLinkToClipboard, String()); ContextMenuItem MediaPlayPause(ActionType, ContextMenuItemTagMediaPlayPause, contextMenuItemTagMediaPlay()); - ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute, + ContextMenuItem MediaMute(ActionType, ContextMenuItemTagMediaMute, contextMenuItemTagMediaMute()); #if SUPPORTS_TOGGLE_SHOW_HIDE_MEDIA_CONTROLS ContextMenuItem ToggleMediaControls(ActionType, ContextMenuItemTagToggleMediaControls, @@ -1434,6 +1434,11 @@ void ContextMenuController::checkOrEnableIfNeeded(ContextMenuItem& item) const item.setTitle(contextMenuItemTagMediaPlay()); break; case ContextMenuItemTagMediaMute: + if (m_hitTestResult.mediaMuted()) + item.setTitle(contextMenuItemTagMediaUnmute()); + else + item.setTitle(contextMenuItemTagMediaMute()); + break; shouldEnable = m_hitTestResult.mediaHasAudio(); shouldCheck = shouldEnable && m_hitTestResult.mediaMuted(); break; diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp index 0ebc8e824..faaa1b703 100644 --- a/Source/WebCore/platform/LocalizedStrings.cpp +++ b/Source/WebCore/platform/LocalizedStrings.cpp @@ -533,7 +533,12 @@ String contextMenuItemTagMediaMute() { return WEB_UI_STRING("Mute", "Media Mute context menu item"); } - + +String contextMenuItemTagMediaUnmute() +{ + return WEB_UI_STRING("Unmute", "Media Unmute context menu item"); +} + String contextMenuItemTagInspectElement() { return WEB_UI_STRING("Inspect Element", "Inspect Element context menu item"); diff --git a/Source/WebCore/platform/LocalizedStrings.h b/Source/WebCore/platform/LocalizedStrings.h index 43b611858..94d9b6499 100644 --- a/Source/WebCore/platform/LocalizedStrings.h +++ b/Source/WebCore/platform/LocalizedStrings.h @@ -132,19 +132,24 @@ namespace WebCore { #endif String contextMenuItemTagOpenVideoInNewWindow(); String contextMenuItemTagOpenAudioInNewWindow(); + String contextMenuItemTagOpenMediaInNewWindow(); String contextMenuItemTagDownloadVideoToDisk(); String contextMenuItemTagDownloadAudioToDisk(); + String contextMenuItemTagDownloadMediaToDisk(); String contextMenuItemTagCopyVideoLinkToClipboard(); String contextMenuItemTagCopyAudioLinkToClipboard(); + String contextMenuItemTagCopyMediaLinkToClipboard(); String contextMenuItemTagToggleMediaControls(); String contextMenuItemTagShowMediaControls(); String contextMenuItemTagHideMediaControls(); String contextMenuItemTagToggleMediaLoop(); String contextMenuItemTagEnterVideoFullscreen(); String contextMenuItemTagExitVideoFullscreen(); + String contextMenuItemTagMediaPlayPause(); String contextMenuItemTagMediaPlay(); String contextMenuItemTagMediaPause(); String contextMenuItemTagMediaMute(); + String contextMenuItemTagMediaUnmute(); String contextMenuItemTagInspectElement(); #endif // ENABLE(CONTEXT_MENUS) diff --git a/Source/WebCore/platform/qt/LocalizedStringsQt.cpp b/Source/WebCore/platform/qt/LocalizedStringsQt.cpp index bf1f6ff0e..d8605b24d 100644 --- a/Source/WebCore/platform/qt/LocalizedStringsQt.cpp +++ b/Source/WebCore/platform/qt/LocalizedStringsQt.cpp @@ -133,6 +133,11 @@ String contextMenuItemTagOpenAudioInNewWindow() return QCoreApplication::translate("QWebPage", "Open Audio", "Open Audio in New Window"); } +String contextMenuItemTagOpenMediaInNewWindow() +{ + return QCoreApplication::translate("QWebPage", "Open Media", "Open Media in New Window context menu item"); +} + String contextMenuItemTagDownloadVideoToDisk() { return QCoreApplication::translate("QWebPage", "Download Video", "Download Video context menu item"); @@ -143,19 +148,29 @@ String contextMenuItemTagDownloadAudioToDisk() return QCoreApplication::translate("QWebPage", "Download Audio", "Download Audio context menu item"); } +String contextMenuItemTagDownloadMediaToDisk() +{ + return QCoreApplication::translate("QWebPage", "Download Media", "Download Media context menu item"); +} + String contextMenuItemTagCopyVideoLinkToClipboard() { - return QCoreApplication::translate("QWebPage", "Copy Video", "Copy Video Link Location"); + return QCoreApplication::translate("QWebPage", "Copy Video Address", "Copy Video Link to Clipboard"); } String contextMenuItemTagCopyAudioLinkToClipboard() { - return QCoreApplication::translate("QWebPage", "Copy Audio", "Copy Audio Link Location"); + return QCoreApplication::translate("QWebPage", "Copy Audio Address", "Copy Audio Link to Clipboard"); +} + +String contextMenuItemTagCopyMediaLinkToClipboard() +{ + return QCoreApplication::translate("QWebPage", "Copy Media Address", "Copy Media Link to Clipboard"); } String contextMenuItemTagToggleMediaControls() { - return QCoreApplication::translate("QWebPage", "Toggle Controls", "Toggle Media Controls"); + return QCoreApplication::translate("QWebPage", "Show Controls", "Toggle Media Controls checkable context menu item"); } String contextMenuItemTagShowMediaControls() @@ -170,7 +185,7 @@ String contextMenuItemTagHideMediaControls() String contextMenuItemTagToggleMediaLoop() { - return QCoreApplication::translate("QWebPage", "Toggle Loop", "Toggle Media Loop Playback"); + return QCoreApplication::translate("QWebPage", "Looping", "Toggle Media Loop Playback"); } String contextMenuItemTagEnterVideoFullscreen() @@ -188,9 +203,19 @@ String contextMenuItemTagMediaPause() return QCoreApplication::translate("QWebPage", "Pause", "Pause"); } +String contextMenuItemTagMediaPlayPause() +{ + return QCoreApplication::translate("QWebPage", "Play/Pause", "Toggle Play and Pause state"); +} + String contextMenuItemTagMediaMute() { - return QCoreApplication::translate("QWebPage", "Mute", "Mute"); + return QCoreApplication::translate("QWebPage", "Mute", "Media Mute context menu item"); +} + +String contextMenuItemTagMediaUnmute() +{ + return QCoreApplication::translate("QWebPage", "Unmute", "Media Unmute context menu item"); } String contextMenuItemTagOpenFrameInNewWindow() |