1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2024-10-06 02:50:50 +01:00
cool-retro-term/app/main.qml

186 lines
5.3 KiB
QML
Raw Normal View History

2013-12-28 13:52:10 +00:00
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-old-term.
*
* cool-old-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.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
import QtGraphicalEffects 1.0
import org.kde.konsole 0.1
ApplicationWindow{
id: terminalWindow
2014-07-12 00:51:53 +01:00
width: 1024
height: 768
2014-07-07 00:42:17 +01:00
minimumWidth: 320
minimumHeight: 240
2014-07-12 00:51:53 +01:00
property bool fullscreen: shadersettings.fullscreen
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
2014-07-14 01:23:22 +01:00
flags: Qt.WA_TranslucentBackground
color: "#00000000"
2014-03-30 21:29:15 +01:00
title: qsTr("cool-old-term")
Action {
id: fullscreenAction
2014-04-16 18:30:11 +01:00
text: qsTr("&Fullscreen")
shortcut: "Alt+F11"
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
checkable: true
checked: shadersettings.fullscreen
}
Action {
id: quitAction
2014-04-16 18:30:11 +01:00
text: qsTr("&Quit")
shortcut: "Ctrl+Q"
onTriggered: terminalWindow.close();
}
Action{
id: showsettingsAction
2014-04-16 18:30:11 +01:00
text: qsTr("&Settings")
onTriggered: settingswindow.show();
}
2014-04-16 18:30:11 +01:00
Action{
id: copyAction
text: qsTr("&Copy")
shortcut: "Ctrl+Shift+C"
onTriggered: terminal.copyClipboard()
}
Action{
id: pasteAction
text: qsTr("&Paste")
shortcut: "Ctrl+Shift+V"
onTriggered: terminal.pasteClipboard()
}
Action{
id: zoomIn
text: qsTr("&Zoom In")
shortcut: "Ctrl++"
onTriggered: {
var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization];
var maxScalingIndex = shadersettings.fontScalingList.length - 1;
shadersettings.setScalingIndex(Math.min(oldScaling + 1, maxScalingIndex));
}
}
Action{
id: zoomOut
text: qsTr("&Zoom Out")
shortcut: "Ctrl+-"
onTriggered: {
var oldScaling = shadersettings.fontScalingIndexes[shadersettings.rasterization];
shadersettings.setScalingIndex(Math.max(oldScaling - 1, 0));
}
}
2014-07-27 17:00:18 +01:00
Action{
id: showAboutAction
text: qsTr("About")
onTriggered: {
aboutDialog.show();
}
}
menuBar: MenuBar {
id: menubar
Menu {
title: qsTr("File")
visible: shadersettings.fullscreen ? false : true
MenuItem {action: quitAction}
}
Menu {
title: qsTr("Edit")
visible: shadersettings.fullscreen ? false : true
2014-04-16 18:30:11 +01:00
MenuItem {action: copyAction}
MenuItem {action: pasteAction}
MenuSeparator{}
MenuItem {action: showsettingsAction}
2014-04-16 18:30:11 +01:00
}
Menu{
title: qsTr("View")
visible: shadersettings.fullscreen ? false : true
MenuItem {action: fullscreenAction}
MenuSeparator{}
MenuItem {action: zoomIn}
MenuItem {action: zoomOut}
}
2014-07-27 17:00:18 +01:00
Menu{
title: qsTr("Help")
visible: shadersettings.fullscreen ? false : true
MenuItem {action: showAboutAction}
}
}
2014-06-27 22:54:17 +01:00
ApplicationSettings{
2014-06-07 01:19:37 +01:00
id: shadersettings
}
2014-07-12 00:51:53 +01:00
TimeManager{
id: timeManager
enableTimer: terminalWindow.visible
}
Item{
id: maincontainer
anchors.centerIn: parent
width: parent.width * shadersettings.window_scaling
height: parent.height * shadersettings.window_scaling
scale: 1.0 / shadersettings.window_scaling
2014-07-09 18:03:02 +01:00
smooth: false
antialiasing: false
2014-07-14 01:23:22 +01:00
opacity: shadersettings.windowOpacity * 0.3 + 0.7
2014-07-09 18:03:02 +01:00
Loader{
id: frame
anchors.fill: parent
2014-07-12 00:51:53 +01:00
property rect sourceRect: item.sourceRect
2014-07-09 18:03:02 +01:00
z: 2.1
source: shadersettings.frame_source
}
2014-06-27 22:54:17 +01:00
PreprocessedTerminal{
2014-03-30 21:29:15 +01:00
id: terminal
anchors.fill: parent
anchors.margins: 30
}
2014-06-27 22:54:17 +01:00
ShaderTerminal{
id: shadercontainer
anchors.fill: parent
z: 1.9
}
2013-11-25 15:46:10 +00:00
}
SettingsWindow{
id: settingswindow
visible: false
}
2014-07-27 17:00:18 +01:00
AboutDialog{
id: aboutDialog
visible: false
}
2014-04-20 21:59:46 +01:00
Loader{
id: sizeoverlayloader
z: 3
anchors.centerIn: parent
active: shadersettings.show_terminal_size
sourceComponent: SizeOverlay{
terminalSize: terminal.terminalSize
}
}
2014-06-25 13:29:10 +01:00
Component.onCompleted: shadersettings.handleFontChanged();
}