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 contrast: 0.85
|
||||||
property real brightness: 0.75
|
property real brightness: 0.75
|
||||||
|
|
||||||
|
property bool show_terminal_size: true
|
||||||
|
|
||||||
//Scaling of the preprocessed terminal with respect to the window.
|
//Scaling of the preprocessed terminal with respect to the window.
|
||||||
property real terminal_scaling: 1.0
|
property real terminal_scaling: 1.0
|
||||||
onTerminal_scalingChanged: handleFontChanged();
|
onTerminal_scalingChanged: handleFontChanged();
|
||||||
@ -167,6 +169,8 @@ Item{
|
|||||||
console.log(profilename + settings);
|
console.log(profilename + settings);
|
||||||
settings = JSON.parse(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
|
fps = settings.fps !== undefined ? settings.fps: fps
|
||||||
|
|
||||||
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
contrast = settings.contrast !== undefined ? settings.contrast : contrast;
|
||||||
@ -197,9 +201,10 @@ Item{
|
|||||||
function storeCurrentSettings(){
|
function storeCurrentSettings(){
|
||||||
var settings = {
|
var settings = {
|
||||||
fps: fps,
|
fps: fps,
|
||||||
ambient_light : ambient_light,
|
show_terminal_size: show_terminal_size,
|
||||||
brightness : brightness,
|
ambient_light: ambient_light,
|
||||||
contrast : contrast,
|
brightness: brightness,
|
||||||
|
contrast: contrast,
|
||||||
background_color: _background_color,
|
background_color: _background_color,
|
||||||
font_color: _font_color,
|
font_color: _font_color,
|
||||||
brightness_flickering: brightness_flickering,
|
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 real mBloom: shadersettings.bloom_strength
|
||||||
|
|
||||||
|
property size terminalSize
|
||||||
|
|
||||||
//Force reload of the blursource when settings change
|
//Force reload of the blursource when settings change
|
||||||
onMBloomChanged: restartBlurredSource()
|
onMBloomChanged: restartBlurredSource()
|
||||||
|
|
||||||
@ -69,6 +71,8 @@ Item{
|
|||||||
|
|
||||||
colorScheme: "MyWhiteOnBlack"
|
colorScheme: "MyWhiteOnBlack"
|
||||||
|
|
||||||
|
onTerminalSizeChanged: terminalContainer.terminalSize = ktermitem.terminalSize
|
||||||
|
|
||||||
session: KSession {
|
session: KSession {
|
||||||
id: ksession
|
id: ksession
|
||||||
kbScheme: "linux"
|
kbScheme: "linux"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!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>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
18
app/main.qml
18
app/main.qml
@ -126,8 +126,8 @@ ApplicationWindow{
|
|||||||
Terminal{
|
Terminal{
|
||||||
id: terminal
|
id: terminal
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
property int frameOffsetX: frame.item.addedWidth - frame.item.borderLeft - frame.item.borderRight
|
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 frameOffsetY: frame.item.addedHeight - frame.item.borderTop - frame.item.borderBottom
|
||||||
width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling
|
width: (parent.width + frameOffsetX) * shadersettings.terminal_scaling
|
||||||
height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling
|
height: (parent.height + frameOffsetY) * shadersettings.terminal_scaling
|
||||||
}
|
}
|
||||||
@ -139,7 +139,6 @@ ApplicationWindow{
|
|||||||
ShaderManager{
|
ShaderManager{
|
||||||
id: shadercontainer
|
id: shadercontainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
blending: true
|
|
||||||
z: 1.9
|
z: 1.9
|
||||||
}
|
}
|
||||||
RadialGradient{
|
RadialGradient{
|
||||||
@ -153,10 +152,21 @@ ApplicationWindow{
|
|||||||
GradientStop{position: 0.7; color: "#00000000"}
|
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{
|
ShaderSettings{
|
||||||
id: shadersettings
|
id: shadersettings
|
||||||
Component.onCompleted: terminal.loadKTerminal();
|
Component.onCompleted: {
|
||||||
|
terminal.loadKTerminal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loader{
|
Loader{
|
||||||
id: settingswindowloader
|
id: settingswindowloader
|
||||||
|
@ -1058,6 +1058,8 @@ void KTerminalDisplay::updateImageSize()
|
|||||||
int lines = qMin(oldlin,_lines);
|
int lines = qMin(oldlin,_lines);
|
||||||
int columns = qMin(oldcol,_columns);
|
int columns = qMin(oldcol,_columns);
|
||||||
|
|
||||||
|
emit terminalSizeChanged();
|
||||||
|
|
||||||
if (oldimg)
|
if (oldimg)
|
||||||
{
|
{
|
||||||
for (int line = 0; line < lines; line++)
|
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(QFont font READ getVTFont WRITE setVTFont )
|
||||||
Q_PROPERTY(bool activeFocusOnClick READ autoFocus WRITE setAutoFocus NOTIFY changedAutoFocus)
|
Q_PROPERTY(bool activeFocusOnClick READ autoFocus WRITE setAutoFocus NOTIFY changedAutoFocus)
|
||||||
Q_PROPERTY(bool ShowIMEOnClick READ autoVKB WRITE setAutoVKB NOTIFY changedAutoVKB)
|
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; }
|
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,
|
* Sets which characters, in addition to letters and numbers,
|
||||||
@ -410,6 +416,8 @@ signals:
|
|||||||
void updatedImage();
|
void updatedImage();
|
||||||
void clicked();
|
void clicked();
|
||||||
|
|
||||||
|
void terminalSizeChanged();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
/**
|
/**
|
||||||
|
@ -60,6 +60,7 @@ Module {
|
|||||||
Property { name: "font"; type: "QFont" }
|
Property { name: "font"; type: "QFont" }
|
||||||
Property { name: "activeFocusOnClick"; type: "bool" }
|
Property { name: "activeFocusOnClick"; type: "bool" }
|
||||||
Property { name: "ShowIMEOnClick"; type: "bool" }
|
Property { name: "ShowIMEOnClick"; type: "bool" }
|
||||||
|
Property { name: "terminalSize"; type: "QSize" }
|
||||||
Signal {
|
Signal {
|
||||||
name: "changedScheme"
|
name: "changedScheme"
|
||||||
Parameter { name: "scheme"; type: "string" }
|
Parameter { name: "scheme"; type: "string" }
|
||||||
@ -110,6 +111,7 @@ Module {
|
|||||||
name: "changedSession"
|
name: "changedSession"
|
||||||
Parameter { name: "session"; type: "KSession"; isPointer: true }
|
Parameter { name: "session"; type: "KSession"; isPointer: true }
|
||||||
}
|
}
|
||||||
|
Signal { name: "terminalSizeChanged" }
|
||||||
Signal { name: "updatedImage" }
|
Signal { name: "updatedImage" }
|
||||||
Method { name: "forcedFocus" }
|
Method { name: "forcedFocus" }
|
||||||
Method {
|
Method {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user