[vlc-commits] qml: add global shortcuts
Pierre Lamot
git at videolan.org
Thu Oct 8 09:42:07 CEST 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Oct 5 13:49:27 2020 +0200| [5c6166f6ff375371ab02e9d4ee8816cb99961dfd] | committer: Pierre Lamot
qml: add global shortcuts
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5c6166f6ff375371ab02e9d4ee8816cb99961dfd
---
modules/gui/qt/Makefile.am | 1 +
modules/gui/qt/maininterface/qml/MainInterface.qml | 5 ++
modules/gui/qt/menus/qml/GlobalShortcuts.qml | 59 ++++++++++++++++++++++
modules/gui/qt/vlc.qrc | 1 +
4 files changed, 66 insertions(+)
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index c85f52fb83..e6cab60218 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -637,6 +637,7 @@ libqt_plugin_la_QML = \
gui/qt/medialibrary/qml/VideoListDisplay.qml \
gui/qt/menus/qml/AudioMenu.qml \
gui/qt/menus/qml/CheckableModelSubMenu.qml \
+ gui/qt/menus/qml/GlobalShortcuts.qml \
gui/qt/menus/qml/HelpMenu.qml \
gui/qt/menus/qml/MainDropdownMenu.qml \
gui/qt/menus/qml/MainMenubar.qml \
diff --git a/modules/gui/qt/maininterface/qml/MainInterface.qml b/modules/gui/qt/maininterface/qml/MainInterface.qml
index 2e3dd9b8ef..477464eb6f 100644
--- a/modules/gui/qt/maininterface/qml/MainInterface.qml
+++ b/modules/gui/qt/maininterface/qml/MainInterface.qml
@@ -164,6 +164,11 @@ Rectangle {
}
}
+ Loader {
+ asynchronous: true
+ source: "qrc:///menus/GlobalShortcuts.qml"
+ }
+
Loader {
id: dialogsLoader
diff --git a/modules/gui/qt/menus/qml/GlobalShortcuts.qml b/modules/gui/qt/menus/qml/GlobalShortcuts.qml
new file mode 100644
index 0000000000..489a4cad97
--- /dev/null
+++ b/modules/gui/qt/menus/qml/GlobalShortcuts.qml
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (C) 2020 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+import QtQuick 2.11
+
+Item {
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+O"; onActivated: dialogProvider.simpleOpenDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Shift+O"; onActivated: dialogProvider.openFileDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+F"; onActivated: dialogProvider.PLOpenDir(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+D"; onActivated: dialogProvider.openDiscDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+N"; onActivated: dialogProvider.openNetDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+C"; onActivated: dialogProvider.openCaptureDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+V"; onActivated: dialogProvider.openUrlDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Y"; onActivated: dialogProvider.savePlayingToPlaylist(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+R"; onActivated: dialogProvider.openAndTranscodingDialogs(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+S"; onActivated: dialogProvider.openAndStreamingDialogs(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Q"; onActivated: dialogProvider.quit(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+E"; onActivated: dialogProvider.extendedDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+I"; onActivated: dialogProvider.mediaInfoDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+J"; onActivated: dialogProvider.mediaCodecDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+M"; onActivated: dialogProvider.messagesDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+P"; onActivated: dialogProvider.prefsDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+B"; onActivated: dialogProvider.bookmarksDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+T"; onActivated: dialogProvider.gotoTimeDialog(); }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"F1"; onActivated: dialogProvider.helpDialog(); }
+
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+Shift+W"; onActivated: dialogProvider.vlmDialog(); enabled: mainInterface.hasVLM; }
+
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"Ctrl+L"; onActivated: mainInterface.playlistVisible = !mainInterface.playlistVisible; }
+ Shortcut{ context: Qt.ApplicationShortcut; sequence:"F11"; onActivated: mainInterface.toggleInterfaceFullScreen(); }
+
+ Repeater {
+ model: recentsMedias
+
+ Item {
+ Shortcut {
+ sequence: "Ctrl+" + (index + 1)
+ onActivated: mainPlaylistController.append([mrl], true)
+ context: Qt.ApplicationShortcut
+ }
+ }
+ }
+
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index fcf9c86592..d9d9c8da66 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -294,6 +294,7 @@
<file alias="CheckableModelSubMenu.qml">menus/qml/CheckableModelSubMenu.qml</file>
<file alias="ViewMenu.qml">menus/qml/ViewMenu.qml</file>
<file alias="PopupMenu.qml">menus/qml/PopupMenu.qml</file>
+ <file alias="GlobalShortcuts.qml">menus/qml/GlobalShortcuts.qml</file>
</qresource>
<qresource prefix="/player">
<file alias="Player.qml">player/qml/Player.qml</file>
More information about the vlc-commits
mailing list