1
0
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:
Filippo Scognamiglio 2014-06-07 02:19:37 +02:00
parent 947b355c29
commit bd0938610f
4 changed files with 83 additions and 92 deletions

View File

@ -127,7 +127,7 @@ Item{
ListElement{pixelSize: 18; virtualWidth: 0; virtualHeight: 6}, ListElement{pixelSize: 18; virtualWidth: 0; virtualHeight: 6},
ListElement{pixelSize: 24; virtualWidth: 0; virtualHeight: 8}, ListElement{pixelSize: 24; virtualWidth: 0; virtualHeight: 8},
ListElement{pixelSize: 35; virtualWidth: 5; virtualHeight: 12}, 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: 54; virtualWidth: 7; virtualHeight: 11},
ListElement{pixelSize: 64; virtualWidth: 8; virtualHeight: 11}, ListElement{pixelSize: 64; virtualWidth: 8; virtualHeight: 11},
ListElement{pixelSize: 75; virtualWidth: 8; virtualHeight: 11}] ListElement{pixelSize: 75; virtualWidth: 8; virtualHeight: 11}]

View File

@ -47,7 +47,7 @@ Item{
property int mScanlines: shadersettings.rasterization property int mScanlines: shadersettings.rasterization
onMScanlinesChanged: restartBlurredSource() onMScanlinesChanged: restartBlurredSource()
property size terminalSize property size terminalSize: kterminal.terminalSize
property size paintedTextSize property size paintedTextSize
onPaintedTextSizeChanged: console.log(paintedTextSize) onPaintedTextSizeChanged: console.log(paintedTextSize)
@ -60,33 +60,22 @@ Item{
blurredSource.live = true; blurredSource.live = true;
livetimer.restart() livetimer.restart()
} }
function loadKTerminal(){
kterminal.active = true;
}
function unloadKTerminal(){
kterminal.active = false;
}
function pasteClipboard(){ function pasteClipboard(){
kterminal.item.pasteClipboard(); kterminal.pasteClipboard();
} }
function copyClipboard(){ function copyClipboard(){
kterminal.item.copyClipboard(); kterminal.copyClipboard();
} }
Loader{
id: kterminal
active: false
anchors.fill: parent
sourceComponent: KTerminal { KTerminal {
id: ktermitem id: kterminal
anchors.fill: parent
font.pixelSize: shadersettings.font.pixelSize font.pixelSize: shadersettings.font.pixelSize
font.family: shadersettings.font.name font.family: shadersettings.font.name
colorScheme: "MyWhiteOnBlack" colorScheme: "MyWhiteOnBlack"
onTerminalSizeChanged: terminalContainer.terminalSize = ktermitem.terminalSize
session: KSession { session: KSession {
id: ksession id: ksession
kbScheme: "linux" kbScheme: "linux"
@ -112,13 +101,12 @@ Item{
var scanline_height = fontMetrics.paintedHeight / vertical_density; var scanline_height = fontMetrics.paintedHeight / vertical_density;
var scanline_width = fontMetrics.paintedWidth / horizontal_density; var scanline_width = fontMetrics.paintedWidth / horizontal_density;
console.log("Font height: " + fontMetrics.paintedHeight)
var scanline_spacing = shadersettings.font.lineSpacing; var scanline_spacing = shadersettings.font.lineSpacing;
var line_spacing = Math.round(scanline_spacing * scanline_height); var line_spacing = Math.round(scanline_spacing * scanline_height);
console.log("Scanline Height: " + scanline_height) // console.log("Font height: " + fontMetrics.paintedHeight)
console.log("Line Spacing: " + line_spacing) // console.log("Scanline Height: " + scanline_height)
// console.log("Line Spacing: " + line_spacing)
terminalContainer.scanlineHeight = scanline_height; terminalContainer.scanlineHeight = scanline_height;
terminalContainer.scanlineWidth = scanline_width; terminalContainer.scanlineWidth = scanline_width;
@ -126,15 +114,12 @@ Item{
setLineSpacing(line_spacing); setLineSpacing(line_spacing);
restartBlurredSource(); restartBlurredSource();
} }
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
Component.onCompleted: { Component.onCompleted: {
shadersettings.terminalFontChanged.connect(handleFontChange); shadersettings.terminalFontChanged.connect(handleFontChange);
handleFontChange(); handleFontChange();
forceActiveFocus(); forceActiveFocus();
} }
} }
}
Menu{ Menu{
id: contextmenu id: contextmenu
MenuItem{action: copyAction} MenuItem{action: copyAction}
@ -146,33 +131,33 @@ Item{
acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
anchors.fill: parent anchors.fill: parent
onWheel: onWheel:
wheel.angleDelta.y > 0 ? kterminal.item.scrollUp() : kterminal.item.scrollDown() wheel.angleDelta.y > 0 ? kterminal.scrollUp() : kterminal.scrollDown()
onClicked: { onClicked: {
if (mouse.button == Qt.RightButton){ if (mouse.button == Qt.RightButton){
contextmenu.popup(); contextmenu.popup();
} else if (mouse.button == Qt.MiddleButton){ } else if (mouse.button == Qt.MiddleButton){
kterminal.item.pasteSelection(); kterminal.pasteSelection();
} }
} }
onDoubleClicked: { onDoubleClicked: {
if (mouse.button == Qt.LeftButton){ if (mouse.button == Qt.LeftButton){
var coord = correctDistortion(mouse.x, mouse.y); var coord = correctDistortion(mouse.x, mouse.y);
kterminal.item.mouseDoubleClick(coord.width, coord.height); kterminal.mouseDoubleClick(coord.width, coord.height);
} }
} }
onPositionChanged: { onPositionChanged: {
var coord = correctDistortion(mouse.x, mouse.y); var coord = correctDistortion(mouse.x, mouse.y);
kterminal.item.mouseMove(coord.width, coord.height); kterminal.mouseMove(coord.width, coord.height);
} }
onPressed: { onPressed: {
if (mouse.button == Qt.LeftButton){ if (mouse.button == Qt.LeftButton){
var coord = correctDistortion(mouse.x, mouse.y); var coord = correctDistortion(mouse.x, mouse.y);
kterminal.item.mousePress(coord.width, coord.height); kterminal.mousePress(coord.width, coord.height);
} }
} }
onReleased: { onReleased: {
if (mouse.button == Qt.LeftButton){ 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 id: livetimer
running: true running: true
onTriggered: parent.live = false; onTriggered: parent.live = false;
function updateImageHandler(){
livetimer.restart();
blurredSource.live = true;
}
Component.onCompleted: kterminal.updatedImage.connect(updateImageHandler);
} }
} }
ShaderEffectSource{ ShaderEffectSource{

View File

@ -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-06-06T20:31:03. --> <!-- Written by QtCreator 3.0.1, 2014-06-07T01:48:03. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -74,7 +74,10 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="int" key="PE.EnvironmentAspect.Base">0</value> <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">&lt;VARIABLE&gt;=&lt;VALUE&gt;</value>
</valuelist>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QML Scene</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QML Scene</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmlProjectManager.QmlRunConfiguration.QmlScene</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmlProjectManager.QmlRunConfiguration.QmlScene</value>

View File

@ -88,6 +88,10 @@ ApplicationWindow{
} }
} }
ShaderSettings{
id: shadersettings
}
Loader{ Loader{
id: frame id: frame
property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling, property rect sourceRect: Qt.rect(-item.rectX * shadersettings.window_scaling,
@ -142,9 +146,6 @@ ApplicationWindow{
z: 1.9 z: 1.9
} }
} }
ShaderSettings{
id: shadersettings
}
SettingsWindow{ SettingsWindow{
id: settingswindow id: settingswindow
visible: false visible: false
@ -158,8 +159,4 @@ ApplicationWindow{
terminalSize: terminal.terminalSize terminalSize: terminal.terminalSize
} }
} }
Component.onCompleted: {
terminal.loadKTerminal();
}
} }