mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Handle closing tabs and windows when shell process is terminated.
This commit is contained in:
@@ -28,6 +28,7 @@ import "utils.js" as Utils
|
|||||||
|
|
||||||
Item{
|
Item{
|
||||||
id: terminalContainer
|
id: terminalContainer
|
||||||
|
signal sessionFinished()
|
||||||
|
|
||||||
property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight)
|
property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight)
|
||||||
property alias mainTerminal: kterminal
|
property alias mainTerminal: kterminal
|
||||||
@@ -126,7 +127,7 @@ Item{
|
|||||||
id: ksession
|
id: ksession
|
||||||
|
|
||||||
onFinished: {
|
onFinished: {
|
||||||
Qt.quit()
|
terminalContainer.sessionFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import "utils.js" as Utils
|
|||||||
ShaderTerminal {
|
ShaderTerminal {
|
||||||
property alias title: terminal.title
|
property alias title: terminal.title
|
||||||
property alias terminalSize: terminal.terminalSize
|
property alias terminalSize: terminal.terminalSize
|
||||||
|
signal sessionFinished()
|
||||||
|
|
||||||
property real devicePixelRatio: terminalWindow.screen.devicePixelRatio
|
property real devicePixelRatio: terminalWindow.screen.devicePixelRatio
|
||||||
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
||||||
@@ -44,6 +45,7 @@ ShaderTerminal {
|
|||||||
PreprocessedTerminal {
|
PreprocessedTerminal {
|
||||||
id: terminal
|
id: terminal
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
onSessionFinished: mainShader.sessionFinished()
|
||||||
}
|
}
|
||||||
|
|
||||||
function activate() {
|
function activate() {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Item {
|
|||||||
readonly property size terminalSize: stack.currentItem ? stack.currentItem.terminalSize : Qt.size(0, 0)
|
readonly property size terminalSize: stack.currentItem ? stack.currentItem.terminalSize : Qt.size(0, 0)
|
||||||
property alias currentIndex: tabBar.currentIndex
|
property alias currentIndex: tabBar.currentIndex
|
||||||
readonly property int count: tabsModel.count
|
readonly property int count: tabsModel.count
|
||||||
|
property var hostWindow
|
||||||
|
|
||||||
function addTab() {
|
function addTab() {
|
||||||
tabsModel.append({ title: qsTr("Tab %1").arg(tabsModel.count + 1) })
|
tabsModel.append({ title: qsTr("Tab %1").arg(tabsModel.count + 1) })
|
||||||
@@ -35,8 +36,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeTab(index) {
|
function closeTab(index) {
|
||||||
if (tabsModel.count <= 1)
|
if (tabsModel.count <= 1) {
|
||||||
|
hostWindow.close()
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
tabsModel.remove(index)
|
tabsModel.remove(index)
|
||||||
if (tabBar.currentIndex >= tabsModel.count) {
|
if (tabBar.currentIndex >= tabsModel.count) {
|
||||||
@@ -109,6 +112,7 @@ Item {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
onTitleChanged: tabsModel.setProperty(index, "title", title)
|
onTitleChanged: tabsModel.setProperty(index, "title", title)
|
||||||
|
onSessionFinished: tabsRoot.closeTab(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ ApplicationWindow {
|
|||||||
id: terminalTabs
|
id: terminalTabs
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: (parent.height + Math.abs(y))
|
height: (parent.height + Math.abs(y))
|
||||||
|
hostWindow: terminalWindow
|
||||||
}
|
}
|
||||||
Loader {
|
Loader {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|||||||
Reference in New Issue
Block a user