18 Commits

Author SHA1 Message Date
Filippo Scognamiglio
b0f3b8f3d0 Update QMLTermWidget submodule. 2022-01-09 10:53:35 +01:00
Filippo Scognamiglio
06e7191056 Disable Qt5 Connections warnings. 2022-01-09 10:47:02 +01:00
Filippo Scognamiglio
997131ba64 Tiny fixes to burn-in. 2022-01-08 23:15:29 +01:00
Filippo Scognamiglio
ef9f412e5f Clip profiles list. 2022-01-08 22:36:02 +01:00
Filippo Scognamiglio
7b69d41c60 Remove slow burn-in effect. 2022-01-08 22:32:42 +01:00
Filippo Scognamiglio
552947f507 Improve burn-in timings. 2022-01-08 22:20:44 +01:00
Filippo Scognamiglio
f69f2df63c More Connections refactorings. 2022-01-03 21:06:33 +01:00
Filippo Scognamiglio
aa270067f6 Improve settings window. 2022-01-03 20:56:49 +01:00
Filippo Scognamiglio
28977313da UI/UX fixes for OSX version. 2022-01-03 18:43:07 +01:00
Filippo Scognamiglio
cfe35d7795 Merge pull request #665 from Swordfish90/unstable
Improve rasterization and terminal frame. Some refactoring.
2021-07-15 23:43:06 +02:00
Dmytro Pashchenko
9d06f10a9b some grammar fixes (#636) 2021-07-01 23:14:53 +02:00
Mizumoto Ryohei
8c27f7683b update brew command (#664)
* update brew command

* Update README.md
2021-07-01 23:12:26 +02:00
Filippo Scognamiglio
bf1a491789 Merge pull request #638 from amake/patch-1
Mention MacPorts in readme
2021-07-01 23:10:42 +02:00
Filippo Scognamiglio
0f18a0349a Merge pull request #589 from rbanffy/master
Update 3270 font to 2.3.1
2021-06-30 08:49:39 +02:00
Ricardo Bánffy
39181f42cf Update font version to 2.3.1 2021-03-25 09:52:21 +00:00
Aaron Madlon-Kay
3d706ad1a7 Mention MacPorts in readme 2021-01-27 14:42:57 +09:00
Ricardo Bánffy
a31b77e5bc Update 3270 font with version 2.0.4.
See https://github.com/rbanffy/3270font/tree/v2.0.4 for changes.
2020-05-17 12:29:24 +01:00
Ricardo Bánffy
b417643415 Renamed 3270 font to latest binary version 2020-05-17 12:21:13 +01:00
24 changed files with 290 additions and 326 deletions

View File

@@ -8,7 +8,7 @@
cool-retro-term is a terminal emulator which mimics the look and feel of the old cathode tube screens.
It has been designed to be eye-candy, customizable, and reasonably lightweight.
It uses the QML port of qtermwidget (Konsole) developed by me: https://github.com/Swordfish90/qmltermwidget .
It uses the QML port of qtermwidget (Konsole) developed by me: https://github.com/Swordfish90/qmltermwidget.
This terminal emulator works under Linux and macOS and requires Qt 5.2 or higher.
@@ -51,9 +51,13 @@ Users of **Ubuntu 14.04 LTS (Trusty) up to 15.10 (Wily)** can use [this PPA](htt
eopkg it cool-retro-term
```
**macOS** users can grab the latest dmg from the [release page](https://github.com/Swordfish90/cool-retro-term/releases) or install via Homebrew:
**macOS** users can grab the latest dmg from the [release page](https://github.com/Swordfish90/cool-retro-term/releases) or install via Homebrew or MacPorts:
```
brew cask install cool-retro-term
brew install cool-retro-term --cask
```
or
```
port install cool-retro-term
```
**FreeBSD** users can install cool-retro-term with `pkg`:
@@ -202,10 +206,10 @@ open cool-retro-term.app
**Homebrew**
```sh
brew cask install cool-retro-term
brew install cool-retro-term --cask
```
## Donations
I made this project in my spare time because I love what I'm doing. If you are enjoying it and you want to buy me a beer click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flscogna%40gmail%2ecom&lc=IT&item_name=Filippo%20Scognamiglio&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted).
I made this project in my spare time because I love what I'm doing. If you are enjoying it, and you want to buy me a beer click [here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flscogna%40gmail%2ecom&lc=IT&item_name=Filippo%20Scognamiglio&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted).
You can also add "bounties" on your favourite issues. More information on the [Bountysource](https://www.bountysource.com/teams/crt/issues) page.

View File

@@ -1,4 +1,4 @@
QT += qml quick widgets sql
QT += qml quick widgets sql quickcontrols2
TARGET = cool-retro-term
DESTDIR = $$OUT_PWD/../

View File

@@ -6,11 +6,13 @@
#include <QtWidgets/QApplication>
#include <QIcon>
#include <QQuickStyle>
#include <QDebug>
#include <stdlib.h>
#include <QFontDatabase>
#include <QLoggingCategory>
#include <fileio.h>
#include <monospacefontmanager.h>
@@ -33,6 +35,9 @@ int main(int argc, char *argv[])
// This disables QT appmenu under Ubuntu, which is not working with QML apps.
setenv("QT_QPA_PLATFORMTHEME", "", 1);
// Disable Connections slot warnings
QLoggingCategory::setFilterRules("qt.qml.connections.warning=false");
#if defined (Q_OS_LINUX)
setenv("QSG_RENDER_LOOP", "threaded", 0);
#endif
@@ -42,6 +47,9 @@ int main(int argc, char *argv[])
setenv("LC_CTYPE", "UTF-8", 1);
#endif
// Force fusion style on every platform
QQuickStyle::setStyle("Fusion");
if (argc>1 && (!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help"))) {
QTextStream cout(stdout, QIODevice::WriteOnly);
cout << "Usage: " << argv[0] << " [--default-settings] [--workdir <dir>] [--program <prog>] [-p|--profile <prof>] [--fullscreen] [-h|--help]" << endl;
@@ -65,9 +73,7 @@ int main(int argc, char *argv[])
}
QApplication app(argc, argv);
// set application attributes
// Has no effects, see https://bugreports.qt.io/browse/QTBUG-51293
// app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, true);
app.setAttribute(Qt::AA_MacDontSwapCtrlAndMeta, true);
QQmlApplicationEngine engine;
FileIO fileIO;

View File

@@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
*
* This file is part of cool-retro-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.2
QtObject {
readonly property string version: appVersion
readonly property int profileVersion: 2
readonly property real screenCurvatureSize: 0.4
readonly property real minimumFontScaling: 0.25
readonly property real maximumFontScaling: 2.50
readonly property real minBurnInFadeTime: 160
readonly property real maxBurnInFadeTime: 1600
readonly property int no_rasterization: 0
readonly property int scanline_rasterization: 1
readonly property int pixel_rasterization: 2
readonly property int subpixel_rasterization: 3
readonly property real baseFontScaling: 0.75
}

View File

@@ -23,15 +23,27 @@ import QtQuick.Controls 2.0
import "utils.js" as Utils
QtObject {
readonly property string version: appVersion
readonly property int profileVersion: 2
// APPLICATION SETTINGS ///////////////////////////////////////////////////////
// STATIC CONSTANTS ////////////////////////////////////////////////////////
readonly property real screenCurvatureSize: 0.4
readonly property real minimumFontScaling: 0.25
readonly property real maximumFontScaling: 2.50
readonly property real minBurnInFadeTime: 160
readonly property real maxBurnInFadeTime: 1600
property bool isMacOS: Qt.platform.os === "osx"
// GENERAL SETTINGS ///////////////////////////////////////////////////////
property int x: 100
property int y: 100
property int width: 1024
property int height: 768
property bool fullscreen: false
property bool showMenubar: Qt.platform.os === "osx" ? true : false
property bool showMenubar: false
property string wintitle: "cool-retro-term"
@@ -42,9 +54,9 @@ QtObject {
property bool verbose: false
property real bloomQuality: 0.5
property real burnInQuality: 0.5
property bool useFastBurnIn: Qt.platform.os === "osx" ? false : true
property bool blinkingCursor: false
onWindowScalingChanged: handleFontChanged()
@@ -94,13 +106,17 @@ QtObject {
property real totalMargin: frameMargin + margin
readonly property int no_rasterization: 0
readonly property int scanline_rasterization: 1
readonly property int pixel_rasterization: 2
readonly property int subpixel_rasterization: 3
property int rasterization: no_rasterization
property bool blinkingCursor: false
// FONTS //////////////////////////////////////////////////////////////////
readonly property real baseFontScaling: 0.75
property real fontScaling: 1.0
property real totalFontScaling: appConstants.baseFontScaling * fontScaling
property real totalFontScaling: baseFontScaling * fontScaling
property real fontWidth: 1.0
@@ -116,28 +132,28 @@ QtObject {
property Loader fontManager: Loader {
states: [
State {
when: rasterization == appConstants.no_rasterization
when: rasterization == no_rasterization
PropertyChanges {
target: fontManager
source: "Fonts.qml"
}
},
State {
when: rasterization == appConstants.scanline_rasterization
when: rasterization == scanline_rasterization
PropertyChanges {
target: fontManager
source: "FontScanlines.qml"
}
},
State {
when: rasterization == appConstants.pixel_rasterization
when: rasterization == pixel_rasterization
PropertyChanges {
target: fontManager
source: "FontPixels.qml"
}
},
State {
when: rasterization == appConstants.subpixel_rasterization
when: rasterization == subpixel_rasterization
PropertyChanges {
target: fontManager
source: "FontPixels.qml"
@@ -163,12 +179,12 @@ QtObject {
}
function incrementScaling() {
fontScaling = Math.min(fontScaling + 0.05, appConstants.maximumFontScaling)
fontScaling = Math.min(fontScaling + 0.05, maximumFontScaling)
handleFontChanged()
}
function decrementScaling() {
fontScaling = Math.max(fontScaling - 0.05, appConstants.minimumFontScaling)
fontScaling = Math.max(fontScaling - 0.05, minimumFontScaling)
handleFontChanged()
}
@@ -226,8 +242,7 @@ QtObject {
"bloomQuality": bloomQuality,
"burnInQuality": burnInQuality,
"useCustomCommand": useCustomCommand,
"customCommand": customCommand,
"useFastBurnIn": useFastBurnIn
"customCommand": customCommand
}
return stringify(settings)
}
@@ -322,9 +337,6 @@ QtObject {
!== undefined ? settings.useCustomCommand : useCustomCommand
customCommand = settings.customCommand
!== undefined ? settings.customCommand : customCommand
useFastBurnIn = settings.useFastBurnIn
!== undefined ? settings.useFastBurnIn : useFastBurnIn
}
function loadProfileString(profileString) {

View File

@@ -29,26 +29,29 @@ Loader {
property real lastUpdate: 0
property real prevLastUpdate: 0
property real delay: (1.0 / appSettings.fps) * 1000
property real burnIn: appSettings.burnIn
property real burnInFadeTime: 1 / Utils.lint(_minBurnInFadeTime, _maxBurnInFadeTime, burnIn)
property real _minBurnInFadeTime: appConstants.minBurnInFadeTime
property real _maxBurnInFadeTime: appConstants.maxBurnInFadeTime
property real _minBurnInFadeTime: appSettings.minBurnInFadeTime
property real _maxBurnInFadeTime: appSettings.maxBurnInFadeTime
active: appSettings.useFastBurnIn && appSettings.burnIn !== 0
active: appSettings.burnIn !== 0
anchors.fill: parent
function completelyUpdate() {
prevLastUpdate = lastUpdate;
lastUpdate = timeManager.time;
item.source.scheduleUpdate();
let newTime = timeManager.time
if (newTime > lastUpdate) {
prevLastUpdate = lastUpdate
lastUpdate = newTime
}
function restartBlurSource(){
prevLastUpdate = timeManager.time;
lastUpdate = prevLastUpdate;
completelyUpdate();
item.source.scheduleUpdate()
}
function restartBlurSource() {
prevLastUpdate = timeManager.time
lastUpdate = prevLastUpdate
completelyUpdate()
}
sourceComponent: Item {
@@ -72,20 +75,30 @@ Loader {
Connections {
target: kterminal
onImagePainted: completelyUpdate()
function onImagePainted() {
completelyUpdate()
}
}
// Restart blurred source settings change.
Connections{
Connections {
target: appSettings
onBurnInChanged: burnInEffect.restartBlurSource();
onTerminalFontChanged: burnInEffect.restartBlurSource();
onRasterizationChanged: burnInEffect.restartBlurSource();
onBurnInQualityChanged: burnInEffect.restartBlurSource();
function onBurnInChanged() {
burnInEffect.restartBlurSource()
}
Connections {
target: kterminalScrollbar
onOpacityChanged: completelyUpdate()
function onTerminalFontChanged() {
burnInEffect.restartBlurSource()
}
function onRasterizationChanged() {
burnInEffect.restartBlurSource()
}
function onBurnInQualityChanged() {
burnInEffect.restartBlurSource()
}
}
}

View File

@@ -34,10 +34,8 @@ Item {
visible: false
//This is a workaround to a Qt 5.2 bug.
onColorChanged: if (Qt.platform.os !== "osx")
colorSelected(color)
onAccepted: if (Qt.platform.os === "osx")
colorSelected(color)
onColorChanged: if (!appSettings.isMacOS) colorSelected(color)
onAccepted: if (appSettings.isMacOS) colorSelected(color)
}
Rectangle {
anchors.fill: parent

View File

@@ -213,7 +213,7 @@ QtObject {
ListElement {
name: "IBM_3278"
text: "HD: IBM 3278 (1971)"
source: "fonts/1971-ibm-3278/3270Medium.ttf"
source: "fonts/1971-ibm-3278/3270-Regular.ttf"
lineSpacing: 0.2
pixelSize: 32
fontWidth: 1.0

View File

@@ -34,7 +34,6 @@ Item{
property ShaderEffectSource mainSource: kterminalSource
property BurnInEffect burnInEffect: burnInEffect
property SlowBurnIn slowBurnInEffect: slowBurnInEffect
property real fontWidth: 1.0
property real screenScaling: 1.0
property real scaleTexture: 1.0
@@ -45,28 +44,54 @@ Item{
property size fontMetrics: kterminal.fontMetrics
// Manage copy and paste
Connections{
Connections {
target: copyAction
onTriggered: kterminal.copyClipboard();
function onTriggered() {
kterminal.copyClipboard()
}
Connections{
}
Connections {
target: pasteAction
onTriggered: kterminal.pasteClipboard()
function onTriggered() {
kterminal.pasteClipboard()
}
}
//When settings are updated sources need to be redrawn.
Connections{
Connections {
target: appSettings
onFontScalingChanged: terminalContainer.updateSources();
onFontWidthChanged: terminalContainer.updateSources();
function onFontScalingChanged() {
terminalContainer.updateSources()
}
Connections{
function onFontWidthChanged() {
terminalContainer.updateSources()
}
}
Connections {
target: terminalContainer
onWidthChanged: terminalContainer.updateSources();
onHeightChanged: terminalContainer.updateSources();
function onWidthChanged() {
terminalContainer.updateSources()
}
function onHeightChanged() {
terminalContainer.updateSources()
}
}
Connections {
target: terminalWindow
function onActiveChanged() {
kterminal.forceActiveFocus()
}
}
function updateSources() {
kterminal.update();
kterminal.update()
}
QMLTermWidget {
@@ -143,7 +168,7 @@ Item{
var args = Utils.tokenizeCommandLine(appSettings.customCommand);
ksession.setShellProgram(args[0]);
ksession.setArgs(args.slice(1));
} else if (!defaultCmd && Qt.platform.os === "osx") {
} else if (!defaultCmd && appSettings.isMacOS) {
// OSX Requires the following default parameters for auto login.
ksession.setArgs(["-i", "-l"]);
}
@@ -173,7 +198,7 @@ Item{
Loader {
id: menuLoader
sourceComponent: (Qt.platform.os === "osx" || appSettings.showMenubar ? shortContextMenu : fullContextMenu)
sourceComponent: (appSettings.isMacOS || appSettings.showMenubar ? shortContextMenu : fullContextMenu)
}
property alias contextmenu: menuLoader.item
@@ -217,7 +242,7 @@ Item{
y = (y - margin) / height;
var cc = Qt.size(0.5 - x, 0.5 - y);
var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature * appConstants.screenCurvatureSize;
var distortion = (cc.height * cc.height + cc.width * cc.width) * appSettings.screenCurvature * appSettings.screenCurvatureSize;
return Qt.point((x - cc.width * (1+distortion) * distortion) * (kterminal.totalWidth),
(y - cc.height * (1+distortion) * distortion) * (kterminal.totalHeight))
@@ -250,9 +275,5 @@ Item{
BurnInEffect {
id: burnInEffect
}
SlowBurnIn {
id: slowBurnInEffect
}
}
}

View File

@@ -154,12 +154,6 @@ ColumnLayout {
Label {
text: Math.round(burnInSlider.value * 100) + "%"
}
CheckBox {
Layout.columnSpan: 2
text: qsTr("Burnin optimization (might display timing artifacts)")
checked: appSettings.useFastBurnIn
onCheckedChanged: appSettings.useFastBurnIn = checked
}
}
}
}

View File

@@ -33,6 +33,7 @@ ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
model: appSettings.profilesList
clip: true
delegate: Rectangle {
width: label.width
height: label.height
@@ -113,7 +114,7 @@ ColumnLayout {
var version = profileObject.version
!== undefined ? profileObject.version : 1
if (version !== appConstants.profileVersion)
if (version !== appSettings.profileVersion)
throw "This profile is not supported on this version of CRT."
delete profileObject.name
@@ -160,7 +161,7 @@ ColumnLayout {
var profileSettings = JSON.parse(
profileObject.obj_string)
profileSettings["name"] = profileObject.text
profileSettings["version"] = appConstants.profileVersion
profileSettings["version"] = appSettings.profileVersion
var result = fileIO.write(url, JSON.stringify(
profileSettings,
@@ -215,10 +216,12 @@ ColumnLayout {
}
Label {
text: qsTr("Opacity")
visible: !appSettings.isMacOS
}
SimpleSlider {
onValueChanged: appSettings.windowOpacity = value
value: appSettings.windowOpacity
visible: !appSettings.isMacOS
}
}
}

View File

@@ -68,7 +68,10 @@ ColumnLayout {
}
Connections {
target: appSettings
onTerminalFontChanged: fontChanger.updateIndex()
function onTerminalFontChanged() {
fontChanger.updateIndex()
}
}
Component.onCompleted: updateIndex()
}
@@ -83,8 +86,8 @@ ColumnLayout {
onValueChanged: appSettings.fontScaling = value
value: appSettings.fontScaling
stepSize: 0.05
from: appConstants.minimumFontScaling
to: appConstants.maximumFontScaling
from: appSettings.minimumFontScaling
to: appSettings.maximumFontScaling
}
SizedLabel {
text: Math.round(fontScalingChanger.value * 100) + "%"

View File

@@ -27,14 +27,17 @@ import QtQuick.Dialogs 1.1
Window {
id: settings_window
title: qsTr("Settings")
width: 800
height: 600
width: 600
height: 480
property int tabmargins: 15
Item {
anchors { fill: parent; margins: tabmargins }
TabBar {
id: bar
width: parent.width
anchors { left: parent.left; right: parent.right; top: parent.top; }
TabButton {
text: qsTr("General")
}
@@ -49,15 +52,17 @@ Window {
}
}
StackLayout {
Frame {
anchors {
top: bar.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
margins: tabmargins
}
StackLayout {
anchors.fill: parent
currentIndex: bar.currentIndex
SettingsGeneralTab { }
@@ -65,4 +70,6 @@ Window {
SettingsEffectsTab { }
SettingsAdvancedTab { }
}
}
}
}

View File

@@ -2,12 +2,12 @@ import QtQuick 2.0
QtObject {
property string rasterizationShader:
(appSettings.rasterization === appConstants.no_rasterization ? "
(appSettings.rasterization === appSettings.no_rasterization ? "
lowp vec3 applyRasterization(vec2 screenCoords, lowp vec3 texel, vec2 virtualResolution, float intensity) {
return texel;
}" : "") +
(appSettings.rasterization === appConstants.scanline_rasterization ? "
(appSettings.rasterization === appSettings.scanline_rasterization ? "
#define INTENSITY 0.30
#define BRIGHTBOOST 0.30
@@ -22,7 +22,7 @@ QtObject {
return mix(texel, rasterizationColor, intensity);
}" : "") +
(appSettings.rasterization === appConstants.pixel_rasterization ? "
(appSettings.rasterization === appSettings.pixel_rasterization ? "
#define INTENSITY 0.30
#define BRIGHTBOOST 0.30
@@ -40,7 +40,7 @@ QtObject {
return mix(texel, rasterizationColor, intensity);
}" : "") +
(appSettings.rasterization === appConstants.subpixel_rasterization ? "
(appSettings.rasterization === appSettings.subpixel_rasterization ? "
#define INTENSITY 0.30
#define BRIGHTBOOST 0.30
#define SUBPIXELS 3.0

View File

@@ -24,7 +24,6 @@ import QtGraphicalEffects 1.0
import "utils.js" as Utils
Item {
property SlowBurnIn slowBurnInEffect
property ShaderEffectSource source
property BurnInEffect burnInEffect
property ShaderEffectSource bloomSource
@@ -32,7 +31,7 @@ Item {
property color fontColor: appSettings.fontColor
property color backgroundColor: appSettings.backgroundColor
property real screenCurvature: appSettings.screenCurvature * appConstants.screenCurvatureSize
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
property real chromaColor: appSettings.chromaColor
@@ -67,14 +66,10 @@ Item {
property real glowingLine: appSettings.glowingLine * 0.2
// Fast burnin properties
property real burnIn: appSettings.useFastBurnIn ? appSettings.burnIn : 0
property real burnIn: appSettings.burnIn
property real burnInLastUpdate: burnInEffect.lastUpdate
property real burnInTime: burnInEffect.burnInFadeTime
// Slow burnin properties
property real slowBurnIn: appSettings.useFastBurnIn ? 0 : appSettings.burnIn
property ShaderEffectSource slowBurnInSource: slowBurnInEffect.source
property real jitter: appSettings.jitter
property size jitterDisplacement: Qt.size(0.007 * jitter, 0.002 * jitter)
property real shadowLength: 0.25 * screenCurvature * Utils.lint(0.50, 1.5, ambientLight)
@@ -185,8 +180,6 @@ Item {
uniform sampler2D burnInSource;
uniform highp float burnInLastUpdate;
uniform highp float burnInTime;" : "") +
(slowBurnIn !== 0 ? "
uniform sampler2D slowBurnInSource;" : "") +
(staticNoise !== 0 ? "
uniform highp float staticNoise;" : "") +
(((staticNoise !== 0 || jitter !== 0) ||(fallBack && (flickering || horizontalSync))) ? "
@@ -314,11 +307,6 @@ Item {
txt_color = max(txt_color, convertWithChroma(burnInColor));"
: "") +
(slowBurnIn !== 0 ? "
vec4 txt_blur = texture2D(slowBurnInSource, staticCoords);
txt_color = max(txt_color, convertWithChroma(txt_blur.rgb * txt_blur.a));
" : "") +
"txt_color += fontColor.rgb * vec3(color);" +
"txt_color = applyRasterization(staticCoords, txt_color, virtualResolution, rasterizationIntensity);\n" +

View File

@@ -1,140 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
*
* This file is part of cool-retro-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.0
import "utils.js" as Utils
Loader {
property ShaderEffectSource source: item ? item.source : null
active: !appSettings.useFastBurnIn && appSettings.burnIn !== 0
anchors.fill: parent
sourceComponent: Item {
property alias source: burnInSourceEffect
property int burnInScaling: scaleTexture * appSettings.burnInQuality
ShaderEffectSource {
property bool updateBurnIn: false
property real burnIn: appSettings.burnIn
property real fps: appSettings.fps !== 0 ? appSettings.fps : 60
property real burnInFadeTime: Utils.lint(minBurnInFadeTime, maxBurnInFadeTime, burnIn)
property real burnInCoefficient: 1000 / (fps * burnInFadeTime)
property real minBurnInFadeTime: appConstants.minBurnInFadeTime
property real maxBurnInFadeTime: appConstants.maxBurnInFadeTime
id: burnInSourceEffect
anchors.fill: parent
sourceItem: burnInEffect
recursive: true
live: false
hideSource: true
wrapMode: kterminalSource.wrapMode
visible: false
function restartBlurSource(){
livetimer.restart();
}
// This updates the burnin synched with the timer.
Connections {
target: burnInSourceEffect.updateBurnIn ? timeManager : null
ignoreUnknownSignals: false
onTimeChanged: {
burnInSourceEffect.scheduleUpdate();
}
}
Timer {
id: livetimer
// The interval assumes 60 fps. This is the time needed burnout a white pixel.
// We multiply 1.1 to have a little bit of margin over the theoretical value.
// This solution is not extremely clean, but it's probably the best to avoid measuring fps.
interval: burnInSourceEffect.burnInFadeTime * 1.1
running: true
onTriggered: burnInSourceEffect.updateBurnIn = false;
}
Connections {
target: kterminal
onImagePainted:{
burnInSourceEffect.scheduleUpdate();
burnInSourceEffect.updateBurnIn = true;
livetimer.restart();
}
}
// Restart blurred source settings change.
Connections {
target: appSettings
onBurnInChanged: burnInSourceEffect.restartBlurSource();
onTerminalFontChanged: burnInSourceEffect.restartBlurSource();
onRasterizationChanged: burnInSourceEffect.restartBlurSource();
onBurnInQualityChanged: burnInSourceEffect.restartBlurSource();
}
Connections {
target: kterminalScrollbar
onOpacityChanged: burnInSourceEffect.restartBlurSource();
}
ShaderEffect {
id: burnInEffect
property variant txt_source: kterminalSource
property variant blurredSource: burnInSourceEffect
property real burnInCoefficient: burnInSourceEffect.burnInCoefficient
anchors.fill: parent
blending: false
fragmentShader:
"#ifdef GL_ES
precision mediump float;
#endif\n" +
"uniform lowp float qt_Opacity;" +
"uniform lowp sampler2D txt_source;" +
"varying highp vec2 qt_TexCoord0;
uniform lowp sampler2D blurredSource;
uniform highp float burnInCoefficient;" +
"float max3(vec3 v) {
return max (max (v.x, v.y), v.z);
}" +
"void main() {" +
"vec2 coords = qt_TexCoord0;" +
"vec3 origColor = texture2D(txt_source, coords).rgb;" +
"vec3 blur_color = texture2D(blurredSource, coords).rgb - vec3(burnInCoefficient);" +
"vec3 color = min(origColor + blur_color, max(origColor, blur_color));" +
"gl_FragColor = vec4(color, max3(color - origColor));" +
"}"
onStatusChanged: if (log) console.log(log) //Print warning messages
}
}
}
}

View File

@@ -33,7 +33,6 @@ ShaderTerminal {
source: terminal.mainSource
burnInEffect: terminal.burnInEffect
slowBurnInEffect: terminal.slowBurnInEffect
virtualResolution: terminal.virtualResolution
screenResolution: Qt.size(
terminalWindow.width * devicePixelRatio * appSettings.windowScaling,

View File

@@ -29,7 +29,7 @@ ShaderEffect {
property real _ambientLight: Utils.lint(0.2, 0.8, appSettings.ambientLight)
property color frameColor: Utils.mix(_staticFrameColor, _lightColor, _ambientLight)
property real screenCurvature: appSettings.screenCurvature * appConstants.screenCurvatureSize
property real screenCurvature: appSettings.screenCurvature * appSettings.screenCurvatureSize
// Coefficient of the log curve used to approximate shadowing
property real screenShadowCoeff: Utils.lint(20.0, 10.0, _ambientLight)

Binary file not shown.

View File

@@ -53,20 +53,30 @@ ApplicationWindow {
property bool fullscreen: appSettings.fullscreen
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
menuBar: WindowMenu {
id: mainMenu
visible: (Qt.platform.os === "osx" || appSettings.showMenubar)
menuBar: qtquickMenuLoader.item
Loader {
id: qtquickMenuLoader
active: !appSettings.isMacOS && appSettings.showMenubar
sourceComponent: WindowMenu { }
}
Loader {
id: globalMenuLoader
active: appSettings.isMacOS
sourceComponent: OSXMenu { }
}
property string wintitle: appSettings.wintitle
color: "#00000000"
title: terminalContainer.title || qsTr(appSettings.wintitle)
Action {
id: showMenubarAction
text: qsTr("Show Menubar")
enabled: Qt.platform.os !== "osx"
enabled: !appSettings.isMacOS
shortcut: "Ctrl+Shift+M"
checkable: true
checked: appSettings.showMenubar
@@ -75,7 +85,7 @@ ApplicationWindow {
Action {
id: fullscreenAction
text: qsTr("Fullscreen")
enabled: Qt.platform.os !== "osx"
enabled: !appSettings.isMacOS
shortcut: "Alt+F11"
onTriggered: appSettings.fullscreen = !appSettings.fullscreen
checkable: true
@@ -127,9 +137,6 @@ ApplicationWindow {
aboutDialog.raise()
}
}
ApplicationConstants {
id: appConstants
}
ApplicationSettings {
id: appSettings
}
@@ -157,7 +164,7 @@ ApplicationWindow {
onClosing: {
// OSX Since we are currently supporting only one window
// quit the application when it is closed.
if (Qt.platform.os === "osx")
if (appSettings.isMacOS)
Qt.quit()
}
}

89
app/qml/menus/OSXMenu.qml Normal file
View File

@@ -0,0 +1,89 @@
/*******************************************************************************
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
*
* This file is part of cool-retro-term.
*
* cool-retro-term is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.3
import Qt.labs.platform 1.1
MenuBar {
id: defaultMenuBar
Menu {
title: qsTr("File")
MenuItem {
text: quitAction.text
onTriggered: quitAction.trigger()
}
}
Menu {
title: qsTr("Edit")
MenuItem {
text: copyAction.text
shortcut: "Meta+C"
onTriggered: copyAction.trigger()
}
MenuItem {
text: pasteAction.text
shortcut: "Meta+V"
onTriggered: pasteAction.trigger()
}
MenuSeparator {}
MenuItem {
text: showsettingsAction.text
shortcut: showsettingsAction.shortcut
onTriggered: showsettingsAction.trigger()
}
}
Menu {
title: qsTr("View")
MenuItem {
text: zoomIn.text
shortcut: "Meta++"
onTriggered: zoomIn.trigger()
}
MenuItem {
text: zoomOut.text
shortcut: "Meta+-"
onTriggered: zoomOut.trigger()
}
}
Menu {
id: profilesMenu
title: qsTr("Profiles")
Instantiator {
model: appSettings.profilesList
delegate: MenuItem {
text: model.text
onTriggered: {
appSettings.loadProfileString(obj_string)
appSettings.handleFontChanged()
}
}
onObjectAdded: profilesMenu.insertItem(index, object)
onObjectRemoved: profilesMenu.removeItem(object)
}
}
Menu {
title: qsTr("Help")
MenuItem {
text: showAboutAction.text
onTriggered: showAboutAction.trigger()
}
}
}

View File

@@ -19,7 +19,7 @@
<file>SettingsTerminalTab.qml</file>
<file>FontScanlines.qml</file>
<file>fonts/1977-apple2/PrintChar21.ttf</file>
<file>fonts/1971-ibm-3278/3270Medium.ttf</file>
<file>fonts/1971-ibm-3278/3270-Regular.ttf</file>
<file>Storage.qml</file>
<file>SettingsAdvancedTab.qml</file>
<file>TerminalContainer.qml</file>
@@ -41,11 +41,10 @@
<file>BurnInEffect.qml</file>
<file>fonts/modern-terminus/TerminusTTF-4.46.0.ttf</file>
<file>TerminalFrame.qml</file>
<file>SlowBurnIn.qml</file>
<file>menus/WindowMenu.qml</file>
<file>menus/FullContextMenu.qml</file>
<file>menus/ShortContextMenu.qml</file>
<file>ShaderLibrary.qml</file>
<file>ApplicationConstants.qml</file>
<file>menus/OSXMenu.qml</file>
</qresource>
</RCC>