mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
parent
b14f3d98bc
commit
062df7c512
5 changed files with 254 additions and 66 deletions
|
@ -5,6 +5,7 @@ import QtQuick 2.2
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.1
|
||||||
|
import QtQuick.Controls.Styles 1.1
|
||||||
|
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
import ".."
|
import ".."
|
||||||
|
@ -12,94 +13,240 @@ import ".."
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: wizardPage
|
id: wizardPage
|
||||||
property string title
|
property string title
|
||||||
signal openFile(string fileName)
|
property int pageWidth
|
||||||
|
property int pageHeight
|
||||||
|
property var manufacturers: wizardPage.lineManufacturers()
|
||||||
|
property int manufacturerIndex: 0
|
||||||
|
|
||||||
|
SystemPalette{id: palette}
|
||||||
|
signal reloadModel(var newModel)
|
||||||
signal closeWizard()
|
signal closeWizard()
|
||||||
|
|
||||||
|
width: wizardPage.pageWidth
|
||||||
|
height: wizardPage.pageHeight
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: rootElement
|
target: elementRoot
|
||||||
onFinalClicked: {//You can add functions here that get triggered when the final button is clicked in the wizard-element
|
onFinalClicked: {//You can add functions here that get triggered when the final button is clicked in the wizard-element
|
||||||
saveMachine()
|
saveMachine()
|
||||||
}
|
}
|
||||||
|
onResize: {
|
||||||
|
wizardPage.width = pageWidth
|
||||||
|
wizardPage.height = pageHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function lineManufacturers(manufacturer){
|
||||||
|
var manufacturers = []
|
||||||
|
for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) {
|
||||||
|
if (UM.Models.availableMachinesModel.getItem(i).manufacturer != manufacturers[manufacturers.length - 1]){
|
||||||
|
manufacturers.push(UM.Models.availableMachinesModel.getItem(i).manufacturer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return manufacturers
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: title
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
text: parent.title
|
text: parent.title
|
||||||
font.pointSize: 18;
|
font.pointSize: 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: subTitle
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: title.bottom
|
||||||
//: Add Printer wizard page description
|
//: Add Printer wizard page description
|
||||||
text: qsTr("Please select the type of printer:");
|
text: qsTr("Please select the type of printer:");
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
ListView {
|
id: machinesHolder
|
||||||
id: machineList;
|
anchors.left: parent.left
|
||||||
model: UM.Models.availableMachinesModel
|
anchors.top: subTitle.bottom
|
||||||
delegate: RadioButton {
|
implicitWidth: wizardPage.width- UM.Theme.sizes.default_margin.width
|
||||||
id:machine_button
|
implicitHeight: wizardPage.height - subTitle.height - title.height - (machineNameHolder.height * 2)
|
||||||
exclusiveGroup: printerGroup;
|
|
||||||
checked: ListView.view.currentIndex == index ? true : false
|
|
||||||
text: model.name;
|
|
||||||
onClicked: {
|
|
||||||
ListView.view.currentIndex = index;
|
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: machineDelegate
|
||||||
|
ColumnLayout {
|
||||||
|
id: machineLayout
|
||||||
|
spacing: 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width
|
||||||
|
function showManufacturer(){
|
||||||
|
if (model.manufacturer == UM.Models.availableMachinesModel.getItem(index - 1).manufacturer){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
height: {
|
||||||
|
if (machineLayout.showManufacturer() & wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer)
|
||||||
|
return UM.Theme.sizes.standard_list_lineheight.height * 2
|
||||||
|
if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer | machineLayout.showManufacturer())
|
||||||
|
return UM.Theme.sizes.standard_list_lineheight.height * 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Behavior on height{
|
||||||
|
NumberAnimation { target: machineLayout; property: "height"; duration: 200}
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
id: manufacturer
|
||||||
|
property color backgroundColor: "transparent"
|
||||||
|
height: UM.Theme.sizes.standard_list_lineheight.height
|
||||||
|
visible: machineLayout.showManufacturer()
|
||||||
|
anchors.top: machineLayout.top
|
||||||
|
anchors.topMargin: 0
|
||||||
|
text: {
|
||||||
|
if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer)
|
||||||
|
return model.manufacturer + " ▼"
|
||||||
|
else
|
||||||
|
return model.manufacturer + " ►"
|
||||||
|
}
|
||||||
|
style: ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
id: manufacturerBackground
|
||||||
|
opacity: 0.3
|
||||||
|
border.width: 0
|
||||||
|
color: manufacturer.backgroundColor
|
||||||
|
height: UM.Theme.sizes.standard_list_lineheight.height
|
||||||
|
}
|
||||||
|
label: Text {
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
text: control.text
|
||||||
|
color: palette.windowText
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
id: mousearea
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
onEntered: manufacturer.backgroundColor = palette.light
|
||||||
|
onExited: manufacturer.backgroundColor = "transparent"
|
||||||
|
onClicked: {
|
||||||
|
wizardPage.manufacturerIndex = wizardPage.manufacturers.indexOf(model.manufacturer)
|
||||||
|
machineList.currentIndex = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton {
|
||||||
|
id: machineButton
|
||||||
|
opacity: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? 1 : 0
|
||||||
|
height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: machineLayout.showManufacturer() ? manufacturer.height - 5 : 0
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width
|
||||||
|
checked: machineList.currentIndex == index ? true : false
|
||||||
|
exclusiveGroup: printerGroup;
|
||||||
|
text: model.name
|
||||||
|
onClicked: machineList.currentIndex = index;
|
||||||
|
function getAnimationTime(time){
|
||||||
|
if (machineButton.opacity == 0)
|
||||||
|
return time
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
id: author
|
||||||
|
visible: model.author != "Ultimaker" ? true : false
|
||||||
|
height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0
|
||||||
|
//: Printer profile caption meaning: this profile is supported by the community
|
||||||
|
text: qsTr("community supported profile");
|
||||||
|
opacity: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? 1 : 0
|
||||||
|
anchors.left: machineButton.right
|
||||||
|
anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.height/2
|
||||||
|
anchors.verticalCenter: machineButton.verticalCenter
|
||||||
|
anchors.verticalCenterOffset: UM.Theme.sizes.standard_list_lineheight.height / 4
|
||||||
|
font: UM.Theme.fonts.caption;
|
||||||
|
color: palette.mid
|
||||||
|
}
|
||||||
|
Behavior on opacity {
|
||||||
|
SequentialAnimation {
|
||||||
|
PauseAnimation { duration: machineButton.getAnimationTime(100) }
|
||||||
|
NumberAnimation { properties:"opacity"; duration: machineButton.getAnimationTime(200) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: machineList
|
||||||
|
property int currentIndex: 0
|
||||||
|
property int otherMachinesIndex: {
|
||||||
|
for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) {
|
||||||
|
if (UM.Models.availableMachinesModel.getItem(i).manufacturer != "Ultimaker"){
|
||||||
|
return i
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
anchors.fill: parent
|
||||||
|
model: UM.Models.availableMachinesModel
|
||||||
|
delegate: machineDelegate
|
||||||
|
focus: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Item{
|
||||||
text: qsTr("Variation:");
|
id: machineNameHolder
|
||||||
|
height: childrenRect.height
|
||||||
|
anchors.top: machinesHolder.bottom
|
||||||
|
Label {
|
||||||
|
id: insertNameLabel
|
||||||
|
//: Add Printer wizard field label
|
||||||
|
text: qsTr("Printer Name:");
|
||||||
}
|
}
|
||||||
|
TextField {
|
||||||
ScrollView {
|
id: machineName;
|
||||||
ListView {
|
anchors.top: insertNameLabel.bottom
|
||||||
id: variations_list
|
text: machineList.model.getItem(machineList.currentIndex).name
|
||||||
model: machineList.model.getItem(machineList.currentIndex).variations
|
implicitWidth: UM.Theme.sizes.standard_list_input.width
|
||||||
delegate: RadioButton {
|
|
||||||
id: variation_radio_button
|
|
||||||
checked: ListView.view.currentIndex == index ? true : false
|
|
||||||
exclusiveGroup: variationGroup;
|
|
||||||
text: model.name;
|
|
||||||
onClicked: ListView.view.currentIndex = index;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
|
||||||
//: Add Printer wizard field label
|
|
||||||
text: qsTr("Printer Name:");
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
|
|
||||||
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
|
||||||
ExclusiveGroup { id: printerGroup; }
|
ExclusiveGroup { id: printerGroup; }
|
||||||
ExclusiveGroup { id: variationGroup; }
|
|
||||||
|
|
||||||
function getSpecialMachineType(machineId){
|
|
||||||
for (var i = 0; i < UM.Models.addMachinesModel.rowCount(); i++) {
|
|
||||||
if (UM.Models.addMachinesModel.getItem(i).name == machineId){
|
|
||||||
return UM.Models.addMachinesModel.getItem(i).name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveMachine(){
|
function saveMachine(){
|
||||||
if(machineList.currentIndex != -1) {
|
if(machineList.currentIndex != -1) {
|
||||||
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, variations_list.currentIndex, machineName.text)
|
UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text)
|
||||||
|
|
||||||
|
var chosenMachine = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).name
|
||||||
var originalString = "Ultimaker Original"
|
var originalString = "Ultimaker Original"
|
||||||
var originalPlusString = "Ultimaker Original+"
|
var originalPlusString = "Ultimaker Original+"
|
||||||
var originalMachineType = getSpecialMachineType(originalString)
|
|
||||||
|
|
||||||
if (UM.Models.availableMachinesModel.getItem(machineList.currentIndex).name == originalMachineType){
|
if (chosenMachine == originalString | chosenMachine == originalPlusString ){
|
||||||
var variation = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).name
|
wizardPage.reloadModel([
|
||||||
if (variation == originalString || variation == originalPlusString){
|
{
|
||||||
console.log(UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).type)
|
title: "Select Upgraded Parts",
|
||||||
wizardPage.openFile(UM.Models.availableMachinesModel.getItem(machineList.currentIndex).variations.getItem(variations_list.currentIndex).type)
|
page: "SelectUpgradedParts.qml"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
title: "Upgrade Ultimaker Firmware",
|
||||||
|
page: "UpgradeFirmware.qml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Ultimaker Checkup",
|
||||||
|
page: "UltimakerCheckup.qml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Bedleveling Wizard",
|
||||||
|
page: "Bedleveling.qml"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
wizardPage.closeWizard()
|
wizardPage.closeWizard()
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,25 @@ import QtQuick.Window 2.1
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: wizardPage
|
||||||
property string title
|
property string title
|
||||||
anchors.fill: parent;
|
property int pageWidth
|
||||||
|
property int pageHeight
|
||||||
|
|
||||||
|
SystemPalette{id: palette}
|
||||||
|
//signal openFile(string fileName)
|
||||||
|
//signal closeWizard()
|
||||||
|
|
||||||
|
width: wizardPage.pageWidth
|
||||||
|
height: wizardPage.pageHeight
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: elementRoot
|
||||||
|
onResize: {
|
||||||
|
wizardPage.width = pageWidth
|
||||||
|
wizardPage.height = pageHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: parent.title
|
text: parent.title
|
||||||
|
|
|
@ -9,8 +9,25 @@ import QtQuick.Window 2.1
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: wizardPage
|
||||||
property string title
|
property string title
|
||||||
anchors.fill: parent;
|
property int pageWidth
|
||||||
|
property int pageHeight
|
||||||
|
|
||||||
|
SystemPalette{id: palette}
|
||||||
|
//signal openFile(string fileName)
|
||||||
|
//signal closeWizard()
|
||||||
|
|
||||||
|
width: wizardPage.pageWidth
|
||||||
|
height: wizardPage.pageHeight
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: elementRoot
|
||||||
|
onResize: {
|
||||||
|
wizardPage.width = pageWidth
|
||||||
|
wizardPage.height = pageHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: parent.title
|
text: parent.title
|
||||||
|
@ -18,23 +35,26 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
//: Add Printer wizard page description
|
//: Add UM Original wizard page description
|
||||||
text: qsTr("Please select the type of printer:");
|
width: 300
|
||||||
|
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: qsTr("To assist you in having better default settings for your Ultimaker. Cura would like to know which upgrades you have in your machine:");
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
Layout.fillWidth: true;
|
Layout.fillWidth: true;
|
||||||
|
Column {
|
||||||
ListView {
|
CheckBox {
|
||||||
id: machineList;
|
text: qsTr("Breakfast")
|
||||||
model: UM.Models.availableMachinesModel
|
checked: true
|
||||||
delegate: RadioButton {
|
}
|
||||||
exclusiveGroup: printerGroup;
|
CheckBox {
|
||||||
text: model.name;
|
text: qsTr("Lunch")
|
||||||
onClicked: {
|
}
|
||||||
ListView.view.currentIndex = index;
|
CheckBox {
|
||||||
|
text: qsTr("Dinner")
|
||||||
}
|
checked: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +64,6 @@ ColumnLayout {
|
||||||
text: qsTr("Printer Name:");
|
text: qsTr("Printer Name:");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name }
|
|
||||||
|
|
||||||
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
Item { Layout.fillWidth: true; Layout.fillHeight: true; }
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,10 @@ import QtQuick.Window 2.1
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: wizardPage
|
||||||
property string title
|
property string title
|
||||||
|
property int pageWidth
|
||||||
|
property int pageHeight
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|
|
@ -9,9 +9,11 @@ import QtQuick.Window 2.1
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: wizardPage
|
||||||
property string title
|
property string title
|
||||||
|
property int pageWidth
|
||||||
|
property int pageHeight
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
signal openFile(string fileName)
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: parent.title
|
text: parent.title
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue