1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-22 12:58:39 +00:00

Changing font properties doesn't reload the terminal.

This commit is contained in:
Filippo Scognamiglio 2014-05-29 11:33:45 +02:00
parent 05edbb9504
commit 4ad83b2dcc
4 changed files with 13 additions and 10 deletions

View File

@ -74,6 +74,7 @@ Item{
property int frames_index: 1 property int frames_index: 1
property var frames_list: framelist property var frames_list: framelist
signal terminalFontChanged
property real font_scaling: 1.0 property real font_scaling: 1.0
property var font: currentfont property var font: currentfont
property int font_index: 0 property int font_index: 0
@ -90,11 +91,10 @@ Item{
onFont_scalingChanged: handleFontChanged(); onFont_scalingChanged: handleFontChanged();
function handleFontChanged(){ function handleFontChanged(){
terminal.unloadKTerminal();
currentfont.source = fontlist.get(font_index).source; currentfont.source = fontlist.get(font_index).source;
currentfont.pixelSize = fontlist.get(font_index).pixelSize; currentfont.pixelSize = fontlist.get(font_index).pixelSize;
currentfont.lineSpacing = fontlist.get(font_index).lineSpacing; currentfont.lineSpacing = fontlist.get(font_index).lineSpacing;
terminal.loadKTerminal(); terminalFontChanged();
} }
FontLoader{ FontLoader{

View File

@ -44,7 +44,6 @@ Item{
function restartBlurredSource(){ function restartBlurredSource(){
if(!blurredSource) return; if(!blurredSource) return;
blurredSource.live = true; blurredSource.live = true;
livetimer.restart() livetimer.restart()
} }
@ -85,15 +84,18 @@ Item{
} }
} }
onUpdatedImage: {blurredSource.live = true;livetimer.restart();} function handleFontChange(){
Component.onCompleted: {
var scaling_factor = shadersettings.font_scaling * shadersettings.window_scaling; var scaling_factor = shadersettings.font_scaling * shadersettings.window_scaling;
var font_size = Math.ceil(shadersettings.font.pixelSize * scaling_factor); var font_size = Math.ceil(shadersettings.font.pixelSize * scaling_factor);
var line_spacing = Math.ceil(shadersettings.font.lineSpacing * font_size); var line_spacing = Math.ceil(shadersettings.font.lineSpacing * font_size);
font.pixelSize = font_size; font.pixelSize = font_size;
font.family = shadersettings.font.name; font.family = shadersettings.font.name;
setLineSpacing(line_spacing); setLineSpacing(line_spacing);
}
onUpdatedImage: {blurredSource.live = true;livetimer.restart();}
Component.onCompleted: {
shadersettings.terminalFontChanged.connect(handleFontChange);
forceActiveFocus(); forceActiveFocus();
} }
} }

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-05-29T01:07:57. --> <!-- Written by QtCreator 3.0.1, 2014-05-29T11:32:54. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>

View File

@ -152,9 +152,6 @@ ApplicationWindow{
} }
ShaderSettings{ ShaderSettings{
id: shadersettings id: shadersettings
Component.onCompleted: {
terminal.loadKTerminal();
}
} }
SettingsWindow{ SettingsWindow{
id: settingswindow id: settingswindow
@ -169,4 +166,8 @@ ApplicationWindow{
terminalSize: terminal.terminalSize terminalSize: terminal.terminalSize
} }
} }
Component.onCompleted: {
terminal.loadKTerminal();
}
} }