diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2019-04-08 15:12:03 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-04-08 15:34:35 +0300 |
commit | 3bf8a1f257aea598dbb1930066f502d9ea37ae4e (patch) | |
tree | 69bc16ca41264065cc1c290994b9a51f7f3765bc /plugins/SliceInfoPlugin | |
parent | ac1b1a99023ced552bb137ed3bce15715d593b25 (diff) |
New style more info dialog for SliceInfo
CURA-6057
Diffstat (limited to 'plugins/SliceInfoPlugin')
-rw-r--r-- | plugins/SliceInfoPlugin/MoreInfoWindow.qml | 176 | ||||
-rwxr-xr-x | plugins/SliceInfoPlugin/SliceInfo.py | 2 |
2 files changed, 91 insertions, 87 deletions
diff --git a/plugins/SliceInfoPlugin/MoreInfoWindow.qml b/plugins/SliceInfoPlugin/MoreInfoWindow.qml index e00ad6730d..82d5044bed 100644 --- a/plugins/SliceInfoPlugin/MoreInfoWindow.qml +++ b/plugins/SliceInfoPlugin/MoreInfoWindow.qml @@ -1,150 +1,154 @@ -// Copyright (c) 2018 Ultimaker B.V. +// Copyright (c) 2019 Ultimaker B.V. // Cura is released under the terms of the LGPLv3 or higher. -import QtQuick 2.7 +import QtQuick 2.10 +import QtQuick.Controls 2.3 import QtQuick.Window 2.2 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 import UM 1.3 as UM -import Cura 1.0 as Cura +import Cura 1.1 as Cura -UM.Dialog +Window { + UM.I18nCatalog { id: catalog; name: "cura" } + id: baseDialog title: catalog.i18nc("@title:window", "More information on anonymous data collection") visible: false + modality: Qt.ApplicationModal + minimumWidth: 500 * screenScaleFactor minimumHeight: 400 * screenScaleFactor width: minimumWidth height: minimumHeight - property bool allowSendData: true // for saving the user's choice + color: UM.Theme.getColor("main_background") - onAccepted: manager.setSendSliceInfo(allowSendData) + property bool allowSendData: true // for saving the user's choice onVisibilityChanged: { if (visible) { - baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info"); + baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info") if (baseDialog.allowSendData) { - allowSendButton.checked = true; + allowSendButton.checked = true } else { - dontSendButton.checked = true; + dontSendButton.checked = true } } } + // Main content area Item { - id: textRow - anchors - { - top: parent.top - bottom: radioButtonsRow.top - bottomMargin: UM.Theme.getSize("default_margin").height - left: parent.left - right: parent.right - } + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_margin").width - Label + Item // Text part { - id: headerText + id: textRow anchors { top: parent.top + bottom: radioButtonsRow.top + bottomMargin: UM.Theme.getSize("default_margin").height left: parent.left right: parent.right } - text: catalog.i18nc("@text:window", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.") - wrapMode: Text.WordWrap - } - - TextArea - { - id: exampleData - anchors + Label { - top: headerText.bottom - topMargin: UM.Theme.getSize("default_margin").height - bottom: parent.bottom - bottomMargin: UM.Theme.getSize("default_margin").height - left: parent.left - right: parent.right + id: headerText + anchors + { + top: parent.top + left: parent.left + right: parent.right + } + text: catalog.i18nc("@text:window", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.") + wrapMode: Text.WordWrap + renderType: Text.NativeRendering } - text: manager.getExampleData() - readOnly: true - textFormat: TextEdit.PlainText + Cura.ScrollableTextArea + { + anchors + { + top: headerText.bottom + topMargin: UM.Theme.getSize("default_margin").height + bottom: parent.bottom + bottomMargin: UM.Theme.getSize("default_margin").height + left: parent.left + right: parent.right + } + + textArea.text: manager.getExampleData() + textArea.readOnly: true + } } - } - - Column - { - id: radioButtonsRow - width: parent.width - anchors.bottom: buttonRow.top - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - - ExclusiveGroup { id: group } - RadioButton + Column // Radio buttons for agree and disagree { - id: dontSendButton - text: catalog.i18nc("@text:window", "I don't want to send this data") - exclusiveGroup: group - onClicked: + id: radioButtonsRow + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: buttonRow.top + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + + Cura.RadioButton { - baseDialog.allowSendData = !checked; + id: dontSendButton + text: catalog.i18nc("@text:window", "I don't want to send this data") + onClicked: + { + baseDialog.allowSendData = !checked + } } - } - RadioButton - { - id: allowSendButton - text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura") - exclusiveGroup: group - onClicked: + Cura.RadioButton { - baseDialog.allowSendData = checked; + id: allowSendButton + text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura") + onClicked: + { + baseDialog.allowSendData = checked + } } } - } - - Item - { - id: buttonRow - anchors.bottom: parent.bottom - width: parent.width - anchors.bottomMargin: UM.Theme.getSize("default_margin").height - - UM.I18nCatalog { id: catalog; name: "cura" } - Button + Item // Bottom buttons { + id: buttonRow + anchors.bottom: parent.bottom + anchors.left: parent.left anchors.right: parent.right - text: catalog.i18nc("@action:button", "OK") - onClicked: + + height: childrenRect.height + + Cura.PrimaryButton { - baseDialog.accepted() - baseDialog.hide() + anchors.right: parent.right + text: catalog.i18nc("@action:button", "OK") + onClicked: + { + manager.setSendSliceInfo(allowSendData) + baseDialog.hide() + } } - } - Button - { - anchors.left: parent.left - text: catalog.i18nc("@action:button", "Cancel") - onClicked: + Cura.SecondaryButton { - baseDialog.rejected() - baseDialog.hide() + anchors.left: parent.left + text: catalog.i18nc("@action:button", "Cancel") + onClicked: + { + baseDialog.hide() + } } } } diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 065923c43d..3763db5534 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -62,7 +62,7 @@ class SliceInfo(QObject, Extension): def showMoreInfoDialog(self): if self._more_info_dialog is None: self._more_info_dialog = self._createDialog("MoreInfoWindow.qml") - self._more_info_dialog.open() + self._more_info_dialog.show() def _createDialog(self, qml_name): Logger.log("d", "Creating dialog [%s]", qml_name) |