mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-31 02:01:19 +00:00
Added terminal size overlay
This commit is contained in:
parent
2af093220f
commit
115171e969
@ -27,6 +27,8 @@ Item{
|
||||
property real contrast: 0.85
|
||||
property real brightness: 0.75
|
||||
|
||||
property bool show_terminal_size: true
|
||||
|
||||
//Scaling of the preprocessed terminal with respect to the window.
|
||||
property real terminal_scaling: 1.0
|
||||
onTerminal_scalingChanged: handleFontChanged();
|
||||
@ -167,6 +169,8 @@ Item{
|
||||
console.log(profilename + settings);
|
||||
settings = JSON.parse(settings);
|
||||
|
||||
show_terminal_size = settings.show_terminal_size ? settings.show_terminal_size : show_terminal_size
|
||||
|
||||
fps = settings.fps !== undefined ? settings.fps: fps
|
||||
|
||||
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
||||
@ -197,9 +201,10 @@ Item{
|
||||
function storeCurrentSettings(){
|
||||
var settings = {
|
||||
fps: fps,
|
||||
ambient_light : ambient_light,
|
||||
brightness : brightness,
|
||||
contrast : contrast,
|
||||
show_terminal_size: show_terminal_size,
|
||||
ambient_light: ambient_light,
|
||||
brightness: brightness,
|
||||
contrast: contrast,
|
||||
background_color: _background_color,
|
||||
font_color: _font_color,
|
||||
brightness_flickering: brightness_flickering,
|
||||
|
29
app/SizeOverlay.qml
Normal file
29
app/SizeOverlay.qml
Normal file
@ -0,0 +1,29 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle{
|
||||
property size terminalSize
|
||||
property real topOpacity: 0.6
|
||||
width: textSize.width * 2
|
||||
height: textSize.height * 2
|
||||
radius: 5
|
||||
border.width: 2
|
||||
border.color: "white"
|
||||
color: "black"
|
||||
opacity: sizetimer.running ? 0.6 : 0.0
|
||||
|
||||
Behavior on opacity{NumberAnimation{duration: 200}}
|
||||
|
||||
onTerminalSizeChanged: sizetimer.restart()
|
||||
|
||||
Text{
|
||||
id: textSize
|
||||
anchors.centerIn: parent
|
||||
color: "white"
|
||||
text: terminalSize.width + "x" + terminalSize.height
|
||||
}
|
||||
Timer{
|
||||
id: sizetimer
|
||||
interval: 1000
|
||||
running: false
|
||||
}
|
||||
}
|
@ -35,6 +35,8 @@ Item{
|
||||
|
||||
property real mBloom: shadersettings.bloom_strength
|
||||
|
||||
property size terminalSize
|
||||
|
||||
//Force reload of the blursource when settings change
|
||||
onMBloomChanged: restartBlurredSource()
|
||||
|
||||
@ -69,6 +71,8 @@ Item{
|
||||
|
||||
colorScheme: "MyWhiteOnBlack"
|
||||
|
||||
onTerminalSizeChanged: terminalContainer.terminalSize = ktermitem.terminalSize
|
||||
|
||||
session: KSession {
|
||||
id: ksession
|
||||
kbScheme: "linux"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.0.1, 2014-04-16T19:36:46. -->
|
||||
<!-- Written by QtCreator 3.0.1, 2014-04-17T13:17:40. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
|
18
app/main.qml
18
app/main.qml
@ -126,8 +126,8 @@ ApplicationWindow{
|
||||
Terminal{
|
||||
id: terminal
|
||||
anchors.centerIn: parent
|
||||
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
|
||||
property int frameOffsetY: frame.item.addedHeight -frame.item.borderTop - frame.item.borderBottom
|
||||
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
|
||||
property int frameOffsetY: frame.item.addedHeight - frame.item.borderTop - frame.item.borderBottom
|
||||
width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling
|
||||
height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling
|
||||
}
|
||||
@ -139,7 +139,6 @@ ApplicationWindow{
|
||||
ShaderManager{
|
||||
id: shadercontainer
|
||||
anchors.fill: parent
|
||||
blending: true
|
||||
z: 1.9
|
||||
}
|
||||
RadialGradient{
|
||||
@ -153,10 +152,21 @@ ApplicationWindow{
|
||||
GradientStop{position: 0.7; color: "#00000000"}
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: sizeoverlayloader
|
||||
z: 3
|
||||
anchors.centerIn: parent
|
||||
active: shadersettings.show_terminal_size
|
||||
sourceComponent: SizeOverlay{
|
||||
terminalSize: terminal.terminalSize
|
||||
}
|
||||
}
|
||||
}
|
||||
ShaderSettings{
|
||||
id: shadersettings
|
||||
Component.onCompleted: terminal.loadKTerminal();
|
||||
Component.onCompleted: {
|
||||
terminal.loadKTerminal();
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: settingswindowloader
|
||||
|
@ -1058,6 +1058,8 @@ void KTerminalDisplay::updateImageSize()
|
||||
int lines = qMin(oldlin,_lines);
|
||||
int columns = qMin(oldcol,_columns);
|
||||
|
||||
emit terminalSizeChanged();
|
||||
|
||||
if (oldimg)
|
||||
{
|
||||
for (int line = 0; line < lines; line++)
|
||||
|
@ -68,6 +68,7 @@ class KONSOLEPRIVATE_EXPORT KTerminalDisplay : public QQuickPaintedItem
|
||||
Q_PROPERTY(QFont font READ getVTFont WRITE setVTFont )
|
||||
Q_PROPERTY(bool activeFocusOnClick READ autoFocus WRITE setAutoFocus NOTIFY changedAutoFocus)
|
||||
Q_PROPERTY(bool ShowIMEOnClick READ autoVKB WRITE setAutoVKB NOTIFY changedAutoVKB)
|
||||
Q_PROPERTY(QSize terminalSize READ getTerminalSize NOTIFY terminalSizeChanged)
|
||||
|
||||
|
||||
|
||||
@ -190,7 +191,12 @@ public:
|
||||
*/
|
||||
int fontWidth() { return _fontWidth; }
|
||||
|
||||
|
||||
/**
|
||||
* Return size of the terminal as columns lines.
|
||||
*/
|
||||
QSize getTerminalSize(){
|
||||
return QSize(columns(), lines());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets which characters, in addition to letters and numbers,
|
||||
@ -410,6 +416,8 @@ signals:
|
||||
void updatedImage();
|
||||
void clicked();
|
||||
|
||||
void terminalSizeChanged();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
|
@ -60,6 +60,7 @@ Module {
|
||||
Property { name: "font"; type: "QFont" }
|
||||
Property { name: "activeFocusOnClick"; type: "bool" }
|
||||
Property { name: "ShowIMEOnClick"; type: "bool" }
|
||||
Property { name: "terminalSize"; type: "QSize" }
|
||||
Signal {
|
||||
name: "changedScheme"
|
||||
Parameter { name: "scheme"; type: "string" }
|
||||
@ -110,6 +111,7 @@ Module {
|
||||
name: "changedSession"
|
||||
Parameter { name: "session"; type: "KSession"; isPointer: true }
|
||||
}
|
||||
Signal { name: "terminalSizeChanged" }
|
||||
Signal { name: "updatedImage" }
|
||||
Method { name: "forcedFocus" }
|
||||
Method {
|
||||
|
Loading…
x
Reference in New Issue
Block a user