2013-12-28 14:52:10 +01: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/>.
|
|
|
|
*******************************************************************************/
|
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
|
|
|
|
import QtQuick.Controls 1.1
|
2014-03-20 16:19:11 +01:00
|
|
|
import QtGraphicalEffects 1.0
|
2014-03-20 11:29:29 +01:00
|
|
|
|
|
|
|
import org.kde.konsole 0.1
|
|
|
|
|
2014-03-20 16:19:11 +01:00
|
|
|
ApplicationWindow{
|
|
|
|
id: terminalWindow
|
|
|
|
width: 1024
|
|
|
|
height: 768
|
|
|
|
|
2014-03-30 22:29:15 +02:00
|
|
|
title: qsTr("cool-old-term")
|
|
|
|
visible: true
|
|
|
|
visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed
|
2014-03-20 16:19:11 +01:00
|
|
|
|
|
|
|
Action {
|
|
|
|
id: fullscreenAction
|
2014-04-16 19:30:11 +02:00
|
|
|
text: qsTr("&Fullscreen")
|
2014-03-20 16:19:11 +01:00
|
|
|
shortcut: "Alt+F11"
|
|
|
|
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
|
2014-04-17 13:56:13 +02:00
|
|
|
checkable: true
|
|
|
|
checked: shadersettings.fullscreen
|
2014-03-20 16:19:11 +01:00
|
|
|
}
|
|
|
|
Action {
|
|
|
|
id: quitAction
|
2014-04-16 19:30:11 +02:00
|
|
|
text: qsTr("&Quit")
|
2014-03-20 16:19:11 +01:00
|
|
|
shortcut: "Ctrl+Q"
|
|
|
|
onTriggered: terminalWindow.close();
|
|
|
|
}
|
|
|
|
Action{
|
|
|
|
id: showsettingsAction
|
2014-04-16 19:30:11 +02:00
|
|
|
text: qsTr("&Settings")
|
2014-04-17 13:56:13 +02:00
|
|
|
onTriggered: settingswindow.show();
|
2014-03-20 16:19:11 +01:00
|
|
|
}
|
2014-04-16 19:30:11 +02: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()
|
|
|
|
}
|
2014-03-20 16:19:11 +01:00
|
|
|
|
|
|
|
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 19:30:11 +02:00
|
|
|
MenuItem {action: copyAction}
|
|
|
|
MenuItem {action: pasteAction}
|
|
|
|
MenuSeparator{}
|
2014-03-20 16:19:11 +01:00
|
|
|
MenuItem {action: showsettingsAction}
|
2014-04-16 19:30:11 +02:00
|
|
|
}
|
|
|
|
Menu{
|
|
|
|
title: qsTr("View")
|
|
|
|
visible: shadersettings.fullscreen ? false : true
|
2014-03-20 16:19:11 +01:00
|
|
|
MenuItem {action: fullscreenAction}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 22:07:37 +02:00
|
|
|
Loader{
|
|
|
|
id: frame
|
2014-04-20 22:59:46 +02:00
|
|
|
property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling,
|
|
|
|
-item.rectY * shadersettings.window_scaling,
|
|
|
|
terminal.width + 2*item.rectX * shadersettings.window_scaling,
|
|
|
|
terminal.height + 2*item.rectY * shadersettings.window_scaling)
|
2014-04-02 22:07:37 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
z: 2.1
|
|
|
|
source: shadersettings.frame_source
|
2014-04-05 15:14:52 +02:00
|
|
|
opacity: 1.0
|
2014-04-02 22:07:37 +02:00
|
|
|
}
|
|
|
|
|
2014-03-20 16:19:11 +01:00
|
|
|
Item{
|
|
|
|
id: maincontainer
|
2014-04-02 22:07:37 +02:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: parent.width * shadersettings.window_scaling
|
|
|
|
height: parent.height * shadersettings.window_scaling
|
|
|
|
scale: 1.0 / shadersettings.window_scaling
|
2014-04-03 18:44:23 +02:00
|
|
|
|
2014-03-31 14:13:51 +02:00
|
|
|
Image{
|
|
|
|
id: randtexture
|
|
|
|
source: "frames/images/randfunction.png"
|
|
|
|
width: 512
|
|
|
|
height: 512
|
2014-04-18 12:00:17 +02:00
|
|
|
sourceSize.width: 512
|
|
|
|
sourceSize.height: 256
|
|
|
|
fillMode: Image.TileVertically
|
2014-03-31 14:13:51 +02:00
|
|
|
}
|
|
|
|
ShaderEffectSource{
|
|
|
|
id: randfuncsource
|
|
|
|
sourceItem: randtexture
|
|
|
|
live: false
|
|
|
|
hideSource: true
|
|
|
|
wrapMode: ShaderEffectSource.Repeat
|
|
|
|
}
|
|
|
|
Timer{
|
|
|
|
id: timetimer
|
|
|
|
property real time: 0
|
|
|
|
onTriggered: time += interval
|
2014-04-03 18:44:23 +02:00
|
|
|
interval: Math.round(1000 / shadersettings.fps)
|
2014-03-31 14:13:51 +02:00
|
|
|
running: true
|
|
|
|
repeat: true
|
|
|
|
}
|
2014-03-30 22:29:15 +02:00
|
|
|
Terminal{
|
|
|
|
id: terminal
|
2014-04-16 19:18:14 +02:00
|
|
|
anchors.centerIn: parent
|
2014-04-17 13:27:41 +02:00
|
|
|
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
|
|
|
|
property int frameOffsetY: frame.item.addedHeight - frame.item.borderTop - frame.item.borderBottom
|
2014-04-20 22:59:46 +02:00
|
|
|
width: parent.width + frameOffsetX * shadersettings.window_scaling
|
|
|
|
height: parent.height + frameOffsetY * shadersettings.window_scaling
|
2014-03-30 22:29:15 +02:00
|
|
|
}
|
2014-03-20 16:19:11 +01:00
|
|
|
ShaderEffectSource{
|
|
|
|
id: theSource
|
|
|
|
sourceItem: terminal
|
|
|
|
sourceRect: frame.sourceRect
|
|
|
|
}
|
2014-03-31 14:13:51 +02:00
|
|
|
ShaderManager{
|
|
|
|
id: shadercontainer
|
|
|
|
anchors.fill: parent
|
|
|
|
z: 1.9
|
|
|
|
}
|
2013-11-25 16:46:10 +01:00
|
|
|
}
|
2014-03-20 16:19:11 +01:00
|
|
|
ShaderSettings{
|
|
|
|
id: shadersettings
|
2014-04-17 13:27:41 +02:00
|
|
|
Component.onCompleted: {
|
|
|
|
terminal.loadKTerminal();
|
|
|
|
}
|
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-04-20 22:59:46 +02:00
|
|
|
Loader{
|
|
|
|
id: sizeoverlayloader
|
|
|
|
z: 3
|
|
|
|
anchors.centerIn: parent
|
|
|
|
active: shadersettings.show_terminal_size
|
|
|
|
sourceComponent: SizeOverlay{
|
|
|
|
terminalSize: terminal.terminalSize
|
|
|
|
}
|
|
|
|
}
|
2013-11-22 14:17:24 +01:00
|
|
|
}
|