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{
|
||||
id: terminalContainer
|
||||
signal sessionFinished()
|
||||
|
||||
property size virtualResolution: Qt.size(kterminal.totalWidth, kterminal.totalHeight)
|
||||
property alias mainTerminal: kterminal
|
||||
@@ -126,7 +127,7 @@ Item{
|
||||
id: ksession
|
||||
|
||||
onFinished: {
|
||||
Qt.quit()
|
||||
terminalContainer.sessionFinished()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import "utils.js" as Utils
|
||||
ShaderTerminal {
|
||||
property alias title: terminal.title
|
||||
property alias terminalSize: terminal.terminalSize
|
||||
signal sessionFinished()
|
||||
|
||||
property real devicePixelRatio: terminalWindow.screen.devicePixelRatio
|
||||
property bool loadBloomEffect: appSettings.bloom > 0 || appSettings._frameShininess > 0
|
||||
@@ -44,6 +45,7 @@ ShaderTerminal {
|
||||
PreprocessedTerminal {
|
||||
id: terminal
|
||||
anchors.fill: parent
|
||||
onSessionFinished: mainShader.sessionFinished()
|
||||
}
|
||||
|
||||
function activate() {
|
||||
|
||||
@@ -28,6 +28,7 @@ Item {
|
||||
readonly property size terminalSize: stack.currentItem ? stack.currentItem.terminalSize : Qt.size(0, 0)
|
||||
property alias currentIndex: tabBar.currentIndex
|
||||
readonly property int count: tabsModel.count
|
||||
property var hostWindow
|
||||
|
||||
function addTab() {
|
||||
tabsModel.append({ title: qsTr("Tab %1").arg(tabsModel.count + 1) })
|
||||
@@ -35,8 +36,10 @@ Item {
|
||||
}
|
||||
|
||||
function closeTab(index) {
|
||||
if (tabsModel.count <= 1)
|
||||
if (tabsModel.count <= 1) {
|
||||
hostWindow.close()
|
||||
return
|
||||
}
|
||||
|
||||
tabsModel.remove(index)
|
||||
if (tabBar.currentIndex >= tabsModel.count) {
|
||||
@@ -109,6 +112,7 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
onTitleChanged: tabsModel.setProperty(index, "title", title)
|
||||
onSessionFinished: tabsRoot.closeTab(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,7 @@ ApplicationWindow {
|
||||
id: terminalTabs
|
||||
width: parent.width
|
||||
height: (parent.height + Math.abs(y))
|
||||
hostWindow: terminalWindow
|
||||
}
|
||||
Loader {
|
||||
anchors.centerIn: parent
|
||||
|
||||
Reference in New Issue
Block a user