From 2aac62f55b6c0f10e677cb38850308091e90a3ef Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 22 Feb 2016 14:20:35 +0100 Subject: [PATCH 01/15] Remove variant setting overrides from machine settings These will be implemented by the new profiles. Contributes to issue CURA-892. --- resources/machines/ultimaker2plus_025.json | 10 ---------- resources/machines/ultimaker2plus_040.json | 5 +---- resources/machines/ultimaker2plus_060.json | 12 ------------ resources/machines/ultimaker2plus_080.json | 13 ------------- 4 files changed, 1 insertion(+), 39 deletions(-) diff --git a/resources/machines/ultimaker2plus_025.json b/resources/machines/ultimaker2plus_025.json index b51af3cafc..d4ce8c9b4f 100644 --- a/resources/machines/ultimaker2plus_025.json +++ b/resources/machines/ultimaker2plus_025.json @@ -13,16 +13,6 @@ "overrides": { "machine_nozzle_size": { "default": 0.25 }, - - "layer_height": { "default": 0.06 }, - "layer_height_0": { "default": 0.15 }, - - "infill_sparse_density": { "default": 12 }, - "speed_print": { "default": 30 }, - "speed_wall": { "inherit_function": "parent_value / 30 * 20" }, - "speed_wall_x": { "inherit_function": "speed_print / 30 * 25" }, - "speed_topbottom": { "inherit_function": "parent_value / 30 * 20" }, - "coasting_volume": { "default": 0.1 }, "coasting_min_volume": { "default": 0.17 } } diff --git a/resources/machines/ultimaker2plus_040.json b/resources/machines/ultimaker2plus_040.json index 1cb7383b18..33afefed12 100644 --- a/resources/machines/ultimaker2plus_040.json +++ b/resources/machines/ultimaker2plus_040.json @@ -12,9 +12,6 @@ "variant": "0.4 mm", "overrides": { - "machine_nozzle_size": { "default": 0.40 }, - - "wall_line_width_0": { "inherit_function": "parent_value * 0.875" }, - "skin_line_width": { "inherit_function": "parent_value * 0.875" } + "machine_nozzle_size": { "default": 0.40 } } } diff --git a/resources/machines/ultimaker2plus_060.json b/resources/machines/ultimaker2plus_060.json index 132fcfff45..4a4c8c8dd1 100644 --- a/resources/machines/ultimaker2plus_060.json +++ b/resources/machines/ultimaker2plus_060.json @@ -13,18 +13,6 @@ "overrides": { "machine_nozzle_size": { "default": 0.60 }, - - "layer_height": { "default": 0.15 }, - "layer_height_0": { "default": 0.4 }, - - "shell_thickness": { "default": 1.8 }, - - "infill_sparse_density": { "default": 15 }, - "speed_print": { "default": 55 }, - "speed_wall": { "inherit_function": "parent_value / 55 * 25" }, - "speed_wall_x": { "inherit_function": "speed_print / 55 * 40" }, - "speed_topbottom": { "inherit_function": "parent_value / 55 * 20" }, - "coasting_volume": { "default": 1.36 } } } diff --git a/resources/machines/ultimaker2plus_080.json b/resources/machines/ultimaker2plus_080.json index 02d5607552..48a0f75d02 100644 --- a/resources/machines/ultimaker2plus_080.json +++ b/resources/machines/ultimaker2plus_080.json @@ -13,19 +13,6 @@ "overrides": { "machine_nozzle_size": { "default": 0.80 }, - - "layer_height": { "default": 0.2 }, - "layer_height_0": { "default": 0.5 }, - - "shell_thickness": { "default": 2.4 }, - "top_bottom_thickness": { "inherit_function": "parent_value / 2" }, - - "infill_sparse_density": { "default": 16 }, - "speed_print": { "default": 40 }, - "speed_wall": { "inherit_function": "parent_value / 40 * 20" }, - "speed_wall_x": { "inherit_function": "speed_print / 40 * 30" }, - "speed_topbottom": { "inherit_function": "parent_value / 40 * 20" }, - "coasting_volume": { "default": 3.22 } } } From cbcbf3c9716819fc94192e5c91904acd1b0ee91d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 22 Feb 2016 15:45:21 +0100 Subject: [PATCH 02/15] Improve default support settings These were found by Paul to be better. I agree on the Touching Buildplate option being the one that the user most likely would use most often, and I am inclined to take his word on the support angle. --- resources/machines/fdmprinter.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index cbd7089976..0564ceea6d 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -1221,7 +1221,7 @@ "buildplate": "Touching Buildplate", "everywhere": "Everywhere" }, - "default": "everywhere", + "default": "buildplate", "enabled": "support_enable" }, "support_angle": { @@ -1231,7 +1231,7 @@ "type": "float", "min_value": "0", "max_value": "90", - "default": 60, + "default": 50, "visible": false, "enabled": "support_enable" }, From c50c223124241494a640c2fbcfd2c9979767b9c5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 23 Feb 2016 09:38:51 +0100 Subject: [PATCH 03/15] Rename variable for code style The code style specifies using lowercase with underscores. Contributes to issue CURA-864. --- .../CuraEngineBackend/ProcessSlicedObjectListJob.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py index 1aec739f92..6b74426cf4 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py @@ -24,7 +24,7 @@ class ProcessSlicedObjectListJob(Job): self._message = message self._scene = Application.getInstance().getController().getScene() self._progress = None - self._abortRequested = False + self._abort_requested = False ## Aborts the processing of layers. # @@ -33,14 +33,14 @@ class ProcessSlicedObjectListJob(Job): # requested and then stop processing by itself. There is no guarantee # that the abort will stop the job any time soon or even at all. def abort(self): - self._abortRequested = True + self._abort_requested = True def run(self): if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView": self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1) self._progress.show() Job.yieldThread() - if self._abortRequested: + if self._abort_requested: if self._progress: self._progress.hide() return @@ -57,7 +57,7 @@ class ProcessSlicedObjectListJob(Job): else: object_id_map[id(node)] = node Job.yieldThread() - if self._abortRequested: + if self._abort_requested: if self._progress: self._progress.hide() return @@ -113,7 +113,7 @@ class ProcessSlicedObjectListJob(Job): # TODO: Rebuild the layer data mesh once the layer has been processed. # This needs some work in LayerData so we can add the new layers instead of recreating the entire mesh. - if self._abortRequested: + if self._abort_requested: if self._progress: self._progress.hide() return @@ -123,7 +123,7 @@ class ProcessSlicedObjectListJob(Job): # We are done processing all the layers we got from the engine, now create a mesh out of the data layer_data.build() - if self._abortRequested: + if self._abort_requested: if self._progress: self._progress.hide() return From 720324f0c6f52738afe7db12865ed821f99abca6 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 21 Jan 2016 18:56:18 +0100 Subject: [PATCH 04/15] Replace Theme property accessors with getThing calls --- resources/qml/AboutDialog.qml | 2 +- resources/qml/Cura.qml | 36 +++---- resources/qml/JobSpecs.qml | 62 ++++++------- resources/qml/ProfileSetup.qml | 12 +-- resources/qml/SaveButton.qml | 93 ++++++++++--------- resources/qml/Sidebar.qml | 54 +++++------ resources/qml/SidebarHeader.qml | 38 ++++---- resources/qml/SidebarSimple.qml | 42 ++++----- resources/qml/SidebarTooltip.qml | 20 ++-- resources/qml/Toolbar.qml | 28 +++--- resources/qml/WizardPages/AddMachine.qml | 37 ++++++-- resources/qml/WizardPages/Bedleveling.qml | 14 +-- .../qml/WizardPages/SelectUpgradedParts.qml | 10 +- .../qml/WizardPages/UltimakerCheckup.qml | 22 ++--- resources/qml/WizardPages/UpgradeFirmware.qml | 14 +-- 15 files changed, 255 insertions(+), 229 deletions(-) diff --git a/resources/qml/AboutDialog.qml b/resources/qml/AboutDialog.qml index 48ecdf0563..e3e9f8e9b7 100644 --- a/resources/qml/AboutDialog.qml +++ b/resources/qml/AboutDialog.qml @@ -38,7 +38,7 @@ UM.Dialog id: version text: "Cura %1".arg(UM.Application.version) - font: UM.Theme.fonts.large + font: UM.Theme.getFont("large") anchors.horizontalCenter : logo.horizontalCenter anchors.horizontalCenterOffset : (logo.width * 0.25) anchors.top: logo.bottom diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f4ed262e1e..ca9faa4aee 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -337,8 +337,8 @@ UM.MainWindow { bottom: parent.bottom; right: sidebar.left; - bottomMargin: UM.Theme.sizes.default_margin.height; - rightMargin: UM.Theme.sizes.default_margin.width; + bottomMargin: UM.Theme.getSize("default_margin").height; + rightMargin: UM.Theme.getSize("default_margin").width; } } @@ -347,7 +347,7 @@ UM.MainWindow anchors { horizontalCenter: parent.horizontalCenter - horizontalCenterOffset: -(UM.Theme.sizes.sidebar.width/ 2) + horizontalCenterOffset: -(UM.Theme.getSize("sidebar").width/ 2) top: parent.verticalCenter; bottom: parent.bottom; } @@ -361,10 +361,10 @@ UM.MainWindow //anchors.right: parent.right; //anchors.bottom: parent.bottom anchors.top: viewModeButton.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height; + anchors.topMargin: UM.Theme.getSize("default_margin").height; anchors.left: viewModeButton.left; //anchors.bottom: buttons.top; - //anchors.bottomMargin: UM.Theme.sizes.default_margin.height; + //anchors.bottomMargin: UM.Theme.getSize("default_margin").height; height: childrenRect.height; @@ -376,15 +376,15 @@ UM.MainWindow id: openFileButton; //style: UM.Backend.progress < 0 ? UM.Theme.styles.open_file_button : UM.Theme.styles.tool_button; text: catalog.i18nc("@action:button","Open File"); - iconSource: UM.Theme.icons.load + iconSource: UM.Theme.getIcon("load") style: UM.Theme.styles.tool_button tooltip: ''; anchors { top: parent.top; - //topMargin: UM.Theme.sizes.loadfile_margin.height + //topMargin: UM.Theme.getSize("loadfile_margin").height left: parent.left; - //leftMargin: UM.Theme.sizes.loadfile_margin.width + //leftMargin: UM.Theme.getSize("loadfile_margin").width } action: actions.open; } @@ -395,14 +395,14 @@ UM.MainWindow anchors { left: parent.left - leftMargin: UM.Theme.sizes.default_margin.width; + leftMargin: UM.Theme.getSize("default_margin").width; bottom: parent.bottom - bottomMargin: UM.Theme.sizes.default_margin.height; + bottomMargin: UM.Theme.getSize("default_margin").height; } source: UM.Theme.images.logo; - width: UM.Theme.sizes.logo.width; - height: UM.Theme.sizes.logo.height; + width: UM.Theme.getSize("logo").width; + height: UM.Theme.getSize("logo").height; z: -1; sourceSize.width: width; @@ -416,11 +416,11 @@ UM.MainWindow anchors { top: toolbar.bottom; - topMargin: UM.Theme.sizes.window_margin.height; + topMargin: UM.Theme.getSize("window_margin").height; left: parent.left; } text: catalog.i18nc("@action:button","View Mode"); - iconSource: UM.Theme.icons.viewmode; + iconSource: UM.Theme.getIcon("viewmode"); style: UM.Theme.styles.tool_button; tooltip: ''; @@ -453,7 +453,7 @@ UM.MainWindow anchors { top: openFileButton.bottom; - topMargin: UM.Theme.sizes.window_margin.height; + topMargin: UM.Theme.getSize("window_margin").height; left: parent.left; } } @@ -469,7 +469,7 @@ UM.MainWindow right: parent.right; } - width: UM.Theme.sizes.sidebar.width; + width: UM.Theme.getSize("sidebar").width; addMachineAction: actions.addMachine; configureMachinesAction: actions.configureMachines; @@ -479,8 +479,8 @@ UM.MainWindow Rectangle { - x: base.mouseX + UM.Theme.sizes.default_margin.width; - y: base.mouseY + UM.Theme.sizes.default_margin.height; + x: base.mouseX + UM.Theme.getSize("default_margin").width; + y: base.mouseY + UM.Theme.getSize("default_margin").height; width: childrenRect.width; height: childrenRect.height; diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 81df2bb08a..bf3968329c 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -25,7 +25,7 @@ Rectangle { property variant printDuration: PrintInformation.currentPrintTime; property real printMaterialAmount: PrintInformation.materialAmount; - width: UM.Theme.sizes.jobspecs.width + width: UM.Theme.getSize("jobspecs").width height: childrenRect.height color: "transparent" @@ -80,7 +80,7 @@ Rectangle { id: jobNameRow anchors.top: parent.top anchors.right: parent.right - height: UM.Theme.sizes.jobspecs_line.height + height: UM.Theme.getSize("jobspecs_line").height visible: base.activity Item @@ -93,8 +93,8 @@ Rectangle { id: printJobPencilIcon anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.sizes.save_button_specs_icons.width - height: UM.Theme.sizes.save_button_specs_icons.height + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height onClicked: { @@ -108,12 +108,12 @@ Rectangle { color: "transparent" UM.RecolorImage { - width: UM.Theme.sizes.save_button_specs_icons.width - height: UM.Theme.sizes.save_button_specs_icons.height + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height sourceSize.width: width sourceSize.height: width - color: control.hovered ? UM.Theme.colors.setting_control_button_hover : UM.Theme.colors.text - source: UM.Theme.icons.pencil; + color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("text"); + source: UM.Theme.getIcon("pencil"); } } } @@ -123,8 +123,8 @@ Rectangle { { id: printJobTextfield anchors.right: printJobPencilIcon.left - anchors.rightMargin: UM.Theme.sizes.default_margin.width/2 - height: UM.Theme.sizes.jobspecs_line.height + anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 + height: UM.Theme.getSize("jobspecs_line").height width: base.width property int unremovableSpacing: 5 text: '' @@ -144,8 +144,8 @@ Rectangle { regExp: /^[^\\ \/ \.]*$/ } style: TextFieldStyle{ - textColor: UM.Theme.colors.setting_control_text; - font: UM.Theme.fonts.default_bold; + textColor: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default_bold"); background: Rectangle { opacity: 0 border.width: 0 @@ -159,10 +159,10 @@ Rectangle { id: boundingSpec anchors.top: jobNameRow.bottom anchors.right: parent.right - height: UM.Theme.sizes.jobspecs_line.height + height: UM.Theme.getSize("jobspecs_line").height verticalAlignment: Text.AlignVCenter - font: UM.Theme.fonts.small - color: UM.Theme.colors.text_subtext + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") text: Printer.getSceneBoundingBoxString } @@ -170,7 +170,7 @@ Rectangle { id: specsRow anchors.top: boundingSpec.bottom anchors.right: parent.right - height: UM.Theme.sizes.jobspecs_line.height + height: UM.Theme.getSize("jobspecs_line").height Item{ width: parent.width @@ -179,42 +179,42 @@ Rectangle { UM.RecolorImage { id: timeIcon anchors.right: timeSpec.left - anchors.rightMargin: UM.Theme.sizes.default_margin.width/2 + anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.sizes.save_button_specs_icons.width - height: UM.Theme.sizes.save_button_specs_icons.height + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height sourceSize.width: width sourceSize.height: width - color: UM.Theme.colors.text_subtext - source: UM.Theme.icons.print_time; + color: UM.Theme.getColor("text_subtext") + source: UM.Theme.getIcon("print_time"); } Label{ id: timeSpec anchors.right: lengthIcon.left - anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.fonts.small - color: UM.Theme.colors.text_subtext + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) } UM.RecolorImage { id: lengthIcon anchors.right: lengthSpec.left - anchors.rightMargin: UM.Theme.sizes.default_margin.width/2 + anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.sizes.save_button_specs_icons.width - height: UM.Theme.sizes.save_button_specs_icons.height + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height sourceSize.width: width sourceSize.height: width - color: UM.Theme.colors.text_subtext - source: UM.Theme.icons.category_material; + color: UM.Theme.getColor("text_subtext") + source: UM.Theme.getIcon("category_material"); } Label{ id: lengthSpec anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.fonts.small - color: UM.Theme.colors.text_subtext + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") text: base.printMaterialAmount <= 0 ? catalog.i18nc("@label", "0.0 m") : catalog.i18nc("@label", "%1 m").arg(base.printMaterialAmount) } } diff --git a/resources/qml/ProfileSetup.qml b/resources/qml/ProfileSetup.qml index cf67a88108..e8d966ae40 100644 --- a/resources/qml/ProfileSetup.qml +++ b/resources/qml/ProfileSetup.qml @@ -18,18 +18,18 @@ Item{ Rectangle{ id: globalProfileRow anchors.top: base.top - height: UM.Theme.sizes.sidebar_setup.height + height: UM.Theme.getSize("sidebar_setup").height width: base.width Label{ id: globalProfileLabel anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.verticalCenter: parent.verticalCenter text: catalog.i18nc("@label","Profile:"); width: parent.width/100*45 - font: UM.Theme.fonts.default; - color: UM.Theme.colors.text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); } @@ -37,9 +37,9 @@ Item{ id: globalProfileSelection text: UM.MachineManager.activeProfile width: parent.width/100*55 - height: UM.Theme.sizes.setting_control.height + height: UM.Theme.getSize("setting_control").height anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter tooltip: UM.MachineManager.activeProfile style: UM.Theme.styles.sidebar_header_button diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 1ec031aac8..a0d89bd4a9 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -16,7 +16,7 @@ Rectangle { property int backendState: UM.Backend.state; property bool activity: Printer.getPlatformActivity; //Behavior on progress { NumberAnimation { duration: 250; } } - property int totalHeight: childrenRect.height + UM.Theme.sizes.default_margin.height + property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height property string fileBaseName property string statusText: { if(base.backendState == 0) { @@ -34,33 +34,39 @@ Rectangle { Label { id: statusLabel - width: parent.width - 2 * UM.Theme.sizes.default_margin.width + width: parent.width - 2 * UM.Theme.getSize("default_margin").width anchors.top: parent.top anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width - color: UM.Theme.colors.text - font: UM.Theme.fonts.large + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("large") text: statusText; } Rectangle{ id: progressBar - width: parent.width - 2 * UM.Theme.sizes.default_margin.width - height: UM.Theme.sizes.progressbar.height + width: parent.width - 2 * UM.Theme.getSize("default_margin").width + height: UM.Theme.getSize("progressbar").height anchors.top: statusLabel.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height/4 + anchors.topMargin: UM.Theme.getSize("default_margin").height/4 anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width - radius: UM.Theme.sizes.progressbar_radius.width - color: UM.Theme.colors.progressbar_background + anchors.leftMargin: UM.Theme.getSize("default_margin").width + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_background") Rectangle{ width: Math.max(parent.width * base.progress) height: parent.height +<<<<<<< 041fa2b3592e015eebe779169c9d7f4565b3a788 color: UM.Theme.colors.progressbar_control radius: UM.Theme.sizes.progressbar_radius.width visible: base.backendState == 1 ? true : false +======= + color: UM.Theme.getColor("progressbar_control") + radius: UM.Theme.getSize("progressbar_radius").width + visible: base.progress > 0.99 ? false : true +>>>>>>> Replace Theme property accessors with getThing calls } } @@ -69,16 +75,16 @@ Rectangle { width: base.width height: saveToButton.height anchors.top: progressBar.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left Button { id: saveToButton property int resizedWidth - x: base.width - saveToButton.resizedWidth - UM.Theme.sizes.default_margin.width - UM.Theme.sizes.save_button_save_to_button.height + UM.Theme.sizes.save_button_save_to_button.width + x: base.width - saveToButton.resizedWidth - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("save_button_save_to_button").height + UM.Theme.getSize("save_button_save_to_button").width tooltip: UM.OutputDeviceManager.activeDeviceDescription; enabled: base.backendState == 2 && base.activity == true - height: UM.Theme.sizes.save_button_save_to_button.height + height: UM.Theme.getSize("save_button_save_to_button").height width: 150 anchors.top:parent.top text: UM.OutputDeviceManager.activeDeviceShortDescription @@ -91,26 +97,26 @@ Rectangle { background: Rectangle { //opacity: control.enabled ? 1.0 : 0.5 //Behavior on opacity { NumberAnimation { duration: 50; } } - border.width: UM.Theme.sizes.default_lining.width - border.color: !control.enabled ? UM.Theme.colors.action_button_disabled_border : - control.pressed ? UM.Theme.colors.action_button_active_border : - control.hovered ? UM.Theme.colors.action_button_hovered_border : UM.Theme.colors.action_button_border - color: !control.enabled ? UM.Theme.colors.action_button_disabled : - control.pressed ? UM.Theme.colors.action_button_active : - control.hovered ? UM.Theme.colors.action_button_hovered : UM.Theme.colors.action_button + border.width: UM.Theme.getSize("default_lining").width + border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : + control.pressed ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + color: !control.enabled ? UM.Theme.getColor("action_button_disabled") : + control.pressed ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") Behavior on color { ColorAnimation { duration: 50; } } width: { - saveToButton.resizedWidth = actualLabel.width + (UM.Theme.sizes.default_margin.width * 2) + saveToButton.resizedWidth = actualLabel.width + (UM.Theme.getSize("default_margin").width * 2) return saveToButton.resizedWidth } Label { id: actualLabel //Behavior on opacity { NumberAnimation { duration: 50; } } anchors.centerIn: parent - color: !control.enabled ? UM.Theme.colors.action_button_disabled_text : - control.pressed ? UM.Theme.colors.action_button_active_text : - control.hovered ? UM.Theme.colors.action_button_hovered_text : UM.Theme.colors.action_button_text - font: UM.Theme.fonts.action_button + color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : + control.pressed ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text") + font: UM.Theme.getFont("action_button") text: control.text; } } @@ -123,39 +129,40 @@ Rectangle { tooltip: catalog.i18nc("@info:tooltip","Select the active output device"); anchors.top:parent.top anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width - width: UM.Theme.sizes.save_button_save_to_button.height - height: UM.Theme.sizes.save_button_save_to_button.height + + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("save_button_save_to_button").height + height: UM.Theme.getSize("save_button_save_to_button").height enabled: base.backendState == 2 && base.activity == true + //iconSource: UM.Theme.icons[UM.OutputDeviceManager.activeDeviceIconName]; style: ButtonStyle { background: Rectangle { id: deviceSelectionIcon - border.width: UM.Theme.sizes.default_lining.width - border.color: !control.enabled ? UM.Theme.colors.action_button_disabled_border : - control.pressed ? UM.Theme.colors.action_button_active_border : - control.hovered ? UM.Theme.colors.action_button_hovered_border : UM.Theme.colors.action_button_border - color: !control.enabled ? UM.Theme.colors.action_button_disabled : - control.pressed ? UM.Theme.colors.action_button_active : - control.hovered ? UM.Theme.colors.action_button_hovered : UM.Theme.colors.action_button + border.width: UM.Theme.getSize("default_lining").width + border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : + control.pressed ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + color: !control.enabled ? UM.Theme.getColor("action_button_disabled") : + control.pressed ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") Behavior on color { ColorAnimation { duration: 50; } } anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.save_button_text_margin.width / 2; + anchors.leftMargin: UM.Theme.getSize("save_button_text_margin").width / 2; width: parent.height height: parent.height UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter - width: UM.Theme.sizes.standard_arrow.width - height: UM.Theme.sizes.standard_arrow.height + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: height - color: !control.enabled ? UM.Theme.colors.action_button_disabled_text : - control.pressed ? UM.Theme.colors.action_button_active_text : - control.hovered ? UM.Theme.colors.action_button_hovered_text : UM.Theme.colors.action_button_text; - source: UM.Theme.icons.arrow_bottom; + color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : + control.pressed ? UM.Theme.getColor("action_button_active_text") : control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text"); + source: UM.Theme.getIcon("arrow_bottom"); } } label: Label{ } diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 2778e9d779..fe7cfd080b 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -18,7 +18,7 @@ Rectangle property Action manageProfilesAction; property int currentModeIndex; - color: UM.Theme.colors.sidebar; + color: UM.Theme.getColor("sidebar"); UM.I18nCatalog { id: catalog; name:"cura"} function showTooltip(item, position, text) @@ -56,10 +56,10 @@ Rectangle Rectangle { id: headerSeparator width: parent.width - height: UM.Theme.sizes.sidebar_lining.height - color: UM.Theme.colors.sidebar_lining + height: UM.Theme.getSize("sidebar_lining").height + color: UM.Theme.getColor("sidebar_lining") anchors.top: header.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height } ProfileSetup { @@ -67,7 +67,7 @@ Rectangle addProfileAction: base.addProfileAction manageProfilesAction: base.manageProfilesAction anchors.top: settingsModeSelection.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width height: totalHeightProfileSetup } @@ -94,22 +94,22 @@ Rectangle id: settingsModeLabel text: catalog.i18nc("@label:listbox","Setup"); anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.top: headerSeparator.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width/100*45 - font: UM.Theme.fonts.large; - color: UM.Theme.colors.text + font: UM.Theme.getFont("large"); + color: UM.Theme.getColor("text") } Rectangle { id: settingsModeSelection width: parent.width/100*55 - height: UM.Theme.sizes.sidebar_header_mode_toggle.height + height: UM.Theme.getSize("sidebar_header_mode_toggle").height anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.top: headerSeparator.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height Component{ id: wizardDelegate Button { @@ -126,20 +126,20 @@ Rectangle style: ButtonStyle { background: Rectangle { - border.width: UM.Theme.sizes.default_lining.width - border.color: control.checked ? UM.Theme.colors.toggle_checked_border : - control.pressed ? UM.Theme.colors.toggle_active_border : - control.hovered ? UM.Theme.colors.toggle_hovered_border : UM.Theme.colors.toggle_unchecked_border - color: control.checked ? UM.Theme.colors.toggle_checked : - control.pressed ? UM.Theme.colors.toggle_active : - control.hovered ? UM.Theme.colors.toggle_hovered : UM.Theme.colors.toggle_unchecked + border.width: UM.Theme.getSize("default_lining").width + border.color: control.checked ? UM.Theme.getColor("toggle_checked_border : ") + control.pressed ? UM.Theme.getColor("toggle_active_border :") + control.hovered ? UM.Theme.getColor("toggle_hovered_border : UM").Theme.getColor("toggle_unchecked_border") + color: control.checked ? UM.Theme.getColor("toggle_checked : ") + control.pressed ? UM.Theme.getColor("toggle_active :") + control.hovered ? UM.Theme.getColor("toggle_hovered : UM").Theme.getColor("toggle_unchecked") Behavior on color { ColorAnimation { duration: 50; } } Label { anchors.centerIn: parent - color: control.checked ? UM.Theme.colors.toggle_checked_text : - control.pressed ? UM.Theme.colors.toggle_active_text : - control.hovered ? UM.Theme.colors.toggle_hovered_text : UM.Theme.colors.toggle_unchecked_text - font: UM.Theme.fonts.default + color: control.checked ? UM.Theme.getColor("toggle_checked_text : ") + control.pressed ? UM.Theme.getColor("toggle_active_text :") + control.hovered ? UM.Theme.getColor("toggle_hovered_text : UM").Theme.getColor("toggle_unchecked_text") + font: UM.Theme.getFont("default") text: control.text; } } @@ -165,7 +165,7 @@ Rectangle anchors.bottom: footerSeparator.top anchors.top: profileItem.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: base.left anchors.right: base.right @@ -201,10 +201,10 @@ Rectangle Rectangle { id: footerSeparator width: parent.width - height: UM.Theme.sizes.sidebar_lining.height - color: UM.Theme.colors.sidebar_lining + height: UM.Theme.getSize("sidebar_lining").height + color: UM.Theme.getColor("sidebar_lining") anchors.bottom: saveButton.top - anchors.bottomMargin: UM.Theme.sizes.default_margin.height + anchors.bottomMargin: UM.Theme.getSize("default_margin").height } SaveButton diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index b1d54112bb..2875332872 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -21,27 +21,27 @@ Item width: base.width height: 0 anchors.top: parent.top - color: UM.Theme.colors.sidebar_header_bar + color: UM.Theme.getColor("sidebar_header_bar") } Label{ id: printjobTabLabel text: catalog.i18nc("@label:listbox","Print Job"); anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.top: sidebarTabRow.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width/100*45 - font: UM.Theme.fonts.large; - color: UM.Theme.colors.text + font: UM.Theme.getFont("large"); + color: UM.Theme.getColor("text") } Rectangle { id: machineSelectionRow width: base.width - height: UM.Theme.sizes.sidebar_setup.height + height: UM.Theme.getSize("sidebar_setup").height anchors.top: printjobTabLabel.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.horizontalCenter: parent.horizontalCenter Label{ @@ -49,20 +49,20 @@ Item //: Machine selection label text: catalog.i18nc("@label:listbox","Printer:"); anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.fonts.default; - color: UM.Theme.colors.text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); } ToolButton { id: machineSelection text: UM.MachineManager.activeMachineInstance; width: parent.width/100*55 - height: UM.Theme.sizes.setting_control.height + height: UM.Theme.getSize("setting_control").height tooltip: UM.MachineManager.activeMachineInstance; anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter style: UM.Theme.styles.sidebar_header_button @@ -97,30 +97,30 @@ Item Rectangle { id: variantRow anchors.top: machineSelectionRow.bottom - anchors.topMargin: UM.MachineManager.hasVariants ? UM.Theme.sizes.default_margin.height : 0 + anchors.topMargin: UM.MachineManager.hasVariants ? UM.Theme.getSize("default_margin").height : 0 width: base.width - height: UM.MachineManager.hasVariants ? UM.Theme.sizes.sidebar_setup.height : 0 + height: UM.MachineManager.hasVariants ? UM.Theme.getSize("sidebar_setup").height : 0 visible: UM.MachineManager.hasVariants Label{ id: variantLabel text: catalog.i18nc("@label","Nozzle:"); anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.verticalCenter: parent.verticalCenter width: parent.width/100*45 - font: UM.Theme.fonts.default; - color: UM.Theme.colors.text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); } ToolButton { id: variantSelection text: UM.MachineManager.activeMachineVariant width: parent.width/100*55 - height: UM.Theme.sizes.setting_control.height + height: UM.Theme.getSize("setting_control").height tooltip: UM.MachineManager.activeMachineVariant; anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter style: UM.Theme.styles.sidebar_header_button diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index c51b07b1f4..a163f2db42 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -27,19 +27,19 @@ Item id: infillCellLeft anchors.top: parent.top anchors.left: parent.left - width: base.width/100* 35 - UM.Theme.sizes.default_margin.width + width: base.width/100* 35 - UM.Theme.getSize("default_margin").width height: childrenRect.height Label{ id: infillLabel //: Infill selection label text: catalog.i18nc("@label","Infill:"); - font: UM.Theme.fonts.default; - color: UM.Theme.colors.text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); anchors.top: parent.top - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width } } @@ -48,7 +48,7 @@ Item height: childrenRect.height; width: base.width / 100 * 65 - spacing: UM.Theme.sizes.default_margin.width + spacing: UM.Theme.getSize("default_margin").width anchors.left: infillCellLeft.right anchors.top: infillCellLeft.top @@ -81,23 +81,23 @@ Item Rectangle{ id: infillIconLining - width: (infillCellRight.width - 3 * UM.Theme.sizes.default_margin.width) / 4; + width: (infillCellRight.width - 3 * UM.Theme.getSize("default_margin").width) / 4; height: width - border.color: (infillListView.activeIndex == index) ? UM.Theme.colors.setting_control_selected : - (mousearea.containsMouse ? UM.Theme.colors.setting_control_border_highlight : UM.Theme.colors.setting_control_border) - border.width: UM.Theme.sizes.default_lining.width - color: infillListView.activeIndex == index ? UM.Theme.colors.setting_control_selected : "transparent" + border.color: (infillListView.activeIndex == index) ? UM.Theme.getColor("setting_control_selected :") + (mousearea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight : UM").Theme.getColor("setting_control_border)") + border.width: UM.Theme.getSize("default_lining").width + color: infillListView.activeIndex == index ? UM.Theme.getColor("setting_control_selected : "transparent"") UM.RecolorImage { id: infillIcon anchors.fill: parent; - anchors.margins: UM.Theme.sizes.infill_button_margin.width + anchors.margins: UM.Theme.getSize("infill_button_margin").width sourceSize.width: width sourceSize.height: width source: UM.Theme.icons[model.icon]; - color: (infillListView.activeIndex == index) ? UM.Theme.colors.text_white : UM.Theme.colors.text + color: (infillListView.activeIndex == index) ? UM.Theme.getColor("text_white : UM").Theme.getColor("text") } MouseArea { @@ -122,7 +122,7 @@ Item id: infillLabel anchors.top: infillIconLining.bottom anchors.horizontalCenter: infillIconLining.horizontalCenter - color: infillListView.activeIndex == index ? UM.Theme.colors.setting_control_text : UM.Theme.colors.setting_control_border + color: infillListView.activeIndex == index ? UM.Theme.getColor("setting_control_text : UM").Theme.getColor("setting_control_border") text: name } } @@ -172,25 +172,25 @@ Item Rectangle { id: helpersCellLeft anchors.top: infillCellRight.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left - width: parent.width/100*35 - UM.Theme.sizes.default_margin.width + width: parent.width/100*35 - UM.Theme.getSize("default_margin").width height: childrenRect.height Label{ anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width //: Helpers selection label text: catalog.i18nc("@label:listbox","Helpers:"); - font: UM.Theme.fonts.default; - color: UM.Theme.colors.text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); } } Rectangle { id: helpersCellRight anchors.top: helpersCellLeft.top anchors.left: helpersCellLeft.right - width: parent.width/100*65 - UM.Theme.sizes.default_margin.width + width: parent.width/100*65 - UM.Theme.getSize("default_margin").width height: childrenRect.height CheckBox{ @@ -230,7 +230,7 @@ Item property bool hovered_ex: false anchors.top: brimCheckBox.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left //: Setting enable support checkbox diff --git a/resources/qml/SidebarTooltip.qml b/resources/qml/SidebarTooltip.qml index c51a33c611..1c7f4bcb76 100644 --- a/resources/qml/SidebarTooltip.qml +++ b/resources/qml/SidebarTooltip.qml @@ -11,11 +11,11 @@ import UM 1.0 as UM UM.PointingRectangle { id: base; - width: UM.Theme.sizes.tooltip.width; - height: label.height + UM.Theme.sizes.tooltip_margins.height * 2; - color: UM.Theme.colors.tooltip; + width: UM.Theme.getSize("tooltip").width; + height: label.height + UM.Theme.getSize("tooltip_margins").height * 2; + color: UM.Theme.getColor("tooltip"); - arrowSize: UM.Theme.sizes.default_arrow.width + arrowSize: UM.Theme.getSize("default_arrow").width opacity: 0; Behavior on opacity { NumberAnimation { duration: 100; } } @@ -28,7 +28,7 @@ UM.PointingRectangle { y = parent.height - base.height; } else { x = position.x - base.width; - y = position.y - UM.Theme.sizes.tooltip_arrow_margins.height; + y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height; } base.opacity = 1; target = Qt.point(40 , position.y) @@ -42,14 +42,14 @@ UM.PointingRectangle { id: label; anchors { top: parent.top; - topMargin: UM.Theme.sizes.tooltip_margins.height; + topMargin: UM.Theme.getSize("tooltip_margins").height; left: parent.left; - leftMargin: UM.Theme.sizes.tooltip_margins.width; + leftMargin: UM.Theme.getSize("tooltip_margins").width; right: parent.right; - rightMargin: UM.Theme.sizes.tooltip_margins.width; + rightMargin: UM.Theme.getSize("tooltip_margins").width; } wrapMode: Text.Wrap; - font: UM.Theme.fonts.default; - color: UM.Theme.colors.tooltip_text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("tooltip_text"); } } diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 46bafb9296..72b5a6d7da 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -20,7 +20,7 @@ Item { anchors.bottom: parent.bottom; anchors.left: parent.left; - spacing: UM.Theme.sizes.button_lining.width + spacing: UM.Theme.getSize("button_lining").width Repeater { id: repeat @@ -54,47 +54,47 @@ Item { id: panelBorder; anchors.left: parent.right; - anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.top: base.top; anchors.topMargin: base.activeY z: buttons.z -1 - target: Qt.point(parent.right, base.activeY + UM.Theme.sizes.button.height/2) - arrowSize: UM.Theme.sizes.default_arrow.width + target: Qt.point(parent.right, base.activeY + UM.Theme.getSize("button").height/2) + arrowSize: UM.Theme.getSize("default_arrow").width width: { if (panel.item && panel.width > 0){ - return Math.max(panel.width + 2 * UM.Theme.sizes.default_margin.width) + return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width) } else { return 0 } } - height: panel.item ? panel.height + 2 * UM.Theme.sizes.default_margin.height : 0; + height: panel.item ? panel.height + 2 * UM.Theme.getSize("default_margin").height : 0; opacity: panel.item ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } - color: UM.Theme.colors.lining; - //border.width: UM.Theme.sizes.default_lining.width - //border.color: UM.Theme.colors.lining + color: UM.Theme.getColor("lining"); + //border.width: UM.Theme.getSize("default_lining").width + //border.color: UM.Theme.getColor("lining") UM.PointingRectangle { id: panelBackground; - color: UM.Theme.colors.tool_panel_background; + color: UM.Theme.getColor("tool_panel_background"); anchors.fill: parent - anchors.margins: UM.Theme.sizes.default_lining.width + anchors.margins: UM.Theme.getSize("default_lining").width - target: Qt.point(-UM.Theme.sizes.default_margin.width, UM.Theme.sizes.button.height/2) + target: Qt.point(-UM.Theme.getSize("default_margin").width, UM.Theme.getSize("button").height/2) arrowSize: parent.arrowSize } Loader { id: panel - x: UM.Theme.sizes.default_margin.width; - y: UM.Theme.sizes.default_margin.height; + x: UM.Theme.getSize("default_margin").width; + y: UM.Theme.getSize("default_margin").height; source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : ""; enabled: UM.Controller.toolsEnabled; diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index 9bce4f3210..1a85ddd861 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -98,12 +98,12 @@ Item background: Rectangle { border.width: 0 color: "transparent"; - height: UM.Theme.sizes.standard_list_lineheight.height + height: UM.Theme.getSize("standard_list_lineheight").height width: machineList.width } label: Text { anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.standard_arrow.width + UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("standard_arrow").width + UM.Theme.getSize("default_margin").width text: control.text color: palette.windowText font.bold: true @@ -111,13 +111,13 @@ Item id: downArrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.left - anchors.rightMargin: UM.Theme.sizes.default_margin.width - width: UM.Theme.sizes.standard_arrow.width - height: UM.Theme.sizes.standard_arrow.height + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width color: palette.windowText - source: base.activeManufacturer == section ? UM.Theme.icons.arrow_bottom : UM.Theme.icons.arrow_right + source: base.activeManufacturer == section ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") } } } @@ -133,10 +133,10 @@ Item id: machineButton anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width + anchors.leftMargin: UM.Theme.getSize("standard_list_lineheight").width opacity: 1; - height: UM.Theme.sizes.standard_list_lineheight.height; + height: UM.Theme.getSize("standard_list_lineheight").height; checked: ListView.isCurrentItem; @@ -183,6 +183,25 @@ Item id: machineNameHolder anchors.bottom: parent.bottom; + Item + { + height: errorMessage.lineHeight + anchors.bottom: insertNameLabel.top + anchors.bottomMargin: insertNameLabel.height * errorMessage.lineCount + Label + { + id: errorMessage + property bool show: false + width: base.width + height: errorMessage.show ? errorMessage.lineHeight : 0 + visible: errorMessage.show + text: catalog.i18nc("@label", "This printer name has already been used. Please choose a different printer name."); + wrapMode: Text.WordWrap + Behavior on height {NumberAnimation {duration: 75; }} + color: UM.Theme.getColor("error") + } + } + Label { id: insertNameLabel @@ -192,7 +211,7 @@ Item { id: machineName; text: getMachineName() - implicitWidth: UM.Theme.sizes.standard_list_input.width + implicitWidth: UM.Theme.getSize("standard_list_input").width } } diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index a6c471341c..18b58497b2 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -47,7 +47,7 @@ Item { id: pageDescription anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label","To make sure your prints will come out great, you can now adjust your buildplate. When you click 'Move to Next Position' the nozzle will move to the different positions that can be adjusted.") @@ -56,7 +56,7 @@ Item { id: bedlevelingText anchors.top: pageDescription.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label", "For every postition; insert a piece of paper under the nozzle and adjust the print bed height. The print bed height is right when the paper is slightly gripped by the tip of the nozzle.") @@ -65,10 +65,10 @@ Item Item{ id: bedlevelingWrapper anchors.top: bedlevelingText.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.horizontalCenter: parent.horizontalCenter height: skipBedlevelingButton.height - width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.sizes.default_margin.height < wizardPage.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.sizes.default_margin.height : wizardPage.width + width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height < wizardPage.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.getSize("default_margin").height : wizardPage.width Button { id: bedlevelingButton @@ -103,9 +103,9 @@ Item { id: skipBedlevelingButton anchors.top: parent.width < wizardPage.width ? parent.top : bedlevelingButton.bottom - anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.sizes.default_margin.height/2 + anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.getSize("default_margin").height/2 anchors.left: parent.width < wizardPage.width ? bedlevelingButton.right : parent.left - anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0 + anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.getSize("default_margin").width : 0 text: catalog.i18nc("@action:button","Skip Bedleveling"); onClicked: base.visible = false; } @@ -116,7 +116,7 @@ Item id: resultText visible: false anchors.top: bedlevelingWrapper.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left width: parent.width wrapMode: Text.WordWrap diff --git a/resources/qml/WizardPages/SelectUpgradedParts.qml b/resources/qml/WizardPages/SelectUpgradedParts.qml index c8ccc4fe8d..4a327a6ed4 100644 --- a/resources/qml/WizardPages/SelectUpgradedParts.qml +++ b/resources/qml/WizardPages/SelectUpgradedParts.qml @@ -36,7 +36,7 @@ Item { id: pageDescription anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label","To assist you in having better default settings for your Ultimaker. Cura would like to know which upgrades you have in your machine:") @@ -47,10 +47,10 @@ Item id: pageCheckboxes height: childrenRect.height anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.top: pageDescription.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height - width: parent.width - UM.Theme.sizes.default_margin.width + anchors.topMargin: UM.Theme.getSize("default_margin").height + width: parent.width - UM.Theme.getSize("default_margin").width CheckBox { id: extruderCheckBox @@ -85,7 +85,7 @@ Item { width: parent.width anchors.top: pageCheckboxes.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height wrapMode: Text.WordWrap text: catalog.i18nc("@label","If you bought your Ultimaker after october 2012 you will have the Extruder drive upgrade. If you do not have this upgrade, it is highly recommended to improve reliability. This upgrade can be bought from the Ultimaker webshop or found on thingiverse as thing:26094"); } diff --git a/resources/qml/WizardPages/UltimakerCheckup.qml b/resources/qml/WizardPages/UltimakerCheckup.qml index db538ed7d6..b8c8aebe12 100644 --- a/resources/qml/WizardPages/UltimakerCheckup.qml +++ b/resources/qml/WizardPages/UltimakerCheckup.qml @@ -78,7 +78,7 @@ Item { id: pageDescription anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label","It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional"); @@ -87,10 +87,10 @@ Item Item{ id: startStopButtons anchors.top: pageDescription.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.horizontalCenter: parent.horizontalCenter height: childrenRect.height - width: startCheckButton.width + skipCheckButton.width + UM.Theme.sizes.default_margin.height < wizardPage.width ? startCheckButton.width + skipCheckButton.width + UM.Theme.sizes.default_margin.height : wizardPage.width + width: startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height < wizardPage.width ? startCheckButton.width + skipCheckButton.width + UM.Theme.getSize("default_margin").height : wizardPage.width Button { id: startCheckButton @@ -109,9 +109,9 @@ Item { id: skipCheckButton anchors.top: parent.width < wizardPage.width ? parent.top : startCheckButton.bottom - anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.sizes.default_margin.height/2 + anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.getSize("default_margin").height/2 anchors.left: parent.width < wizardPage.width ? startCheckButton.right : parent.left - anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0 + anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.getSize("default_margin").width : 0 //enabled: !alreadyTested text: catalog.i18nc("@action:button","Skip Printer Check"); onClicked: { @@ -123,7 +123,7 @@ Item Item{ id: checkupContent anchors.top: startStopButtons.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height visible: false ////////////////////////////////////////////////////////// Label @@ -227,7 +227,7 @@ Item height: nozzleTemp.height anchors.top: nozzleTempLabel.top anchors.left: bedTempStatus.right - anchors.leftMargin: UM.Theme.sizes.default_margin.width/2 + anchors.leftMargin: UM.Theme.getSize("default_margin").width/2 Button { height: nozzleTemp.height - 2 @@ -250,7 +250,7 @@ Item id: nozzleTemp anchors.top: nozzleTempLabel.top anchors.left: nozzleTempButton.right - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width width: wizardPage.rightRow * 0.2 wrapMode: Text.WordWrap text: printer_connection != null ? printer_connection.extruderTemperature + "°C" : "0°C" @@ -283,7 +283,7 @@ Item height: bedTemp.height anchors.top: bedTempLabel.top anchors.left: bedTempStatus.right - anchors.leftMargin: UM.Theme.sizes.default_margin.width/2 + anchors.leftMargin: UM.Theme.getSize("default_margin").width/2 Button { height: bedTemp.height - 2 @@ -307,7 +307,7 @@ Item width: wizardPage.rightRow * 0.2 anchors.top: bedTempLabel.top anchors.left: bedTempButton.right - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width wrapMode: Text.WordWrap text: printer_connection != null ? printer_connection.bedTemperature + "°C": "0°C" font.bold: true @@ -317,7 +317,7 @@ Item id: resultText visible: false anchors.top: bedTemp.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left width: parent.width wrapMode: Text.WordWrap diff --git a/resources/qml/WizardPages/UpgradeFirmware.qml b/resources/qml/WizardPages/UpgradeFirmware.qml index f7031febe3..4bbb049f20 100644 --- a/resources/qml/WizardPages/UpgradeFirmware.qml +++ b/resources/qml/WizardPages/UpgradeFirmware.qml @@ -27,7 +27,7 @@ Item { id: pageDescription anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label","Firmware is the piece of software running directly on your 3D printer. This firmware controls the step motors, regulates the temperature and ultimately makes your printer work.") @@ -37,7 +37,7 @@ Item { id: upgradeText1 anchors.top: pageDescription.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label","The firmware shipping with new Ultimakers works, but upgrades have been made to make better prints, and make calibration easier."); @@ -47,16 +47,16 @@ Item { id: upgradeText2 anchors.top: upgradeText1.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label","Cura requires these new features and thus your firmware will most likely need to be upgraded. You can do so now."); } Item{ anchors.top: upgradeText2.bottom - anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.horizontalCenter: parent.horizontalCenter - width: upgradeButton.width + skipUpgradeButton.width + UM.Theme.sizes.default_margin.height < wizardPage.width ? upgradeButton.width + skipUpgradeButton.width + UM.Theme.sizes.default_margin.height : wizardPage.width + width: upgradeButton.width + skipUpgradeButton.width + UM.Theme.getSize("default_margin").height < wizardPage.width ? upgradeButton.width + skipUpgradeButton.width + UM.Theme.getSize("default_margin").height : wizardPage.width Button { id: upgradeButton anchors.top: parent.top @@ -67,9 +67,9 @@ Item Button { id: skipUpgradeButton anchors.top: parent.width < wizardPage.width ? parent.top : upgradeButton.bottom - anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.sizes.default_margin.height/2 + anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.getSize("default_margin").height/2 anchors.left: parent.width < wizardPage.width ? upgradeButton.right : parent.left - anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0 + anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.getSize("default_margin").width : 0 text: catalog.i18nc("@action:button","Skip Upgrade"); onClicked: { base.currentPage += 1 From d93055da1a8c12b010c36211d05ed039c368ee1d Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 25 Jan 2016 02:38:51 +0100 Subject: [PATCH 05/15] Fix syntax --- resources/qml/Sidebar.qml | 18 +++++++++--------- resources/qml/SidebarSimple.qml | 21 +++++++++++++++------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index fe7cfd080b..18eb6d836a 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -127,18 +127,18 @@ Rectangle style: ButtonStyle { background: Rectangle { border.width: UM.Theme.getSize("default_lining").width - border.color: control.checked ? UM.Theme.getColor("toggle_checked_border : ") - control.pressed ? UM.Theme.getColor("toggle_active_border :") - control.hovered ? UM.Theme.getColor("toggle_hovered_border : UM").Theme.getColor("toggle_unchecked_border") - color: control.checked ? UM.Theme.getColor("toggle_checked : ") - control.pressed ? UM.Theme.getColor("toggle_active :") - control.hovered ? UM.Theme.getColor("toggle_hovered : UM").Theme.getColor("toggle_unchecked") + border.color: control.checked ? UM.Theme.getColor("toggle_checked_border") : + control.pressed ? UM.Theme.getColor("toggle_active_border") : + control.hovered ? UM.Theme.getColor("toggle_hovered_border") : UM.Theme.getColor("toggle_unchecked_border") + color: control.checked ? UM.Theme.getColor("toggle_checked") : + control.pressed ? UM.Theme.getColor("toggle_active") : + control.hovered ? UM.Theme.getColor("toggle_hovered") : UM.Theme.getColor("toggle_unchecked") Behavior on color { ColorAnimation { duration: 50; } } Label { anchors.centerIn: parent - color: control.checked ? UM.Theme.getColor("toggle_checked_text : ") - control.pressed ? UM.Theme.getColor("toggle_active_text :") - control.hovered ? UM.Theme.getColor("toggle_hovered_text : UM").Theme.getColor("toggle_unchecked_text") + color: control.checked ? UM.Theme.getColor("toggle_checked_text") : + control.pressed ? UM.Theme.getColor("toggle_active_text") : + control.hovered ? UM.Theme.getColor("toggle_hovered_text") : UM.Theme.getColor("toggle_unchecked_text") font: UM.Theme.getFont("default") text: control.text; } diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index a163f2db42..c877b67f5b 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -84,10 +84,19 @@ Item width: (infillCellRight.width - 3 * UM.Theme.getSize("default_margin").width) / 4; height: width - border.color: (infillListView.activeIndex == index) ? UM.Theme.getColor("setting_control_selected :") - (mousearea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight : UM").Theme.getColor("setting_control_border)") + border.color: { + if(infillListView.activeIndex == index) + { + return UM.Theme.getColor("setting_control_selected") + } + else if(mousearea.containsMouse) + { + return UM.Theme.getColor("setting_control_border_highlight") + } + return UM.Theme.getColor("setting_control_border") + } border.width: UM.Theme.getSize("default_lining").width - color: infillListView.activeIndex == index ? UM.Theme.getColor("setting_control_selected : "transparent"") + color: infillListView.activeIndex == index ? UM.Theme.getColor("setting_control_selected") : "transparent" UM.RecolorImage { id: infillIcon @@ -96,8 +105,8 @@ Item sourceSize.width: width sourceSize.height: width - source: UM.Theme.icons[model.icon]; - color: (infillListView.activeIndex == index) ? UM.Theme.getColor("text_white : UM").Theme.getColor("text") + source: UM.Theme.getIcon(model.icon); + color: (infillListView.activeIndex == index) ? UM.Theme.getColor("text_white") : UM.Theme.getColor("text") } MouseArea { @@ -122,7 +131,7 @@ Item id: infillLabel anchors.top: infillIconLining.bottom anchors.horizontalCenter: infillIconLining.horizontalCenter - color: infillListView.activeIndex == index ? UM.Theme.getColor("setting_control_text : UM").Theme.getColor("setting_control_border") + color: infillListView.activeIndex == index ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_border") text: name } } From 19c25895bf8d09c04b45d1f9d7cf1d46dfad3bda Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 25 Jan 2016 02:40:29 +0100 Subject: [PATCH 06/15] Convert Toolbar.qml and styles.qml to Theme getThing style --- resources/qml/Toolbar.qml | 2 +- resources/themes/cura/styles.qml | 319 ++++++++++++++++++------------- 2 files changed, 185 insertions(+), 136 deletions(-) diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index 72b5a6d7da..ff223cb38f 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -29,7 +29,7 @@ Item { Button { text: model.name - iconSource: UM.Theme.icons[model.icon]; + iconSource: UM.Theme.getIcon(model.icon); checkable: true; checked: model.active; diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 0f39bea005..c54dad7a0c 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -11,57 +11,107 @@ QtObject { property Component sidebar_header_button: Component { ButtonStyle { background: Rectangle { - color: UM.Theme.colors.setting_control - border.width: UM.Theme.sizes.default_lining.width - border.color: control.hovered ? UM.Theme.colors.setting_control_border_highlight : UM.Theme.colors.setting_control_border + color: UM.Theme.getColor("setting_control") + border.width: UM.Theme.getSize("default_lining").width + border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") UM.RecolorImage { id: downArrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width - width: UM.Theme.sizes.standard_arrow.width - height: UM.Theme.sizes.standard_arrow.height + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width - color: UM.Theme.colors.setting_category_text - source: UM.Theme.icons.arrow_bottom + color: UM.Theme.getColor("setting_category_text") + source: UM.Theme.getIcon("arrow_bottom") } Label { id: sidebarComboBoxLabel - color: UM.Theme.colors.setting_control_text + color: UM.Theme.getColor("setting_control_text") text: control.text; elide: Text.ElideRight; anchors.left: parent.left; - anchors.leftMargin: UM.Theme.sizes.setting_unit_margin.width + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.right: downArrow.left; anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.fonts.default + font: UM.Theme.getFont("default") } } label: Label{} } } +<<<<<<< HEAD +======= +/* + property Component open_file_button: Component { + ButtonStyle { + background: Item{ + implicitWidth: UM.Theme.getSize("button").width; + implicitHeight: UM.Theme.getSize("button").height; + Rectangle { + id: tool_button_background + anchors.left: parent.right + anchors.verticalCenter: parent.verticalCenter + opacity: control.hovered ? 1.0 : 0.0; + + width: control.hovered ? label.width : 0; + height: label.height + + Behavior on width { NumberAnimation { duration: 100; } } + Behavior on height { NumberAnimation { duration: 100; } } + Behavior on opacity { NumberAnimation { duration: 100; } } + + Label { + id: label + anchors.bottom: parent.bottom + text: control.text + font: UM.Theme.getFont("button_tooltip"); + color: UM.Theme.getColor("button_tooltip_text"); + } + } + Rectangle { + anchors.fill: parent; + color: control.pressed ? UM.Theme.getColor("button_active") : + control.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button") + Behavior on color { ColorAnimation { duration: 50; } } + } + } + label: Item { + Image { + anchors.centerIn: parent; + source: control.iconSource; + width: UM.Theme.getSize("button_icon").width; + height: UM.Theme.getSize("button_icon").height; + sourceSize: UM.Theme.getSize("button_icon") + } + } + } + } +*/ + +>>>>>>> Convert Toolbar.qml and styles.qml to Theme getThing style property Component tool_button: Component { ButtonStyle { background: Item { - implicitWidth: UM.Theme.sizes.button.width; - implicitHeight: UM.Theme.sizes.button.height; + implicitWidth: UM.Theme.getSize("button").width; + implicitHeight: UM.Theme.getSize("button").height; UM.PointingRectangle { id: button_tooltip anchors.left: parent.right - anchors.leftMargin: UM.Theme.sizes.button_tooltip_arrow.width * 2 + anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2 anchors.verticalCenter: parent.verticalCenter target: Qt.point(parent.x, y + height/2) - arrowSize: UM.Theme.sizes.button_tooltip_arrow.width - color: UM.Theme.colors.tooltip + arrowSize: UM.Theme.getSize("button_tooltip_arrow").width + color: UM.Theme.getColor("tooltip") opacity: control.hovered ? 1.0 : 0.0; - width: control.hovered ? button_tip.width + UM.Theme.sizes.button_tooltip.width : 0 - height: UM.Theme.sizes.button_tooltip.height + width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0 + height: UM.Theme.getSize("button_tooltip").height Behavior on width { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } } @@ -73,8 +123,8 @@ QtObject { anchors.verticalCenter: parent.verticalCenter; text: control.text; - font: UM.Theme.fonts.button_tooltip; - color: UM.Theme.colors.tooltip_text; + font: UM.Theme.getFont("button_tooltip"); + color: UM.Theme.getColor("tooltip_text"); } } @@ -86,13 +136,13 @@ QtObject { color: { if(control.checkable && control.checked && control.hovered) { - return UM.Theme.colors.button_active_hover; + return UM.Theme.getColor("button_active_hover"); } else if(control.pressed || (control.checkable && control.checked)) { - return UM.Theme.colors.button_active; + return UM.Theme.getColor("button_active"); } else if(control.hovered) { - return UM.Theme.colors.button_hover; + return UM.Theme.getColor("button_hover"); } else { - return UM.Theme.colors.button; + return UM.Theme.getColor("button"); } } Behavior on color { ColorAnimation { duration: 50; } } @@ -102,16 +152,16 @@ QtObject { id: tool_button_arrow opacity: !control.enabled ? 0.2 : 1.0 anchors.right: parent.right; - anchors.rightMargin: (UM.Theme.sizes.button.width - UM.Theme.sizes.button_icon.width) / 4 + anchors.rightMargin: (UM.Theme.getSize("button").width - UM.Theme.getSize("button_icon").width) / 4 anchors.bottom: parent.bottom; - anchors.bottomMargin: (UM.Theme.sizes.button.height - UM.Theme.sizes.button_icon.height) / 4 - width: UM.Theme.sizes.standard_arrow.width - height: UM.Theme.sizes.standard_arrow.height + anchors.bottomMargin: (UM.Theme.getSize("button").height - UM.Theme.getSize("button_icon").height) / 4 + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width visible: control.menu != null; - color: UM.Theme.colors.button_text - source: UM.Theme.icons.arrow_bottom + color: UM.Theme.getColor("button_text") + source: UM.Theme.getIcon("arrow_bottom") } } } @@ -121,37 +171,36 @@ QtObject { anchors.centerIn: parent; opacity: !control.enabled ? 0.2 : 1.0 source: control.iconSource; - width: UM.Theme.sizes.button_icon.width; - height: UM.Theme.sizes.button_icon.height; + width: UM.Theme.getSize("button_icon").width; + height: UM.Theme.getSize("button_icon").height; - sourceSize: UM.Theme.sizes.button_icon + sourceSize: UM.Theme.getSize("button_icon") } } } } - property Component progressbar: Component{ ProgressBarStyle { background:Rectangle { - implicitWidth: UM.Theme.sizes.message.width - (UM.Theme.sizes.default_margin.width * 2) - implicitHeight: UM.Theme.sizes.progressbar.height - radius: UM.Theme.sizes.progressbar_radius.width - color: UM.Theme.colors.progressbar_background + implicitWidth: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) + implicitHeight: UM.Theme.getSize("progressbar").height + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_background") } progress: Rectangle { - color: control.indeterminate ? "transparent" : UM.Theme.colors.progressbar_control + color: control.indeterminate ? "transparent" : UM.Theme.getColor("progressbar_control") radius: UM.Theme.sizes.progressbar_radius.width Rectangle{ - radius: UM.Theme.sizes.progressbar_radius.width - color: UM.Theme.colors.progressbar_control - width: UM.Theme.sizes.progressbar_control.width - height: UM.Theme.sizes.progressbar_control.height + radius: UM.Theme.getSize("progressbar_radius").width + color: UM.Theme.getColor("progressbar_control") + width: UM.Theme.getSize("progressbar_control").width + height: UM.Theme.getSize("progressbar_control").height visible: control.indeterminate SequentialAnimation on x { id: xAnim - property int animEndPoint: UM.Theme.sizes.message.width - (UM.Theme.sizes.default_margin.width * 2) - UM.Theme.sizes.progressbar_control.width + property int animEndPoint: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) - UM.Theme.getSize("progressbar_control").width running: control.indeterminate loops: Animation.Infinite NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;} @@ -169,41 +218,41 @@ QtObject { background: Rectangle { anchors.fill: parent; anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width - implicitHeight: UM.Theme.sizes.section.height; + anchors.rightMargin: UM.Theme.getSize("default_margin").width + implicitHeight: UM.Theme.getSize("section").height; color: { if(control.color) { return control.color; } else if(!control.enabled) { - return UM.Theme.colors.setting_category_disabled; + return UM.Theme.getColor("setting_category_disabled"); } else if(control.hovered && control.checkable && control.checked) { - return UM.Theme.colors.setting_category_active_hover; + return UM.Theme.getColor("setting_category_active_hover"); } else if(control.pressed || (control.checkable && control.checked)) { - return UM.Theme.colors.setting_category_active; + return UM.Theme.getColor("setting_category_active"); } else if(control.hovered) { - return UM.Theme.colors.setting_category_hover; + return UM.Theme.getColor("setting_category_hover"); } else { - return UM.Theme.colors.setting_category; + return UM.Theme.getColor("setting_category"); } } Behavior on color { ColorAnimation { duration: 50; } } Rectangle { - height: UM.Theme.sizes.default_lining.height + height: UM.Theme.getSize("default_lining").height width: parent.width anchors.bottom: parent.bottom color: { if(!control.enabled) { - return UM.Theme.colors.setting_category_disabled_border; + return UM.Theme.getColor("setting_category_disabled_border"); } else if(control.hovered && control.checkable && control.checked) { - return UM.Theme.colors.setting_category_active_hover_border; + return UM.Theme.getColor("setting_category_active_hover_border"); } else if(control.pressed || (control.checkable && control.checked)) { - return UM.Theme.colors.setting_category_active_border; + return UM.Theme.getColor("setting_category_active_border"); } else if(control.hovered) { - return UM.Theme.colors.setting_category_hover_border; + return UM.Theme.getColor("setting_category_hover_border"); } else { - return UM.Theme.colors.setting_category_border; + return UM.Theme.getColor("setting_category_border"); } } } @@ -215,15 +264,15 @@ QtObject { id: icon; anchors.left: parent.left height: parent.height - width: UM.Theme.sizes.section_icon_column.width + width: UM.Theme.getSize("section_icon_column").width UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width - color: UM.Theme.colors.setting_category_text + anchors.leftMargin: UM.Theme.getSize("default_margin").width + color: UM.Theme.getColor("setting_category_text") source: control.iconSource; - width: UM.Theme.sizes.section_icon.width; - height: UM.Theme.sizes.section_icon.height; + width: UM.Theme.getSize("section_icon").width; + height: UM.Theme.getSize("section_icon").height; sourceSize.width: width + 15 sourceSize.height: width + 15 } @@ -232,13 +281,13 @@ QtObject { Label { anchors { left: icon.right; - leftMargin: UM.Theme.sizes.default_lining.width; + leftMargin: UM.Theme.getSize("default_lining").width; right: parent.right; verticalCenter: parent.verticalCenter; } text: control.text; - font: UM.Theme.fonts.setting_category; - color: UM.Theme.colors.setting_category_text; + font: UM.Theme.getFont("setting_category"); + color: UM.Theme.getColor("setting_category_text"); fontSizeMode: Text.HorizontalFit; minimumPointSize: 8 } @@ -246,13 +295,13 @@ QtObject { id: category_arrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width * 2 - width / 2 - width: UM.Theme.sizes.standard_arrow.width - height: UM.Theme.sizes.standard_arrow.height + anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 - width / 2 + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width - color: UM.Theme.colors.setting_category_text - source: control.checked ? UM.Theme.icons.arrow_bottom : UM.Theme.icons.arrow_left + color: UM.Theme.getColor("setting_category_text") + source: control.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") } } } @@ -266,62 +315,62 @@ QtObject { transientScrollBars: false scrollBarBackground: Rectangle { - implicitWidth: UM.Theme.sizes.scrollbar.width + implicitWidth: UM.Theme.getSize("scrollbar").width radius: implicitWidth / 2 - color: UM.Theme.colors.scrollbar_background; + color: UM.Theme.getColor("scrollbar_background"); } handle: Rectangle { id: scrollViewHandle - implicitWidth: UM.Theme.sizes.scrollbar.width; + implicitWidth: UM.Theme.getSize("scrollbar").width; radius: implicitWidth / 2 - color: styleData.pressed ? UM.Theme.colors.scrollbar_handle_down : styleData.hovered ? UM.Theme.colors.scrollbar_handle_hover : UM.Theme.colors.scrollbar_handle; + color: styleData.pressed ? UM.Theme.getColor("scrollbar_handle_down") : styleData.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle"); Behavior on color { ColorAnimation { duration: 50; } } } } } property variant setting_item: UM.SettingItemStyle { - labelFont: UM.Theme.fonts.default; - labelColor: UM.Theme.colors.setting_control_text; + labelFont: UM.Theme.getFont("default"); + labelColor: UM.Theme.getColor("setting_control_text"); - spacing: UM.Theme.sizes.default_lining.height; - fixedHeight: UM.Theme.sizes.setting.height; + spacing: UM.Theme.getSize("default_lining").height; + fixedHeight: UM.Theme.getSize("setting").height; - controlWidth: UM.Theme.sizes.setting_control.width; - controlRightMargin: UM.Theme.sizes.setting_control_margin.width; - controlColor: UM.Theme.colors.setting_control; - controlHighlightColor: UM.Theme.colors.setting_control_highlight; - controlBorderColor: UM.Theme.colors.setting_control_border; - controlBorderHighlightColor: UM.Theme.colors.setting_control_border_highlight; - controlTextColor: UM.Theme.colors.setting_control_text; - controlBorderWidth: UM.Theme.sizes.default_lining.width; - controlFont: UM.Theme.fonts.default; + controlWidth: UM.Theme.getSize("setting_control").width; + controlRightMargin: UM.Theme.getSize("setting_control_margin").width; + controlColor: UM.Theme.getColor("setting_control"); + controlHighlightColor: UM.Theme.getColor("setting_control_highlight"); + controlBorderColor: UM.Theme.getColor("setting_control_border"); + controlBorderHighlightColor: UM.Theme.getColor("setting_control_border_highlight"); + controlTextColor: UM.Theme.getColor("setting_control_text"); + controlBorderWidth: UM.Theme.getSize("default_lining").width; + controlFont: UM.Theme.getFont("default"); - validationErrorColor: UM.Theme.colors.setting_validation_error; - validationWarningColor: UM.Theme.colors.setting_validation_warning; - validationOkColor: UM.Theme.colors.setting_validation_ok; + validationErrorColor: UM.Theme.getColor("setting_validation_error"); + validationWarningColor: UM.Theme.getColor("setting_validation_warning"); + validationOkColor: UM.Theme.getColor("setting_validation_ok"); - unitRightMargin: UM.Theme.sizes.setting_unit_margin.width; - unitColor: UM.Theme.colors.setting_unit; - unitFont: UM.Theme.fonts.default; + unitRightMargin: UM.Theme.getSize("setting_unit_margin").width; + unitColor: UM.Theme.getColor("setting_unit"); + unitFont: UM.Theme.getFont("default"); } property Component checkbox: Component { CheckBoxStyle { background: Item { } indicator: Rectangle { - implicitWidth: UM.Theme.sizes.checkbox.width; - implicitHeight: UM.Theme.sizes.checkbox.height; + implicitWidth: UM.Theme.getSize("checkbox").width; + implicitHeight: UM.Theme.getSize("checkbox").height; - color: (control.hovered || control.hovered_ex) ? UM.Theme.colors.checkbox_hover : UM.Theme.colors.checkbox; + color: (control.hovered || control.hovered_ex) ? UM.Theme.getColor("checkbox_hover") : UM.Theme.getColor("checkbox"); Behavior on color { ColorAnimation { duration: 50; } } - radius: control.exclusiveGroup ? UM.Theme.sizes.checkbox.width / 2 : 0 + radius: control.exclusiveGroup ? UM.Theme.getSize("checkbox").width / 2 : 0 - border.width: UM.Theme.sizes.default_lining.width; - border.color: (control.hovered || control.hovered_ex) ? UM.Theme.colors.checkbox_border_hover : UM.Theme.colors.checkbox_border; + border.width: UM.Theme.getSize("default_lining").width; + border.color: (control.hovered || control.hovered_ex) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border"); UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter @@ -330,16 +379,16 @@ QtObject { height: parent.height/2.5 sourceSize.width: width sourceSize.height: width - color: UM.Theme.colors.checkbox_mark - source: control.exclusiveGroup ? UM.Theme.icons.dot : UM.Theme.icons.check + color: UM.Theme.getColor("checkbox_mark") + source: control.exclusiveGroup ? UM.Theme.getIcon("dot") : UM.Theme.getIcon("check") opacity: control.checked Behavior on opacity { NumberAnimation { duration: 100; } } } } label: Label { text: control.text; - color: UM.Theme.colors.checkbox_text; - font: UM.Theme.fonts.default; + color: UM.Theme.getColor("checkbox_text"); + font: UM.Theme.getFont("default"); } } } @@ -348,11 +397,11 @@ QtObject { SliderStyle { groove: Rectangle { implicitWidth: control.width; - implicitHeight: UM.Theme.sizes.slider_groove.height; + implicitHeight: UM.Theme.getSize("slider_groove").height; - color: UM.Theme.colors.slider_groove; - border.width: UM.Theme.sizes.default_lining.width; - border.color: UM.Theme.colors.slider_groove_border; + color: UM.Theme.getColor("slider_groove"); + border.width: UM.Theme.getSize("default_lining").width; + border.color: UM.Theme.getColor("slider_groove_border"); Rectangle { anchors { @@ -360,14 +409,14 @@ QtObject { top: parent.top; bottom: parent.bottom; } - color: UM.Theme.colors.slider_groove_fill; + color: UM.Theme.getColor("slider_groove_fill"); width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width; } } handle: Rectangle { - width: UM.Theme.sizes.slider_handle.width; - height: UM.Theme.sizes.slider_handle.height; - color: control.hovered ? UM.Theme.colors.slider_handle_hover : UM.Theme.colors.slider_handle; + width: UM.Theme.getSize("slider_handle").width; + height: UM.Theme.getSize("slider_handle").height; + color: control.hovered ? UM.Theme.getColor("slider_handle_hover") : UM.Theme.getColor("slider_handle"); Behavior on color { ColorAnimation { duration: 50; } } } } @@ -378,28 +427,28 @@ QtObject { groove: Rectangle { id: layerSliderGroove implicitWidth: control.width; - implicitHeight: UM.Theme.sizes.slider_groove.height; + implicitHeight: UM.Theme.getSize("slider_groove").height; radius: width/2; - color: UM.Theme.colors.slider_groove; - border.width: UM.Theme.sizes.default_lining.width; - border.color: UM.Theme.colors.slider_groove_border; + color: UM.Theme.getColor("slider_groove"); + border.width: UM.Theme.getSize("default_lining").width; + border.color: UM.Theme.getColor("slider_groove_border"); Rectangle { anchors { left: parent.left; top: parent.top; bottom: parent.bottom; } - color: UM.Theme.colors.slider_groove_fill; + color: UM.Theme.getColor("slider_groove_fill"); width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width; radius: width/2 } } handle: Rectangle { id: layerSliderControl - width: UM.Theme.sizes.slider_handle.width; - height: UM.Theme.sizes.slider_handle.height; - color: control.hovered ? UM.Theme.colors.slider_handle_hover : UM.Theme.colors.slider_handle; + width: UM.Theme.getSize("slider_handle").width; + height: UM.Theme.getSize("slider_handle").height; + color: control.hovered ? UM.Theme.getColor("slider_handle_hover") : UM.Theme.getColor("slider_handle"); Behavior on color { ColorAnimation { duration: 50; } } TextField { id: valueLabel @@ -414,17 +463,17 @@ QtObject { validator: IntValidator {bottom: 1; top: control.maximumValue + 1;} visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false anchors.top: layerSliderControl.bottom - anchors.topMargin: width/2 - UM.Theme.sizes.default_margin.width/2 + anchors.topMargin: width/2 - UM.Theme.getSize("default_margin").width/2 anchors.horizontalCenter: layerSliderControl.horizontalCenter rotation: 90 style: TextFieldStyle{ - textColor: UM.Theme.colors.setting_control_text; - font: UM.Theme.fonts.default; + textColor: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); background: Rectangle { - implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + UM.Theme.sizes.default_margin.width - implicitHeight: UM.Theme.sizes.slider_handle.height + UM.Theme.sizes.default_margin.width - border.width: UM.Theme.sizes.default_lining.width; - border.color: UM.Theme.colors.slider_groove_border; + implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + UM.Theme.getSize("default_margin").width + implicitHeight: UM.Theme.getSize("slider_handle").height + UM.Theme.getSize("default_margin").width + border.width: UM.Theme.getSize("default_lining").width; + border.color: UM.Theme.getColor("slider_groove_border"); } } } @@ -434,27 +483,27 @@ QtObject { property Component text_field: Component { TextFieldStyle { - textColor: UM.Theme.colors.setting_control_text; - font: UM.Theme.fonts.default; + textColor: UM.Theme.getColor("setting_control_text"); + font: UM.Theme.getFont("default"); background: Rectangle { implicitHeight: control.height; implicitWidth: control.width; - border.width: UM.Theme.sizes.default_lining.width; - border.color: control.hovered ? UM.Theme.colors.setting_control_border_highlight : UM.Theme.colors.setting_control_border; + border.width: UM.Theme.getSize("default_lining").width; + border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); - color: UM.Theme.colors.setting_validation_ok; + color: UM.Theme.getColor("setting_validation_ok"); Label { anchors.right: parent.right; - anchors.rightMargin: UM.Theme.sizes.setting_unit_margin.width; + anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width; anchors.verticalCenter: parent.verticalCenter; text: control.unit ? control.unit : "" - color: UM.Theme.colors.setting_unit; - font: UM.Theme.fonts.default; + color: UM.Theme.getColor("setting_unit"); + font: UM.Theme.getFont("default"); } } } From 4e139ae7106718731d4c2bc0948c21aeec87112a Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 15 Feb 2016 08:39:38 +0100 Subject: [PATCH 07/15] Fix minor error after rebase --- resources/qml/SaveButton.qml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index a0d89bd4a9..c1be09d3c9 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -58,15 +58,9 @@ Rectangle { Rectangle{ width: Math.max(parent.width * base.progress) height: parent.height -<<<<<<< 041fa2b3592e015eebe779169c9d7f4565b3a788 - color: UM.Theme.colors.progressbar_control - radius: UM.Theme.sizes.progressbar_radius.width - visible: base.backendState == 1 ? true : false -======= color: UM.Theme.getColor("progressbar_control") radius: UM.Theme.getSize("progressbar_radius").width - visible: base.progress > 0.99 ? false : true ->>>>>>> Replace Theme property accessors with getThing calls + visible: base.backendState == 1 ? true : false } } From e2b208824683a0b6e37e139fbd6aa1359c73f04c Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 15 Feb 2016 08:41:58 +0100 Subject: [PATCH 08/15] Add a configureSettingsAction that will open the setting visibility page --- resources/qml/Cura.qml | 12 +++++++++++- resources/qml/Sidebar.qml | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index ca9faa4aee..a5b3397988 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -475,6 +475,16 @@ UM.MainWindow configureMachinesAction: actions.configureMachines; addProfileAction: actions.addProfile; manageProfilesAction: actions.manageProfiles; + + configureSettingsAction: Action + { + onTriggered: + { + preferences.visible = true; + preferences.setPage(2); + preferences.getCurrentItem().scrollToSection(source); + } + } } Rectangle @@ -593,7 +603,7 @@ UM.MainWindow addMachine.onTriggered: addMachineWizard.visible = true; addProfile.onTriggered: { UM.MachineManager.createProfile(); preferences.visible = true; preferences.setPage(4); } - preferences.onTriggered: { preferences.visible = true; preferences.setPage(0); } + preferences.onTriggered: { preferences.visible = true; } configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(3); } manageProfiles.onTriggered: { preferences.visible = true; preferences.setPage(4); } diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 18eb6d836a..742fadb34e 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -16,6 +16,7 @@ Rectangle property Action configureMachinesAction; property Action addProfileAction; property Action manageProfilesAction; + property Action configureSettingsAction; property int currentModeIndex; color: UM.Theme.getColor("sidebar"); @@ -239,7 +240,7 @@ Rectangle id: sidebarAdvanced; visible: false; - configureSettings: base.configureMachinesAction; + configureSettings: base.configureSettingsAction; onShowTooltip: base.showTooltip(item, location, text) onHideTooltip: base.hideTooltip() } From d208885755e9e20e5a96bbf3b8cbb6b2dc21437b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 15 Feb 2016 08:42:40 +0100 Subject: [PATCH 09/15] Load preference pages dynamically and reset the current page to 0 on close --- resources/qml/Cura.qml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a5b3397988..c291f6178c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -512,25 +512,22 @@ UM.MainWindow { //; Remove & re-add the general page as we want to use our own instead of uranium standard. removePage(0); - insertPage(0, catalog.i18nc("@title:tab","General"), generalPage); + insertPage(0, catalog.i18nc("@title:tab","General"), Qt.resolvedUrl("GeneralPage.qml")); //: View preferences page title - insertPage(1, catalog.i18nc("@title:tab","View"), viewPage); + insertPage(1, catalog.i18nc("@title:tab","View"), Qt.resolvedUrl("ViewPage.qml")); //Force refresh setPage(0) } - Item { - visible: false - GeneralPage + onVisibleChanged: + { + if(!visible) { - id: generalPage - } - - ViewPage - { - id: viewPage + // When the dialog closes, switch to the General page. + // This prevents us from having a heavy page like Setting Visiblity active in the background. + setPage(0); } } } From e6ef4405c36863fee3da87cd38986d45e395a9c2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Feb 2016 15:19:50 +0100 Subject: [PATCH 10/15] Replace a bunch of Theme property accessors with getThing calls --- plugins/LayerView/LayerView.qml | 20 ++++----- .../PerObjectSettingsPanel.qml | 44 +++++++++---------- plugins/USBPrinting/ControlWindow.qml | 2 +- resources/qml/AboutDialog.qml | 2 +- resources/qml/Cura.qml | 2 +- resources/qml/SidebarHeader.qml | 14 +++--- 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/plugins/LayerView/LayerView.qml b/plugins/LayerView/LayerView.qml index ad363af4aa..b26d301648 100644 --- a/plugins/LayerView/LayerView.qml +++ b/plugins/LayerView/LayerView.qml @@ -10,16 +10,16 @@ import UM 1.0 as UM Item { - width: UM.Theme.sizes.button.width - height: UM.Theme.sizes.slider_layerview_size.height + width: UM.Theme.getSize("button").width + height: UM.Theme.getSize("slider_layerview_size").height Slider { id: slider - width: UM.Theme.sizes.slider_layerview_size.width - height: UM.Theme.sizes.slider_layerview_size.height + width: UM.Theme.getSize("slider_layerview_size").width + height: UM.Theme.getSize("slider_layerview_size").height anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.slider_layerview_margin.width/2 + anchors.leftMargin: UM.Theme.getSize("slider_layerview_margin").width/2 orientation: Qt.Vertical minimumValue: 0; maximumValue: UM.LayerView.numLayers; @@ -34,11 +34,11 @@ Item anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter z: slider.z - 1 - width: UM.Theme.sizes.slider_layerview_background.width - height: slider.height + UM.Theme.sizes.default_margin.height * 2 - color: UM.Theme.colors.tool_panel_background; - border.width: UM.Theme.sizes.default_lining.width - border.color: UM.Theme.colors.lining + width: UM.Theme.getSize("slider_layerview_background").width + height: slider.height + UM.Theme.getSize("default_margin").height * 2 + color: UM.Theme.getColor("tool_panel_background"); + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") MouseArea { id: sliderMouseArea diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index f64e3d4935..087c100f2c 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -22,13 +22,13 @@ Item { anchors.top: parent.top; anchors.left: parent.left; - spacing: UM.Theme.sizes.default_margin.height; + spacing: UM.Theme.getSize("default_margin").height; UM.SettingItem { id: profileSelection - width: UM.Theme.sizes.setting.width; - height: UM.Theme.sizes.setting.height; + width: UM.Theme.getSize("setting").width; + height: UM.Theme.getSize("setting").height; name: catalog.i18nc("@label", "Object profile") type: "enum" @@ -48,8 +48,8 @@ Item { Column { id: customisedSettings - spacing: UM.Theme.sizes.default_lining.height; - width: UM.Theme.sizes.setting.width + UM.Theme.sizes.setting.height/2; + spacing: UM.Theme.getSize("default_lining").height; + width: UM.Theme.getSize("setting").width + UM.Theme.getSize("setting").height/2; Repeater { id: settings; @@ -57,8 +57,8 @@ Item { model: UM.ActiveTool.properties.getValue("Model").getItem(base.currentIndex).settings UM.SettingItem { - width: UM.Theme.sizes.setting.width; - height: UM.Theme.sizes.setting.height; + width: UM.Theme.getSize("setting").width; + height: UM.Theme.getSize("setting").height; name: model.label; type: model.type; @@ -80,8 +80,8 @@ Item { { anchors.left: parent.right; - width: UM.Theme.sizes.setting.height; - height: UM.Theme.sizes.setting.height; + width: UM.Theme.getSize("setting").height; + height: UM.Theme.getSize("setting").height; onClicked: UM.ActiveTool.properties.getValue("Model").removeSettingOverride(UM.ActiveTool.properties.getValue("Model").getItem(base.currentIndex).id, model.key) @@ -98,8 +98,8 @@ Item { height: parent.height/2 sourceSize.width: width sourceSize.height: width - color: control.hovered ? UM.Theme.colors.setting_control_button_hover : UM.Theme.colors.setting_control_button - source: UM.Theme.icons.cross1 + color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") + source: UM.Theme.getIcon("cross1") } } } @@ -112,7 +112,7 @@ Item { { id: customise_settings_button; anchors.right: profileSelection.right; - height: UM.Theme.sizes.setting.height; + height: UM.Theme.getSize("setting").height; visible: parseInt(UM.Preferences.getValue("cura/active_mode")) == 1 text: catalog.i18nc("@action:button", "Add Setting"); @@ -123,16 +123,16 @@ Item { { width: control.width; height: control.height; - border.width: UM.Theme.sizes.default_lining.width; - border.color: control.pressed ? UM.Theme.colors.action_button_active_border : - control.hovered ? UM.Theme.colors.action_button_hovered_border : UM.Theme.colors.action_button_border - color: control.pressed ? UM.Theme.colors.action_button_active : - control.hovered ? UM.Theme.colors.action_button_hovered : UM.Theme.colors.action_button + border.width: UM.Theme.getSize("default_lining").width; + border.color: control.pressed ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + color: control.pressed ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") } label: Label { text: control.text; - color: UM.Theme.colors.setting_control_text; + color: UM.Theme.getColor("setting_control_text"); anchors.centerIn: parent } } @@ -181,7 +181,7 @@ Item { } Column { - width: view.width - UM.Theme.sizes.default_margin.width * 2; + width: view.width - UM.Theme.getSize("default_margin").width * 2; height: childrenRect.height; Repeater { @@ -212,11 +212,11 @@ Item { } label: Row { - spacing: UM.Theme.sizes.default_margin.width; + spacing: UM.Theme.getSize("default_margin").width; Image { anchors.verticalCenter: parent.verticalCenter; - source: control.checked ? UM.Theme.icons.arrow_right : UM.Theme.icons.arrow_bottom; + source: control.checked ? UM.Theme.getIcon("arrow_right") : UM.Theme.getIcon("arrow_bottom"); } Label { @@ -260,7 +260,7 @@ Item { delegate: ToolButton { id: button; - x: model.depth * UM.Theme.sizes.default_margin.width; + x: model.depth * UM.Theme.getSize("default_margin").width; text: model.name; tooltip: model.description; visible: !model.global_only diff --git a/plugins/USBPrinting/ControlWindow.qml b/plugins/USBPrinting/ControlWindow.qml index efe1e21b25..553da23fed 100644 --- a/plugins/USBPrinting/ControlWindow.qml +++ b/plugins/USBPrinting/ControlWindow.qml @@ -21,7 +21,7 @@ UM.Dialog anchors.fill: parent; Row { - spacing: UM.Theme.sizes.default_margin.width; + spacing: UM.Theme.getSize("default_margin").width; Text { //: USB Printing dialog label, %1 is head temperature diff --git a/resources/qml/AboutDialog.qml b/resources/qml/AboutDialog.qml index e3e9f8e9b7..eb8795c5a6 100644 --- a/resources/qml/AboutDialog.qml +++ b/resources/qml/AboutDialog.qml @@ -24,7 +24,7 @@ UM.Dialog width: parent.width * 0.75 height: width * (1/4.25) - source: UM.Theme.images.logo + source: UM.Theme.getImage("logo") sourceSize.width: width sourceSize.height: height diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index c291f6178c..f320e03e67 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -400,7 +400,7 @@ UM.MainWindow bottomMargin: UM.Theme.getSize("default_margin").height; } - source: UM.Theme.images.logo; + source: UM.Theme.getImage("logo"); width: UM.Theme.getSize("logo").width; height: UM.Theme.getSize("logo").height; z: -1; diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 2875332872..adc29a3daf 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -161,30 +161,30 @@ Item Rectangle { id: materialSelectionRow anchors.top: variantRow.bottom - anchors.topMargin: UM.MachineManager.hasMaterials ? UM.Theme.sizes.default_margin.height : 0 + anchors.topMargin: UM.MachineManager.hasMaterials ? UM.Theme.getSize("default_margin").height : 0 width: base.width - height: UM.MachineManager.hasMaterials ? UM.Theme.sizes.sidebar_setup.height : 0 + height: UM.MachineManager.hasMaterials ? UM.Theme.getSize("sidebar_setup").height : 0 visible: UM.MachineManager.hasMaterials Label{ id: materialSelectionLabel text: catalog.i18nc("@label","Material:"); anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.default_margin.width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width; anchors.verticalCenter: parent.verticalCenter width: parent.width/100*45 - font: UM.Theme.fonts.default; - color: UM.Theme.colors.text; + font: UM.Theme.getFont("default"); + color: UM.Theme.getColor("text"); } ToolButton { id: materialSelection text: UM.MachineManager.activeMaterial width: parent.width/100*55 - height: UM.Theme.sizes.setting_control.height + height: UM.Theme.getSize("setting_control").height tooltip: UM.MachineManager.activeMaterial; anchors.right: parent.right - anchors.rightMargin: UM.Theme.sizes.default_margin.width + anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: parent.verticalCenter style: UM.Theme.styles.sidebar_header_button From 074048f83ca714f3da21ce4b8627770201202a77 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Feb 2016 15:20:16 +0100 Subject: [PATCH 11/15] Use the key property of action's source to scroll setting visibility --- resources/qml/Cura.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f320e03e67..09ea6a54b6 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -482,7 +482,7 @@ UM.MainWindow { preferences.visible = true; preferences.setPage(2); - preferences.getCurrentItem().scrollToSection(source); + preferences.getCurrentItem().scrollToSection(source.key); } } } From 222b4666d3c7e4c2d22741b5ccd3f861f9cd3d89 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Feb 2016 15:20:41 +0100 Subject: [PATCH 12/15] Do not load the theme again when the UI has been loaded Theme is now loaded on creation instead --- resources/qml/Cura.qml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 09ea6a54b6..cdd97b84cb 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -706,11 +706,6 @@ UM.MainWindow } } - Component.onCompleted: - { - UM.Theme.load(UM.Resources.getPath(UM.Resources.Themes, "cura")) - } - Timer { id: startupTimer; From fa907dfb1b565287eaa8cea8dc4d69e2f63e26ff Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Feb 2016 15:21:33 +0100 Subject: [PATCH 13/15] Fix sizing behaviour of Save button Use the text size with some margin for the button size and simply anchor it to the right drop down button. --- resources/qml/SaveButton.qml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index c1be09d3c9..f08fe6bab6 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -74,13 +74,14 @@ Rectangle { Button { id: saveToButton - property int resizedWidth - x: base.width - saveToButton.resizedWidth - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("save_button_save_to_button").height + UM.Theme.getSize("save_button_save_to_button").width + tooltip: UM.OutputDeviceManager.activeDeviceDescription; enabled: base.backendState == 2 && base.activity == true height: UM.Theme.getSize("save_button_save_to_button").height - width: 150 + anchors.top:parent.top + anchors.right: deviceSelectionMenu.left; + text: UM.OutputDeviceManager.activeDeviceShortDescription onClicked: { @@ -88,9 +89,9 @@ Rectangle { } style: ButtonStyle { - background: Rectangle { - //opacity: control.enabled ? 1.0 : 0.5 - //Behavior on opacity { NumberAnimation { duration: 50; } } + background: + Rectangle + { border.width: UM.Theme.getSize("default_lining").width border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : control.pressed ? UM.Theme.getColor("action_button_active_border") : @@ -99,13 +100,11 @@ Rectangle { control.pressed ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") Behavior on color { ColorAnimation { duration: 50; } } - width: { - saveToButton.resizedWidth = actualLabel.width + (UM.Theme.getSize("default_margin").width * 2) - return saveToButton.resizedWidth - } + + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) + Label { id: actualLabel - //Behavior on opacity { NumberAnimation { duration: 50; } } anchors.centerIn: parent color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : control.pressed ? UM.Theme.getColor("action_button_active_text") : @@ -155,7 +154,8 @@ Rectangle { sourceSize.width: width sourceSize.height: height color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : - control.pressed ? UM.Theme.getColor("action_button_active_text") : control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text"); + control.pressed ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text"); source: UM.Theme.getIcon("arrow_bottom"); } } From e378c54ce22ed3ef05198ca829b9692df106feb7 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Feb 2016 15:22:18 +0100 Subject: [PATCH 14/15] Remove commented code from Cura theme styles.qml --- resources/themes/cura/styles.qml | 50 -------------------------------- 1 file changed, 50 deletions(-) diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index c54dad7a0c..454ab4ed14 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -42,56 +42,6 @@ QtObject { } } -<<<<<<< HEAD -======= -/* - property Component open_file_button: Component { - ButtonStyle { - background: Item{ - implicitWidth: UM.Theme.getSize("button").width; - implicitHeight: UM.Theme.getSize("button").height; - Rectangle { - id: tool_button_background - anchors.left: parent.right - anchors.verticalCenter: parent.verticalCenter - opacity: control.hovered ? 1.0 : 0.0; - - width: control.hovered ? label.width : 0; - height: label.height - - Behavior on width { NumberAnimation { duration: 100; } } - Behavior on height { NumberAnimation { duration: 100; } } - Behavior on opacity { NumberAnimation { duration: 100; } } - - Label { - id: label - anchors.bottom: parent.bottom - text: control.text - font: UM.Theme.getFont("button_tooltip"); - color: UM.Theme.getColor("button_tooltip_text"); - } - } - Rectangle { - anchors.fill: parent; - color: control.pressed ? UM.Theme.getColor("button_active") : - control.hovered ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("button") - Behavior on color { ColorAnimation { duration: 50; } } - } - } - label: Item { - Image { - anchors.centerIn: parent; - source: control.iconSource; - width: UM.Theme.getSize("button_icon").width; - height: UM.Theme.getSize("button_icon").height; - sourceSize: UM.Theme.getSize("button_icon") - } - } - } - } -*/ - ->>>>>>> Convert Toolbar.qml and styles.qml to Theme getThing style property Component tool_button: Component { ButtonStyle { background: Item { From 2aaf633492c1f49d8224ff2064e60b2ee91f59c2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 16 Feb 2016 15:22:53 +0100 Subject: [PATCH 15/15] Replace usage of UM.Theme with Theme from context in Cura theme styles This way we do not recursively try to create the Theme object --- resources/themes/cura/styles.qml | 274 +++++++++++++++---------------- 1 file changed, 136 insertions(+), 138 deletions(-) diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index 454ab4ed14..d1cd8d1872 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -5,37 +5,37 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 -import UM 1.0 as UM +import UM 1.1 as UM QtObject { property Component sidebar_header_button: Component { ButtonStyle { background: Rectangle { - color: UM.Theme.getColor("setting_control") - border.width: UM.Theme.getSize("default_lining").width - border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") + color: Theme.getColor("setting_control") + border.width: Theme.getSize("default_lining").width + border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border") UM.RecolorImage { id: downArrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + anchors.rightMargin: Theme.getSize("default_margin").width + width: Theme.getSize("standard_arrow").width + height: Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width - color: UM.Theme.getColor("setting_category_text") - source: UM.Theme.getIcon("arrow_bottom") + color: Theme.getColor("setting_category_text") + source: Theme.getIcon("arrow_bottom") } Label { id: sidebarComboBoxLabel - color: UM.Theme.getColor("setting_control_text") + color: Theme.getColor("setting_control_text") text: control.text; elide: Text.ElideRight; anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.leftMargin: Theme.getSize("setting_unit_margin").width anchors.right: downArrow.left; anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("default") + font: Theme.getFont("default") } } label: Label{} @@ -45,23 +45,23 @@ QtObject { property Component tool_button: Component { ButtonStyle { background: Item { - implicitWidth: UM.Theme.getSize("button").width; - implicitHeight: UM.Theme.getSize("button").height; + implicitWidth: Theme.getSize("button").width; + implicitHeight: Theme.getSize("button").height; UM.PointingRectangle { id: button_tooltip anchors.left: parent.right - anchors.leftMargin: UM.Theme.getSize("button_tooltip_arrow").width * 2 + anchors.leftMargin: Theme.getSize("button_tooltip_arrow").width * 2 anchors.verticalCenter: parent.verticalCenter target: Qt.point(parent.x, y + height/2) - arrowSize: UM.Theme.getSize("button_tooltip_arrow").width - color: UM.Theme.getColor("tooltip") + arrowSize: Theme.getSize("button_tooltip_arrow").width + color: Theme.getColor("tooltip") opacity: control.hovered ? 1.0 : 0.0; - width: control.hovered ? button_tip.width + UM.Theme.getSize("button_tooltip").width : 0 - height: UM.Theme.getSize("button_tooltip").height + width: control.hovered ? button_tip.width + Theme.getSize("button_tooltip").width : 0 + height: Theme.getSize("button_tooltip").height Behavior on width { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } } @@ -73,8 +73,8 @@ QtObject { anchors.verticalCenter: parent.verticalCenter; text: control.text; - font: UM.Theme.getFont("button_tooltip"); - color: UM.Theme.getColor("tooltip_text"); + font: Theme.getFont("button_tooltip"); + color: Theme.getColor("tooltip_text"); } } @@ -86,13 +86,13 @@ QtObject { color: { if(control.checkable && control.checked && control.hovered) { - return UM.Theme.getColor("button_active_hover"); + return Theme.getColor("button_active_hover"); } else if(control.pressed || (control.checkable && control.checked)) { - return UM.Theme.getColor("button_active"); + return Theme.getColor("button_active"); } else if(control.hovered) { - return UM.Theme.getColor("button_hover"); + return Theme.getColor("button_hover"); } else { - return UM.Theme.getColor("button"); + return Theme.getColor("button"); } } Behavior on color { ColorAnimation { duration: 50; } } @@ -102,16 +102,16 @@ QtObject { id: tool_button_arrow opacity: !control.enabled ? 0.2 : 1.0 anchors.right: parent.right; - anchors.rightMargin: (UM.Theme.getSize("button").width - UM.Theme.getSize("button_icon").width) / 4 + anchors.rightMargin: (Theme.getSize("button").width - Theme.getSize("button_icon").width) / 4 anchors.bottom: parent.bottom; - anchors.bottomMargin: (UM.Theme.getSize("button").height - UM.Theme.getSize("button_icon").height) / 4 - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + anchors.bottomMargin: (Theme.getSize("button").height - Theme.getSize("button_icon").height) / 4 + width: Theme.getSize("standard_arrow").width + height: Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width visible: control.menu != null; - color: UM.Theme.getColor("button_text") - source: UM.Theme.getIcon("arrow_bottom") + color: Theme.getColor("button_text") + source: Theme.getIcon("arrow_bottom") } } } @@ -121,10 +121,10 @@ QtObject { anchors.centerIn: parent; opacity: !control.enabled ? 0.2 : 1.0 source: control.iconSource; - width: UM.Theme.getSize("button_icon").width; - height: UM.Theme.getSize("button_icon").height; + width: Theme.getSize("button_icon").width; + height: Theme.getSize("button_icon").height; - sourceSize: UM.Theme.getSize("button_icon") + sourceSize: Theme.getSize("button_icon") } } } @@ -133,24 +133,24 @@ QtObject { property Component progressbar: Component{ ProgressBarStyle { background:Rectangle { - implicitWidth: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) - implicitHeight: UM.Theme.getSize("progressbar").height - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_background") + implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) + implicitHeight: Theme.getSize("progressbar").height + radius: Theme.getSize("progressbar_radius").width + color: Theme.getColor("progressbar_background") } progress: Rectangle { - color: control.indeterminate ? "transparent" : UM.Theme.getColor("progressbar_control") - radius: UM.Theme.sizes.progressbar_radius.width + color: control.indeterminate ? "transparent" : Theme.getColor("progressbar_control") + radius: Theme.getSize("progressbar_radius").width Rectangle{ - radius: UM.Theme.getSize("progressbar_radius").width - color: UM.Theme.getColor("progressbar_control") - width: UM.Theme.getSize("progressbar_control").width - height: UM.Theme.getSize("progressbar_control").height + radius: Theme.getSize("progressbar_radius").width + color: Theme.getColor("progressbar_control") + width: Theme.getSize("progressbar_control").width + height: Theme.getSize("progressbar_control").height visible: control.indeterminate SequentialAnimation on x { id: xAnim - property int animEndPoint: UM.Theme.getSize("message").width - (UM.Theme.getSize("default_margin").width * 2) - UM.Theme.getSize("progressbar_control").width + property int animEndPoint: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) - Theme.getSize("progressbar_control").width running: control.indeterminate loops: Animation.Infinite NumberAnimation { from: 0; to: xAnim.animEndPoint; duration: 2000;} @@ -161,48 +161,46 @@ QtObject { } } - - property Component sidebar_category: Component { ButtonStyle { background: Rectangle { anchors.fill: parent; anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.leftMargin: Theme.getSize("default_margin").width anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - implicitHeight: UM.Theme.getSize("section").height; + anchors.rightMargin: Theme.getSize("default_margin").width + implicitHeight: Theme.getSize("section").height; color: { if(control.color) { return control.color; } else if(!control.enabled) { - return UM.Theme.getColor("setting_category_disabled"); + return Theme.getColor("setting_category_disabled"); } else if(control.hovered && control.checkable && control.checked) { - return UM.Theme.getColor("setting_category_active_hover"); + return Theme.getColor("setting_category_active_hover"); } else if(control.pressed || (control.checkable && control.checked)) { - return UM.Theme.getColor("setting_category_active"); + return Theme.getColor("setting_category_active"); } else if(control.hovered) { - return UM.Theme.getColor("setting_category_hover"); + return Theme.getColor("setting_category_hover"); } else { - return UM.Theme.getColor("setting_category"); + return Theme.getColor("setting_category"); } } Behavior on color { ColorAnimation { duration: 50; } } Rectangle { - height: UM.Theme.getSize("default_lining").height + height: Theme.getSize("default_lining").height width: parent.width anchors.bottom: parent.bottom color: { if(!control.enabled) { - return UM.Theme.getColor("setting_category_disabled_border"); + return Theme.getColor("setting_category_disabled_border"); } else if(control.hovered && control.checkable && control.checked) { - return UM.Theme.getColor("setting_category_active_hover_border"); + return Theme.getColor("setting_category_active_hover_border"); } else if(control.pressed || (control.checkable && control.checked)) { - return UM.Theme.getColor("setting_category_active_border"); + return Theme.getColor("setting_category_active_border"); } else if(control.hovered) { - return UM.Theme.getColor("setting_category_hover_border"); + return Theme.getColor("setting_category_hover_border"); } else { - return UM.Theme.getColor("setting_category_border"); + return Theme.getColor("setting_category_border"); } } } @@ -214,15 +212,15 @@ QtObject { id: icon; anchors.left: parent.left height: parent.height - width: UM.Theme.getSize("section_icon_column").width + width: Theme.getSize("section_icon_column").width UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - color: UM.Theme.getColor("setting_category_text") + anchors.leftMargin: Theme.getSize("default_margin").width + color: Theme.getColor("setting_category_text") source: control.iconSource; - width: UM.Theme.getSize("section_icon").width; - height: UM.Theme.getSize("section_icon").height; + width: Theme.getSize("section_icon").width; + height: Theme.getSize("section_icon").height; sourceSize.width: width + 15 sourceSize.height: width + 15 } @@ -231,13 +229,13 @@ QtObject { Label { anchors { left: icon.right; - leftMargin: UM.Theme.getSize("default_lining").width; + leftMargin: Theme.getSize("default_lining").width; right: parent.right; verticalCenter: parent.verticalCenter; } text: control.text; - font: UM.Theme.getFont("setting_category"); - color: UM.Theme.getColor("setting_category_text"); + font: Theme.getFont("setting_category"); + color: Theme.getColor("setting_category_text"); fontSizeMode: Text.HorizontalFit; minimumPointSize: 8 } @@ -245,13 +243,13 @@ QtObject { id: category_arrow anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2 - width / 2 - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + anchors.rightMargin: Theme.getSize("default_margin").width * 2 - width / 2 + width: Theme.getSize("standard_arrow").width + height: Theme.getSize("standard_arrow").height sourceSize.width: width sourceSize.height: width - color: UM.Theme.getColor("setting_category_text") - source: control.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") + color: Theme.getColor("setting_category_text") + source: control.checked ? Theme.getIcon("arrow_bottom") : Theme.getIcon("arrow_left") } } } @@ -265,62 +263,62 @@ QtObject { transientScrollBars: false scrollBarBackground: Rectangle { - implicitWidth: UM.Theme.getSize("scrollbar").width + implicitWidth: Theme.getSize("scrollbar").width radius: implicitWidth / 2 - color: UM.Theme.getColor("scrollbar_background"); + color: Theme.getColor("scrollbar_background"); } handle: Rectangle { id: scrollViewHandle - implicitWidth: UM.Theme.getSize("scrollbar").width; + implicitWidth: Theme.getSize("scrollbar").width; radius: implicitWidth / 2 - color: styleData.pressed ? UM.Theme.getColor("scrollbar_handle_down") : styleData.hovered ? UM.Theme.getColor("scrollbar_handle_hover") : UM.Theme.getColor("scrollbar_handle"); + color: styleData.pressed ? Theme.getColor("scrollbar_handle_down") : styleData.hovered ? Theme.getColor("scrollbar_handle_hover") : Theme.getColor("scrollbar_handle"); Behavior on color { ColorAnimation { duration: 50; } } } } } property variant setting_item: UM.SettingItemStyle { - labelFont: UM.Theme.getFont("default"); - labelColor: UM.Theme.getColor("setting_control_text"); + labelFont: Theme.getFont("default"); + labelColor: Theme.getColor("setting_control_text"); - spacing: UM.Theme.getSize("default_lining").height; - fixedHeight: UM.Theme.getSize("setting").height; + spacing: Theme.getSize("default_lining").height; + fixedHeight: Theme.getSize("setting").height; - controlWidth: UM.Theme.getSize("setting_control").width; - controlRightMargin: UM.Theme.getSize("setting_control_margin").width; - controlColor: UM.Theme.getColor("setting_control"); - controlHighlightColor: UM.Theme.getColor("setting_control_highlight"); - controlBorderColor: UM.Theme.getColor("setting_control_border"); - controlBorderHighlightColor: UM.Theme.getColor("setting_control_border_highlight"); - controlTextColor: UM.Theme.getColor("setting_control_text"); - controlBorderWidth: UM.Theme.getSize("default_lining").width; - controlFont: UM.Theme.getFont("default"); + controlWidth: Theme.getSize("setting_control").width; + controlRightMargin: Theme.getSize("setting_control_margin").width; + controlColor: Theme.getColor("setting_control"); + controlHighlightColor: Theme.getColor("setting_control_highlight"); + controlBorderColor: Theme.getColor("setting_control_border"); + controlBorderHighlightColor: Theme.getColor("setting_control_border_highlight"); + controlTextColor: Theme.getColor("setting_control_text"); + controlBorderWidth: Theme.getSize("default_lining").width; + controlFont: Theme.getFont("default"); - validationErrorColor: UM.Theme.getColor("setting_validation_error"); - validationWarningColor: UM.Theme.getColor("setting_validation_warning"); - validationOkColor: UM.Theme.getColor("setting_validation_ok"); + validationErrorColor: Theme.getColor("setting_validation_error"); + validationWarningColor: Theme.getColor("setting_validation_warning"); + validationOkColor: Theme.getColor("setting_validation_ok"); - unitRightMargin: UM.Theme.getSize("setting_unit_margin").width; - unitColor: UM.Theme.getColor("setting_unit"); - unitFont: UM.Theme.getFont("default"); + unitRightMargin: Theme.getSize("setting_unit_margin").width; + unitColor: Theme.getColor("setting_unit"); + unitFont: Theme.getFont("default"); } property Component checkbox: Component { CheckBoxStyle { background: Item { } indicator: Rectangle { - implicitWidth: UM.Theme.getSize("checkbox").width; - implicitHeight: UM.Theme.getSize("checkbox").height; + implicitWidth: Theme.getSize("checkbox").width; + implicitHeight: Theme.getSize("checkbox").height; - color: (control.hovered || control.hovered_ex) ? UM.Theme.getColor("checkbox_hover") : UM.Theme.getColor("checkbox"); + color: (control.hovered || control.hovered_ex) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); Behavior on color { ColorAnimation { duration: 50; } } - radius: control.exclusiveGroup ? UM.Theme.getSize("checkbox").width / 2 : 0 + radius: control.exclusiveGroup ? Theme.getSize("checkbox").width / 2 : 0 - border.width: UM.Theme.getSize("default_lining").width; - border.color: (control.hovered || control.hovered_ex) ? UM.Theme.getColor("checkbox_border_hover") : UM.Theme.getColor("checkbox_border"); + border.width: Theme.getSize("default_lining").width; + border.color: (control.hovered || control.hovered_ex) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); UM.RecolorImage { anchors.verticalCenter: parent.verticalCenter @@ -329,16 +327,16 @@ QtObject { height: parent.height/2.5 sourceSize.width: width sourceSize.height: width - color: UM.Theme.getColor("checkbox_mark") - source: control.exclusiveGroup ? UM.Theme.getIcon("dot") : UM.Theme.getIcon("check") + color: Theme.getColor("checkbox_mark") + source: control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check") opacity: control.checked Behavior on opacity { NumberAnimation { duration: 100; } } } } label: Label { text: control.text; - color: UM.Theme.getColor("checkbox_text"); - font: UM.Theme.getFont("default"); + color: Theme.getColor("checkbox_text"); + font: Theme.getFont("default"); } } } @@ -347,11 +345,11 @@ QtObject { SliderStyle { groove: Rectangle { implicitWidth: control.width; - implicitHeight: UM.Theme.getSize("slider_groove").height; + implicitHeight: Theme.getSize("slider_groove").height; - color: UM.Theme.getColor("slider_groove"); - border.width: UM.Theme.getSize("default_lining").width; - border.color: UM.Theme.getColor("slider_groove_border"); + color: Theme.getColor("slider_groove"); + border.width: Theme.getSize("default_lining").width; + border.color: Theme.getColor("slider_groove_border"); Rectangle { anchors { @@ -359,14 +357,14 @@ QtObject { top: parent.top; bottom: parent.bottom; } - color: UM.Theme.getColor("slider_groove_fill"); + color: Theme.getColor("slider_groove_fill"); width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width; } } handle: Rectangle { - width: UM.Theme.getSize("slider_handle").width; - height: UM.Theme.getSize("slider_handle").height; - color: control.hovered ? UM.Theme.getColor("slider_handle_hover") : UM.Theme.getColor("slider_handle"); + width: Theme.getSize("slider_handle").width; + height: Theme.getSize("slider_handle").height; + color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle"); Behavior on color { ColorAnimation { duration: 50; } } } } @@ -377,28 +375,28 @@ QtObject { groove: Rectangle { id: layerSliderGroove implicitWidth: control.width; - implicitHeight: UM.Theme.getSize("slider_groove").height; + implicitHeight: Theme.getSize("slider_groove").height; radius: width/2; - color: UM.Theme.getColor("slider_groove"); - border.width: UM.Theme.getSize("default_lining").width; - border.color: UM.Theme.getColor("slider_groove_border"); + color: Theme.getColor("slider_groove"); + border.width: Theme.getSize("default_lining").width; + border.color: Theme.getColor("slider_groove_border"); Rectangle { anchors { left: parent.left; top: parent.top; bottom: parent.bottom; } - color: UM.Theme.getColor("slider_groove_fill"); + color: Theme.getColor("slider_groove_fill"); width: (control.value / (control.maximumValue - control.minimumValue)) * parent.width; radius: width/2 } } handle: Rectangle { id: layerSliderControl - width: UM.Theme.getSize("slider_handle").width; - height: UM.Theme.getSize("slider_handle").height; - color: control.hovered ? UM.Theme.getColor("slider_handle_hover") : UM.Theme.getColor("slider_handle"); + width: Theme.getSize("slider_handle").width; + height: Theme.getSize("slider_handle").height; + color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle"); Behavior on color { ColorAnimation { duration: 50; } } TextField { id: valueLabel @@ -413,17 +411,17 @@ QtObject { validator: IntValidator {bottom: 1; top: control.maximumValue + 1;} visible: UM.LayerView.getLayerActivity && Printer.getPlatformActivity ? true : false anchors.top: layerSliderControl.bottom - anchors.topMargin: width/2 - UM.Theme.getSize("default_margin").width/2 + anchors.topMargin: width/2 - Theme.getSize("default_margin").width/2 anchors.horizontalCenter: layerSliderControl.horizontalCenter rotation: 90 style: TextFieldStyle{ - textColor: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default"); + textColor: Theme.getColor("setting_control_text"); + font: Theme.getFont("default"); background: Rectangle { - implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + UM.Theme.getSize("default_margin").width - implicitHeight: UM.Theme.getSize("slider_handle").height + UM.Theme.getSize("default_margin").width - border.width: UM.Theme.getSize("default_lining").width; - border.color: UM.Theme.getColor("slider_groove_border"); + implicitWidth: control.maxValue.length * valueLabel.font.pixelSize + Theme.getSize("default_margin").width + implicitHeight: Theme.getSize("slider_handle").height + Theme.getSize("default_margin").width + border.width: Theme.getSize("default_lining").width; + border.color: Theme.getColor("slider_groove_border"); } } } @@ -433,27 +431,27 @@ QtObject { property Component text_field: Component { TextFieldStyle { - textColor: UM.Theme.getColor("setting_control_text"); - font: UM.Theme.getFont("default"); + textColor: Theme.getColor("setting_control_text"); + font: Theme.getFont("default"); background: Rectangle { implicitHeight: control.height; implicitWidth: control.width; - border.width: UM.Theme.getSize("default_lining").width; - border.color: control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border"); + border.width: Theme.getSize("default_lining").width; + border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); - color: UM.Theme.getColor("setting_validation_ok"); + color: Theme.getColor("setting_validation_ok"); Label { anchors.right: parent.right; - anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width; + anchors.rightMargin: Theme.getSize("setting_unit_margin").width; anchors.verticalCenter: parent.verticalCenter; text: control.unit ? control.unit : "" - color: UM.Theme.getColor("setting_unit"); - font: UM.Theme.getFont("default"); + color: Theme.getColor("setting_unit"); + font: Theme.getFont("default"); } } }