mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 07:04:20 +00:00 
			
		
		
		
	Improve QML syntax and update license headers.
This commit is contained in:
		| @@ -1,9 +1,28 @@ | ||||
| /******************************************************************************* | ||||
| * 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 | ||||
| import QtQuick.Controls 2.2 | ||||
| import QtQuick.Layouts 1.1 | ||||
| import QtQuick.Window 2.0 | ||||
|  | ||||
| Window{ | ||||
| Window { | ||||
|     id: dialogwindow | ||||
|     title: qsTr("About") | ||||
|     width: 600 | ||||
| @@ -11,16 +30,19 @@ Window{ | ||||
|  | ||||
|     modality: Qt.ApplicationModal | ||||
|  | ||||
|     ColumnLayout{ | ||||
|     ColumnLayout { | ||||
|         anchors.fill: parent | ||||
|         anchors.margins: 15 | ||||
|         spacing: 15 | ||||
|         Text { | ||||
|             Layout.alignment: Qt.AlignHCenter | ||||
|             text: "cool-retro-term" | ||||
|             font {bold: true; pointSize: 18} | ||||
|             font { | ||||
|                 bold: true | ||||
|                 pointSize: 18 | ||||
|             } | ||||
|         } | ||||
|         Loader{ | ||||
|         Loader { | ||||
|             id: mainContent | ||||
|             Layout.fillHeight: true | ||||
|             Layout.fillWidth: true | ||||
| @@ -41,32 +63,33 @@ Window{ | ||||
|                     } | ||||
|                 } | ||||
|             ] | ||||
|             Component.onCompleted: mainContent.state = "Default"; | ||||
|             Component.onCompleted: mainContent.state = "Default" | ||||
|         } | ||||
|         Item{ | ||||
|         Item { | ||||
|             Layout.fillWidth: true | ||||
|             height: childrenRect.height | ||||
|             Button{ | ||||
|             Button { | ||||
|                 anchors.left: parent.left | ||||
|                 text: qsTr("License") | ||||
|                 onClicked: { | ||||
|                     mainContent.state == "Default" ? mainContent.state = "License" : mainContent.state = "Default" | ||||
|                     mainContent.state == "Default" ? mainContent.state | ||||
|                                                      = "License" : mainContent.state = "Default" | ||||
|                 } | ||||
|             } | ||||
|             Button{ | ||||
|             Button { | ||||
|                 anchors.right: parent.right | ||||
|                 text: qsTr("Close") | ||||
|                 onClicked: dialogwindow.close(); | ||||
|                 onClicked: dialogwindow.close() | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     // MAIN COMPONENTS //////////////////////////////////////////////////////// | ||||
|     Component{ | ||||
|     Component { | ||||
|         id: defaultComponent | ||||
|         ColumnLayout{ | ||||
|         ColumnLayout { | ||||
|             anchors.fill: parent | ||||
|             spacing: 10 | ||||
|             Image{ | ||||
|             Image { | ||||
|                 Layout.fillWidth: true | ||||
|                 Layout.fillHeight: true | ||||
|                 Layout.alignment: Qt.AlignHCenter | ||||
| @@ -74,39 +97,36 @@ Window{ | ||||
|                 source: "images/crt256.png" | ||||
|                 smooth: true | ||||
|             } | ||||
|             Text{ | ||||
|             Text { | ||||
|                 Layout.alignment: Qt.AlignCenter | ||||
|                 horizontalAlignment: Text.AlignHCenter | ||||
|                 text: appSettings.version + "\n" + | ||||
|                       qsTr("Author: ") + "Filippo Scognamiglio\n" + | ||||
|                       qsTr("Email: ")  + "flscogna@gmail.com\n" + | ||||
|                       qsTr("Source: ") + "https://github.com/Swordfish90/cool-retro-term\n" | ||||
|                 text: appSettings.version + "\n" + qsTr( | ||||
|                           "Author: ") + "Filippo Scognamiglio\n" + qsTr( | ||||
|                           "Email: ") + "flscogna@gmail.com\n" + qsTr( | ||||
|                           "Source: ") + "https://github.com/Swordfish90/cool-retro-term\n" | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     Component{ | ||||
|     Component { | ||||
|         id: licenseComponent | ||||
|         ScrollView { | ||||
|             anchors.fill: parent | ||||
|             clip: true | ||||
|             TextArea{ | ||||
|             TextArea { | ||||
|                 readOnly: true | ||||
|                 wrapMode: TextEdit.Wrap | ||||
|                 text: "Copyright (c) 2013 Filippo Scognamiglio <flscogna@gmail.com>\n\n" + | ||||
|                       "https://github.com/Swordfish90/cool-retro-term\n\n" + | ||||
|  | ||||
|                       "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.\n\n" + | ||||
|  | ||||
|                       "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.\n\n" + | ||||
|  | ||||
|                       "You should have received a copy of the GNU General Public License " + | ||||
|                       "along with this program.  If not, see <http://www.gnu.org/licenses/>." | ||||
|                 text: "Copyright (c) 2013-2021 Filippo Scognamiglio <flscogna@gmail.com>\n\n" | ||||
|                       + "https://github.com/Swordfish90/cool-retro-term\n\n" + | ||||
|                       "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.\n\n" + | ||||
|                       "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.\n\n" + | ||||
|                       "You should have received a copy of the GNU General Public License " | ||||
|                       + "along with this program.  If not, see <http://www.gnu.org/licenses/>." | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,3 +1,22 @@ | ||||
| /******************************************************************************* | ||||
| * 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 | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,7 +17,6 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.0 | ||||
| import QtQuick.Layouts 1.1 | ||||
| @@ -32,41 +31,42 @@ RowLayout { | ||||
|     property alias max_value: slider.to | ||||
|     property alias stepSize: slider.stepSize | ||||
|  | ||||
|     signal newValue(real newValue); | ||||
|     signal newValue(real newValue) | ||||
|  | ||||
|     id: setting_component | ||||
|     Layout.fillWidth: true | ||||
|  | ||||
|     onValueChanged: { | ||||
|         check.checked = !(value == 0); | ||||
|         if(check.checked) | ||||
|             slider.value = value; | ||||
|         check.checked = !(value == 0) | ||||
|         if (check.checked) | ||||
|             slider.value = value | ||||
|     } | ||||
|  | ||||
|     CheckBox{ | ||||
|     CheckBox { | ||||
|         id: check | ||||
|         implicitWidth: 160 | ||||
|         onClicked: { | ||||
|             if(!checked){ | ||||
|                 checked = false; | ||||
|                 slider.enabled = false; | ||||
|                 newValue(0); | ||||
|             if (!checked) { | ||||
|                 checked = false | ||||
|                 slider.enabled = false | ||||
|                 newValue(0) | ||||
|             } else { | ||||
|                 checked = true; | ||||
|                 newValue(slider.value); | ||||
|                 slider.enabled = true; | ||||
|                 checked = true | ||||
|                 newValue(slider.value) | ||||
|                 slider.enabled = true | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     Slider{ | ||||
|     Slider { | ||||
|         id: slider | ||||
|         stepSize: parent.stepSize | ||||
|         Layout.fillWidth: true | ||||
|         onValueChanged: { | ||||
|             newValue(value); | ||||
|             newValue(value) | ||||
|         } | ||||
|     } | ||||
|     SizedLabel { | ||||
|         text: Math.round(((value - min_value) / (max_value - min_value)) * 100) + "%" | ||||
|         text: Math.round( | ||||
|                   ((value - min_value) / (max_value - min_value)) * 100) + "%" | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,14 +17,13 @@ | ||||
| * 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 | ||||
| import QtQuick.Dialogs 1.1 | ||||
|  | ||||
| Item { | ||||
|     id: rootItem | ||||
|  | ||||
|     signal colorSelected (color color) | ||||
|     signal colorSelected(color color) | ||||
|     property color color | ||||
|     property string name | ||||
|  | ||||
| @@ -35,10 +34,12 @@ 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 (Qt.platform.os !== "osx") | ||||
|                             colorSelected(color) | ||||
|         onAccepted: if (Qt.platform.os === "osx") | ||||
|                         colorSelected(color) | ||||
|     } | ||||
|     Rectangle{ | ||||
|     Rectangle { | ||||
|         anchors.fill: parent | ||||
|         radius: 10 | ||||
|         color: rootItem.color | ||||
| @@ -50,14 +51,14 @@ Item { | ||||
|             color: "white" | ||||
|             opacity: 0.5 | ||||
|         } | ||||
|         Text{ | ||||
|         Text { | ||||
|             anchors.centerIn: parent | ||||
|             z: parent.z + 1 | ||||
|             text: name + ":  " + rootItem.color | ||||
|         } | ||||
|     } | ||||
|     MouseArea{ | ||||
|     MouseArea { | ||||
|         anchors.fill: parent | ||||
|         onClicked: colorDialog.visible = true; | ||||
|         onClicked: colorDialog.visible = true | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,7 @@ | ||||
|  | ||||
|  | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,15 +19,12 @@ | ||||
| * 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 QtQuick.Controls 2.0 | ||||
| import QtQuick.Layouts 1.0 | ||||
|  | ||||
| // This component is simply a label with a predefined size. | ||||
| // Used to improve alignment. | ||||
|  | ||||
| Label { | ||||
|     id: textfield | ||||
|     Layout.minimumWidth: appSettings.labelWidth | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,10 +17,9 @@ | ||||
| * 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{ | ||||
| QtObject { | ||||
|     property int selectedFontIndex | ||||
|     property real scaling | ||||
|     property var _font: fontlist.get(selectedFontIndex) | ||||
| @@ -31,8 +30,8 @@ QtObject{ | ||||
|     property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth | ||||
|     property bool lowResolutionFont: true | ||||
|  | ||||
|     property ListModel fontlist: ListModel{ | ||||
|         ListElement{ | ||||
|     property ListModel fontlist: ListModel { | ||||
|         ListElement { | ||||
|             name: "COMMODORE_PET" | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/PetMe.ttf" | ||||
| @@ -41,7 +40,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "IBM_PC" | ||||
|             text: "IBM PC (1981)" | ||||
|             source: "fonts/1981-ibm-pc/PxPlus_IBM_BIOS.ttf" | ||||
| @@ -50,7 +49,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PROGGY_TINY" | ||||
|             text: "Proggy Tiny (Modern)" | ||||
|             source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" | ||||
| @@ -59,7 +58,7 @@ QtObject{ | ||||
|             baseScaling: 3.3 | ||||
|             fontWidth: 0.9 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "TERMINUS_SCALED" | ||||
|             text: "Terminus (Modern)" | ||||
|             source: "fonts/modern-terminus/TerminusTTF-4.46.0.ttf" | ||||
| @@ -68,7 +67,7 @@ QtObject{ | ||||
|             baseScaling: 3.0 | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PRO_FONT_SCALED" | ||||
|             text: "Pro Font (Modern)" | ||||
|             source: "fonts/modern-pro-font-win-tweaked/ProFontWindows.ttf" | ||||
| @@ -77,7 +76,7 @@ QtObject{ | ||||
|             baseScaling: 3.0 | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "APPLE_II" | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
| @@ -86,7 +85,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.9 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "ATARI_400" | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/AtariClassic-Regular.ttf" | ||||
| @@ -95,7 +94,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "COMMODORE_64" | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_Pro_Mono-STYLE.ttf" | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,10 +17,9 @@ | ||||
| * 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{ | ||||
| QtObject { | ||||
|     property int selectedFontIndex | ||||
|     property real scaling | ||||
|     property var _font: fontlist.get(selectedFontIndex) | ||||
| @@ -31,8 +30,8 @@ QtObject{ | ||||
|     property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth | ||||
|     property bool lowResolutionFont: true | ||||
|  | ||||
|     property ListModel fontlist: ListModel{ | ||||
|         ListElement{ | ||||
|     property ListModel fontlist: ListModel { | ||||
|         ListElement { | ||||
|             name: "COMMODORE_PET" | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/PetMe.ttf" | ||||
| @@ -41,7 +40,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "IBM_PC" | ||||
|             text: "IBM PC (1981)" | ||||
|             source: "fonts/1981-ibm-pc/PxPlus_IBM_BIOS.ttf" | ||||
| @@ -50,7 +49,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PROGGY_TINY" | ||||
|             text: "Proggy Tiny (Modern)" | ||||
|             source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" | ||||
| @@ -59,7 +58,7 @@ QtObject{ | ||||
|             baseScaling: 3.3 | ||||
|             fontWidth: 0.9 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "TERMINUS_SCALED" | ||||
|             text: "Terminus (Modern)" | ||||
|             source: "fonts/modern-terminus/TerminusTTF-4.46.0.ttf" | ||||
| @@ -68,7 +67,7 @@ QtObject{ | ||||
|             baseScaling: 3.0 | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PRO_FONT_SCALED" | ||||
|             text: "Pro Font (Modern)" | ||||
|             source: "fonts/modern-pro-font-win-tweaked/ProFontWindows.ttf" | ||||
| @@ -77,7 +76,7 @@ QtObject{ | ||||
|             baseScaling: 3.0 | ||||
|             fontWidth: 1.0 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "APPLE_II" | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
| @@ -86,7 +85,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.8 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "ATARI_400" | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/AtariClassic-Regular.ttf" | ||||
| @@ -95,7 +94,7 @@ QtObject{ | ||||
|             baseScaling: 3.5 | ||||
|             fontWidth: 0.7 | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "COMMODORE_64" | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_Pro_Mono-STYLE.ttf" | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,27 +17,20 @@ | ||||
| * 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{ | ||||
| QtObject { | ||||
|     property int selectedFontIndex | ||||
|     property real scaling | ||||
|     property var source: fontlist.get(selectedFontIndex).source | ||||
|     property var _font: fontlist.get(selectedFontIndex) | ||||
|     property bool lowResolutionFont: _font.lowResolutionFont | ||||
|  | ||||
|     property int pixelSize: lowResolutionFont | ||||
|                                  ? _font.pixelSize | ||||
|                                  : _font.pixelSize * scaling | ||||
|     property int pixelSize: lowResolutionFont ? _font.pixelSize : _font.pixelSize * scaling | ||||
|  | ||||
|     property int lineSpacing: lowResolutionFont | ||||
|                                   ? _font.lineSpacing | ||||
|                                   : pixelSize * _font.lineSpacing | ||||
|     property int lineSpacing: lowResolutionFont ? _font.lineSpacing : pixelSize * _font.lineSpacing | ||||
|  | ||||
|     property real screenScaling: lowResolutionFont | ||||
|                                      ? _font.baseScaling * scaling | ||||
|                                      : 1.0 | ||||
|     property real screenScaling: lowResolutionFont ? _font.baseScaling * scaling : 1.0 | ||||
|  | ||||
|     property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth | ||||
|  | ||||
| @@ -52,9 +45,8 @@ QtObject{ | ||||
|     // High resolution fonts are instead drawn on a texture which has the | ||||
|     // size of the screen, and the scaling directly controls their pixels size. | ||||
|     // Those are slower to render but are not pixelated. | ||||
|  | ||||
|     property ListModel fontlist: ListModel { | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "TERMINUS_SCALED" | ||||
|             text: "Terminus (Modern)" | ||||
|             source: "fonts/modern-terminus/TerminusTTF-4.46.0.ttf" | ||||
| @@ -66,7 +58,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PRO_FONT_SCALED" | ||||
|             text: "Pro Font (Modern)" | ||||
|             source: "fonts/modern-pro-font-win-tweaked/ProFontWindows.ttf" | ||||
| @@ -78,7 +70,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "EXCELSIOR_SCALED" | ||||
|             text: "Fixedsys Excelsior (Modern)" | ||||
|             source: "fonts/modern-fixedsys-excelsior/FSEX301-L2.ttf" | ||||
| @@ -90,7 +82,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "COMMODORE_PET_SCALED" | ||||
|             text: "Commodore PET (1977)" | ||||
|             source: "fonts/1977-commodore-pet/PetMe.ttf" | ||||
| @@ -102,7 +94,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PROGGY_TINY_SCALED" | ||||
|             text: "Proggy Tiny (Modern)" | ||||
|             source: "fonts/modern-proggy-tiny/ProggyTiny.ttf" | ||||
| @@ -114,7 +106,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "APPLE_II_SCALED" | ||||
|             text: "Apple ][ (1977)" | ||||
|             source: "fonts/1977-apple2/PrintChar21.ttf" | ||||
| @@ -126,7 +118,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "ATARI_400_SCALED" | ||||
|             text: "Atari 400-800 (1979)" | ||||
|             source: "fonts/1979-atari-400-800/AtariClassic-Regular.ttf" | ||||
| @@ -138,7 +130,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "IBM_PC_SCALED" | ||||
|             text: "IBM PC (1981)" | ||||
|             source: "fonts/1981-ibm-pc/PxPlus_IBM_BIOS.ttf" | ||||
| @@ -150,7 +142,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "COMMODORE_64_SCALED" | ||||
|             text: "Commodore 64 (1982)" | ||||
|             source: "fonts/1982-commodore64/C64_Pro_Mono-STYLE.ttf" | ||||
| @@ -162,7 +154,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "IBM_DOS" | ||||
|             text: "IBM DOS (1985)" | ||||
|             source: "fonts/1985-ibm-pc-vga/PxPlus_IBM_VGA8.ttf" | ||||
| @@ -174,7 +166,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "HERMIT" | ||||
|             text: "HD: Hermit (Modern)" | ||||
|             source: "fonts/modern-hermit/Hermit-medium.otf" | ||||
| @@ -185,7 +177,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "TERMINUS" | ||||
|             text: "HD: Terminus (Modern)" | ||||
|             source: "fonts/modern-terminus/TerminusTTF-4.46.0.ttf" | ||||
| @@ -196,7 +188,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "PRO_FONT" | ||||
|             text: "HD: Pro Font (Modern)" | ||||
|             source: "fonts/modern-pro-font-win-tweaked/ProFontWindows.ttf" | ||||
| @@ -207,7 +199,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "INCONSOLATA" | ||||
|             text: "HD: Inconsolata (Modern)" | ||||
|             source: "fonts/modern-inconsolata/Inconsolata.otf" | ||||
| @@ -218,7 +210,7 @@ QtObject{ | ||||
|             isSystemFont: false | ||||
|             family: "" | ||||
|         } | ||||
|         ListElement{ | ||||
|         ListElement { | ||||
|             name: "IBM_3278" | ||||
|             text: "HD: IBM 3278 (1971)" | ||||
|             source: "fonts/1971-ibm-3278/3270Medium.ttf" | ||||
| @@ -234,7 +226,7 @@ QtObject{ | ||||
|     Component.onCompleted: addSystemFonts() | ||||
|  | ||||
|     function addSystemFonts() { | ||||
|         var families = monospaceSystemFonts; | ||||
|         var families = monospaceSystemFonts | ||||
|         for (var i = 0; i < families.length; i++) { | ||||
|             if (verbose) { | ||||
|                 console.log("Adding system font: ", families[i]) | ||||
| @@ -245,16 +237,16 @@ QtObject{ | ||||
|  | ||||
|     function convertToListElement(family) { | ||||
|         return { | ||||
|             name: "System: " + family, | ||||
|             text: qsTr("System: ") + family, | ||||
|             source: "", | ||||
|             lineSpacing: 0.1, | ||||
|             pixelSize: 30, | ||||
|             fontWidth: 1.0, | ||||
|             baseScaling: 1.0, | ||||
|             lowResolutionFont: false, | ||||
|             isSystemFont: true, | ||||
|             family: family | ||||
|             "name": "System: " + family, | ||||
|             "text": qsTr("System: ") + family, | ||||
|             "source": "", | ||||
|             "lineSpacing": 0.1, | ||||
|             "pixelSize": 30, | ||||
|             "fontWidth": 1.0, | ||||
|             "baseScaling": 1.0, | ||||
|             "lowResolutionFont": false, | ||||
|             "isSystemFont": true, | ||||
|             "family": family | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,14 +17,13 @@ | ||||
| * 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 | ||||
| import QtQuick.Window 2.0 | ||||
| import QtQuick.Controls 2.0 | ||||
| import QtQuick.Layouts 1.1 | ||||
| import QtQuick.Dialogs 1.1 | ||||
|  | ||||
| Window{ | ||||
| Window { | ||||
|     id: insertnamedialog | ||||
|     width: 400 | ||||
|     height: 100 | ||||
| @@ -39,50 +38,53 @@ Window{ | ||||
|         title: qsTr("Error") | ||||
|         visible: false | ||||
|  | ||||
|         function showError(message){ | ||||
|             text = message; | ||||
|             open(); | ||||
|         function showError(message) { | ||||
|             text = message | ||||
|             open() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     function validateName(name){ | ||||
|         var profile_list = appSettings.profilesList; | ||||
|     function validateName(name) { | ||||
|         var profile_list = appSettings.profilesList | ||||
|         if (name === "") | ||||
|             return 1; | ||||
|         return 0; | ||||
|             return 1 | ||||
|         return 0 | ||||
|     } | ||||
|  | ||||
|     ColumnLayout{ | ||||
|     ColumnLayout { | ||||
|         anchors.margins: 10 | ||||
|         anchors.fill: parent | ||||
|         RowLayout{ | ||||
|             Label{text: qsTr("Name")} | ||||
|             TextField{ | ||||
|         RowLayout { | ||||
|             Label { | ||||
|                 text: qsTr("Name") | ||||
|             } | ||||
|             TextField { | ||||
|                 id: namefield | ||||
|                 Layout.fillWidth: true | ||||
|                 Component.onCompleted: forceActiveFocus() | ||||
|                 onAccepted: okbutton.clickAction() | ||||
|             } | ||||
|         } | ||||
|         RowLayout{ | ||||
|         RowLayout { | ||||
|             Layout.alignment: Qt.AlignBottom | Qt.AlignRight | ||||
|             Button{ | ||||
|             Button { | ||||
|                 id: okbutton | ||||
|                 text: qsTr("OK") | ||||
|                 onClicked: clickAction() | ||||
|                 function clickAction(){ | ||||
|                     var name = namefield.text; | ||||
|                     switch(validateName(name)){ | ||||
|                 function clickAction() { | ||||
|                     var name = namefield.text | ||||
|                     switch (validateName(name)) { | ||||
|                     case 1: | ||||
|                         errorDialog.showError(qsTr("The name you inserted is empty. Please choose a different one.")); | ||||
|                         break; | ||||
|                         errorDialog.showError( | ||||
|                                     qsTr("The name you inserted is empty. Please choose a different one.")) | ||||
|                         break | ||||
|                     default: | ||||
|                         nameSelected(name); | ||||
|                         close(); | ||||
|                         nameSelected(name) | ||||
|                         close() | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             Button{ | ||||
|             Button { | ||||
|                 text: qsTr("Cancel") | ||||
|                 onClicked: close() | ||||
|             } | ||||
|   | ||||
| @@ -1,3 +1,22 @@ | ||||
| /******************************************************************************* | ||||
| * 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 | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,7 +17,6 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.0 | ||||
| import QtQuick.Layouts 1.1 | ||||
| @@ -25,26 +24,26 @@ import QtQml 2.0 | ||||
|  | ||||
| import "Components" | ||||
|  | ||||
| ColumnLayout{ | ||||
|     GroupBox{ | ||||
| ColumnLayout { | ||||
|     GroupBox { | ||||
|         Layout.fillWidth: true | ||||
|         title: qsTr("Command") | ||||
|  | ||||
|         ColumnLayout { | ||||
|             anchors.fill: parent | ||||
|             CheckBox{ | ||||
|             CheckBox { | ||||
|                 id: useCustomCommand | ||||
|                 text: qsTr("Use custom command instead of shell at startup") | ||||
|                 checked: appSettings.useCustomCommand | ||||
|                 onCheckedChanged: appSettings.useCustomCommand = checked | ||||
|             } | ||||
|             // Workaround for QTBUG-31627 for pre 5.3.0 | ||||
|             Binding{ | ||||
|             Binding { | ||||
|                 target: useCustomCommand | ||||
|                 property: "checked" | ||||
|                 value: appSettings.useCustomCommand | ||||
|             } | ||||
|             TextField{ | ||||
|             TextField { | ||||
|                 id: customCommand | ||||
|                 Layout.fillWidth: true | ||||
|                 text: appSettings.customCommand | ||||
| @@ -53,89 +52,109 @@ ColumnLayout{ | ||||
|  | ||||
|                 // Save text even if user forgets to press enter or unfocus | ||||
|                 function saveSetting() { | ||||
|                     appSettings.customCommand = text; | ||||
|                     appSettings.customCommand = text | ||||
|                 } | ||||
|                 Component.onCompleted: settings_window.closing.connect(saveSetting) | ||||
|                 Component.onCompleted: settings_window.closing.connect( | ||||
|                                            saveSetting) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     GroupBox{ | ||||
|     GroupBox { | ||||
|         title: qsTr("Performance") | ||||
|         Layout.fillWidth: true | ||||
|         GridLayout{ | ||||
|         GridLayout { | ||||
|             anchors.fill: parent | ||||
|             columns: 4 | ||||
|  | ||||
|             Label{text: qsTr("Effects FPS")} | ||||
|             Slider{ | ||||
|             Label { | ||||
|                 text: qsTr("Effects FPS") | ||||
|             } | ||||
|             Slider { | ||||
|                 Layout.fillWidth: true | ||||
|                 Layout.columnSpan: 2 | ||||
|                 id: fpsSlider | ||||
|                 onValueChanged: { | ||||
|                     if (enabled) { | ||||
|                         appSettings.fps = value !== 60 ? value + 1 : 0; | ||||
|                         appSettings.fps = value !== 60 ? value + 1 : 0 | ||||
|                     } | ||||
|                 } | ||||
|                 stepSize: 1 | ||||
|                 enabled: false | ||||
|                 Component.onCompleted: { | ||||
|                     from = 0; | ||||
|                     to = 60; | ||||
|                     value = appSettings.fps !== 0 ? appSettings.fps - 1 : 60; | ||||
|                     enabled = true; | ||||
|                     from = 0 | ||||
|                     to = 60 | ||||
|                     value = appSettings.fps !== 0 ? appSettings.fps - 1 : 60 | ||||
|                     enabled = true | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Label{text: appSettings.fps !== 0 ? appSettings.fps : qsTr("Max")} | ||||
|             Label{text: qsTr("Texture Quality")} | ||||
|             Slider{ | ||||
|             Label { | ||||
|                 text: appSettings.fps !== 0 ? appSettings.fps : qsTr("Max") | ||||
|             } | ||||
|             Label { | ||||
|                 text: qsTr("Texture Quality") | ||||
|             } | ||||
|             Slider { | ||||
|                 id: txtslider | ||||
|                 Layout.fillWidth: true | ||||
|                 Layout.columnSpan: 2 | ||||
|                 onValueChanged: if (enabled) appSettings.windowScaling = value; | ||||
|                 onValueChanged: if (enabled) | ||||
|                                     appSettings.windowScaling = value | ||||
|                 stepSize: 0.05 | ||||
|                 enabled: false | ||||
|                 Component.onCompleted: { | ||||
|                     from = 0.25 //Without this value gets set to 0.5 | ||||
|                     value = appSettings.windowScaling; | ||||
|                     enabled = true; | ||||
|                     value = appSettings.windowScaling | ||||
|                     enabled = true | ||||
|                 } | ||||
|             } | ||||
|             Label{text: Math.round(txtslider.value * 100) + "%"} | ||||
|             Label { | ||||
|                 text: Math.round(txtslider.value * 100) + "%" | ||||
|             } | ||||
|  | ||||
|             Label{text: qsTr("Bloom Quality")} | ||||
|             Slider{ | ||||
|             Label { | ||||
|                 text: qsTr("Bloom Quality") | ||||
|             } | ||||
|             Slider { | ||||
|                 Layout.fillWidth: true | ||||
|                 Layout.columnSpan: 2 | ||||
|                 id: bloomSlider | ||||
|                 onValueChanged: if (enabled) appSettings.bloomQuality = value; | ||||
|                 onValueChanged: if (enabled) | ||||
|                                     appSettings.bloomQuality = value | ||||
|                 stepSize: 0.05 | ||||
|                 enabled: false | ||||
|                 Component.onCompleted: { | ||||
|                     from = 0.25 | ||||
|                     value = appSettings.bloomQuality; | ||||
|                     enabled = true; | ||||
|                     value = appSettings.bloomQuality | ||||
|                     enabled = true | ||||
|                 } | ||||
|             } | ||||
|             Label{text: Math.round(bloomSlider.value * 100) + "%"} | ||||
|             Label { | ||||
|                 text: Math.round(bloomSlider.value * 100) + "%" | ||||
|             } | ||||
|  | ||||
|             Label{text: qsTr("BurnIn Quality")} | ||||
|             Slider{ | ||||
|             Label { | ||||
|                 text: qsTr("BurnIn Quality") | ||||
|             } | ||||
|             Slider { | ||||
|                 Layout.fillWidth: true | ||||
|                 id: burnInSlider | ||||
|                 Layout.columnSpan: 2 | ||||
|                 onValueChanged: if (enabled) appSettings.burnInQuality = value; | ||||
|                 onValueChanged: if (enabled) | ||||
|                                     appSettings.burnInQuality = value | ||||
|                 stepSize: 0.05 | ||||
|                 enabled: false | ||||
|                 Component.onCompleted: { | ||||
|                     from = 0.25 | ||||
|                     value = appSettings.burnInQuality; | ||||
|                     enabled = true; | ||||
|                     value = appSettings.burnInQuality | ||||
|                     enabled = true | ||||
|                 } | ||||
|             } | ||||
|             Label{text: Math.round(burnInSlider.value * 100) + "%"} | ||||
|             CheckBox{ | ||||
|             Label { | ||||
|                 text: Math.round(burnInSlider.value * 100) + "%" | ||||
|             } | ||||
|             CheckBox { | ||||
|                 Layout.columnSpan: 2 | ||||
|                 text: qsTr("Burnin optimization (Might display timing artifacts)") | ||||
|                 checked: appSettings.useFastBurnIn | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,71 +17,70 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.0 | ||||
| import QtQuick.Layouts 1.1 | ||||
|  | ||||
| ColumnLayout{ | ||||
| ColumnLayout { | ||||
|     spacing: 2 | ||||
|  | ||||
|     GroupBox{ | ||||
|     GroupBox { | ||||
|         title: qsTr("Effects") | ||||
|         Layout.fillWidth: true | ||||
|  | ||||
|         ColumnLayout { | ||||
|             anchors.fill: parent | ||||
|  | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Bloom") | ||||
|                 onNewValue: appSettings.bloom = newValue | ||||
|                 value: appSettings.bloom | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("BurnIn") | ||||
|                 onNewValue: appSettings.burnIn = newValue | ||||
|                 value: appSettings.burnIn | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Static Noise") | ||||
|                 onNewValue: appSettings.staticNoise = newValue | ||||
|                 value: appSettings.staticNoise | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Jitter") | ||||
|                 onNewValue: appSettings.jitter = newValue | ||||
|                 value: appSettings.jitter | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Glow Line") | ||||
|                 onNewValue: appSettings.glowingLine = newValue; | ||||
|                 onNewValue: appSettings.glowingLine = newValue | ||||
|                 value: appSettings.glowingLine | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Screen Curvature") | ||||
|                 onNewValue: appSettings.screenCurvature = newValue; | ||||
|                 value: appSettings.screenCurvature; | ||||
|                 onNewValue: appSettings.screenCurvature = newValue | ||||
|                 value: appSettings.screenCurvature | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Ambient Light") | ||||
|                 onNewValue: appSettings.ambientLight = newValue; | ||||
|                 onNewValue: appSettings.ambientLight = newValue | ||||
|                 value: appSettings.ambientLight | ||||
|                 enabled: appSettings.framesIndex !== 0 | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Flickering") | ||||
|                 onNewValue: appSettings.flickering = newValue; | ||||
|                 value: appSettings.flickering; | ||||
|                 onNewValue: appSettings.flickering = newValue | ||||
|                 value: appSettings.flickering | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("Horizontal Sync") | ||||
|                 onNewValue: appSettings.horizontalSync = newValue; | ||||
|                 value: appSettings.horizontalSync; | ||||
|                 onNewValue: appSettings.horizontalSync = newValue | ||||
|                 value: appSettings.horizontalSync | ||||
|             } | ||||
|             CheckableSlider{ | ||||
|             CheckableSlider { | ||||
|                 name: qsTr("RGB Shift") | ||||
|                 onNewValue: appSettings.rbgShift = newValue; | ||||
|                 value: appSettings.rbgShift; | ||||
|                 onNewValue: appSettings.rbgShift = newValue | ||||
|                 value: appSettings.rbgShift | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,14 +17,13 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.4 | ||||
| import QtQuick.Layouts 1.1 | ||||
| import QtQuick.Dialogs 1.1 | ||||
|  | ||||
| ColumnLayout{ | ||||
|     GroupBox{ | ||||
| ColumnLayout { | ||||
|     GroupBox { | ||||
|         Layout.fillWidth: true | ||||
|         title: qsTr("Profile") | ||||
|         RowLayout { | ||||
| @@ -52,112 +51,127 @@ ColumnLayout{ | ||||
|             ColumnLayout { | ||||
|                 Layout.fillHeight: true | ||||
|                 Layout.fillWidth: false | ||||
|                 Button{ | ||||
|                 Button { | ||||
|                     Layout.fillWidth: true | ||||
|                     text: qsTr("Save") | ||||
|                     onClicked: { | ||||
|                         insertname.profileName = ""; | ||||
|                         insertname.profileName = "" | ||||
|                         insertname.show() | ||||
|                     } | ||||
|                 } | ||||
|                 Button{ | ||||
|                 Button { | ||||
|                     Layout.fillWidth: true | ||||
|                     property alias currentIndex: profilesView.currentIndex | ||||
|                     enabled: currentIndex >= 0 | ||||
|                     text: qsTr("Load") | ||||
|                     onClicked: { | ||||
|                         var index = currentIndex; | ||||
|                         var index = currentIndex | ||||
|                         if (index >= 0) | ||||
|                             appSettings.loadProfile(index); | ||||
|                             appSettings.loadProfile(index) | ||||
|                     } | ||||
|                 } | ||||
|                 Button{ | ||||
|                 Button { | ||||
|                     Layout.fillWidth: true | ||||
|                     text: qsTr("Remove") | ||||
|                     property alias currentIndex: profilesView.currentIndex | ||||
|  | ||||
|                     enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin | ||||
|                     enabled: currentIndex >= 0 && !appSettings.profilesList.get( | ||||
|                                  currentIndex).builtin | ||||
|                     onClicked: { | ||||
|                         appSettings.profilesList.remove(currentIndex); | ||||
|                         profilesView.selection.clear(); | ||||
|                         appSettings.profilesList.remove(currentIndex) | ||||
|                         profilesView.selection.clear() | ||||
|  | ||||
|                         // TODO This is a very ugly workaround. The view didn't update on Qt 5.3.2. | ||||
|                         profilesView.model = 0; | ||||
|                         profilesView.model = appSettings.profilesList; | ||||
|                         profilesView.model = 0 | ||||
|                         profilesView.model = appSettings.profilesList | ||||
|                     } | ||||
|                 } | ||||
|                 Item { | ||||
|                     // Spacing | ||||
|                     Layout.fillHeight: true | ||||
|                 } | ||||
|                 Button{ | ||||
|                 Button { | ||||
|                     Layout.fillWidth: true | ||||
|                     text: qsTr("Import") | ||||
|                     onClicked: { | ||||
|                         fileDialog.selectExisting = true; | ||||
|                         fileDialog.callBack = function (url) {loadFile(url);}; | ||||
|                         fileDialog.open(); | ||||
|                         fileDialog.selectExisting = true | ||||
|                         fileDialog.callBack = function (url) { | ||||
|                             loadFile(url) | ||||
|                         } | ||||
|                         fileDialog.open() | ||||
|                     } | ||||
|                     function loadFile(url) { | ||||
|                         try { | ||||
|                             if (appSettings.verbose) | ||||
|                                 console.log("Loading file: " + url); | ||||
|                                 console.log("Loading file: " + url) | ||||
|  | ||||
|                             var profileObject = JSON.parse(fileIO.read(url)); | ||||
|                             var name = profileObject.name; | ||||
|                             var profileObject = JSON.parse(fileIO.read(url)) | ||||
|                             var name = profileObject.name | ||||
|  | ||||
|                             if (!name) | ||||
|                                 throw "Profile doesn't have a name"; | ||||
|                                 throw "Profile doesn't have a name" | ||||
|  | ||||
|                             var version = profileObject.version !== undefined ? profileObject.version : 1; | ||||
|                             var version = profileObject.version | ||||
|                                     !== undefined ? profileObject.version : 1 | ||||
|                             if (version !== appSettings.profileVersion) | ||||
|                                 throw "This profile is not supported on this version of CRT."; | ||||
|                                 throw "This profile is not supported on this version of CRT." | ||||
|  | ||||
|                             delete profileObject.name; | ||||
|                             delete profileObject.name | ||||
|  | ||||
|                             appSettings.appendCustomProfile(name, JSON.stringify(profileObject)); | ||||
|                             appSettings.appendCustomProfile(name, | ||||
|                                                             JSON.stringify( | ||||
|                                                                 profileObject)) | ||||
|                         } catch (err) { | ||||
|                             messageDialog.text = qsTr(err) | ||||
|                             messageDialog.open(); | ||||
|                             messageDialog.open() | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 Button{ | ||||
|                 Button { | ||||
|                     property alias currentIndex: profilesView.currentIndex | ||||
|  | ||||
|                     Layout.fillWidth: true | ||||
|  | ||||
|                     text: qsTr("Export") | ||||
|                     enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin | ||||
|                     enabled: currentIndex >= 0 && !appSettings.profilesList.get( | ||||
|                                  currentIndex).builtin | ||||
|                     onClicked: { | ||||
|                         fileDialog.selectExisting = false; | ||||
|                         fileDialog.callBack = function (url) {storeFile(url);}; | ||||
|                         fileDialog.open(); | ||||
|                         fileDialog.selectExisting = false | ||||
|                         fileDialog.callBack = function (url) { | ||||
|                             storeFile(url) | ||||
|                         } | ||||
|                         fileDialog.open() | ||||
|                     } | ||||
|                     function storeFile(url) { | ||||
|                         try { | ||||
|                             var urlString = url.toString(); | ||||
|                             var urlString = url.toString() | ||||
|  | ||||
|                             // Fix the extension if it's missing. | ||||
|                             var extension = urlString.substring(urlString.length - 5, urlString.length); | ||||
|                             var urlTail = (extension === ".json" ? "" : ".json"); | ||||
|                             url += urlTail; | ||||
|                             var extension = urlString.substring( | ||||
|                                         urlString.length - 5, urlString.length) | ||||
|                             var urlTail = (extension === ".json" ? "" : ".json") | ||||
|                             url += urlTail | ||||
|  | ||||
|                             if (true) | ||||
|                                 console.log("Storing file: " + url); | ||||
|                                 console.log("Storing file: " + url) | ||||
|  | ||||
|                             var profileObject = appSettings.profilesList.get(currentIndex); | ||||
|                             var profileSettings = JSON.parse(profileObject.obj_string); | ||||
|                             profileSettings["name"] = profileObject.text; | ||||
|                             profileSettings["version"] = appSettings.profileVersion; | ||||
|                             var profileObject = appSettings.profilesList.get( | ||||
|                                         currentIndex) | ||||
|                             var profileSettings = JSON.parse( | ||||
|                                         profileObject.obj_string) | ||||
|                             profileSettings["name"] = profileObject.text | ||||
|                             profileSettings["version"] = appSettings.profileVersion | ||||
|  | ||||
|                             var result = fileIO.write(url, JSON.stringify(profileSettings, undefined, 2)); | ||||
|                             var result = fileIO.write(url, JSON.stringify( | ||||
|                                                           profileSettings, | ||||
|                                                           undefined, 2)) | ||||
|                             if (!result) | ||||
|                                 throw "The file could not be written."; | ||||
|                                 throw "The file could not be written." | ||||
|                         } catch (err) { | ||||
|                             console.log(err); | ||||
|                             messageDialog.text = qsTr("There has been an error storing the file.") | ||||
|                             messageDialog.open(); | ||||
|                             console.log(err) | ||||
|                             messageDialog.text = qsTr( | ||||
|                                         "There has been an error storing the file.") | ||||
|                             messageDialog.open() | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
| @@ -165,29 +179,37 @@ ColumnLayout{ | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     GroupBox{ | ||||
|     GroupBox { | ||||
|         title: qsTr("Screen") | ||||
|         Layout.fillWidth: true | ||||
|         GridLayout{ | ||||
|         GridLayout { | ||||
|             anchors.fill: parent | ||||
|             columns: 2 | ||||
|             Label{ text: qsTr("Brightness") } | ||||
|             SimpleSlider{ | ||||
|             Label { | ||||
|                 text: qsTr("Brightness") | ||||
|             } | ||||
|             SimpleSlider { | ||||
|                 onValueChanged: appSettings.brightness = value | ||||
|                 value: appSettings.brightness | ||||
|             } | ||||
|             Label{ text: qsTr("Contrast") } | ||||
|             SimpleSlider{ | ||||
|             Label { | ||||
|                 text: qsTr("Contrast") | ||||
|             } | ||||
|             SimpleSlider { | ||||
|                 onValueChanged: appSettings.contrast = value | ||||
|                 value: appSettings.contrast | ||||
|             } | ||||
|             Label{ text: qsTr("Margin") } | ||||
|             SimpleSlider{ | ||||
|             Label { | ||||
|                 text: qsTr("Margin") | ||||
|             } | ||||
|             SimpleSlider { | ||||
|                 onValueChanged: appSettings._margin = value | ||||
|                 value: appSettings._margin | ||||
|             } | ||||
|             Label{ text: qsTr("Opacity") } | ||||
|             SimpleSlider{ | ||||
|             Label { | ||||
|                 text: qsTr("Opacity") | ||||
|             } | ||||
|             SimpleSlider { | ||||
|                 onValueChanged: appSettings.windowOpacity = value | ||||
|                 value: appSettings.windowOpacity | ||||
|             } | ||||
| @@ -195,17 +217,18 @@ ColumnLayout{ | ||||
|     } | ||||
|  | ||||
|     // DIALOGS //////////////////////////////////////////////////////////////// | ||||
|     InsertNameDialog{ | ||||
|     InsertNameDialog { | ||||
|         id: insertname | ||||
|         onNameSelected: { | ||||
|             appSettings.appendCustomProfile(name, appSettings.composeProfileString()); | ||||
|             appSettings.appendCustomProfile(name, | ||||
|                                             appSettings.composeProfileString()) | ||||
|         } | ||||
|     } | ||||
|     MessageDialog { | ||||
|         id: messageDialog | ||||
|         title: qsTr("File Error") | ||||
|         onAccepted: { | ||||
|             messageDialog.close(); | ||||
|             messageDialog.close() | ||||
|         } | ||||
|     } | ||||
|     Loader { | ||||
| @@ -213,23 +236,23 @@ ColumnLayout{ | ||||
|         property bool selectExisting: false | ||||
|         id: fileDialog | ||||
|  | ||||
|         sourceComponent: FileDialog{ | ||||
|         sourceComponent: FileDialog { | ||||
|             nameFilters: ["Json files (*.json)"] | ||||
|             selectMultiple: false | ||||
|             selectFolder: false | ||||
|             selectExisting: fileDialog.selectExisting | ||||
|             onAccepted: callBack(fileUrl); | ||||
|             onAccepted: callBack(fileUrl) | ||||
|         } | ||||
|  | ||||
|         onSelectExistingChanged: reload() | ||||
|  | ||||
|         function open() { | ||||
|             item.open(); | ||||
|             item.open() | ||||
|         } | ||||
|  | ||||
|         function reload() { | ||||
|             active = false; | ||||
|             active = true; | ||||
|             active = false | ||||
|             active = true | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,7 +17,6 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.1 | ||||
| import QtQuick.Layouts 1.1 | ||||
| @@ -25,15 +24,17 @@ import QtQml 2.0 | ||||
|  | ||||
| import "Components" | ||||
|  | ||||
| ColumnLayout{ | ||||
| ColumnLayout { | ||||
|  | ||||
|     GroupBox{ | ||||
|     GroupBox { | ||||
|         title: qsTr("Font") | ||||
|         Layout.fillWidth: true | ||||
|         GridLayout{ | ||||
|         GridLayout { | ||||
|             anchors.fill: parent | ||||
|             columns: 2 | ||||
|             Label { text: qsTr("Rasterization") } | ||||
|             Label { | ||||
|                 text: qsTr("Rasterization") | ||||
|             } | ||||
|             ComboBox { | ||||
|                 id: rasterizationBox | ||||
|  | ||||
| @@ -46,114 +47,120 @@ ColumnLayout{ | ||||
|                     appSettings.rasterization = currentIndex | ||||
|                 } | ||||
|             } | ||||
|             Label{ text: qsTr("Name") } | ||||
|             ComboBox{ | ||||
|             Label { | ||||
|                 text: qsTr("Name") | ||||
|             } | ||||
|             ComboBox { | ||||
|                 id: fontChanger | ||||
|                 Layout.fillWidth: true | ||||
|                 model: appSettings.fontlist | ||||
|                 textRole: "text" | ||||
|                 onActivated: { | ||||
|                     var name = appSettings.fontlist.get(index).name; | ||||
|                     appSettings.fontNames[appSettings.rasterization] = name; | ||||
|                     appSettings.handleFontChanged(); | ||||
|                     var name = appSettings.fontlist.get(index).name | ||||
|                     appSettings.fontNames[appSettings.rasterization] = name | ||||
|                     appSettings.handleFontChanged() | ||||
|                 } | ||||
|                 function updateIndex(){ | ||||
|                     var name = appSettings.fontNames[appSettings.rasterization]; | ||||
|                     var index = appSettings.getIndexByName(name); | ||||
|                 function updateIndex() { | ||||
|                     var name = appSettings.fontNames[appSettings.rasterization] | ||||
|                     var index = appSettings.getIndexByName(name) | ||||
|                     if (index !== undefined) | ||||
|                         currentIndex = index; | ||||
|                         currentIndex = index | ||||
|                 } | ||||
|                 Connections{ | ||||
|                 Connections { | ||||
|                     target: appSettings | ||||
|                     onTerminalFontChanged: fontChanger.updateIndex(); | ||||
|                     onTerminalFontChanged: fontChanger.updateIndex() | ||||
|                 } | ||||
|                 Component.onCompleted: updateIndex(); | ||||
|                 Component.onCompleted: updateIndex() | ||||
|             } | ||||
|             Label{ text: qsTr("Scaling") } | ||||
|             RowLayout{ | ||||
|             Label { | ||||
|                 text: qsTr("Scaling") | ||||
|             } | ||||
|             RowLayout { | ||||
|                 Layout.fillWidth: true | ||||
|                 Slider{ | ||||
|                 Slider { | ||||
|                     Layout.fillWidth: true | ||||
|                     id: fontScalingChanger | ||||
|                     onValueChanged: appSettings.fontScaling = value | ||||
|                     value: appSettings.fontScaling | ||||
|                     stepSize: 0.05 | ||||
|                     from: appSettings.minimumFontScaling; | ||||
|                     to: appSettings.maximumFontScaling; | ||||
|                     from: appSettings.minimumFontScaling | ||||
|                     to: appSettings.maximumFontScaling | ||||
|                 } | ||||
|                 SizedLabel{ | ||||
|                 SizedLabel { | ||||
|                     text: Math.round(fontScalingChanger.value * 100) + "%" | ||||
|                 } | ||||
|             } | ||||
|             Label{ text: qsTr("Font Width") } | ||||
|             RowLayout{ | ||||
|             Label { | ||||
|                 text: qsTr("Font Width") | ||||
|             } | ||||
|             RowLayout { | ||||
|                 Layout.fillWidth: true | ||||
|                 Slider{ | ||||
|                 Slider { | ||||
|                     Layout.fillWidth: true | ||||
|                     id: widthChanger | ||||
|                     onValueChanged: appSettings.fontWidth = value; | ||||
|                     onValueChanged: appSettings.fontWidth = value | ||||
|                     value: appSettings.fontWidth | ||||
|                     stepSize: 0.05 | ||||
|                     from: 0.5 | ||||
|                     to: 1.5 | ||||
|                 } | ||||
|                 SizedLabel{ | ||||
|                 SizedLabel { | ||||
|                     text: Math.round(widthChanger.value * 100) + "%" | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     GroupBox{ | ||||
|     GroupBox { | ||||
|         title: qsTr("Cursor") | ||||
|         Layout.fillWidth: true | ||||
|         ColumnLayout { | ||||
|             anchors.fill: parent | ||||
|             CheckBox{ | ||||
|             CheckBox { | ||||
|                 id: blinkingCursor | ||||
|                 text: qsTr("Blinking Cursor") | ||||
|                 checked: appSettings.blinkingCursor | ||||
|                 onCheckedChanged: appSettings.blinkingCursor = checked | ||||
|             } | ||||
|             Binding{ | ||||
|             Binding { | ||||
|                 target: blinkingCursor | ||||
|                 property: "checked" | ||||
|                 value: appSettings.blinkingCursor | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     GroupBox{ | ||||
|     GroupBox { | ||||
|         title: qsTr("Colors") | ||||
|         Layout.fillWidth: true | ||||
|         ColumnLayout{ | ||||
|         ColumnLayout { | ||||
|             anchors.fill: parent | ||||
|             ColumnLayout{ | ||||
|             ColumnLayout { | ||||
|                 Layout.fillWidth: true | ||||
|                 CheckableSlider{ | ||||
|                 CheckableSlider { | ||||
|                     name: qsTr("Chroma Color") | ||||
|                     onNewValue: appSettings.chromaColor = newValue | ||||
|                     value: appSettings.chromaColor | ||||
|                 } | ||||
|                 CheckableSlider{ | ||||
|                 CheckableSlider { | ||||
|                     name: qsTr("Saturation Color") | ||||
|                     onNewValue: appSettings.saturationColor = newValue | ||||
|                     value: appSettings.saturationColor | ||||
|                     enabled: appSettings.chromaColor !== 0 | ||||
|                 } | ||||
|             } | ||||
|             RowLayout{ | ||||
|             RowLayout { | ||||
|                 Layout.fillWidth: true | ||||
|                 ColorButton{ | ||||
|                 ColorButton { | ||||
|                     name: qsTr("Font") | ||||
|                     height: 50 | ||||
|                     Layout.fillWidth: true | ||||
|                     onColorSelected: appSettings._fontColor = color; | ||||
|                     onColorSelected: appSettings._fontColor = color | ||||
|                     color: appSettings._fontColor | ||||
|                 } | ||||
|                 ColorButton{ | ||||
|                 ColorButton { | ||||
|                     name: qsTr("Background") | ||||
|                     height: 50 | ||||
|                     Layout.fillWidth: true | ||||
|                     onColorSelected: appSettings._backgroundColor = color; | ||||
|                     onColorSelected: appSettings._backgroundColor = color | ||||
|                     color: appSettings._backgroundColor | ||||
|                 } | ||||
|             } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -86,7 +86,7 @@ Item { | ||||
|          blending: false | ||||
|  | ||||
|          //Smooth random texture used for flickering effect. | ||||
|          Image{ | ||||
|          Image { | ||||
|              id: noiseTexture | ||||
|              source: "images/allNoise512.png" | ||||
|              width: 512 | ||||
| @@ -94,7 +94,7 @@ Item { | ||||
|              fillMode: Image.Tile | ||||
|              visible: false | ||||
|          } | ||||
|          ShaderEffectSource{ | ||||
|          ShaderEffectSource { | ||||
|              id: noiseShaderSource | ||||
|              sourceItem: noiseTexture | ||||
|              wrapMode: ShaderEffectSource.Repeat | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,7 +17,6 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.0 | ||||
| import QtQuick.Layouts 1.1 | ||||
| @@ -33,12 +32,12 @@ RowLayout { | ||||
|  | ||||
|     id: setting_component | ||||
|     spacing: 10 | ||||
|     Slider{ | ||||
|     Slider { | ||||
|         id: slider | ||||
|         stepSize: parent.stepSize | ||||
|         Layout.fillWidth: true | ||||
|     } | ||||
|     SizedLabel{ | ||||
|     SizedLabel { | ||||
|         text: Math.round(value * maxMultiplier) + "%" | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,12 +17,12 @@ | ||||
| * 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 | ||||
|  | ||||
| Rectangle{ | ||||
| Rectangle { | ||||
|     property size terminalSize | ||||
|     property real topOpacity: 0.6 | ||||
|  | ||||
|     width: textSize.width * 2 | ||||
|     height: textSize.height * 2 | ||||
|     radius: 5 | ||||
| @@ -31,17 +31,21 @@ Rectangle{ | ||||
|     color: "black" | ||||
|     opacity: sizetimer.running ? 0.6 : 0.0 | ||||
|  | ||||
|     Behavior on opacity{NumberAnimation{duration: 200}} | ||||
|     Behavior on opacity { | ||||
|         NumberAnimation { | ||||
|             duration: 200 | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     onTerminalSizeChanged: sizetimer.restart() | ||||
|  | ||||
|     Text{ | ||||
|     Text { | ||||
|         id: textSize | ||||
|         anchors.centerIn: parent | ||||
|         color: "white" | ||||
|         text: terminalSize.width + "x" + terminalSize.height | ||||
|     } | ||||
|     Timer{ | ||||
|     Timer { | ||||
|         id: sizetimer | ||||
|         interval: 1000 | ||||
|         running: false | ||||
|   | ||||
| @@ -1,3 +1,23 @@ | ||||
| /******************************************************************************* | ||||
| * 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 | ||||
| @@ -6,12 +26,10 @@ 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 { | ||||
| @@ -48,7 +66,7 @@ Loader { | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Timer{ | ||||
|             Timer { | ||||
|                 id: livetimer | ||||
|  | ||||
|                 // The interval assumes 60 fps. This is the time needed burnout a white pixel. | ||||
| @@ -59,7 +77,7 @@ Loader { | ||||
|                 running: true | ||||
|                 onTriggered: burnInSourceEffect.updateBurnIn = false; | ||||
|             } | ||||
|             Connections{ | ||||
|             Connections { | ||||
|                 target: kterminal | ||||
|                 onImagePainted:{ | ||||
|                     burnInSourceEffect.scheduleUpdate(); | ||||
| @@ -68,7 +86,7 @@ Loader { | ||||
|                 } | ||||
|             } | ||||
|             // Restart blurred source settings change. | ||||
|             Connections{ | ||||
|             Connections { | ||||
|                 target: appSettings | ||||
|                 onBurnInChanged: burnInSourceEffect.restartBlurSource(); | ||||
|                 onTerminalFontChanged: burnInSourceEffect.restartBlurSource(); | ||||
| @@ -92,28 +110,28 @@ Loader { | ||||
|  | ||||
|                 fragmentShader: | ||||
|                     "#ifdef GL_ES | ||||
|                     precision mediump float; | ||||
|                 #endif\n" + | ||||
|                         precision mediump float; | ||||
|                     #endif\n" + | ||||
|  | ||||
|                 "uniform lowp float qt_Opacity;" + | ||||
|                 "uniform lowp sampler2D txt_source;" + | ||||
|                     "uniform lowp float qt_Opacity;" + | ||||
|                     "uniform lowp sampler2D txt_source;" + | ||||
|  | ||||
|                 "varying highp vec2 qt_TexCoord0; | ||||
|              uniform lowp sampler2D blurredSource; | ||||
|              uniform highp float burnInCoefficient;" + | ||||
|                     "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); | ||||
|                 }" + | ||||
|                     "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));" + | ||||
|                     "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));" + | ||||
|                 "}" | ||||
|                         "gl_FragColor = vec4(color, max3(color - origColor));" + | ||||
|                     "}" | ||||
|  | ||||
|                 onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
|             } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -27,7 +27,7 @@ QtObject { | ||||
|     property bool initialized: false | ||||
|  | ||||
|     function getDatabase() { | ||||
|          return LocalStorage.openDatabaseSync("coolretroterm" + dbMajorVersion, dbMinorVersion, "StorageDatabase", 100000); | ||||
|          return LocalStorage.openDatabaseSync("coolretroterm" + dbMajorVersion, dbMinorVersion, "StorageDatabase", 100000) | ||||
|     } | ||||
|  | ||||
|     function initialize() { | ||||
| @@ -35,43 +35,47 @@ QtObject { | ||||
|         db.transaction( | ||||
|             function(tx) { | ||||
|                 tx.executeSql('CREATE TABLE IF NOT EXISTS settings(setting TEXT UNIQUE, value TEXT)'); | ||||
|           }); | ||||
|             } | ||||
|         ) | ||||
|  | ||||
|         initialized = true; | ||||
|         initialized = true | ||||
|     } | ||||
|  | ||||
|     function setSetting(setting, value) { | ||||
|        if(!initialized) initialize(); | ||||
|         if(!initialized) initialize(); | ||||
|  | ||||
|        var db = getDatabase(); | ||||
|        var res = ""; | ||||
|        db.transaction(function(tx) { | ||||
|             var rs = tx.executeSql('INSERT OR REPLACE INTO settings VALUES (?,?);', [setting,value]); | ||||
|                   //console.log(rs.rowsAffected) | ||||
|                   if (rs.rowsAffected > 0) { | ||||
|         var db = getDatabase(); | ||||
|         var res = ""; | ||||
|         db.transaction( | ||||
|             function(tx) { | ||||
|                 var rs = tx.executeSql('INSERT OR REPLACE INTO settings VALUES (?,?);', [setting,value]); | ||||
|                 //console.log(rs.rowsAffected) | ||||
|                 if (rs.rowsAffected > 0) { | ||||
|                     res = "OK"; | ||||
|                   } else { | ||||
|                 } else { | ||||
|                     res = "Error"; | ||||
|                   } | ||||
|             } | ||||
|       ); | ||||
|                 } | ||||
|            } | ||||
|       ) | ||||
|       // The function returns “OK” if it was successful, or “Error” if it wasn't | ||||
|       return res; | ||||
|       return res | ||||
|     } | ||||
|  | ||||
|     function getSetting(setting) { | ||||
|        if(!initialized) initialize(); | ||||
|        var db = getDatabase(); | ||||
|        var res=""; | ||||
|        db.transaction(function(tx) { | ||||
|          var rs = tx.executeSql('SELECT value FROM settings WHERE setting=?;', [setting]); | ||||
|          if (rs.rows.length > 0) { | ||||
|               res = rs.rows.item(0).value; | ||||
|          } else { | ||||
|              res = undefined; | ||||
|          } | ||||
|       }) | ||||
|       return res | ||||
|         if(!initialized) initialize(); | ||||
|         var db = getDatabase(); | ||||
|         var res = ""; | ||||
|         db.transaction( | ||||
|             function(tx) { | ||||
|                 var rs = tx.executeSql('SELECT value FROM settings WHERE setting=?;', [setting]); | ||||
|                 if (rs.rows.length > 0) { | ||||
|                 res = rs.rows.item(0).value; | ||||
|                 } else { | ||||
|                 res = undefined; | ||||
|                 } | ||||
|             } | ||||
|         ) | ||||
|         return res | ||||
|     } | ||||
|  | ||||
|     function dropSettings(){ | ||||
| @@ -79,6 +83,7 @@ QtObject { | ||||
|         db.transaction( | ||||
|             function(tx) { | ||||
|                 tx.executeSql('DROP TABLE settings'); | ||||
|           }); | ||||
|             } | ||||
|         ) | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,3 +1,22 @@ | ||||
| /******************************************************************************* | ||||
| * 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 | ||||
| import QtGraphicalEffects 1.0 | ||||
|  | ||||
| @@ -15,36 +34,35 @@ ShaderTerminal { | ||||
|     slowBurnInEffect: terminal.slowBurnInEffect | ||||
|     virtual_resolution: terminal.virtualResolution | ||||
|  | ||||
|     TimeManager{ | ||||
|     TimeManager { | ||||
|         id: timeManager | ||||
|         enableTimer: terminalWindow.visible | ||||
|     } | ||||
|  | ||||
|     PreprocessedTerminal{ | ||||
|     PreprocessedTerminal { | ||||
|         id: terminal | ||||
|         anchors.fill: parent | ||||
|     } | ||||
|  | ||||
|     //  EFFECTS  //////////////////////////////////////////////////////////////// | ||||
|  | ||||
|     Loader{ | ||||
|     Loader { | ||||
|         id: bloomEffectLoader | ||||
|         active: appSettings.bloom | ||||
|         asynchronous: true | ||||
|         width: parent.width * appSettings.bloomQuality | ||||
|         height: parent.height * appSettings.bloomQuality | ||||
|  | ||||
|         sourceComponent: FastBlur{ | ||||
|             radius: Utils.lint(16, 64, appSettings.bloomQuality); | ||||
|         sourceComponent: FastBlur { | ||||
|             radius: Utils.lint(16, 64, appSettings.bloomQuality) | ||||
|             source: terminal.mainSource | ||||
|             transparentBorder: true | ||||
|         } | ||||
|     } | ||||
|     Loader{ | ||||
|     Loader { | ||||
|         id: bloomSourceLoader | ||||
|         active: appSettings.bloom !== 0 | ||||
|         asynchronous: true | ||||
|         sourceComponent: ShaderEffectSource{ | ||||
|         sourceComponent: ShaderEffectSource { | ||||
|             id: _bloomEffectSource | ||||
|             sourceItem: bloomEffectLoader.item | ||||
|             hideSource: true | ||||
| @@ -54,71 +72,4 @@ ShaderTerminal { | ||||
|     } | ||||
|  | ||||
|     bloomSource: bloomSourceLoader.item | ||||
|  | ||||
| //    NewTerminalFrame { | ||||
| //        id: terminalFrame | ||||
| //        anchors.fill: parent | ||||
| //        blending: true | ||||
| //    } | ||||
|  | ||||
|     // This shader might be useful in the future. Since we used it only for a couple | ||||
|     // of calculations is probably best to move those in the main shader. If in the future | ||||
|     // we need to store another fullScreen channel this might be handy. | ||||
|  | ||||
| //    ShaderEffect { | ||||
| //        id: rasterizationEffect | ||||
| //        width: parent.width | ||||
| //        height: parent.height | ||||
| //        property real outColor: 0.0 | ||||
| //        property real dispX: (5 / width) * appSettings.windowScaling | ||||
| //        property real dispY: (5 / height) * appSettings.windowScaling | ||||
| //        property size virtual_resolution: terminal.virtualResolution | ||||
|  | ||||
| //        blending: false | ||||
|  | ||||
| //        fragmentShader: | ||||
| //            "uniform lowp float qt_Opacity;" + | ||||
|  | ||||
| //            "varying highp vec2 qt_TexCoord0; | ||||
| //             uniform highp vec2 virtual_resolution; | ||||
| //             uniform highp float dispX; | ||||
| //             uniform highp float dispY; | ||||
| //             uniform mediump float outColor; | ||||
|  | ||||
| //             highp float getScanlineIntensity(vec2 coords) { | ||||
| //                 highp float result = 1.0;" + | ||||
|  | ||||
| //                (appSettings.rasterization != appSettings.no_rasterization ? | ||||
| //                    "result *= abs(sin(coords.y * virtual_resolution.y * "+Math.PI+"));" : "") + | ||||
| //                (appSettings.rasterization == appSettings.pixel_rasterization ? | ||||
| //                    "result *= abs(sin(coords.x * virtual_resolution.x * "+Math.PI+"));" : "") + " | ||||
|  | ||||
| //                return result; | ||||
| //             }" + | ||||
|  | ||||
| //            "void main() {" + | ||||
| //                "highp float color = getScanlineIntensity(qt_TexCoord0);" + | ||||
|  | ||||
| //                "float distance = length(vec2(0.5) - qt_TexCoord0);" + | ||||
| //                "color = mix(color, 0.0, 1.2 * distance * distance);" + | ||||
|  | ||||
| //                "color *= outColor + smoothstep(0.00, dispX, qt_TexCoord0.x) * (1.0 - outColor);" + | ||||
| //                "color *= outColor + smoothstep(0.00, dispY, qt_TexCoord0.y) * (1.0 - outColor);" + | ||||
| //                "color *= outColor + (1.0 - smoothstep(1.00 - dispX, 1.00, qt_TexCoord0.x)) * (1.0 - outColor);" + | ||||
| //                "color *= outColor + (1.0 - smoothstep(1.00 - dispY, 1.00, qt_TexCoord0.y)) * (1.0 - outColor);" + | ||||
|  | ||||
| //                "gl_FragColor.a = color;" + | ||||
| //            "}" | ||||
|  | ||||
| //        onStatusChanged: if (log) console.log(log) //Print warning messages | ||||
| //    } | ||||
|  | ||||
| //    rasterizationSource: ShaderEffectSource{ | ||||
| //        id: rasterizationEffectSource | ||||
| //        sourceItem: rasterizationEffect | ||||
| //        hideSource: true | ||||
| //        smooth: true | ||||
| //        wrapMode: ShaderEffectSource.ClampToEdge | ||||
| //        visible: false | ||||
| //    } | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,10 +17,9 @@ | ||||
| * 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 | ||||
|  | ||||
| Timer{ | ||||
| Timer { | ||||
|     default property bool enableTimer: false | ||||
|     property real time | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| /******************************************************************************* | ||||
| * Copyright (c) 2013 "Filippo Scognamiglio" | ||||
| * Copyright (c) 2013-2021 "Filippo Scognamiglio" | ||||
| * https://github.com/Swordfish90/cool-retro-term | ||||
| * | ||||
| * This file is part of cool-retro-term. | ||||
| @@ -17,14 +17,13 @@ | ||||
| * 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 | ||||
| import QtQuick.Window 2.1 | ||||
| import QtQuick.Controls 2.3 | ||||
|  | ||||
| import "menus" | ||||
|  | ||||
| ApplicationWindow{ | ||||
| ApplicationWindow { | ||||
|     id: terminalWindow | ||||
|  | ||||
|     width: 1024 | ||||
| @@ -37,7 +36,7 @@ ApplicationWindow{ | ||||
|     onHeightChanged: appSettings.height = height | ||||
|  | ||||
|     // Load saved window geometry and show the window | ||||
|     Component.onCompleted: {         | ||||
|     Component.onCompleted: { | ||||
|         x = appSettings.x | ||||
|         y = appSettings.y | ||||
|         width = appSettings.width | ||||
| @@ -78,7 +77,7 @@ ApplicationWindow{ | ||||
|         text: qsTr("Fullscreen") | ||||
|         enabled: Qt.platform.os !== "osx" | ||||
|         shortcut: "Alt+F11" | ||||
|         onTriggered: appSettings.fullscreen = !appSettings.fullscreen; | ||||
|         onTriggered: appSettings.fullscreen = !appSettings.fullscreen | ||||
|         checkable: true | ||||
|         checked: appSettings.fullscreen | ||||
|     } | ||||
| @@ -86,68 +85,68 @@ ApplicationWindow{ | ||||
|         id: quitAction | ||||
|         text: qsTr("Quit") | ||||
|         shortcut: "Ctrl+Shift+Q" | ||||
|         onTriggered: Qt.quit(); | ||||
|         onTriggered: Qt.quit() | ||||
|     } | ||||
|     Action{ | ||||
|     Action { | ||||
|         id: showsettingsAction | ||||
|         text: qsTr("Settings") | ||||
|         onTriggered: { | ||||
|             settingswindow.show(); | ||||
|             settingswindow.requestActivate(); | ||||
|             settingswindow.raise(); | ||||
|             settingswindow.show() | ||||
|             settingswindow.requestActivate() | ||||
|             settingswindow.raise() | ||||
|         } | ||||
|     } | ||||
|     Action{ | ||||
|     Action { | ||||
|         id: copyAction | ||||
|         text: qsTr("Copy") | ||||
|         shortcut: "Ctrl+Shift+C" | ||||
|     } | ||||
|     Action{ | ||||
|     Action { | ||||
|         id: pasteAction | ||||
|         text: qsTr("Paste") | ||||
|         shortcut: "Ctrl+Shift+V" | ||||
|     } | ||||
|     Action{ | ||||
|     Action { | ||||
|         id: zoomIn | ||||
|         text: qsTr("Zoom In") | ||||
|         shortcut: "Ctrl++" | ||||
|         onTriggered: appSettings.incrementScaling(); | ||||
|         onTriggered: appSettings.incrementScaling() | ||||
|     } | ||||
|     Action{ | ||||
|     Action { | ||||
|         id: zoomOut | ||||
|         text: qsTr("Zoom Out") | ||||
|         shortcut: "Ctrl+-" | ||||
|         onTriggered: appSettings.decrementScaling(); | ||||
|         onTriggered: appSettings.decrementScaling() | ||||
|     } | ||||
|     Action{ | ||||
|     Action { | ||||
|         id: showAboutAction | ||||
|         text: qsTr("About") | ||||
|         onTriggered: { | ||||
|             aboutDialog.show(); | ||||
|             aboutDialog.requestActivate(); | ||||
|             aboutDialog.raise(); | ||||
|             aboutDialog.show() | ||||
|             aboutDialog.requestActivate() | ||||
|             aboutDialog.raise() | ||||
|         } | ||||
|     } | ||||
|     ApplicationSettings{ | ||||
|     ApplicationSettings { | ||||
|         id: appSettings | ||||
|     } | ||||
|     TerminalContainer{ | ||||
|     TerminalContainer { | ||||
|         id: terminalContainer | ||||
|         width: parent.width | ||||
|         height: (parent.height + Math.abs(y)) | ||||
|     } | ||||
|     SettingsWindow{ | ||||
|     SettingsWindow { | ||||
|         id: settingswindow | ||||
|         visible: false | ||||
|     } | ||||
|     AboutDialog{ | ||||
|     AboutDialog { | ||||
|         id: aboutDialog | ||||
|         visible: false | ||||
|     } | ||||
|     Loader{ | ||||
|     Loader { | ||||
|         anchors.centerIn: parent | ||||
|         active: appSettings.showTerminalSize | ||||
|         sourceComponent: SizeOverlay{ | ||||
|         sourceComponent: SizeOverlay { | ||||
|             z: 3 | ||||
|             terminalSize: terminalContainer.terminalSize | ||||
|         } | ||||
|   | ||||
| @@ -17,17 +17,22 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.3 | ||||
|  | ||||
| Menu{ | ||||
| Menu { | ||||
|     id: contextmenu | ||||
|     MenuItem { action: copyAction } | ||||
|     MenuItem { action: pasteAction } | ||||
|     MenuItem { action: showsettingsAction } | ||||
|     MenuItem { | ||||
|         action: copyAction | ||||
|     } | ||||
|     MenuItem { | ||||
|         action: pasteAction | ||||
|     } | ||||
|     MenuItem { | ||||
|         action: showsettingsAction | ||||
|     } | ||||
|  | ||||
|     MenuSeparator { } | ||||
|     MenuSeparator {} | ||||
|  | ||||
|     Menu { | ||||
|         title: qsTr("File") | ||||
| @@ -37,36 +42,54 @@ Menu{ | ||||
|     } | ||||
|     Menu { | ||||
|         title: qsTr("Edit") | ||||
|         MenuItem {action: copyAction} | ||||
|         MenuItem {action: pasteAction} | ||||
|         MenuSeparator { } | ||||
|         MenuItem {action: showsettingsAction} | ||||
|         MenuItem { | ||||
|             action: copyAction | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: pasteAction | ||||
|         } | ||||
|         MenuSeparator {} | ||||
|         MenuItem { | ||||
|             action: showsettingsAction | ||||
|         } | ||||
|     } | ||||
|     Menu{ | ||||
|     Menu { | ||||
|         title: qsTr("View") | ||||
|         MenuItem {action: fullscreenAction; visible: fullscreenAction.enabled} | ||||
|         MenuItem {action: showMenubarAction; visible: showMenubarAction.enabled} | ||||
|         MenuItem {action: zoomIn} | ||||
|         MenuItem {action: zoomOut} | ||||
|         MenuItem { | ||||
|             action: fullscreenAction | ||||
|             visible: fullscreenAction.enabled | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: showMenubarAction | ||||
|             visible: showMenubarAction.enabled | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: zoomIn | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: zoomOut | ||||
|         } | ||||
|     } | ||||
|     Menu{ | ||||
|     Menu { | ||||
|         id: profilesMenu | ||||
|         title: qsTr("Profiles") | ||||
|         Instantiator{ | ||||
|         Instantiator { | ||||
|             model: appSettings.profilesList | ||||
|             delegate: MenuItem { | ||||
|                 text: model.text | ||||
|                 onTriggered: { | ||||
|                     appSettings.loadProfileString(obj_string); | ||||
|                     appSettings.handleFontChanged(); | ||||
|                     appSettings.loadProfileString(obj_string) | ||||
|                     appSettings.handleFontChanged() | ||||
|                 } | ||||
|             } | ||||
|             onObjectAdded: profilesMenu.insertItem(index, object) | ||||
|             onObjectRemoved: profilesMenu.removeItem(object) | ||||
|         } | ||||
|     } | ||||
|     Menu{ | ||||
|     Menu { | ||||
|         title: qsTr("Help") | ||||
|         MenuItem {action: showAboutAction} | ||||
|         MenuItem { | ||||
|             action: showAboutAction | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,12 +17,15 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.3 | ||||
|  | ||||
| Menu{ | ||||
| Menu { | ||||
|     id: contextmenu | ||||
|     MenuItem { action: copyAction } | ||||
|     MenuItem { action: pasteAction } | ||||
|     MenuItem { | ||||
|         action: copyAction | ||||
|     } | ||||
|     MenuItem { | ||||
|         action: pasteAction | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,7 +17,6 @@ | ||||
| * 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 | ||||
| import QtQuick.Controls 2.3 | ||||
|  | ||||
| @@ -27,40 +26,60 @@ MenuBar { | ||||
|  | ||||
|     Menu { | ||||
|         title: qsTr("File") | ||||
|         MenuItem {action: quitAction} | ||||
|         MenuItem { | ||||
|             action: quitAction | ||||
|         } | ||||
|     } | ||||
|     Menu { | ||||
|         title: qsTr("Edit") | ||||
|         MenuItem {action: copyAction} | ||||
|         MenuItem {action: pasteAction} | ||||
|         MenuSeparator { } | ||||
|         MenuItem {action: showsettingsAction} | ||||
|         MenuItem { | ||||
|             action: copyAction | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: pasteAction | ||||
|         } | ||||
|         MenuSeparator {} | ||||
|         MenuItem { | ||||
|             action: showsettingsAction | ||||
|         } | ||||
|     } | ||||
|     Menu{ | ||||
|     Menu { | ||||
|         title: qsTr("View") | ||||
|         MenuItem {action: fullscreenAction; visible: fullscreenAction.enabled} | ||||
|         MenuItem {action: showMenubarAction; visible: showMenubarAction.enabled} | ||||
|         MenuItem {action: zoomIn} | ||||
|         MenuItem {action: zoomOut} | ||||
|         MenuItem { | ||||
|             action: fullscreenAction | ||||
|             visible: fullscreenAction.enabled | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: showMenubarAction | ||||
|             visible: showMenubarAction.enabled | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: zoomIn | ||||
|         } | ||||
|         MenuItem { | ||||
|             action: zoomOut | ||||
|         } | ||||
|     } | ||||
|     Menu{ | ||||
|     Menu { | ||||
|         id: profilesMenu | ||||
|         title: qsTr("Profiles") | ||||
|         Instantiator{ | ||||
|         Instantiator { | ||||
|             model: appSettings.profilesList | ||||
|             delegate: MenuItem { | ||||
|                 text: model.text | ||||
|                 onTriggered: { | ||||
|                     appSettings.loadProfileString(obj_string); | ||||
|                     appSettings.handleFontChanged(); | ||||
|                     appSettings.loadProfileString(obj_string) | ||||
|                     appSettings.handleFontChanged() | ||||
|                 } | ||||
|             } | ||||
|             onObjectAdded: profilesMenu.insertItem(index, object) | ||||
|             onObjectRemoved: profilesMenu.removeItem(object) | ||||
|         } | ||||
|     } | ||||
|     Menu{ | ||||
|     Menu { | ||||
|         title: qsTr("Help") | ||||
|         MenuItem {action: showAboutAction} | ||||
|         MenuItem { | ||||
|             action: showAboutAction | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,3 +1,23 @@ | ||||
| /******************************************************************************* | ||||
| * 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/>. | ||||
| *******************************************************************************/ | ||||
|  | ||||
| .pragma library | ||||
| function clamp(x, min, max) { | ||||
|     if (x <= min) | ||||
| @@ -6,15 +26,18 @@ function clamp(x, min, max) { | ||||
|         return max; | ||||
|     return x; | ||||
| } | ||||
|  | ||||
| function lint(a, b, t) { | ||||
|     return (1 - t) * a + (t) * b; | ||||
| } | ||||
|  | ||||
| function mix(c1, c2, alpha){ | ||||
|     return Qt.rgba(c1.r * alpha + c2.r * (1-alpha), | ||||
|                    c1.g * alpha + c2.g * (1-alpha), | ||||
|                    c1.b * alpha + c2.b * (1-alpha), | ||||
|                    c1.a * alpha + c2.a * (1-alpha)) | ||||
| } | ||||
|  | ||||
| function strToColor(s){ | ||||
|     var r = parseInt(s.substring(1,3), 16) / 256; | ||||
|     var g = parseInt(s.substring(3,5), 16) / 256; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user