mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Merge pull request #912 from Swordfish90/fix/actions-regressions
Fix regressions in shortcuts on Linux
This commit is contained in:
@@ -20,15 +20,14 @@
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQml
|
||||
|
||||
import QMLTermWidget 2.0
|
||||
|
||||
import "menus"
|
||||
import "utils.js" as Utils
|
||||
|
||||
Item {
|
||||
id: preprocessedTerminal
|
||||
Item{
|
||||
id: terminalContainer
|
||||
signal sessionFinished()
|
||||
|
||||
property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight)
|
||||
@@ -48,14 +47,14 @@ Item {
|
||||
// Manage copy and paste
|
||||
Connections {
|
||||
target: copyAction
|
||||
enabled: terminalContainer.hasFocus
|
||||
|
||||
onTriggered: {
|
||||
kterminal.copyClipboard()
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: pasteAction
|
||||
enabled: terminalContainer.hasFocus
|
||||
|
||||
onTriggered: {
|
||||
kterminal.pasteClipboard()
|
||||
}
|
||||
@@ -66,22 +65,22 @@ Item {
|
||||
target: appSettings
|
||||
|
||||
onFontScalingChanged: {
|
||||
preprocessedTerminal.updateSources()
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
|
||||
onFontWidthChanged: {
|
||||
preprocessedTerminal.updateSources()
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: preprocessedTerminal
|
||||
target: terminalContainer
|
||||
|
||||
onWidthChanged: {
|
||||
preprocessedTerminal.updateSources()
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
|
||||
onHeightChanged: {
|
||||
preprocessedTerminal.updateSources()
|
||||
terminalContainer.updateSources()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +118,7 @@ Item {
|
||||
id: ksession
|
||||
|
||||
onFinished: {
|
||||
preprocessedTerminal.sessionFinished()
|
||||
terminalContainer.sessionFinished()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,8 +148,8 @@ Item {
|
||||
pixelSize: pixelSize
|
||||
});
|
||||
|
||||
preprocessedTerminal.fontWidth = fontWidth;
|
||||
preprocessedTerminal.screenScaling = screenScaling;
|
||||
terminalContainer.fontWidth = fontWidth;
|
||||
terminalContainer.screenScaling = screenScaling;
|
||||
scaleTexture = Math.max(1.0, Math.floor(screenScaling * appSettings.windowScaling));
|
||||
}
|
||||
|
||||
@@ -158,7 +157,7 @@ Item {
|
||||
target: appSettings
|
||||
|
||||
onWindowScalingChanged: {
|
||||
scaleTexture = Math.max(1.0, Math.floor(preprocessedTerminal.screenScaling * appSettings.windowScaling));
|
||||
scaleTexture = Math.max(1.0, Math.floor(terminalContainer.screenScaling * appSettings.windowScaling));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +186,9 @@ Item {
|
||||
appSettings.fontManager.refresh()
|
||||
startSession();
|
||||
}
|
||||
Component.onDestruction: {
|
||||
appSettings.fontManager.terminalFontChanged.disconnect(handleFontChanged);
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
@@ -214,7 +216,7 @@ Item {
|
||||
cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor
|
||||
onWheel: function(wheel) {
|
||||
if (wheel.modifiers & Qt.ControlModifier) {
|
||||
wheel.angleDelta.y > 0 ? zoomInAction.trigger() : zoomOutAction.trigger();
|
||||
wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
|
||||
} else {
|
||||
var coord = correctDistortion(wheel.x, wheel.y);
|
||||
kterminal.simulateWheel(coord.x, coord.y, wheel.buttons, wheel.modifiers, wheel.angleDelta);
|
||||
|
||||
@@ -28,13 +28,6 @@ ShaderTerminal {
|
||||
signal sessionFinished()
|
||||
|
||||
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
||||
property bool hasFocus
|
||||
|
||||
onHasFocusChanged: {
|
||||
if (hasFocus) {
|
||||
activate()
|
||||
}
|
||||
}
|
||||
|
||||
id: mainShader
|
||||
opacity: appSettings.windowOpacity * 0.3 + 0.7
|
||||
|
||||
@@ -130,15 +130,17 @@ Item {
|
||||
Repeater {
|
||||
model: tabsModel
|
||||
TerminalContainer {
|
||||
id: terminalContainer
|
||||
hasFocus: terminalWindow.active && StackLayout.isCurrentItem
|
||||
|
||||
onTerminalSizeChanged: updateTerminalSize()
|
||||
|
||||
property bool shouldHaveFocus: terminalWindow.active && StackLayout.isCurrentItem
|
||||
onShouldHaveFocusChanged: {
|
||||
if (shouldHaveFocus) {
|
||||
activate()
|
||||
}
|
||||
}
|
||||
onTitleChanged: tabsModel.setProperty(index, "title", normalizeTitle(title))
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
onSessionFinished: tabsRoot.closeTab(index)
|
||||
onTerminalSizeChanged: updateTerminalSize()
|
||||
|
||||
function updateTerminalSize() {
|
||||
// Every tab will have the same size so we can simply take the first one.
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Window 2.1
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQml
|
||||
|
||||
import "menus"
|
||||
|
||||
@@ -43,25 +42,7 @@ ApplicationWindow {
|
||||
property bool fullscreen: false
|
||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||
|
||||
menuBar: qtquickMenuLoader.item
|
||||
|
||||
Loader {
|
||||
id: qtquickMenuLoader
|
||||
active: !appSettings.isMacOS && (appSettings.showMenubar && !fullscreen)
|
||||
sourceComponent: WindowMenu { }
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: newTabAction
|
||||
enabled: terminalWindow.active
|
||||
onTriggered: terminalTabs.addTab()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: fullscreenAction
|
||||
enabled: terminalWindow.active
|
||||
onTriggered: terminalWindow.fullscreen = !terminalWindow.fullscreen
|
||||
}
|
||||
menuBar: WindowMenu { }
|
||||
|
||||
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
|
||||
|
||||
@@ -69,6 +50,73 @@ ApplicationWindow {
|
||||
|
||||
title: terminalTabs.currentTitle
|
||||
|
||||
Action {
|
||||
id: fullscreenAction
|
||||
text: qsTr("Fullscreen")
|
||||
enabled: !appSettings.isMacOS
|
||||
shortcut: StandardKey.FullScreen
|
||||
onTriggered: fullscreen = !fullscreen
|
||||
checkable: true
|
||||
checked: fullscreen
|
||||
}
|
||||
Action {
|
||||
id: newWindowAction
|
||||
text: qsTr("New Window")
|
||||
shortcut: appSettings.isMacOS ? "Meta+N" : "Ctrl+Shift+N"
|
||||
onTriggered: appRoot.createWindow()
|
||||
}
|
||||
Action {
|
||||
id: quitAction
|
||||
text: qsTr("Quit")
|
||||
shortcut: appSettings.isMacOS ? StandardKey.Close : "Ctrl+Shift+Q"
|
||||
onTriggered: terminalWindow.close()
|
||||
}
|
||||
Action {
|
||||
id: showsettingsAction
|
||||
text: qsTr("Settings")
|
||||
onTriggered: {
|
||||
settingsWindow.show()
|
||||
settingsWindow.requestActivate()
|
||||
settingsWindow.raise()
|
||||
}
|
||||
}
|
||||
Action {
|
||||
id: copyAction
|
||||
text: qsTr("Copy")
|
||||
shortcut: appSettings.isMacOS ? StandardKey.Copy : "Ctrl+Shift+C"
|
||||
}
|
||||
Action {
|
||||
id: pasteAction
|
||||
text: qsTr("Paste")
|
||||
shortcut: appSettings.isMacOS ? StandardKey.Paste : "Ctrl+Shift+V"
|
||||
}
|
||||
Action {
|
||||
id: zoomIn
|
||||
text: qsTr("Zoom In")
|
||||
shortcut: StandardKey.ZoomIn
|
||||
onTriggered: appSettings.incrementScaling()
|
||||
}
|
||||
Action {
|
||||
id: zoomOut
|
||||
text: qsTr("Zoom Out")
|
||||
shortcut: StandardKey.ZoomOut
|
||||
onTriggered: appSettings.decrementScaling()
|
||||
}
|
||||
Action {
|
||||
id: showAboutAction
|
||||
text: qsTr("About")
|
||||
onTriggered: {
|
||||
aboutDialog.show()
|
||||
aboutDialog.requestActivate()
|
||||
aboutDialog.raise()
|
||||
}
|
||||
}
|
||||
Action {
|
||||
id: newTabAction
|
||||
text: qsTr("New Tab")
|
||||
shortcut: appSettings.isMacOS ? StandardKey.AddTab : "Ctrl+Shift+T"
|
||||
onTriggered: terminalTabs.addTab()
|
||||
}
|
||||
TerminalTabs {
|
||||
id: terminalTabs
|
||||
width: parent.width
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*******************************************************************************/
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 2.3
|
||||
|
||||
import "menus"
|
||||
|
||||
@@ -47,83 +46,12 @@ QtObject {
|
||||
|
||||
property ListModel windowsModel: ListModel { }
|
||||
|
||||
property Loader globalMenuLoader: Loader {
|
||||
active: appSettings.isMacOS
|
||||
sourceComponent: OSXMenu { }
|
||||
}
|
||||
|
||||
property Action fullscreenAction: Action {
|
||||
text: qsTr("Fullscreen")
|
||||
enabled: !appSettings.isMacOS
|
||||
shortcut: "Alt+F11"
|
||||
}
|
||||
|
||||
property bool initialFullscreenRequested: Qt.application.arguments.indexOf("--fullscreen") !== -1
|
||||
|
||||
property Action newWindowAction: Action {
|
||||
text: qsTr("New Window")
|
||||
shortcut: "Ctrl+Shift+N"
|
||||
onTriggered: appRoot.createWindow()
|
||||
}
|
||||
|
||||
property Action quitAction: Action {
|
||||
text: qsTr("Quit")
|
||||
shortcut: "Ctrl+Shift+Q"
|
||||
onTriggered: appSettings.close()
|
||||
}
|
||||
|
||||
property Action showsettingsAction: Action {
|
||||
text: qsTr("Settings")
|
||||
onTriggered: {
|
||||
settingsWindow.show()
|
||||
settingsWindow.requestActivate()
|
||||
settingsWindow.raise()
|
||||
}
|
||||
}
|
||||
|
||||
property Action copyAction: Action {
|
||||
text: qsTr("Copy")
|
||||
shortcut: "Ctrl+Shift+C"
|
||||
}
|
||||
|
||||
property Action pasteAction: Action {
|
||||
text: qsTr("Paste")
|
||||
shortcut: "Ctrl+Shift+V"
|
||||
}
|
||||
|
||||
property Action zoomInAction: Action {
|
||||
text: qsTr("Zoom In")
|
||||
shortcut: "Ctrl++"
|
||||
onTriggered: appSettings.incrementScaling()
|
||||
}
|
||||
|
||||
property Action zoomOutAction: Action {
|
||||
text: qsTr("Zoom Out")
|
||||
shortcut: "Ctrl+-"
|
||||
onTriggered: appSettings.decrementScaling()
|
||||
}
|
||||
|
||||
property Action showAboutAction: Action {
|
||||
text: qsTr("About")
|
||||
onTriggered: {
|
||||
aboutDialog.show()
|
||||
aboutDialog.requestActivate()
|
||||
aboutDialog.raise()
|
||||
}
|
||||
}
|
||||
|
||||
property Action newTabAction: Action {
|
||||
text: qsTr("New Tab")
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
var useFullscreen = initialFullscreenRequested
|
||||
var window = windowComponent.createObject(null, { fullscreen: useFullscreen })
|
||||
var window = windowComponent.createObject(null)
|
||||
if (!window)
|
||||
return
|
||||
|
||||
windowsModel.append({ window: window })
|
||||
initialFullscreenRequested = false
|
||||
window.show()
|
||||
window.requestActivate()
|
||||
}
|
||||
|
||||
@@ -65,10 +65,10 @@ Menu {
|
||||
visible: fullscreenAction.enabled
|
||||
}
|
||||
MenuItem {
|
||||
action: zoomInAction
|
||||
action: zoomIn
|
||||
}
|
||||
MenuItem {
|
||||
action: zoomOutAction
|
||||
action: zoomOut
|
||||
}
|
||||
}
|
||||
Menu {
|
||||
|
||||
@@ -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: zoomInAction.text
|
||||
shortcut: "Meta++"
|
||||
onTriggered: zoomInAction.trigger()
|
||||
}
|
||||
MenuItem {
|
||||
text: zoomOutAction.text
|
||||
shortcut: "Meta+-"
|
||||
onTriggered: zoomOutAction.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,33 @@ import QtQuick.Controls 2.3
|
||||
|
||||
MenuBar {
|
||||
id: defaultMenuBar
|
||||
visible: appSettings.showMenubar
|
||||
visible: appSettings.isMacOS || appSettings.showMenubar
|
||||
|
||||
Menu {
|
||||
title: qsTr("File")
|
||||
MenuItem {
|
||||
action: newWindowAction
|
||||
}
|
||||
MenuItem {
|
||||
action: newTabAction
|
||||
}
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
action: quitAction
|
||||
}
|
||||
MenuItem { action: newWindowAction }
|
||||
MenuItem { action: newTabAction }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: quitAction }
|
||||
}
|
||||
Menu {
|
||||
title: qsTr("Edit")
|
||||
MenuItem {
|
||||
action: copyAction
|
||||
}
|
||||
MenuItem {
|
||||
action: pasteAction
|
||||
}
|
||||
MenuItem { action: copyAction }
|
||||
MenuItem { action: pasteAction }
|
||||
MenuSeparator {}
|
||||
MenuItem {
|
||||
action: showsettingsAction
|
||||
}
|
||||
MenuItem { action: showsettingsAction }
|
||||
}
|
||||
Menu {
|
||||
id: viewMenu
|
||||
title: qsTr("View")
|
||||
MenuItem {
|
||||
action: fullscreenAction
|
||||
visible: fullscreenAction.enabled
|
||||
}
|
||||
MenuItem {
|
||||
action: zoomInAction
|
||||
}
|
||||
MenuItem {
|
||||
action: zoomOutAction
|
||||
Instantiator {
|
||||
model: !appSettings.isMacOS ? 1 : 0
|
||||
delegate: MenuItem { action: fullscreenAction }
|
||||
onObjectAdded: (index, object) => viewMenu.insertItem(index, object)
|
||||
onObjectRemoved: (index, object) => viewMenu.removeItem(object)
|
||||
}
|
||||
MenuItem { action: zoomIn }
|
||||
MenuItem { action: zoomOut }
|
||||
}
|
||||
Menu {
|
||||
id: profilesMenu
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
<file>menus/WindowMenu.qml</file>
|
||||
<file>menus/FullContextMenu.qml</file>
|
||||
<file>menus/ShortContextMenu.qml</file>
|
||||
<file>menus/OSXMenu.qml</file>
|
||||
<file>../shaders/terminal_dynamic.vert.qsb</file>
|
||||
<file>../shaders/terminal_static.vert.qsb</file>
|
||||
<file>../shaders/terminal_frame.vert.qsb</file>
|
||||
|
||||
Submodule qmltermwidget updated: 7dad24fefb...d86ebbc396
Reference in New Issue
Block a user