mirror of
				https://github.com/Swordfish90/cool-retro-term.git
				synced 2025-10-31 07:04:20 +00:00 
			
		
		
		
	Merge pull request #662 from Swordfish90/unstable
Migrate to QtQuick.Controls 2.x
This commit is contained in:
		| @@ -79,6 +79,9 @@ int main(int argc, char *argv[]) | |||||||
|     app.setWindowIcon(QIcon(":../icons/32x32/cool-retro-term.png")); |     app.setWindowIcon(QIcon(":../icons/32x32/cool-retro-term.png")); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |     app.setOrganizationName("cool-retro-term"); | ||||||
|  |     app.setOrganizationDomain("cool-retro-term"); | ||||||
|  |  | ||||||
|     // Manage command line arguments from the cpp side |     // Manage command line arguments from the cpp side | ||||||
|     QStringList args = app.arguments(); |     QStringList args = app.arguments(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.2 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
| import QtQuick.Window 2.0 | import QtQuick.Window 2.0 | ||||||
|  |  | ||||||
| @@ -86,9 +86,12 @@ Window{ | |||||||
|     } |     } | ||||||
|     Component{ |     Component{ | ||||||
|         id: licenseComponent |         id: licenseComponent | ||||||
|         TextArea{ |         ScrollView { | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|  |             clip: true | ||||||
|  |             TextArea{ | ||||||
|                 readOnly: true |                 readOnly: true | ||||||
|  |                 wrapMode: TextEdit.Wrap | ||||||
|                 text: "Copyright (c) 2013 Filippo Scognamiglio <flscogna@gmail.com>\n\n" + |                 text: "Copyright (c) 2013 Filippo Scognamiglio <flscogna@gmail.com>\n\n" + | ||||||
|                       "https://github.com/Swordfish90/cool-retro-term\n\n" + |                       "https://github.com/Swordfish90/cool-retro-term\n\n" + | ||||||
|  |  | ||||||
| @@ -106,4 +109,5 @@ Window{ | |||||||
|                       "along with this program.  If not, see <http://www.gnu.org/licenses/>." |                       "along with this program.  If not, see <http://www.gnu.org/licenses/>." | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.0 | import QtQuick.Controls 2.0 | ||||||
|  |  | ||||||
| import "utils.js" as Utils | import "utils.js" as Utils | ||||||
|  |  | ||||||
| @@ -336,6 +336,7 @@ QtObject{ | |||||||
|  |  | ||||||
|         _margin = settings.margin !== undefined ? settings.margin : _margin; |         _margin = settings.margin !== undefined ? settings.margin : _margin; | ||||||
|  |  | ||||||
|  |  | ||||||
|         handleFontChanged(); |         handleFontChanged(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.0 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|  |  | ||||||
| import "Components" | import "Components" | ||||||
| @@ -28,8 +28,8 @@ RowLayout { | |||||||
|     property alias name: check.text |     property alias name: check.text | ||||||
|  |  | ||||||
|     property double value |     property double value | ||||||
|     property alias min_value: slider.minimumValue |     property alias min_value: slider.from | ||||||
|     property alias max_value: slider.maximumValue |     property alias max_value: slider.to | ||||||
|     property alias stepSize: slider.stepSize |     property alias stepSize: slider.stepSize | ||||||
|  |  | ||||||
|     signal newValue(real newValue); |     signal newValue(real newValue); | ||||||
| @@ -67,7 +67,6 @@ RowLayout { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     SizedLabel { |     SizedLabel { | ||||||
|         Layout.fillHeight: true |  | ||||||
|         text: Math.round(((value - min_value) / (max_value - min_value)) * 100) + "%" |         text: Math.round(((value - min_value) / (max_value - min_value)) * 100) + "%" | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -42,8 +42,7 @@ Item { | |||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|         radius: 10 |         radius: 10 | ||||||
|         color: rootItem.color |         color: rootItem.color | ||||||
|         border.color: "black" |  | ||||||
|         Glossy {} |  | ||||||
|         Rectangle { |         Rectangle { | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|             anchors.margins: parent.height * 0.25 |             anchors.margins: parent.height * 0.25 | ||||||
|   | |||||||
| @@ -20,16 +20,14 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| import QtQuick 2.0 | import QtQuick 2.0 | ||||||
| import QtQuick.Controls 1.0 | import QtQuick.Controls 2.0 | ||||||
|  | import QtQuick.Layouts 1.0 | ||||||
|  |  | ||||||
| // This component is simply a label with a predefined size. | // This component is simply a label with a predefined size. | ||||||
| // Used to improve alignment. | // Used to improve alignment. | ||||||
|  |  | ||||||
| Item { | Label { | ||||||
|     property alias text: textfield.text |  | ||||||
|     width: appSettings.labelWidth |  | ||||||
|     Label{ |  | ||||||
|     id: textfield |     id: textfield | ||||||
|         anchors { right: parent.right; verticalCenter: parent.verticalCenter } |     Layout.minimumWidth: appSettings.labelWidth | ||||||
|     } |     width: appSettings.labelWidth | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,21 +0,0 @@ | |||||||
| import QtQuick 2.2 |  | ||||||
|  |  | ||||||
| Rectangle { |  | ||||||
|     anchors.centerIn: parent |  | ||||||
|     width: parent.width - parent.border.width |  | ||||||
|     height: parent.height - parent.border.width |  | ||||||
|     radius:parent.radius - parent.border.width/2 |  | ||||||
|     smooth: true |  | ||||||
|  |  | ||||||
|     border.width: parent.border.width/2 |  | ||||||
|     border.color: "#22FFFFFF" |  | ||||||
|  |  | ||||||
|     gradient: Gradient { |  | ||||||
|         GradientStop { position: 0;    color: "#88FFFFFF" } |  | ||||||
|         GradientStop { position: .1;   color: "#55FFFFFF" } |  | ||||||
|         GradientStop { position: .5;   color: "#33FFFFFF" } |  | ||||||
|         GradientStop { position: .501; color: "#11000000" } |  | ||||||
|         GradientStop { position: .8;   color: "#11FFFFFF" } |  | ||||||
|         GradientStop { position: 1;    color: "#55FFFFFF" } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -20,7 +20,7 @@ | |||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Window 2.0 | import QtQuick.Window 2.0 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.0 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
| import QtQuick.Dialogs 1.1 | import QtQuick.Dialogs 1.1 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,10 +19,11 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.0 | ||||||
|  |  | ||||||
| import QMLTermWidget 1.0 | import QMLTermWidget 1.0 | ||||||
|  |  | ||||||
|  | import "menus" | ||||||
| import "utils.js" as Utils | import "utils.js" as Utils | ||||||
|  |  | ||||||
| Item{ | Item{ | ||||||
| @@ -156,31 +157,23 @@ Item{ | |||||||
|         Component.onCompleted: { |         Component.onCompleted: { | ||||||
|             appSettings.terminalFontChanged.connect(handleFontChanged); |             appSettings.terminalFontChanged.connect(handleFontChanged); | ||||||
|             appSettings.initializedSettings.connect(startSession); |             appSettings.initializedSettings.connect(startSession); | ||||||
|  |             appSettings.handleFontChanged() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     Component { |     Component { | ||||||
|         id: linuxContextMenu |         id: shortContextMenu | ||||||
|         Menu{ |         ShortContextMenu { } | ||||||
|             id: contextmenu |  | ||||||
|             MenuItem { action: copyAction } |  | ||||||
|             MenuItem { action: pasteAction } |  | ||||||
|             MenuSeparator { visible: !appSettings.showMenubar } |  | ||||||
|             MenuItem { action: showsettingsAction ; visible: !appSettings.showMenubar} |  | ||||||
|             MenuSeparator { visible: !appSettings.showMenubar } |  | ||||||
|             CRTMainMenuBar { visible: !appSettings.showMenubar } |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     Component { |     Component { | ||||||
|         id: osxContextMenu |         id: fullContextMenu | ||||||
|         Menu{ |         FullContextMenu { } | ||||||
|             id: contextmenu |  | ||||||
|             MenuItem{action: copyAction} |  | ||||||
|             MenuItem{action: pasteAction} |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     Loader { |     Loader { | ||||||
|         id: menuLoader |         id: menuLoader | ||||||
|         sourceComponent: (Qt.platform.os === "osx" ? osxContextMenu : linuxContextMenu) |         sourceComponent: (Qt.platform.os === "osx" || appSettings.showMenubar ? shortContextMenu : fullContextMenu) | ||||||
|     } |     } | ||||||
|     property alias contextmenu: menuLoader.item |     property alias contextmenu: menuLoader.item | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,18 +19,17 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.0 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|  | import QtQml 2.0 | ||||||
|  |  | ||||||
| import "Components" | import "Components" | ||||||
|  |  | ||||||
| Tab{ | ColumnLayout{ | ||||||
|     ColumnLayout{ |  | ||||||
|         anchors.fill: parent |  | ||||||
|  |  | ||||||
|     GroupBox{ |     GroupBox{ | ||||||
|         Layout.fillWidth: true |         Layout.fillWidth: true | ||||||
|         title: qsTr("Command") |         title: qsTr("Command") | ||||||
|  |  | ||||||
|         ColumnLayout { |         ColumnLayout { | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|             CheckBox{ |             CheckBox{ | ||||||
| @@ -66,12 +65,12 @@ Tab{ | |||||||
|         Layout.fillWidth: true |         Layout.fillWidth: true | ||||||
|         GridLayout{ |         GridLayout{ | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|                 rows: 2 |             columns: 4 | ||||||
|                 columns: 3 |  | ||||||
|  |  | ||||||
|             Label{text: qsTr("Effects FPS")} |             Label{text: qsTr("Effects FPS")} | ||||||
|             Slider{ |             Slider{ | ||||||
|                 Layout.fillWidth: true |                 Layout.fillWidth: true | ||||||
|  |                 Layout.columnSpan: 2 | ||||||
|                 id: fpsSlider |                 id: fpsSlider | ||||||
|                 onValueChanged: { |                 onValueChanged: { | ||||||
|                     if (enabled) { |                     if (enabled) { | ||||||
| @@ -81,58 +80,61 @@ Tab{ | |||||||
|                 stepSize: 1 |                 stepSize: 1 | ||||||
|                 enabled: false |                 enabled: false | ||||||
|                 Component.onCompleted: { |                 Component.onCompleted: { | ||||||
|                         minimumValue = 0; |                     from = 0; | ||||||
|                         maximumValue = 60; |                     to = 60; | ||||||
|                     value = appSettings.fps !== 0 ? appSettings.fps - 1 : 60; |                     value = appSettings.fps !== 0 ? appSettings.fps - 1 : 60; | ||||||
|                     enabled = true; |                     enabled = true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|                 SizedLabel{text: appSettings.fps !== 0 ? appSettings.fps : qsTr("Max")} |             Label{text: appSettings.fps !== 0 ? appSettings.fps : qsTr("Max")} | ||||||
|             Label{text: qsTr("Texture Quality")} |             Label{text: qsTr("Texture Quality")} | ||||||
|             Slider{ |             Slider{ | ||||||
|                     Layout.fillWidth: true |  | ||||||
|                 id: txtslider |                 id: txtslider | ||||||
|  |                 Layout.fillWidth: true | ||||||
|  |                 Layout.columnSpan: 2 | ||||||
|                 onValueChanged: if (enabled) appSettings.windowScaling = value; |                 onValueChanged: if (enabled) appSettings.windowScaling = value; | ||||||
|                 stepSize: 0.05 |                 stepSize: 0.05 | ||||||
|                 enabled: false |                 enabled: false | ||||||
|                 Component.onCompleted: { |                 Component.onCompleted: { | ||||||
|                         minimumValue = 0.25 //Without this value gets set to 0.5 |                     from = 0.25 //Without this value gets set to 0.5 | ||||||
|                     value = appSettings.windowScaling; |                     value = appSettings.windowScaling; | ||||||
|                     enabled = true; |                     enabled = true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|                 SizedLabel{text: Math.round(txtslider.value * 100) + "%"} |             Label{text: Math.round(txtslider.value * 100) + "%"} | ||||||
|  |  | ||||||
|             Label{text: qsTr("Bloom Quality")} |             Label{text: qsTr("Bloom Quality")} | ||||||
|             Slider{ |             Slider{ | ||||||
|                 Layout.fillWidth: true |                 Layout.fillWidth: true | ||||||
|  |                 Layout.columnSpan: 2 | ||||||
|                 id: bloomSlider |                 id: bloomSlider | ||||||
|                 onValueChanged: if (enabled) appSettings.bloomQuality = value; |                 onValueChanged: if (enabled) appSettings.bloomQuality = value; | ||||||
|                 stepSize: 0.05 |                 stepSize: 0.05 | ||||||
|                 enabled: false |                 enabled: false | ||||||
|                 Component.onCompleted: { |                 Component.onCompleted: { | ||||||
|                         minimumValue = 0.25 |                     from = 0.25 | ||||||
|                     value = appSettings.bloomQuality; |                     value = appSettings.bloomQuality; | ||||||
|                     enabled = true; |                     enabled = true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|                 SizedLabel{text: Math.round(bloomSlider.value * 100) + "%"} |             Label{text: Math.round(bloomSlider.value * 100) + "%"} | ||||||
|  |  | ||||||
|             Label{text: qsTr("BurnIn Quality")} |             Label{text: qsTr("BurnIn Quality")} | ||||||
|             Slider{ |             Slider{ | ||||||
|                 Layout.fillWidth: true |                 Layout.fillWidth: true | ||||||
|                 id: burnInSlider |                 id: burnInSlider | ||||||
|  |                 Layout.columnSpan: 2 | ||||||
|                 onValueChanged: if (enabled) appSettings.burnInQuality = value; |                 onValueChanged: if (enabled) appSettings.burnInQuality = value; | ||||||
|                 stepSize: 0.05 |                 stepSize: 0.05 | ||||||
|                 enabled: false |                 enabled: false | ||||||
|                 Component.onCompleted: { |                 Component.onCompleted: { | ||||||
|                         minimumValue = 0.25 |                     from = 0.25 | ||||||
|                     value = appSettings.burnInQuality; |                     value = appSettings.burnInQuality; | ||||||
|                     enabled = true; |                     enabled = true; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|                 SizedLabel{text: Math.round(burnInSlider.value * 100) + "%"} |             Label{text: Math.round(burnInSlider.value * 100) + "%"} | ||||||
|             CheckBox{ |             CheckBox{ | ||||||
|                 Layout.columnSpan: 2 |                 Layout.columnSpan: 2 | ||||||
|                 text: qsTr("Burnin optimization (Might display timing artifacts)") |                 text: qsTr("Burnin optimization (Might display timing artifacts)") | ||||||
| @@ -141,5 +143,4 @@ Tab{ | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,12 +19,10 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.0 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|  |  | ||||||
| Tab{ | ColumnLayout{ | ||||||
|     ColumnLayout{ |  | ||||||
|         anchors.fill: parent |  | ||||||
|     spacing: 2 |     spacing: 2 | ||||||
|  |  | ||||||
|     GroupBox{ |     GroupBox{ | ||||||
| @@ -87,5 +85,4 @@ Tab{ | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,32 +19,34 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.4 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
| import QtQuick.Dialogs 1.1 | import QtQuick.Dialogs 1.1 | ||||||
|  |  | ||||||
| Tab{ | ColumnLayout{ | ||||||
|     ColumnLayout{ |  | ||||||
|         anchors.fill: parent |  | ||||||
|     GroupBox{ |     GroupBox{ | ||||||
|         Layout.fillWidth: true |         Layout.fillWidth: true | ||||||
|             Layout.fillHeight: true |  | ||||||
|         title: qsTr("Profile") |         title: qsTr("Profile") | ||||||
|         RowLayout { |         RowLayout { | ||||||
|             anchors.fill: parent |             anchors.fill: parent | ||||||
|                 TableView { |             ListView { | ||||||
|                 id: profilesView |                 id: profilesView | ||||||
|                 Layout.fillWidth: true |                 Layout.fillWidth: true | ||||||
|                 Layout.fillHeight: true |                 Layout.fillHeight: true | ||||||
|                 model: appSettings.profilesList |                 model: appSettings.profilesList | ||||||
|                     headerVisible: false |                 delegate: Rectangle { | ||||||
|                     TableViewColumn { |                     width: label.width | ||||||
|                         title: qsTr("Profile") |                     height: label.height | ||||||
|                         role: "text" |                     color: (index == profilesView.currentIndex) ? palette.highlight : palette.base | ||||||
|                         width: parent.width * 0.5 |                     Label { | ||||||
|  |                         id: label | ||||||
|  |                         text: appSettings.profilesList.get(index).text | ||||||
|  |                         MouseArea { | ||||||
|  |                             anchors.fill: parent | ||||||
|  |                             onClicked: profilesView.currentIndex = index | ||||||
|  |                             onDoubleClicked: appSettings.loadProfile(index) | ||||||
|  |                         } | ||||||
|                     } |                     } | ||||||
|                     onActivated: { |  | ||||||
|                         appSettings.loadProfile(row); |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             ColumnLayout { |             ColumnLayout { | ||||||
| @@ -60,11 +62,11 @@ Tab{ | |||||||
|                 } |                 } | ||||||
|                 Button{ |                 Button{ | ||||||
|                     Layout.fillWidth: true |                     Layout.fillWidth: true | ||||||
|                         property alias currentIndex: profilesView.currentRow |                     property alias currentIndex: profilesView.currentIndex | ||||||
|                     enabled: currentIndex >= 0 |                     enabled: currentIndex >= 0 | ||||||
|                     text: qsTr("Load") |                     text: qsTr("Load") | ||||||
|                     onClicked: { |                     onClicked: { | ||||||
|                             var index = profilesView.currentRow; |                         var index = currentIndex; | ||||||
|                         if (index >= 0) |                         if (index >= 0) | ||||||
|                             appSettings.loadProfile(index); |                             appSettings.loadProfile(index); | ||||||
|                     } |                     } | ||||||
| @@ -72,7 +74,7 @@ Tab{ | |||||||
|                 Button{ |                 Button{ | ||||||
|                     Layout.fillWidth: true |                     Layout.fillWidth: true | ||||||
|                     text: qsTr("Remove") |                     text: qsTr("Remove") | ||||||
|                         property alias currentIndex: profilesView.currentRow |                     property alias currentIndex: profilesView.currentIndex | ||||||
|  |  | ||||||
|                     enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin |                     enabled: currentIndex >= 0 && !appSettings.profilesList.get(currentIndex).builtin | ||||||
|                     onClicked: { |                     onClicked: { | ||||||
| @@ -121,7 +123,7 @@ Tab{ | |||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|                 Button{ |                 Button{ | ||||||
|                         property alias currentIndex: profilesView.currentRow |                     property alias currentIndex: profilesView.currentIndex | ||||||
|  |  | ||||||
|                     Layout.fillWidth: true |                     Layout.fillWidth: true | ||||||
|  |  | ||||||
| @@ -230,5 +232,4 @@ Tab{ | |||||||
|             active = true; |             active = true; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,14 +19,13 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.1 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|  | import QtQml 2.0 | ||||||
|  |  | ||||||
| import "Components" | import "Components" | ||||||
|  |  | ||||||
| Tab{ | ColumnLayout{ | ||||||
|     ColumnLayout{ |  | ||||||
|         anchors.fill: parent |  | ||||||
|  |  | ||||||
|     GroupBox{ |     GroupBox{ | ||||||
|         title: qsTr("Font") |         title: qsTr("Font") | ||||||
| @@ -52,6 +51,7 @@ Tab{ | |||||||
|                 id: fontChanger |                 id: fontChanger | ||||||
|                 Layout.fillWidth: true |                 Layout.fillWidth: true | ||||||
|                 model: appSettings.fontlist |                 model: appSettings.fontlist | ||||||
|  |                 textRole: "text" | ||||||
|                 onActivated: { |                 onActivated: { | ||||||
|                     var name = appSettings.fontlist.get(index).name; |                     var name = appSettings.fontlist.get(index).name; | ||||||
|                     appSettings.fontNames[appSettings.rasterization] = name; |                     appSettings.fontNames[appSettings.rasterization] = name; | ||||||
| @@ -75,19 +75,11 @@ Tab{ | |||||||
|                 Slider{ |                 Slider{ | ||||||
|                     Layout.fillWidth: true |                     Layout.fillWidth: true | ||||||
|                     id: fontScalingChanger |                     id: fontScalingChanger | ||||||
|                         onValueChanged: if(enabled) appSettings.fontScaling = value |                     onValueChanged: appSettings.fontScaling = value | ||||||
|  |                     value: appSettings.fontScaling | ||||||
|                     stepSize: 0.05 |                     stepSize: 0.05 | ||||||
|                         enabled: false // Another trick to fix initial bad behavior. |                     from: appSettings.minimumFontScaling; | ||||||
|                         Component.onCompleted: { |                     to: appSettings.maximumFontScaling; | ||||||
|                             minimumValue = appSettings.minimumFontScaling; |  | ||||||
|                             maximumValue = appSettings.maximumFontScaling; |  | ||||||
|                             value = appSettings.fontScaling; |  | ||||||
|                             enabled = true; |  | ||||||
|                         } |  | ||||||
|                         Connections{ |  | ||||||
|                             target: appSettings |  | ||||||
|                             onFontScalingChanged: fontScalingChanger.value = appSettings.fontScaling; |  | ||||||
|                         } |  | ||||||
|                 } |                 } | ||||||
|                 SizedLabel{ |                 SizedLabel{ | ||||||
|                     text: Math.round(fontScalingChanger.value * 100) + "%" |                     text: Math.round(fontScalingChanger.value * 100) + "%" | ||||||
| @@ -102,11 +94,8 @@ Tab{ | |||||||
|                     onValueChanged: appSettings.fontWidth = value; |                     onValueChanged: appSettings.fontWidth = value; | ||||||
|                     value: appSettings.fontWidth |                     value: appSettings.fontWidth | ||||||
|                     stepSize: 0.05 |                     stepSize: 0.05 | ||||||
|                         Component.onCompleted: { |                     from: 0.5 | ||||||
|                             // This is needed to avoid unnecessary chnaged events. |                     to: 1.5 | ||||||
|                             minimumValue = 0.5; |  | ||||||
|                             maximumValue = 1.5; |  | ||||||
|                         } |  | ||||||
|                 } |                 } | ||||||
|                 SizedLabel{ |                 SizedLabel{ | ||||||
|                     text: Math.round(widthChanger.value * 100) + "%" |                     text: Math.round(widthChanger.value * 100) + "%" | ||||||
| @@ -170,5 +159,4 @@ Tab{ | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,46 +19,50 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.1 | ||||||
| import QtQuick.Window 2.1 | import QtQuick.Window 2.1 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.3 | ||||||
| import QtQuick.Dialogs 1.1 | import QtQuick.Dialogs 1.1 | ||||||
|  |  | ||||||
| Window { | Window { | ||||||
|     id: settings_window |     id: settings_window | ||||||
|     title: qsTr("Settings") |     title: qsTr("Settings") | ||||||
|     width: 580 |     width: 800 | ||||||
|     height: 400 |     height: 600 | ||||||
|  |  | ||||||
|     property int tabmargins: 15 |     property int tabmargins: 15 | ||||||
|  |  | ||||||
|     TabView{ |     TabBar { | ||||||
|         id: tabView |         id: bar | ||||||
|         anchors.fill: parent |         width: parent.width | ||||||
|         anchors.margins: 10 |         TabButton { | ||||||
|         SettingsGeneralTab { |             text: qsTr("General") | ||||||
|             id: generalTab |  | ||||||
|             title: qsTr("General") |  | ||||||
|             anchors.fill: parent |  | ||||||
|             anchors.margins: tabmargins |  | ||||||
|         } |         } | ||||||
|         SettingsTerminalTab { |         TabButton { | ||||||
|             id: terminalTab |             text: qsTr("Terminal") | ||||||
|             title: qsTr("Terminal") |  | ||||||
|             anchors.fill: parent |  | ||||||
|             anchors.margins: tabmargins |  | ||||||
|         } |         } | ||||||
|         SettingsEffectsTab { |         TabButton { | ||||||
|             id: effectsTab |             text: qsTr("Effects") | ||||||
|             title: qsTr("Effects") |  | ||||||
|             anchors.fill: parent |  | ||||||
|             anchors.margins: tabmargins |  | ||||||
|         } |         } | ||||||
|         SettingsAdvancedTab { |         TabButton { | ||||||
|             id: performanceTab |             text: qsTr("Advanced") | ||||||
|             title: qsTr("Advanced") |  | ||||||
|             anchors.fill: parent |  | ||||||
|             anchors.margins: tabmargins |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     StackLayout { | ||||||
|  |         anchors { | ||||||
|  |             top: bar.bottom | ||||||
|  |             left: parent.left | ||||||
|  |             right: parent.right | ||||||
|  |             bottom: parent.bottom | ||||||
|  |             margins: tabmargins | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         currentIndex: bar.currentIndex | ||||||
|  |  | ||||||
|  |         SettingsGeneralTab { } | ||||||
|  |         SettingsTerminalTab { } | ||||||
|  |         SettingsEffectsTab { } | ||||||
|  |         SettingsAdvancedTab { } | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.0 | ||||||
| import QtQuick.Layouts 1.1 | import QtQuick.Layouts 1.1 | ||||||
|  |  | ||||||
| import "Components" | import "Components" | ||||||
| @@ -27,8 +27,8 @@ import "Components" | |||||||
| RowLayout { | RowLayout { | ||||||
|     property alias value: slider.value |     property alias value: slider.value | ||||||
|     property alias stepSize: slider.stepSize |     property alias stepSize: slider.stepSize | ||||||
|     property alias minimumValue: slider.minimumValue |     property alias minimumValue: slider.from | ||||||
|     property alias maximumValue: slider.maximumValue |     property alias maximumValue: slider.to | ||||||
|     property real maxMultiplier: 100 |     property real maxMultiplier: 100 | ||||||
|  |  | ||||||
|     id: setting_component |     id: setting_component | ||||||
|   | |||||||
| @@ -20,8 +20,9 @@ | |||||||
|  |  | ||||||
| import QtQuick 2.2 | import QtQuick 2.2 | ||||||
| import QtQuick.Window 2.1 | import QtQuick.Window 2.1 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.3 | ||||||
| import QtGraphicalEffects 1.0 |  | ||||||
|  | import "menus" | ||||||
|  |  | ||||||
| ApplicationWindow{ | ApplicationWindow{ | ||||||
|     id: terminalWindow |     id: terminalWindow | ||||||
| @@ -37,8 +38,6 @@ ApplicationWindow{ | |||||||
|  |  | ||||||
|     // Load saved window geometry and show the window |     // Load saved window geometry and show the window | ||||||
|     Component.onCompleted: {         |     Component.onCompleted: {         | ||||||
|         appSettings.handleFontChanged(); |  | ||||||
|  |  | ||||||
|         x = appSettings.x |         x = appSettings.x | ||||||
|         y = appSettings.y |         y = appSettings.y | ||||||
|         width = appSettings.width |         width = appSettings.width | ||||||
| @@ -55,11 +54,9 @@ ApplicationWindow{ | |||||||
|     property bool fullscreen: appSettings.fullscreen |     property bool fullscreen: appSettings.fullscreen | ||||||
|     onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed) |     onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed) | ||||||
|  |  | ||||||
|     //Workaround: Without __contentItem a ugly thin border is visible. |     menuBar: WindowMenu { | ||||||
|     menuBar: CRTMainMenuBar{ |  | ||||||
|         id: mainMenu |         id: mainMenu | ||||||
|         visible: (Qt.platform.os === "osx" || appSettings.showMenubar) |         visible: (Qt.platform.os === "osx" || appSettings.showMenubar) | ||||||
|         __contentItem.visible: mainMenu.visible |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     property string wintitle: appSettings.wintitle |     property string wintitle: appSettings.wintitle | ||||||
| @@ -136,7 +133,6 @@ ApplicationWindow{ | |||||||
|     } |     } | ||||||
|     TerminalContainer{ |     TerminalContainer{ | ||||||
|         id: terminalContainer |         id: terminalContainer | ||||||
|         y: appSettings.showMenubar ? 0 : -2 // Workaroud to hide the margin in the menubar. |  | ||||||
|         width: parent.width |         width: parent.width | ||||||
|         height: (parent.height + Math.abs(y)) |         height: (parent.height + Math.abs(y)) | ||||||
|     } |     } | ||||||
|   | |||||||
							
								
								
									
										72
									
								
								app/qml/menus/FullContextMenu.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								app/qml/menus/FullContextMenu.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,72 @@ | |||||||
|  | /******************************************************************************* | ||||||
|  | * 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.3 | ||||||
|  |  | ||||||
|  | Menu{ | ||||||
|  |     id: contextmenu | ||||||
|  |     MenuItem { action: copyAction } | ||||||
|  |     MenuItem { action: pasteAction } | ||||||
|  |     MenuItem { action: showsettingsAction } | ||||||
|  |  | ||||||
|  |     MenuSeparator { } | ||||||
|  |  | ||||||
|  |     Menu { | ||||||
|  |         title: qsTr("File") | ||||||
|  |         MenuItem { | ||||||
|  |             action: quitAction | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     Menu { | ||||||
|  |         title: qsTr("Edit") | ||||||
|  |         MenuItem {action: copyAction} | ||||||
|  |         MenuItem {action: pasteAction} | ||||||
|  |         MenuSeparator { } | ||||||
|  |         MenuItem {action: showsettingsAction} | ||||||
|  |     } | ||||||
|  |     Menu{ | ||||||
|  |         title: qsTr("View") | ||||||
|  |         MenuItem {action: fullscreenAction; visible: fullscreenAction.enabled} | ||||||
|  |         MenuItem {action: showMenubarAction; visible: showMenubarAction.enabled} | ||||||
|  |         MenuItem {action: zoomIn} | ||||||
|  |         MenuItem {action: zoomOut} | ||||||
|  |     } | ||||||
|  |     Menu{ | ||||||
|  |         id: profilesMenu | ||||||
|  |         title: qsTr("Profiles") | ||||||
|  |         Instantiator{ | ||||||
|  |             model: appSettings.profilesList | ||||||
|  |             delegate: MenuItem { | ||||||
|  |                 text: model.text | ||||||
|  |                 onTriggered: { | ||||||
|  |                     appSettings.loadProfileString(obj_string); | ||||||
|  |                     appSettings.handleFontChanged(); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             onObjectAdded: profilesMenu.insertItem(index, object) | ||||||
|  |             onObjectRemoved: profilesMenu.removeItem(object) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     Menu{ | ||||||
|  |         title: qsTr("Help") | ||||||
|  |         MenuItem {action: showAboutAction} | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										28
									
								
								app/qml/menus/ShortContextMenu.qml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/qml/menus/ShortContextMenu.qml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +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.3 | ||||||
|  |  | ||||||
|  | Menu{ | ||||||
|  |     id: contextmenu | ||||||
|  |     MenuItem { action: copyAction } | ||||||
|  |     MenuItem { action: pasteAction } | ||||||
|  | } | ||||||
| @@ -1,35 +1,51 @@ | |||||||
|  | /******************************************************************************* | ||||||
|  | * 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 2.2 | ||||||
| import QtQuick.Controls 1.1 | import QtQuick.Controls 2.3 | ||||||
| 
 | 
 | ||||||
| MenuBar { | MenuBar { | ||||||
|     id: defaultMenuBar |     id: defaultMenuBar | ||||||
|     property bool visible: true |     visible: appSettings.showMenubar | ||||||
|  | 
 | ||||||
|     Menu { |     Menu { | ||||||
|         title: qsTr("File") |         title: qsTr("File") | ||||||
|         visible: defaultMenuBar.visible |  | ||||||
|         MenuItem {action: quitAction} |         MenuItem {action: quitAction} | ||||||
|     } |     } | ||||||
|     Menu { |     Menu { | ||||||
|         title: qsTr("Edit") |         title: qsTr("Edit") | ||||||
|         visible: defaultMenuBar.visible && appSettings.showMenubar |  | ||||||
|         MenuItem {action: copyAction} |         MenuItem {action: copyAction} | ||||||
|         MenuItem {action: pasteAction} |         MenuItem {action: pasteAction} | ||||||
|         MenuSeparator{visible: Qt.platform.os !== "osx"} |         MenuSeparator { } | ||||||
|         MenuItem {action: showsettingsAction} |         MenuItem {action: showsettingsAction} | ||||||
|     } |     } | ||||||
|     Menu{ |     Menu{ | ||||||
|         title: qsTr("View") |         title: qsTr("View") | ||||||
|         visible: defaultMenuBar.visible |  | ||||||
|         MenuItem {action: fullscreenAction; visible: fullscreenAction.enabled} |         MenuItem {action: fullscreenAction; visible: fullscreenAction.enabled} | ||||||
|         MenuItem {action: showMenubarAction; visible: showMenubarAction.enabled} |         MenuItem {action: showMenubarAction; visible: showMenubarAction.enabled} | ||||||
|         MenuSeparator{visible: showMenubarAction.enabled} |  | ||||||
|         MenuItem {action: zoomIn} |         MenuItem {action: zoomIn} | ||||||
|         MenuItem {action: zoomOut} |         MenuItem {action: zoomOut} | ||||||
|     } |     } | ||||||
|     Menu{ |     Menu{ | ||||||
|         id: profilesMenu |         id: profilesMenu | ||||||
|         title: qsTr("Profiles") |         title: qsTr("Profiles") | ||||||
|         visible: defaultMenuBar.visible |  | ||||||
|         Instantiator{ |         Instantiator{ | ||||||
|             model: appSettings.profilesList |             model: appSettings.profilesList | ||||||
|             delegate: MenuItem { |             delegate: MenuItem { | ||||||
| @@ -45,7 +61,6 @@ MenuBar { | |||||||
|     } |     } | ||||||
|     Menu{ |     Menu{ | ||||||
|         title: qsTr("Help") |         title: qsTr("Help") | ||||||
|         visible: defaultMenuBar.visible |  | ||||||
|         MenuItem {action: showAboutAction} |         MenuItem {action: showAboutAction} | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -12,7 +12,6 @@ | |||||||
|         <file>TimeManager.qml</file> |         <file>TimeManager.qml</file> | ||||||
|         <file>SimpleSlider.qml</file> |         <file>SimpleSlider.qml</file> | ||||||
|         <file>ColorButton.qml</file> |         <file>ColorButton.qml</file> | ||||||
|         <file>Glossy.qml</file> |  | ||||||
|         <file>AboutDialog.qml</file> |         <file>AboutDialog.qml</file> | ||||||
|         <file>InsertNameDialog.qml</file> |         <file>InsertNameDialog.qml</file> | ||||||
|         <file>SettingsEffectsTab.qml</file> |         <file>SettingsEffectsTab.qml</file> | ||||||
| @@ -22,7 +21,6 @@ | |||||||
|         <file>fonts/1977-apple2/PrintChar21.ttf</file> |         <file>fonts/1977-apple2/PrintChar21.ttf</file> | ||||||
|         <file>fonts/1971-ibm-3278/3270Medium.ttf</file> |         <file>fonts/1971-ibm-3278/3270Medium.ttf</file> | ||||||
|         <file>Storage.qml</file> |         <file>Storage.qml</file> | ||||||
|         <file>CRTMainMenuBar.qml</file> |  | ||||||
|         <file>SettingsAdvancedTab.qml</file> |         <file>SettingsAdvancedTab.qml</file> | ||||||
|         <file>TerminalContainer.qml</file> |         <file>TerminalContainer.qml</file> | ||||||
|         <file>images/crt256.png</file> |         <file>images/crt256.png</file> | ||||||
| @@ -44,5 +42,8 @@ | |||||||
|         <file>fonts/modern-terminus/TerminusTTF-4.46.0.ttf</file> |         <file>fonts/modern-terminus/TerminusTTF-4.46.0.ttf</file> | ||||||
|         <file>NewTerminalFrame.qml</file> |         <file>NewTerminalFrame.qml</file> | ||||||
|         <file>SlowBurnIn.qml</file> |         <file>SlowBurnIn.qml</file> | ||||||
|  |         <file>menus/WindowMenu.qml</file> | ||||||
|  |         <file>menus/FullContextMenu.qml</file> | ||||||
|  |         <file>menus/ShortContextMenu.qml</file> | ||||||
|     </qresource> |     </qresource> | ||||||
| </RCC> | </RCC> | ||||||
|   | |||||||
 Submodule qmltermwidget updated: 59f967d5e1...5c47d1f494
									
								
							
		Reference in New Issue
	
	Block a user