mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Fix shortcuts on macOS.
This commit is contained in:
@@ -140,6 +140,7 @@ Item {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
onSessionFinished: tabsRoot.closeTab(index)
|
onSessionFinished: tabsRoot.closeTab(index)
|
||||||
|
onTerminalSizeChanged: updateTerminalSize()
|
||||||
|
|
||||||
function updateTerminalSize() {
|
function updateTerminalSize() {
|
||||||
// Every tab will have the same size so we can simply take the first one.
|
// Every tab will have the same size so we can simply take the first one.
|
||||||
|
|||||||
@@ -42,13 +42,7 @@ ApplicationWindow {
|
|||||||
property bool fullscreen: false
|
property bool fullscreen: false
|
||||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||||
|
|
||||||
menuBar: qtquickMenuLoader.item
|
menuBar: WindowMenu { }
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: qtquickMenuLoader
|
|
||||||
active: appSettings.isMacOS || (appSettings.showMenubar && !fullscreen)
|
|
||||||
sourceComponent: WindowMenu { }
|
|
||||||
}
|
|
||||||
|
|
||||||
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
|
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
|
||||||
|
|
||||||
@@ -60,7 +54,7 @@ ApplicationWindow {
|
|||||||
id: fullscreenAction
|
id: fullscreenAction
|
||||||
text: qsTr("Fullscreen")
|
text: qsTr("Fullscreen")
|
||||||
enabled: !appSettings.isMacOS
|
enabled: !appSettings.isMacOS
|
||||||
shortcut: "Alt+F11"
|
shortcut: StandardKey.FullScreen
|
||||||
onTriggered: fullscreen = !fullscreen
|
onTriggered: fullscreen = !fullscreen
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: fullscreen
|
checked: fullscreen
|
||||||
@@ -68,14 +62,14 @@ ApplicationWindow {
|
|||||||
Action {
|
Action {
|
||||||
id: newWindowAction
|
id: newWindowAction
|
||||||
text: qsTr("New Window")
|
text: qsTr("New Window")
|
||||||
shortcut: "Ctrl+Shift+N"
|
shortcut: appSettings.isMacOS ? "Meta+N" : "Ctrl+Shift+N"
|
||||||
onTriggered: appRoot.createWindow()
|
onTriggered: appRoot.createWindow()
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
id: quitAction
|
id: quitAction
|
||||||
text: qsTr("Quit")
|
text: qsTr("Quit")
|
||||||
shortcut: "Ctrl+Shift+Q"
|
shortcut: appSettings.isMacOS ? StandardKey.Close : "Ctrl+Shift+Q"
|
||||||
onTriggered: appSettings.close()
|
onTriggered: terminalWindow.close()
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
id: showsettingsAction
|
id: showsettingsAction
|
||||||
@@ -89,23 +83,23 @@ ApplicationWindow {
|
|||||||
Action {
|
Action {
|
||||||
id: copyAction
|
id: copyAction
|
||||||
text: qsTr("Copy")
|
text: qsTr("Copy")
|
||||||
shortcut: "Ctrl+Shift+C"
|
shortcut: appSettings.isMacOS ? StandardKey.Copy : "Ctrl+Shift+C"
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
id: pasteAction
|
id: pasteAction
|
||||||
text: qsTr("Paste")
|
text: qsTr("Paste")
|
||||||
shortcut: "Ctrl+Shift+V"
|
shortcut: appSettings.isMacOS ? StandardKey.Paste : "Ctrl+Shift+V"
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
id: zoomIn
|
id: zoomIn
|
||||||
text: qsTr("Zoom In")
|
text: qsTr("Zoom In")
|
||||||
shortcut: "Ctrl++"
|
shortcut: StandardKey.ZoomIn
|
||||||
onTriggered: appSettings.incrementScaling()
|
onTriggered: appSettings.incrementScaling()
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
id: zoomOut
|
id: zoomOut
|
||||||
text: qsTr("Zoom Out")
|
text: qsTr("Zoom Out")
|
||||||
shortcut: "Ctrl+-"
|
shortcut: StandardKey.ZoomOut
|
||||||
onTriggered: appSettings.decrementScaling()
|
onTriggered: appSettings.decrementScaling()
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
@@ -120,6 +114,7 @@ ApplicationWindow {
|
|||||||
Action {
|
Action {
|
||||||
id: newTabAction
|
id: newTabAction
|
||||||
text: qsTr("New Tab")
|
text: qsTr("New Tab")
|
||||||
|
shortcut: appSettings.isMacOS ? StandardKey.AddTab : "Ctrl+Shift+T"
|
||||||
onTriggered: terminalTabs.addTab()
|
onTriggered: terminalTabs.addTab()
|
||||||
}
|
}
|
||||||
TerminalTabs {
|
TerminalTabs {
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
|
|
||||||
* https://github.com/Swordfish90/cool-retro-term
|
|
||||||
*
|
|
||||||
* This file is part of cool-retro-term.
|
|
||||||
*
|
|
||||||
* cool-retro-term 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
import QtQuick 2.3
|
|
||||||
import Qt.labs.platform 1.1
|
|
||||||
|
|
||||||
MenuBar {
|
|
||||||
id: defaultMenuBar
|
|
||||||
|
|
||||||
Menu {
|
|
||||||
title: qsTr("File")
|
|
||||||
MenuItem {
|
|
||||||
text: newWindowAction.text
|
|
||||||
shortcut: newWindowAction.shortcut
|
|
||||||
onTriggered: newWindowAction.trigger()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: newTabAction.text
|
|
||||||
shortcut: newTabAction.shortcut
|
|
||||||
onTriggered: newTabAction.trigger()
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem {
|
|
||||||
text: quitAction.text
|
|
||||||
onTriggered: quitAction.trigger()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
title: qsTr("Edit")
|
|
||||||
MenuItem {
|
|
||||||
text: copyAction.text
|
|
||||||
shortcut: "Meta+C"
|
|
||||||
onTriggered: copyAction.trigger()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: pasteAction.text
|
|
||||||
shortcut: "Meta+V"
|
|
||||||
onTriggered: pasteAction.trigger()
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem {
|
|
||||||
text: showsettingsAction.text
|
|
||||||
shortcut: showsettingsAction.shortcut
|
|
||||||
onTriggered: showsettingsAction.trigger()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
title: qsTr("View")
|
|
||||||
MenuItem {
|
|
||||||
text: zoomIn.text
|
|
||||||
shortcut: "Meta++"
|
|
||||||
onTriggered: zoomIn.trigger()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: zoomOut.text
|
|
||||||
shortcut: "Meta+-"
|
|
||||||
onTriggered: zoomOut.trigger()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
id: profilesMenu
|
|
||||||
title: qsTr("Profiles")
|
|
||||||
Instantiator {
|
|
||||||
model: appSettings.profilesList
|
|
||||||
delegate: MenuItem {
|
|
||||||
text: model.text
|
|
||||||
onTriggered: {
|
|
||||||
appSettings.loadProfileString(obj_string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onObjectAdded: function(index, object) { profilesMenu.insertItem(index, object) }
|
|
||||||
onObjectRemoved: function(object) { profilesMenu.removeItem(object) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Menu {
|
|
||||||
title: qsTr("Help")
|
|
||||||
MenuItem {
|
|
||||||
text: showAboutAction.text
|
|
||||||
onTriggered: showAboutAction.trigger()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,46 +22,32 @@ import QtQuick.Controls 2.3
|
|||||||
|
|
||||||
MenuBar {
|
MenuBar {
|
||||||
id: defaultMenuBar
|
id: defaultMenuBar
|
||||||
visible: appSettings.showMenubar
|
visible: appSettings.isMacOS || appSettings.showMenubar
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
title: qsTr("File")
|
title: qsTr("File")
|
||||||
MenuItem {
|
MenuItem { action: newWindowAction }
|
||||||
action: newWindowAction
|
MenuItem { action: newTabAction }
|
||||||
}
|
MenuSeparator { }
|
||||||
MenuItem {
|
MenuItem { action: quitAction }
|
||||||
action: newTabAction
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem {
|
|
||||||
action: quitAction
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
title: qsTr("Edit")
|
title: qsTr("Edit")
|
||||||
MenuItem {
|
MenuItem { action: copyAction }
|
||||||
action: copyAction
|
MenuItem { action: pasteAction }
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: pasteAction
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
MenuSeparator {}
|
||||||
MenuItem {
|
MenuItem { action: showsettingsAction }
|
||||||
action: showsettingsAction
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
title: qsTr("View")
|
title: qsTr("View")
|
||||||
MenuItem {
|
Instantiator {
|
||||||
action: fullscreenAction
|
model: !appSettings.isMacOS ? 1 : 0
|
||||||
visible: fullscreenAction.enabled
|
delegate: MenuItem { action: fullscreenAction }
|
||||||
}
|
onObjectAdded: (index, object) => menu.insertItem(index, object)
|
||||||
MenuItem {
|
onObjectRemoved: (index, object) => menu.removeItem(object)
|
||||||
action: zoomIn
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
action: zoomOut
|
|
||||||
}
|
}
|
||||||
|
MenuItem { action: zoomIn }
|
||||||
|
MenuItem { action: zoomOut }
|
||||||
}
|
}
|
||||||
Menu {
|
Menu {
|
||||||
id: profilesMenu
|
id: profilesMenu
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
<file>menus/WindowMenu.qml</file>
|
<file>menus/WindowMenu.qml</file>
|
||||||
<file>menus/FullContextMenu.qml</file>
|
<file>menus/FullContextMenu.qml</file>
|
||||||
<file>menus/ShortContextMenu.qml</file>
|
<file>menus/ShortContextMenu.qml</file>
|
||||||
<file>menus/OSXMenu.qml</file>
|
|
||||||
<file>../shaders/terminal_dynamic.vert.qsb</file>
|
<file>../shaders/terminal_dynamic.vert.qsb</file>
|
||||||
<file>../shaders/terminal_static.vert.qsb</file>
|
<file>../shaders/terminal_static.vert.qsb</file>
|
||||||
<file>../shaders/terminal_frame.vert.qsb</file>
|
<file>../shaders/terminal_frame.vert.qsb</file>
|
||||||
|
|||||||
Reference in New Issue
Block a user