1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2026-02-08 00:32:27 +00:00

Revert "Make actions between the different menus global."

This reverts commit e70268bb73.
This commit is contained in:
Filippo Scognamiglio
2026-01-22 00:16:31 +01:00
parent 8cf303132f
commit 2e4536ecdf
8 changed files with 112 additions and 116 deletions

View File

@@ -20,15 +20,14 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQml
import QMLTermWidget 2.0 import QMLTermWidget 2.0
import "menus" import "menus"
import "utils.js" as Utils import "utils.js" as Utils
Item { Item{
id: preprocessedTerminal id: terminalContainer
signal sessionFinished() signal sessionFinished()
property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight) property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight)
@@ -48,14 +47,14 @@ Item {
// Manage copy and paste // Manage copy and paste
Connections { Connections {
target: copyAction target: copyAction
enabled: terminalContainer.hasFocus
onTriggered: { onTriggered: {
kterminal.copyClipboard() kterminal.copyClipboard()
} }
} }
Connections { Connections {
target: pasteAction target: pasteAction
enabled: terminalContainer.hasFocus
onTriggered: { onTriggered: {
kterminal.pasteClipboard() kterminal.pasteClipboard()
} }
@@ -66,22 +65,22 @@ Item {
target: appSettings target: appSettings
onFontScalingChanged: { onFontScalingChanged: {
preprocessedTerminal.updateSources() terminalContainer.updateSources()
} }
onFontWidthChanged: { onFontWidthChanged: {
preprocessedTerminal.updateSources() terminalContainer.updateSources()
} }
} }
Connections { Connections {
target: preprocessedTerminal target: terminalContainer
onWidthChanged: { onWidthChanged: {
preprocessedTerminal.updateSources() terminalContainer.updateSources()
} }
onHeightChanged: { onHeightChanged: {
preprocessedTerminal.updateSources() terminalContainer.updateSources()
} }
} }
@@ -119,7 +118,7 @@ Item {
id: ksession id: ksession
onFinished: { onFinished: {
preprocessedTerminal.sessionFinished() terminalContainer.sessionFinished()
} }
} }
@@ -149,8 +148,8 @@ Item {
pixelSize: pixelSize pixelSize: pixelSize
}); });
preprocessedTerminal.fontWidth = fontWidth; terminalContainer.fontWidth = fontWidth;
preprocessedTerminal.screenScaling = screenScaling; terminalContainer.screenScaling = screenScaling;
scaleTexture = Math.max(1.0, Math.floor(screenScaling * appSettings.windowScaling)); scaleTexture = Math.max(1.0, Math.floor(screenScaling * appSettings.windowScaling));
} }
@@ -158,7 +157,7 @@ Item {
target: appSettings target: appSettings
onWindowScalingChanged: { onWindowScalingChanged: {
scaleTexture = Math.max(1.0, Math.floor(preprocessedTerminal.screenScaling * appSettings.windowScaling)); scaleTexture = Math.max(1.0, Math.floor(terminalContainer.screenScaling * appSettings.windowScaling));
} }
} }
@@ -214,7 +213,7 @@ Item {
cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor cursorShape: kterminal.terminalUsesMouse ? Qt.ArrowCursor : Qt.IBeamCursor
onWheel: function(wheel) { onWheel: function(wheel) {
if (wheel.modifiers & Qt.ControlModifier) { if (wheel.modifiers & Qt.ControlModifier) {
wheel.angleDelta.y > 0 ? zoomInAction.trigger() : zoomOutAction.trigger(); wheel.angleDelta.y > 0 ? zoomIn.trigger() : zoomOut.trigger();
} else { } else {
var coord = correctDistortion(wheel.x, wheel.y); var coord = correctDistortion(wheel.x, wheel.y);
kterminal.simulateWheel(coord.x, coord.y, wheel.buttons, wheel.modifiers, wheel.angleDelta); kterminal.simulateWheel(coord.x, coord.y, wheel.buttons, wheel.modifiers, wheel.angleDelta);

View File

@@ -28,13 +28,6 @@ ShaderTerminal {
signal sessionFinished() signal sessionFinished()
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0 property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
property bool hasFocus
onHasFocusChanged: {
if (hasFocus) {
activate()
}
}
id: mainShader id: mainShader
opacity: appSettings.windowOpacity * 0.3 + 0.7 opacity: appSettings.windowOpacity * 0.3 + 0.7

View File

@@ -130,11 +130,12 @@ Item {
Repeater { Repeater {
model: tabsModel model: tabsModel
TerminalContainer { TerminalContainer {
id: terminalContainer property bool shouldHaveFocus: terminalWindow.active && StackLayout.isCurrentItem
hasFocus: terminalWindow.active && StackLayout.isCurrentItem onShouldHaveFocusChanged: {
if (shouldHaveFocus) {
onTerminalSizeChanged: updateTerminalSize() activate()
}
}
onTitleChanged: tabsModel.setProperty(index, "title", normalizeTitle(title)) onTitleChanged: tabsModel.setProperty(index, "title", normalizeTitle(title))
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true

View File

@@ -20,7 +20,6 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQml
import "menus" import "menus"
@@ -51,24 +50,87 @@ ApplicationWindow {
sourceComponent: WindowMenu { } sourceComponent: WindowMenu { }
} }
Connections {
target: newTabAction
enabled: terminalWindow.active
onTriggered: terminalTabs.addTab()
}
Connections {
target: fullscreenAction
enabled: terminalWindow.active
onTriggered: terminalWindow.fullscreen = !terminalWindow.fullscreen
}
property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height)) property real normalizedWindowScale: 1024 / ((0.5 * width + 0.5 * height))
color: "#00000000" color: "#00000000"
title: terminalTabs.currentTitle title: terminalTabs.currentTitle
Action {
id: showMenubarAction
text: qsTr("Show Menubar")
enabled: !appSettings.isMacOS
shortcut: "Ctrl+Shift+M"
checkable: true
checked: appSettings.showMenubar
onTriggered: appSettings.showMenubar = !appSettings.showMenubar
}
Action {
id: fullscreenAction
text: qsTr("Fullscreen")
enabled: !appSettings.isMacOS
shortcut: "Alt+F11"
onTriggered: appSettings.fullscreen = !appSettings.fullscreen
checkable: true
checked: appSettings.fullscreen
}
Action {
id: newWindowAction
text: qsTr("New Window")
shortcut: "Ctrl+Shift+N"
onTriggered: appRoot.createWindow()
}
Action {
id: quitAction
text: qsTr("Quit")
shortcut: "Ctrl+Shift+Q"
onTriggered: appSettings.close()
}
Action {
id: showsettingsAction
text: qsTr("Settings")
onTriggered: {
settingsWindow.show()
settingsWindow.requestActivate()
settingsWindow.raise()
}
}
Action {
id: copyAction
text: qsTr("Copy")
shortcut: "Ctrl+Shift+C"
}
Action {
id: pasteAction
text: qsTr("Paste")
shortcut: "Ctrl+Shift+V"
}
Action {
id: zoomIn
text: qsTr("Zoom In")
shortcut: "Ctrl++"
onTriggered: appSettings.incrementScaling()
}
Action {
id: zoomOut
text: qsTr("Zoom Out")
shortcut: "Ctrl+-"
onTriggered: appSettings.decrementScaling()
}
Action {
id: showAboutAction
text: qsTr("About")
onTriggered: {
aboutDialog.show()
aboutDialog.requestActivate()
aboutDialog.raise()
}
}
Action {
id: newTabAction
text: qsTr("New Tab")
onTriggered: terminalTabs.addTab()
}
TerminalTabs { TerminalTabs {
id: terminalTabs id: terminalTabs
width: parent.width width: parent.width

View File

@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/ *******************************************************************************/
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 2.3
import "menus" import "menus"
@@ -52,78 +51,12 @@ QtObject {
sourceComponent: OSXMenu { } 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() { function createWindow() {
var useFullscreen = initialFullscreenRequested var window = windowComponent.createObject(null)
var window = windowComponent.createObject(null, { fullscreen: useFullscreen })
if (!window) if (!window)
return return
windowsModel.append({ window: window }) windowsModel.append({ window: window })
initialFullscreenRequested = false
window.show() window.show()
window.requestActivate() window.requestActivate()
} }

View File

@@ -65,10 +65,14 @@ Menu {
visible: fullscreenAction.enabled visible: fullscreenAction.enabled
} }
MenuItem { MenuItem {
action: zoomInAction action: showMenubarAction
visible: showMenubarAction.enabled
} }
MenuItem { MenuItem {
action: zoomOutAction action: zoomIn
}
MenuItem {
action: zoomOut
} }
} }
Menu { Menu {

View File

@@ -64,14 +64,14 @@ MenuBar {
Menu { Menu {
title: qsTr("View") title: qsTr("View")
MenuItem { MenuItem {
text: zoomInAction.text text: zoomIn.text
shortcut: "Meta++" shortcut: "Meta++"
onTriggered: zoomInAction.trigger() onTriggered: zoomIn.trigger()
} }
MenuItem { MenuItem {
text: zoomOutAction.text text: zoomOut.text
shortcut: "Meta+-" shortcut: "Meta+-"
onTriggered: zoomOutAction.trigger() onTriggered: zoomOut.trigger()
} }
} }
Menu { Menu {

View File

@@ -57,10 +57,14 @@ MenuBar {
visible: fullscreenAction.enabled visible: fullscreenAction.enabled
} }
MenuItem { MenuItem {
action: zoomInAction action: showMenubarAction
visible: showMenubarAction.enabled
} }
MenuItem { MenuItem {
action: zoomOutAction action: zoomIn
}
MenuItem {
action: zoomOut
} }
} }
Menu { Menu {