2013-12-28 14:52:10 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2013 "Filippo Scognamiglio"
|
2014-09-03 22:19:34 +02:00
|
|
|
* https://github.com/Swordfish90/cool-retro-term
|
2013-12-28 14:52:10 +01:00
|
|
|
*
|
2014-09-03 22:19:34 +02:00
|
|
|
* This file is part of cool-retro-term.
|
2013-12-28 14:52:10 +01:00
|
|
|
*
|
2014-09-03 22:19:34 +02:00
|
|
|
* cool-retro-term is free software: you can redistribute it and/or modify
|
2013-12-28 14:52:10 +01:00
|
|
|
* 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/>.
|
|
|
|
*******************************************************************************/
|
2013-11-22 14:17:24 +01:00
|
|
|
|
2014-04-17 13:56:13 +02:00
|
|
|
import QtQuick 2.2
|
|
|
|
import QtQuick.Window 2.1
|
2021-06-30 08:33:31 +02:00
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
|
|
|
|
import "menus"
|
2014-03-20 11:29:29 +01:00
|
|
|
|
2014-03-20 16:19:11 +01:00
|
|
|
ApplicationWindow{
|
|
|
|
id: terminalWindow
|
2014-07-12 01:51:53 +02:00
|
|
|
|
2014-03-20 16:19:11 +01:00
|
|
|
width: 1024
|
|
|
|
height: 768
|
2016-08-06 13:43:04 -05:00
|
|
|
|
|
|
|
// Save window properties automatically
|
|
|
|
onXChanged: appSettings.x = x
|
|
|
|
onYChanged: appSettings.y = y
|
|
|
|
onWidthChanged: appSettings.width = width
|
|
|
|
onHeightChanged: appSettings.height = height
|
|
|
|
|
|
|
|
// Load saved window geometry and show the window
|
|
|
|
Component.onCompleted: {
|
|
|
|
x = appSettings.x
|
|
|
|
y = appSettings.y
|
|
|
|
width = appSettings.width
|
|
|
|
height = appSettings.height
|
|
|
|
|
|
|
|
visible = true
|
|
|
|
}
|
|
|
|
|
2014-07-07 01:42:17 +02:00
|
|
|
minimumWidth: 320
|
|
|
|
minimumHeight: 240
|
|
|
|
|
2016-08-06 13:43:04 -05:00
|
|
|
visible: false
|
2014-09-02 18:10:04 +02:00
|
|
|
|
2014-12-11 12:08:15 +01:00
|
|
|
property bool fullscreen: appSettings.fullscreen
|
2014-07-12 01:51:53 +02:00
|
|
|
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
|
|
|
|
2021-06-30 08:33:31 +02:00
|
|
|
menuBar: WindowMenu {
|
2014-12-15 11:56:40 +01:00
|
|
|
id: mainMenu
|
|
|
|
visible: (Qt.platform.os === "osx" || appSettings.showMenubar)
|
|
|
|
}
|
2014-09-18 10:33:40 +02:00
|
|
|
|
2018-01-06 20:17:28 +01:00
|
|
|
property string wintitle: appSettings.wintitle
|
|
|
|
|
2014-07-14 02:23:22 +02:00
|
|
|
color: "#00000000"
|
2018-01-06 20:17:28 +01:00
|
|
|
title: terminalContainer.title || qsTr(appSettings.wintitle)
|
2014-03-20 16:19:11 +01:00
|
|
|
|
2014-08-01 00:07:54 +02:00
|
|
|
Action {
|
|
|
|
id: showMenubarAction
|
|
|
|
text: qsTr("Show Menubar")
|
2014-10-10 15:12:28 +02:00
|
|
|
enabled: Qt.platform.os !== "osx"
|
2014-10-10 20:54:30 +01:00
|
|
|
shortcut: "Ctrl+Shift+M"
|
2014-08-01 00:07:54 +02:00
|
|
|
checkable: true
|
2014-12-11 12:08:15 +01:00
|
|
|
checked: appSettings.showMenubar
|
|
|
|
onTriggered: appSettings.showMenubar = !appSettings.showMenubar
|
2014-08-01 00:07:54 +02:00
|
|
|
}
|
2014-03-20 16:19:11 +01:00
|
|
|
Action {
|
|
|
|
id: fullscreenAction
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Fullscreen")
|
2014-10-10 15:12:28 +02:00
|
|
|
enabled: Qt.platform.os !== "osx"
|
2014-03-20 16:19:11 +01:00
|
|
|
shortcut: "Alt+F11"
|
2014-12-11 12:08:15 +01:00
|
|
|
onTriggered: appSettings.fullscreen = !appSettings.fullscreen;
|
2014-04-17 13:56:13 +02:00
|
|
|
checkable: true
|
2014-12-11 12:08:15 +01:00
|
|
|
checked: appSettings.fullscreen
|
2014-03-20 16:19:11 +01:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
id: quitAction
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Quit")
|
2014-08-07 00:30:08 +02:00
|
|
|
shortcut: "Ctrl+Shift+Q"
|
2014-12-22 20:50:17 +01:00
|
|
|
onTriggered: Qt.quit();
|
2014-03-20 16:19:11 +01:00
|
|
|
}
|
|
|
|
Action{
|
|
|
|
id: showsettingsAction
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Settings")
|
2014-12-22 20:50:17 +01:00
|
|
|
onTriggered: {
|
|
|
|
settingswindow.show();
|
|
|
|
settingswindow.requestActivate();
|
|
|
|
settingswindow.raise();
|
|
|
|
}
|
2014-03-20 16:19:11 +01:00
|
|
|
}
|
2014-04-16 19:30:11 +02:00
|
|
|
Action{
|
|
|
|
id: copyAction
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Copy")
|
2018-03-06 17:33:30 +08:00
|
|
|
shortcut: "Ctrl+Shift+C"
|
2014-04-16 19:30:11 +02:00
|
|
|
}
|
|
|
|
Action{
|
|
|
|
id: pasteAction
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Paste")
|
2018-03-06 17:33:30 +08:00
|
|
|
shortcut: "Ctrl+Shift+V"
|
2014-04-16 19:30:11 +02:00
|
|
|
}
|
2014-07-14 00:53:17 +02:00
|
|
|
Action{
|
|
|
|
id: zoomIn
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Zoom In")
|
2014-07-14 00:53:17 +02:00
|
|
|
shortcut: "Ctrl++"
|
2014-12-11 12:08:15 +01:00
|
|
|
onTriggered: appSettings.incrementScaling();
|
2014-07-14 00:53:17 +02:00
|
|
|
}
|
|
|
|
Action{
|
|
|
|
id: zoomOut
|
2014-08-07 00:33:40 +02:00
|
|
|
text: qsTr("Zoom Out")
|
2014-07-14 00:53:17 +02:00
|
|
|
shortcut: "Ctrl+-"
|
2014-12-11 12:08:15 +01:00
|
|
|
onTriggered: appSettings.decrementScaling();
|
2014-07-14 00:53:17 +02:00
|
|
|
}
|
2014-07-27 18:00:18 +02:00
|
|
|
Action{
|
|
|
|
id: showAboutAction
|
|
|
|
text: qsTr("About")
|
|
|
|
onTriggered: {
|
|
|
|
aboutDialog.show();
|
2014-12-22 20:50:17 +01:00
|
|
|
aboutDialog.requestActivate();
|
|
|
|
aboutDialog.raise();
|
2014-07-27 18:00:18 +02:00
|
|
|
}
|
|
|
|
}
|
2014-06-27 23:54:17 +02:00
|
|
|
ApplicationSettings{
|
2014-12-11 12:08:15 +01:00
|
|
|
id: appSettings
|
2014-06-07 02:19:37 +02:00
|
|
|
}
|
2014-10-11 01:24:20 +02:00
|
|
|
TerminalContainer{
|
2014-10-27 09:28:27 +02:00
|
|
|
id: terminalContainer
|
2018-12-03 12:42:11 +01:00
|
|
|
width: parent.width
|
|
|
|
height: (parent.height + Math.abs(y))
|
2013-11-25 16:46:10 +01:00
|
|
|
}
|
2014-04-17 13:56:13 +02:00
|
|
|
SettingsWindow{
|
|
|
|
id: settingswindow
|
|
|
|
visible: false
|
2013-12-28 02:42:24 +01:00
|
|
|
}
|
2014-07-27 18:00:18 +02:00
|
|
|
AboutDialog{
|
|
|
|
id: aboutDialog
|
|
|
|
visible: false
|
|
|
|
}
|
2014-12-11 01:48:30 +01:00
|
|
|
Loader{
|
|
|
|
anchors.centerIn: parent
|
2014-12-23 18:13:34 +01:00
|
|
|
active: appSettings.showTerminalSize
|
2014-12-11 01:48:30 +01:00
|
|
|
sourceComponent: SizeOverlay{
|
|
|
|
z: 3
|
|
|
|
terminalSize: terminalContainer.terminalSize
|
|
|
|
}
|
|
|
|
}
|
2014-12-22 20:50:17 +01:00
|
|
|
onClosing: {
|
|
|
|
// OSX Since we are currently supporting only one window
|
|
|
|
// quit the application when it is closed.
|
|
|
|
if (Qt.platform.os === "osx")
|
|
|
|
Qt.quit()
|
|
|
|
}
|
2013-11-22 14:17:24 +01:00
|
|
|
}
|