diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 637a4298eb..0bdc9586bd 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -257,10 +257,12 @@ UM.MainWindow { } Image { + id: logo anchors { - verticalCenter: openFileButton.verticalCenter; - left: openFileButton.right; - leftMargin: UM.Theme.sizes.window_margin.width; + left: parent.left + leftMargin: UM.Theme.sizes.default_margin.width; + bottom: parent.bottom + bottomMargin: UM.Theme.sizes.default_margin.height; } source: UM.Theme.images.logo; @@ -272,13 +274,12 @@ UM.MainWindow { } Button { + id: viewModeButton anchors { top: parent.top; - topMargin: UM.Theme.sizes.window_margin.height; right: sidebar.left; rightMargin: UM.Theme.sizes.window_margin.width; } - id: viewModeButton //: View Mode toolbar button text: qsTr("View Mode"); iconSource: UM.Theme.icons.viewmode; @@ -308,10 +309,9 @@ UM.MainWindow { id: toolbar; anchors { - left: parent.left; - leftMargin: UM.Theme.sizes.window_margin.width; - bottom: parent.bottom; - bottomMargin: UM.Theme.sizes.window_margin.height; + horizontalCenter: parent.horizontalCenter + horizontalCenterOffset: -(UM.Theme.sizes.panel.width / 2) + top: parent.top; } } diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index ec7a6bd839..5d4400bfda 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -12,33 +12,14 @@ Item { id: base; width: buttons.width; - height: buttons.height + panel.height; - - Rectangle { - id: activeItemBackground; - - anchors.bottom: parent.bottom; - anchors.bottomMargin: UM.Theme.sizes.default_margin.height; - - width: UM.Theme.sizes.button.width; - height: UM.Theme.sizes.button.height * 2; - - opacity: panelBackground.opacity; - - color: UM.Theme.colors.tool_panel_background - - function setActive(new_x) { - x = new_x; - } - } + height: buttons.height RowLayout { id: buttons; anchors.bottom: parent.bottom; anchors.left: parent.left; - - spacing: UM.Theme.sizes.default_margin.width * 2; + spacing: 1 Repeater { id: repeat @@ -51,7 +32,6 @@ Item { checkable: true; checked: model.active; - onCheckedChanged: if (checked) activeItemBackground.setActive(x); style: UM.Theme.styles.tool_button; @@ -65,21 +45,28 @@ Item { } } - UM.AngledCornerRectangle { + Rectangle { + width: base.width - 10 + height: base.height + z: parent.z - 1 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + color: UM.Theme.colors.button_lining + } + + Rectangle { id: panelBackground; anchors.left: parent.left; - anchors.bottom: buttons.top; - anchors.bottomMargin: UM.Theme.sizes.default_margin.height; + anchors.top: buttons.bottom; - width: panel.item ? Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width, activeItemBackground.x + activeItemBackground.width) : 0; + width: panel.item ? Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width) : 0; height: panel.item ? panel.height + 2 * UM.Theme.sizes.default_margin.height : 0; opacity: panel.item ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } color: UM.Theme.colors.tool_panel_background; - cornerSize: width > 0 ? UM.Theme.sizes.default_margin.width : 0; Loader { id: panel diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index 1c1b2ac6d3..081c6b65bf 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -10,7 +10,8 @@ import QtQuick.Controls.Styles 1.1 import UM 1.0 as UM import ".." -ColumnLayout { +ColumnLayout +{ id: wizardPage property string title property int pageWidth @@ -20,33 +21,34 @@ ColumnLayout { SystemPalette{id: palette} signal reloadModel(var newModel) - signal closeWizard() width: wizardPage.pageWidth height: wizardPage.pageHeight - Connections { + Connections + { target: elementRoot - onFinalClicked: {//You can add functions here that get triggered when the final button is clicked in the wizard-element + onNextClicked: //You can add functions here that get triggered when the final button is clicked in the wizard-element + { saveMachine() } - onResize: { - wizardPage.width = pageWidth - wizardPage.height = pageHeight - } } - function lineManufacturers(manufacturer){ + 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]){ + 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 @@ -54,7 +56,8 @@ ColumnLayout { font.pointSize: 18; } - Label { + Label + { id: subTitle anchors.left: parent.left anchors.top: title.bottom @@ -62,21 +65,25 @@ ColumnLayout { text: qsTr("Please select the type of printer:"); } - ScrollView { + ScrollView + { id: machinesHolder anchors.left: parent.left anchors.top: subTitle.bottom implicitWidth: wizardPage.width- UM.Theme.sizes.default_margin.width implicitHeight: wizardPage.height - subTitle.height - title.height - (machineNameHolder.height * 2) - Component { + Component + { id: machineDelegate - ColumnLayout { + ColumnLayout + { id: machineLayout spacing: 0 anchors.left: parent.left anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width - function showManufacturer(){ + function showManufacturer() + { if (model.manufacturer == UM.Models.availableMachinesModel.getItem(index - 1).manufacturer){ return false } @@ -84,7 +91,8 @@ ColumnLayout { return true } } - height: { + 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()) @@ -92,31 +100,37 @@ ColumnLayout { else return 0 } - Behavior on height{ + Behavior on height + { NumberAnimation { target: machineLayout; property: "height"; duration: 200} } - Button { + 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: { + text: + { if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer) return model.manufacturer + " ▼" else return model.manufacturer + " ►" } - style: ButtonStyle { - background: Rectangle { + 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 { + label: Text + { renderType: Text.NativeRendering horizontalAlignment: Text.AlignLeft text: control.text @@ -124,20 +138,23 @@ ColumnLayout { font.bold: true } } - MouseArea { + MouseArea + { id: mousearea hoverEnabled: true anchors.fill: parent onEntered: manufacturer.backgroundColor = palette.light onExited: manufacturer.backgroundColor = "transparent" - onClicked: { + onClicked: + { wizardPage.manufacturerIndex = wizardPage.manufacturers.indexOf(model.manufacturer) machineList.currentIndex = index } } } - RadioButton { + 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 @@ -149,13 +166,15 @@ ColumnLayout { exclusiveGroup: printerGroup; text: model.name onClicked: machineList.currentIndex = index; - function getAnimationTime(time){ + function getAnimationTime(time) + { if (machineButton.opacity == 0) return time else return 0 } - Label { + Label + { id: author visible: model.author != "Ultimaker" ? true : false height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0 @@ -169,8 +188,10 @@ ColumnLayout { font: UM.Theme.fonts.caption; color: palette.mid } - Behavior on opacity { - SequentialAnimation { + Behavior on opacity + { + SequentialAnimation + { PauseAnimation { duration: machineButton.getAnimationTime(100) } NumberAnimation { properties:"opacity"; duration: machineButton.getAnimationTime(200) } } @@ -180,12 +201,16 @@ ColumnLayout { } } - ListView { + 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"){ + property int otherMachinesIndex: + { + for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) + { + if (UM.Models.availableMachinesModel.getItem(i).manufacturer != "Ultimaker") + { return i } } @@ -197,16 +222,19 @@ ColumnLayout { } } - Item{ + Item + { id: machineNameHolder height: childrenRect.height anchors.top: machinesHolder.bottom - Label { + Label + { id: insertNameLabel //: Add Printer wizard field label text: qsTr("Printer Name:"); } - TextField { + TextField + { id: machineName; anchors.top: insertNameLabel.bottom text: machineList.model.getItem(machineList.currentIndex).name @@ -217,38 +245,30 @@ ColumnLayout { ExclusiveGroup { id: printerGroup; } - function saveMachine(){ - if(machineList.currentIndex != -1) { + function saveMachine() + { + if(machineList.currentIndex != -1) + { UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text) - - var chosenMachine = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).name - var originalString = "Ultimaker Original" - var originalPlusString = "Ultimaker Original+" - - if (chosenMachine == originalString | chosenMachine == originalPlusString ){ - wizardPage.reloadModel([ - { - title: "Select Upgraded Parts", - page: "SelectUpgradedParts.qml" - }, - { - title: "Upgrade Ultimaker Firmware", - page: "UpgradeFirmware.qml" - }, - { - title: "Ultimaker Checkup", - page: "UltimakerCheckup.qml" - }, - { - title: "Bedleveling Wizard", - page: "Bedleveling.qml" - } - ] - ) + var pages = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).pages + var old_page_count = elementRoot.getPageCount() + // Delete old pages (if any) + for (var i = old_page_count - 1; i > 0; i--) + { + elementRoot.removePage(i) + elementRoot.currentPage = 0 } - else { - wizardPage.closeWizard() + // Insert new pages (if any) + for(var i = 0; i < pages.count; i++) + { + elementRoot.insertPage(pages.getItem(i).page + ".qml",pages.getItem(i).title,i + 1) + } + + // Hack to ensure the current page is set correctly + if(old_page_count == 1) + { + elementRoot.currentPage += 1 } } } diff --git a/resources/qml/WizardPages/UltimakerCheckup.qml b/resources/qml/WizardPages/UltimakerCheckup.qml index b980681662..f67694e03a 100644 --- a/resources/qml/WizardPages/UltimakerCheckup.qml +++ b/resources/qml/WizardPages/UltimakerCheckup.qml @@ -55,7 +55,6 @@ Column TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name - } Item diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index b96c7964f2..d06ecf49f3 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -4,7 +4,7 @@ "author": "other", "manufacturer": "other", - "add_pages": [{"page": "AddMachine", "title": "Add new printer"}], + "add_pages": [], "machine_settings": { "machine_start_gcode": { diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index e7794746f5..77b1d2852e 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -90,34 +90,32 @@ QtObject { property Component tool_button: Component { ButtonStyle { background: Item { + ///////////TODO CHANGE SIZES!! implicitWidth: UM.Theme.sizes.button.width; implicitHeight: UM.Theme.sizes.button.height; Rectangle { - anchors.bottom: parent.verticalCenter; + id: tool_button_background + anchors.top: parent.verticalCenter; width: parent.width; + ///////////TODO CHANGE LABELHEIGHT!! height: control.hovered ? parent.height / 2 + label.height : 0; Behavior on height { NumberAnimation { duration: 100; } } opacity: control.hovered ? 1.0 : 0.0; Behavior on opacity { NumberAnimation { duration: 100; } } - Rectangle { - anchors.horizontalCenter: parent.horizontalCenter; - width: childrenRect.width; - height: childrenRect.height; - - Label { - id: label - text: control.text.replace("&", ""); - font: UM.Theme.fonts.button_tooltip; - color: UM.Theme.colors.button_tooltip_text; - } + Label { + id: label + anchors.bottom: parent.bottom + text: control.text.replace("&", ""); + font: UM.Theme.fonts.button_tooltip; + color: UM.Theme.colors.button_tooltip_text; } } - UM.AngledCornerRectangle { + Rectangle { id: buttonFace; anchors.fill: parent; @@ -138,7 +136,6 @@ QtObject { } } Behavior on color { ColorAnimation { duration: 50; } } - cornerSize: UM.Theme.sizes.default_margin.width; Label { anchors.right: parent.right; diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 011b60983c..b600db1c2c 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -70,6 +70,7 @@ "button_hover": [140, 144, 154, 255], "button_active": [12, 169, 227, 255], "button_active_hover": [34, 150, 199, 255], + "button_lining": [140, 144, 154, 255], "button_text": [255, 255, 255, 255], "button_disabled": [245, 245, 245, 255], "button_tooltip_text": [35, 35, 35, 255],