mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-01-18 20:20:45 +00:00
Various riorganizations and fixes.
This commit is contained in:
parent
947b355c29
commit
bd0938610f
@ -127,7 +127,7 @@ Item{
|
||||
ListElement{pixelSize: 18; virtualWidth: 0; virtualHeight: 6},
|
||||
ListElement{pixelSize: 24; virtualWidth: 0; virtualHeight: 8},
|
||||
ListElement{pixelSize: 35; virtualWidth: 5; virtualHeight: 12},
|
||||
ListElement{pixelSize: 47; virtualWidth: 6; virtualHeight: 11},
|
||||
ListElement{pixelSize: 43; virtualWidth: 6; virtualHeight: 11},
|
||||
ListElement{pixelSize: 54; virtualWidth: 7; virtualHeight: 11},
|
||||
ListElement{pixelSize: 64; virtualWidth: 8; virtualHeight: 11},
|
||||
ListElement{pixelSize: 75; virtualWidth: 8; virtualHeight: 11}]
|
||||
|
@ -47,7 +47,7 @@ Item{
|
||||
property int mScanlines: shadersettings.rasterization
|
||||
onMScanlinesChanged: restartBlurredSource()
|
||||
|
||||
property size terminalSize
|
||||
property size terminalSize: kterminal.terminalSize
|
||||
property size paintedTextSize
|
||||
|
||||
onPaintedTextSizeChanged: console.log(paintedTextSize)
|
||||
@ -60,33 +60,22 @@ Item{
|
||||
blurredSource.live = true;
|
||||
livetimer.restart()
|
||||
}
|
||||
function loadKTerminal(){
|
||||
kterminal.active = true;
|
||||
}
|
||||
function unloadKTerminal(){
|
||||
kterminal.active = false;
|
||||
}
|
||||
function pasteClipboard(){
|
||||
kterminal.item.pasteClipboard();
|
||||
kterminal.pasteClipboard();
|
||||
}
|
||||
function copyClipboard(){
|
||||
kterminal.item.copyClipboard();
|
||||
kterminal.copyClipboard();
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: kterminal
|
||||
active: false
|
||||
anchors.fill: parent
|
||||
|
||||
sourceComponent: KTerminal {
|
||||
id: ktermitem
|
||||
KTerminal {
|
||||
id: kterminal
|
||||
anchors.fill: parent
|
||||
font.pixelSize: shadersettings.font.pixelSize
|
||||
font.family: shadersettings.font.name
|
||||
|
||||
colorScheme: "MyWhiteOnBlack"
|
||||
|
||||
onTerminalSizeChanged: terminalContainer.terminalSize = ktermitem.terminalSize
|
||||
|
||||
session: KSession {
|
||||
id: ksession
|
||||
kbScheme: "linux"
|
||||
@ -112,13 +101,12 @@ Item{
|
||||
var scanline_height = fontMetrics.paintedHeight / vertical_density;
|
||||
var scanline_width = fontMetrics.paintedWidth / horizontal_density;
|
||||
|
||||
console.log("Font height: " + fontMetrics.paintedHeight)
|
||||
|
||||
var scanline_spacing = shadersettings.font.lineSpacing;
|
||||
var line_spacing = Math.round(scanline_spacing * scanline_height);
|
||||
|
||||
console.log("Scanline Height: " + scanline_height)
|
||||
console.log("Line Spacing: " + line_spacing)
|
||||
// console.log("Font height: " + fontMetrics.paintedHeight)
|
||||
// console.log("Scanline Height: " + scanline_height)
|
||||
// console.log("Line Spacing: " + line_spacing)
|
||||
|
||||
terminalContainer.scanlineHeight = scanline_height;
|
||||
terminalContainer.scanlineWidth = scanline_width;
|
||||
@ -126,15 +114,12 @@ Item{
|
||||
setLineSpacing(line_spacing);
|
||||
restartBlurredSource();
|
||||
}
|
||||
|
||||
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
|
||||
Component.onCompleted: {
|
||||
shadersettings.terminalFontChanged.connect(handleFontChange);
|
||||
handleFontChange();
|
||||
forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
Menu{
|
||||
id: contextmenu
|
||||
MenuItem{action: copyAction}
|
||||
@ -146,33 +131,33 @@ Item{
|
||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
|
||||
anchors.fill: parent
|
||||
onWheel:
|
||||
wheel.angleDelta.y > 0 ? kterminal.item.scrollUp() : kterminal.item.scrollDown()
|
||||
wheel.angleDelta.y > 0 ? kterminal.scrollUp() : kterminal.scrollDown()
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.RightButton){
|
||||
contextmenu.popup();
|
||||
} else if (mouse.button == Qt.MiddleButton){
|
||||
kterminal.item.pasteSelection();
|
||||
kterminal.pasteSelection();
|
||||
}
|
||||
}
|
||||
onDoubleClicked: {
|
||||
if (mouse.button == Qt.LeftButton){
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.item.mouseDoubleClick(coord.width, coord.height);
|
||||
kterminal.mouseDoubleClick(coord.width, coord.height);
|
||||
}
|
||||
}
|
||||
onPositionChanged: {
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.item.mouseMove(coord.width, coord.height);
|
||||
kterminal.mouseMove(coord.width, coord.height);
|
||||
}
|
||||
onPressed: {
|
||||
if (mouse.button == Qt.LeftButton){
|
||||
var coord = correctDistortion(mouse.x, mouse.y);
|
||||
kterminal.item.mousePress(coord.width, coord.height);
|
||||
kterminal.mousePress(coord.width, coord.height);
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
if (mouse.button == Qt.LeftButton){
|
||||
kterminal.item.mouseRelease(mouse.x, mouse.y);
|
||||
kterminal.mouseRelease(mouse.x, mouse.y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,6 +191,12 @@ Item{
|
||||
id: livetimer
|
||||
running: true
|
||||
onTriggered: parent.live = false;
|
||||
|
||||
function updateImageHandler(){
|
||||
livetimer.restart();
|
||||
blurredSource.live = true;
|
||||
}
|
||||
Component.onCompleted: kterminal.updatedImage.connect(updateImageHandler);
|
||||
}
|
||||
}
|
||||
ShaderEffectSource{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 3.0.1, 2014-06-06T20:31:03. -->
|
||||
<!-- Written by QtCreator 3.0.1, 2014-06-07T01:48:03. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@ -74,7 +74,10 @@
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes">
|
||||
<value type="QString">QML_DISABLE_OPTIMIZER=1</value>
|
||||
<value type="QString"><VARIABLE>=<VALUE></value>
|
||||
</valuelist>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QML Scene</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmlProjectManager.QmlRunConfiguration.QmlScene</value>
|
||||
|
11
app/main.qml
11
app/main.qml
@ -88,6 +88,10 @@ ApplicationWindow{
|
||||
}
|
||||
}
|
||||
|
||||
ShaderSettings{
|
||||
id: shadersettings
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: frame
|
||||
property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling,
|
||||
@ -142,9 +146,6 @@ ApplicationWindow{
|
||||
z: 1.9
|
||||
}
|
||||
}
|
||||
ShaderSettings{
|
||||
id: shadersettings
|
||||
}
|
||||
SettingsWindow{
|
||||
id: settingswindow
|
||||
visible: false
|
||||
@ -158,8 +159,4 @@ ApplicationWindow{
|
||||
terminalSize: terminal.terminalSize
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
terminal.loadKTerminal();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user