Fix code style

Most stuff here was recently changed. Some of it was where I found a pattern in something that was likely copy-pasted from somewhere else, so I did a global search and replace on that.

Contributes to issue CURA-5784.
This commit is contained in:
Ghostkeeper 2018-10-18 14:30:11 +02:00
parent a4c609d514
commit 1bcd134f85
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
24 changed files with 433 additions and 243 deletions

View file

@ -22,7 +22,7 @@ Cura.MachineAction
{ {
id: firmwareUpdaterMachineAction id: firmwareUpdaterMachineAction
anchors.fill: parent; anchors.fill: parent;
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
Label Label

View file

@ -20,7 +20,7 @@ UM.Dialog
GridLayout GridLayout
{ {
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
anchors.fill: parent; anchors.fill: parent;
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 16 * screenScaleFactor columnSpacing: 16 * screenScaleFactor

View file

@ -16,7 +16,7 @@ Button
{ {
id: modelCheckerButton id: modelCheckerButton
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
visible: manager.hasWarnings visible: manager.hasWarnings
tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.") tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.")

View file

@ -31,7 +31,7 @@ UM.Dialog
Item Item
{ {
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
id: base id: base
property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width) property int columnWidth: Math.round((base.width / 2) - UM.Theme.getSize("default_margin").width)
property int textMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) property int textMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)

View file

@ -16,7 +16,7 @@ Item
UM.I18nCatalog UM.I18nCatalog
{ {
id: catalog id: catalog
name:"cura" name: "cura"
} }
Row Row

View file

@ -24,7 +24,7 @@ Window
UM.I18nCatalog UM.I18nCatalog
{ {
id: catalog id: catalog
name:"cura" name: "cura"
} }
Item Item
{ {

View file

@ -54,7 +54,7 @@ Cura.MachineAction
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
SystemPalette { id: palette } SystemPalette { id: palette }
UM.I18nCatalog { id: catalog; name:"cura" } UM.I18nCatalog { id: catalog; name: "cura" }
Label Label
{ {
id: pageTitle id: pageTitle

View file

@ -121,5 +121,5 @@ Item
} }
} }
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
} }

View file

@ -19,7 +19,7 @@ Cura.MachineAction
property bool heatupBedStarted: false property bool heatupBedStarted: false
property bool printerConnected: Cura.MachineManager.printerConnected property bool printerConnected: Cura.MachineManager.printerConnected
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
Label Label
{ {
id: pageTitle id: pageTitle

View file

@ -36,7 +36,7 @@ UM.Dialog
width: parent.width width: parent.width
anchors.bottomMargin: UM.Theme.getSize("default_margin").height anchors.bottomMargin: UM.Theme.getSize("default_margin").height
UM.I18nCatalog { id: catalog; name:"cura" } UM.I18nCatalog { id: catalog; name: "cura" }
Button Button
{ {

View file

@ -40,7 +40,7 @@ Button
id: popup id: popup
y: parent.height + UM.Theme.getSize("default_arrow").height y: parent.height + UM.Theme.getSize("default_arrow").height
x: (parent.width - width) x: parent.width - width
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent

View file

@ -1,4 +1,4 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
pragma Singleton pragma Singleton
@ -67,7 +67,7 @@ Item
property alias browsePackages: browsePackagesAction property alias browsePackages: browsePackagesAction
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
Action Action
{ {

View file

@ -26,7 +26,7 @@ UM.MainWindow
UM.I18nCatalog UM.I18nCatalog
{ {
id: catalog id: catalog
name:"cura" name: "cura"
} }
function showTooltip(item, position, text) function showTooltip(item, position, text)
@ -236,7 +236,7 @@ UM.MainWindow
textRole: "name" textRole: "name"
// update the model's active index // update the model's active index
function updateItemActiveFlags () function updateItemActiveFlags()
{ {
currentIndex = getActiveIndex() currentIndex = getActiveIndex()
for (var i = 0; i < model.rowCount(); i++) for (var i = 0; i < model.rowCount(); i++)
@ -316,7 +316,7 @@ UM.MainWindow
Loader Loader
{ {
// A stage can control this area. If nothing is set, it will therefor show the 3D view. // A stage can control this area. If nothing is set, it will therefore show the 3D view.
id: main id: main
anchors anchors

View file

@ -1,4 +1,4 @@
// Copyright (c) 2015 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
@ -45,7 +45,7 @@ UM.Dialog
anchors.topMargin: ((base.minimumWidth - width) / 2) | 0 anchors.topMargin: ((base.minimumWidth - width) / 2) | 0
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
} }
Label Label
@ -129,32 +129,32 @@ UM.Dialog
} }
Component.onCompleted: Component.onCompleted:
{ {
projectsModel.append({ name:"Cura", description: catalog.i18nc("@label", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" }); projectsModel.append({ name: "Cura", description: catalog.i18nc("@label", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" });
projectsModel.append({ name:"Uranium", description: catalog.i18nc("@label", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" }); projectsModel.append({ name: "Uranium", description: catalog.i18nc("@label", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" });
projectsModel.append({ name:"CuraEngine", description: catalog.i18nc("@label", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" }); projectsModel.append({ name: "CuraEngine", description: catalog.i18nc("@label", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" });
projectsModel.append({ name:"libArcus", description: catalog.i18nc("@label", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" }); projectsModel.append({ name: "libArcus", description: catalog.i18nc("@label", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" });
projectsModel.append({ name:"Python", description: catalog.i18nc("@label", "Programming language"), license: "Python", url: "http://python.org/" }); projectsModel.append({ name: "Python", description: catalog.i18nc("@label", "Programming language"), license: "Python", url: "http://python.org/" });
projectsModel.append({ name:"Qt5", description: catalog.i18nc("@label", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" }); projectsModel.append({ name: "Qt5", description: catalog.i18nc("@label", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" });
projectsModel.append({ name:"PyQt", description: catalog.i18nc("@label", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" }); projectsModel.append({ name: "PyQt", description: catalog.i18nc("@label", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" });
projectsModel.append({ name:"SIP", description: catalog.i18nc("@label", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" }); projectsModel.append({ name: "SIP", description: catalog.i18nc("@label", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" });
projectsModel.append({ name:"Protobuf", description: catalog.i18nc("@label", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" }); projectsModel.append({ name: "Protobuf", description: catalog.i18nc("@label", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" });
projectsModel.append({ name:"SciPy", description: catalog.i18nc("@label", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" }); projectsModel.append({ name: "SciPy", description: catalog.i18nc("@label", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" });
projectsModel.append({ name:"NumPy", description: catalog.i18nc("@label", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" }); projectsModel.append({ name: "NumPy", description: catalog.i18nc("@label", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" });
projectsModel.append({ name:"NumPy-STL", description: catalog.i18nc("@label", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" }); projectsModel.append({ name: "NumPy-STL", description: catalog.i18nc("@label", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" });
projectsModel.append({ name:"Shapely", description: catalog.i18nc("@label", "Support library for handling planar objects"), license: "BSD", url: "https://github.com/Toblerity/Shapely" }); projectsModel.append({ name: "Shapely", description: catalog.i18nc("@label", "Support library for handling planar objects"), license: "BSD", url: "https://github.com/Toblerity/Shapely" });
projectsModel.append({ name:"Trimesh", description: catalog.i18nc("@label", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" }); projectsModel.append({ name: "Trimesh", description: catalog.i18nc("@label", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" });
projectsModel.append({ name:"NetworkX", description: catalog.i18nc("@label", "Support library for analysis of complex networks"), license: "3-clause BSD", url: "https://networkx.github.io/" }); projectsModel.append({ name: "NetworkX", description: catalog.i18nc("@label", "Support library for analysis of complex networks"), license: "3-clause BSD", url: "https://networkx.github.io/" });
projectsModel.append({ name:"libSavitar", description: catalog.i18nc("@label", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" }); projectsModel.append({ name: "libSavitar", description: catalog.i18nc("@label", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" });
projectsModel.append({ name:"libCharon", description: catalog.i18nc("@label", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" }); projectsModel.append({ name: "libCharon", description: catalog.i18nc("@label", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" });
projectsModel.append({ name:"PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" }); projectsModel.append({ name: "PySerial", description: catalog.i18nc("@label", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" });
projectsModel.append({ name:"python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" }); projectsModel.append({ name: "python-zeroconf", description: catalog.i18nc("@label", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" });
projectsModel.append({ name:"Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" }); projectsModel.append({ name: "Clipper", description: catalog.i18nc("@label", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" });
projectsModel.append({ name:"Requests", description: catalog.i18nc("@Label", "Python HTTP library"), license: "GPL", url: "http://docs.python-requests.org" }); projectsModel.append({ name: "Requests", description: catalog.i18nc("@Label", "Python HTTP library"), license: "GPL", url: "http://docs.python-requests.org" });
projectsModel.append({ name:"Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" }); projectsModel.append({ name: "Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" });
projectsModel.append({ name:"Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" }); projectsModel.append({ name: "Font-Awesome-SVG-PNG", description: catalog.i18nc("@label", "SVG icons"), license: "SIL OFL 1.1", url: "https://github.com/encharm/Font-Awesome-SVG-PNG" });
projectsModel.append({ name:"AppImageKit", description: catalog.i18nc("@label", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" }); projectsModel.append({ name: "AppImageKit", description: catalog.i18nc("@label", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" });
} }
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
@ -15,7 +15,7 @@ Item {
property bool activity: CuraApplication.platformActivity property bool activity: CuraApplication.platformActivity
property string fileBaseName: PrintInformation.baseName property string fileBaseName: PrintInformation.baseName
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
height: childrenRect.height height: childrenRect.height

View file

@ -128,7 +128,8 @@ Item
Instantiator Instantiator
{ {
model: Cura.ExtrudersModel { simpleNames: true } model: Cura.ExtrudersModel { simpleNames: true }
Menu { Menu
{
title: model.name title: model.name
NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index } NozzleMenu { title: Cura.MachineManager.activeDefinitionVariantsName; visible: Cura.MachineManager.hasVariants; extruderIndex: index }
@ -267,7 +268,8 @@ Item
} }
} }
UM.ExtensionModel { UM.ExtensionModel
{
id: curaExtensions id: curaExtensions
} }
@ -291,7 +293,8 @@ Item
Connections Connections
{ {
target: Cura.Actions.browsePackages target: Cura.Actions.browsePackages
onTriggered: { onTriggered:
{
curaExtensions.callExtensionMethod("Toolbox", "browsePackages") curaExtensions.callExtensionMethod("Toolbox", "browsePackages")
} }
} }

View file

@ -21,7 +21,7 @@ Rectangle
// Height has an extra 2x margin for the top & bottom margin. // Height has an extra 2x margin for the top & bottom margin.
height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width height: childrenRect.height + 2 * UM.Theme.getSize("default_margin").width
Cura.ExtrudersModel { id: extrudersModel; } Cura.ExtrudersModel { id: extrudersModel }
ListView ListView
{ {
@ -41,7 +41,7 @@ Rectangle
margins: UM.Theme.getSize("sidebar_margin").width margins: UM.Theme.getSize("sidebar_margin").width
} }
ExclusiveGroup { id: extruderMenuGroup; } ExclusiveGroup { id: extruderMenuGroup }
orientation: ListView.Horizontal orientation: ListView.Horizontal
@ -69,8 +69,10 @@ Rectangle
{ {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: { onClicked:
switch (mouse.button) { {
switch (mouse.button)
{
case Qt.LeftButton: case Qt.LeftButton:
extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled extruder_enabled = Cura.MachineManager.getExtruder(model.index).isEnabled
if (extruder_enabled) if (extruder_enabled)
@ -114,7 +116,8 @@ Rectangle
{ {
anchors.fill: parent anchors.fill: parent
border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
border.color: { border.color:
{
if (Cura.MachineManager.getExtruder(index).isEnabled) if (Cura.MachineManager.getExtruder(index).isEnabled)
{ {
if(control.checked || control.pressed) if(control.checked || control.pressed)
@ -128,13 +131,15 @@ Rectangle
} }
return UM.Theme.getColor("action_button_disabled_border") return UM.Theme.getColor("action_button_disabled_border")
} }
color: { color:
{
if (Cura.MachineManager.getExtruder(index).isEnabled) if (Cura.MachineManager.getExtruder(index).isEnabled)
{ {
if(control.checked || control.pressed) if(control.checked || control.pressed)
{ {
return UM.Theme.getColor("action_button_active"); return UM.Theme.getColor("action_button_active");
} else if (control.hovered) }
else if (control.hovered)
{ {
return UM.Theme.getColor("action_button_hovered") return UM.Theme.getColor("action_button_hovered")
} }
@ -157,13 +162,15 @@ Rectangle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
color: { color:
{
if (Cura.MachineManager.getExtruder(index).isEnabled) if (Cura.MachineManager.getExtruder(index).isEnabled)
{ {
if(control.checked || control.pressed) if(control.checked || control.pressed)
{ {
return UM.Theme.getColor("action_button_active_text"); return UM.Theme.getColor("action_button_active_text");
} else if (control.hovered) }
else if (control.hovered)
{ {
return UM.Theme.getColor("action_button_hovered_text") return UM.Theme.getColor("action_button_hovered_text")
} }

View file

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Item Item
{ {
id: base; id: base;
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
height: childrenRect.height + UM.Theme.getSize("sidebar_margin").height height: childrenRect.height + UM.Theme.getSize("sidebar_margin").height

View file

@ -1,4 +1,4 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
@ -31,7 +31,7 @@ Rectangle
property variant printMaterialNames: PrintInformation.materialNames property variant printMaterialNames: PrintInformation.materialNames
color: UM.Theme.getColor("sidebar") color: UM.Theme.getColor("sidebar")
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
Timer { Timer {
id: tooltipDelayTimer id: tooltipDelayTimer
@ -70,7 +70,7 @@ Rectangle
time -= minutes * 60 time -= minutes * 60
var seconds = Math.floor(time); var seconds = Math.floor(time);
var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2);
return finalTime; return finalTime;
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.1
@ -134,7 +134,7 @@ UM.PreferencesPage
UM.PluginsModel { id: plugins } UM.PluginsModel { id: plugins }
//: Language selection label //: Language selection label
UM.I18nCatalog{id: catalog; name:"cura"} UM.I18nCatalog{id: catalog; name: "cura"}
Label Label
{ {

View file

@ -1,4 +1,4 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
@ -26,7 +26,7 @@ Rectangle
property variant printMaterialNames: PrintInformation.materialNames property variant printMaterialNames: PrintInformation.materialNames
color: UM.Theme.getColor("sidebar") color: UM.Theme.getColor("sidebar")
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
// This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it. // This widget doesn't show tooltips by itself. Instead it emits signals so others can do something with it.
signal showTooltip(Item item, point location, string text) signal showTooltip(Item item, point location, string text)
@ -59,7 +59,7 @@ Rectangle
time -= minutes * 60 time -= minutes * 60
var seconds = Math.floor(time); var seconds = Math.floor(time);
var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2); var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2);
return finalTime; return finalTime;
} }
@ -152,7 +152,7 @@ Rectangle
background: Rectangle background: Rectangle
{ {
border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width border.width: control.checked ? UM.Theme.getSize("default_lining").width * 2 : UM.Theme.getSize("default_lining").width
border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border"): UM.Theme.getColor("action_button_border") border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") : control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border")
// for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is // for some reason, QtQuick decided to use the color of the background property as text color for the contentItem, so here it is
color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") : control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")

View file

@ -1,4 +1,4 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
@ -173,7 +173,8 @@ Rectangle
var weights = []; var weights = [];
var costs = []; var costs = [];
var someCostsKnown = false; var someCostsKnown = false;
if(base.printMaterialLengths) { if(base.printMaterialLengths)
{
for(var index = 0; index < base.printMaterialLengths.length; index++) for(var index = 0; index < base.printMaterialLengths.length; index++)
{ {
if(base.printMaterialLengths[index] > 0) if(base.printMaterialLengths[index] > 0)

View file

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Item Item
{ {
id: base; id: base;
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name: "cura"}
property real progress: UM.Backend.progress property real progress: UM.Backend.progress
property int backendState: UM.Backend.state property int backendState: UM.Backend.state
@ -36,7 +36,7 @@ Item
case 2: case 2:
return catalog.i18nc("@label:PrintjobStatus", "Slicing..."); return catalog.i18nc("@label:PrintjobStatus", "Slicing...");
case 3: case 3:
return catalog.i18nc("@label:PrintjobStatus %1 is target operation","Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription); return catalog.i18nc("@label:PrintjobStatus %1 is target operation", "Ready to %1").arg(UM.OutputDeviceManager.activeDeviceShortDescription);
case 4: case 4:
return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice"); return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice");
case 5: case 5:
@ -48,16 +48,20 @@ Item
function sliceOrStopSlicing() function sliceOrStopSlicing()
{ {
try { try
{
if ([1, 5].indexOf(base.backendState) != -1) if ([1, 5].indexOf(base.backendState) != -1)
{ {
CuraApplication.backend.forceSlice(); CuraApplication.backend.forceSlice();
} else { }
else
{
CuraApplication.backend.stopSlicing(); CuraApplication.backend.stopSlicing();
} }
} catch (e) }
catch (e)
{ {
console.log('Could not start or stop slicing', e) console.log("Could not start or stop slicing.", e)
} }
} }
@ -203,51 +207,77 @@ Item
sliceOrStopSlicing(); sliceOrStopSlicing();
} }
style: ButtonStyle { style: ButtonStyle
{
background: Rectangle background: Rectangle
{ {
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: border.color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border"); return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border"); return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border"); return UM.Theme.getColor("action_button_hovered_border");
}
else else
{
return UM.Theme.getColor("action_button_border"); return UM.Theme.getColor("action_button_border");
} }
}
color: color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled"); return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("action_button_active"); return UM.Theme.getColor("action_button_active");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered"); return UM.Theme.getColor("action_button_hovered");
}
else else
{
return UM.Theme.getColor("action_button"); return UM.Theme.getColor("action_button");
} }
}
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
Label { Label
{
id: actualLabel id: actualLabel
anchors.centerIn: parent anchors.centerIn: parent
color: color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text"); return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text"); return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text"); return UM.Theme.getColor("action_button_hovered_text");
}
else else
{
return UM.Theme.getColor("action_button_text"); return UM.Theme.getColor("action_button_text");
} }
}
font: UM.Theme.getFont("action_button") font: UM.Theme.getFont("action_button")
text: control.text; text: control.text;
} }
@ -287,43 +317,61 @@ Item
border.color: border.color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border"); return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed_border"); return UM.Theme.getColor("print_button_ready_pressed_border");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered_border"); return UM.Theme.getColor("print_button_ready_hovered_border");
}
else else
{
return UM.Theme.getColor("print_button_ready_border"); return UM.Theme.getColor("print_button_ready_border");
} }
}
color: color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled"); return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed"); return UM.Theme.getColor("print_button_ready_pressed");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered"); return UM.Theme.getColor("print_button_ready_hovered");
}
else else
{
return UM.Theme.getColor("print_button_ready"); return UM.Theme.getColor("print_button_ready");
} }
}
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
Label { Label
{
id: actualLabel id: actualLabel
anchors.centerIn: parent anchors.centerIn: parent
color:control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text")
font: UM.Theme.getFont("action_button") font: UM.Theme.getFont("action_button")
text: control.text; text: control.text
} }
} }
label: Item { } label: Item { }
} }
} }
Button { Button
{
id: deviceSelectionMenu id: deviceSelectionMenu
tooltip: catalog.i18nc("@info:tooltip","Select the active output device"); tooltip: catalog.i18nc("@info:tooltip","Select the active output device");
anchors.top: parent.top anchors.top: parent.top
@ -349,13 +397,16 @@ Item
if(!control.enabled) if(!control.enabled)
{ {
return UM.Theme.getColor("action_button_disabled_border") return UM.Theme.getColor("action_button_disabled_border")
} else if(control.pressed) }
else if(control.pressed)
{ {
return UM.Theme.getColor("print_button_ready_pressed_border") return UM.Theme.getColor("print_button_ready_pressed_border")
} else if(control.hovered) }
else if(control.hovered)
{ {
return UM.Theme.getColor("print_button_ready_hovered_border") return UM.Theme.getColor("print_button_ready_hovered_border")
} else }
else
{ {
return UM.Theme.getColor("print_button_ready_border") return UM.Theme.getColor("print_button_ready_border")
} }
@ -365,13 +416,16 @@ Item
if(!control.enabled) if(!control.enabled)
{ {
return UM.Theme.getColor("action_button_disabled") return UM.Theme.getColor("action_button_disabled")
} else if(control.pressed) }
else if(control.pressed)
{ {
return UM.Theme.getColor("print_button_ready_pressed") return UM.Theme.getColor("print_button_ready_pressed")
} else if(control.hovered) }
else if(control.hovered)
{ {
return UM.Theme.getColor("print_button_ready_hovered") return UM.Theme.getColor("print_button_ready_hovered")
} else }
else
{ {
return UM.Theme.getColor("print_button_ready") return UM.Theme.getColor("print_button_ready")
} }
@ -391,7 +445,7 @@ Item
sourceSize.width: width sourceSize.width: width
sourceSize.height: height sourceSize.height: height
color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text") color: control.enabled ? UM.Theme.getColor("print_button_ready_text") : UM.Theme.getColor("action_button_disabled_text")
source: UM.Theme.getIcon("arrow_bottom"); source: UM.Theme.getIcon("arrow_bottom")
} }
} }
} }
@ -406,8 +460,8 @@ Item
{ {
text: model.description text: model.description
checkable: true; checkable: true;
checked: model.id == UM.OutputDeviceManager.activeDevice; checked: model.id == UM.OutputDeviceManager.activeDevice
exclusiveGroup: devicesMenuGroup; exclusiveGroup: devicesMenuGroup
onTriggered: onTriggered:
{ {
UM.OutputDeviceManager.setActiveDevice(model.id); UM.OutputDeviceManager.setActiveDevice(model.id);
@ -416,9 +470,9 @@ Item
onObjectAdded: devicesMenu.insertItem(index, object) onObjectAdded: devicesMenu.insertItem(index, object)
onObjectRemoved: devicesMenu.removeItem(object) onObjectRemoved: devicesMenu.removeItem(object)
} }
ExclusiveGroup { id: devicesMenuGroup; } ExclusiveGroup { id: devicesMenuGroup }
} }
} }
UM.OutputDevicesModel { id: devicesModel; } UM.OutputDevicesModel { id: devicesModel }
} }
} }

View file

@ -1,4 +1,4 @@
// Copyright (c) 2017 Ultimaker B.V. // Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1 import QtQuick 2.1
@ -7,10 +7,14 @@ import QtQuick.Controls.Styles 1.1
import UM 1.1 as UM import UM 1.1 as UM
QtObject { QtObject
property Component sidebar_header_button: Component { {
ButtonStyle { property Component sidebar_header_button: Component
background: Rectangle { {
ButtonStyle
{
background: Rectangle
{
color: color:
{ {
if(control.enabled) if(control.enabled)
@ -61,7 +65,8 @@ QtObject {
return Theme.getColor("setting_control_disabled_border"); return Theme.getColor("setting_control_disabled_border");
} }
} }
UM.RecolorImage { UM.RecolorImage
{
id: downArrow id: downArrow
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
@ -73,7 +78,8 @@ QtObject {
color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text") color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text")
source: Theme.getIcon("arrow_bottom") source: Theme.getIcon("arrow_bottom")
} }
Label { Label
{
id: sidebarComboBoxLabel id: sidebarComboBoxLabel
color: control.enabled ? Theme.getColor("setting_control_text") : Theme.getColor("setting_control_disabled_text") color: control.enabled ? Theme.getColor("setting_control_text") : Theme.getColor("setting_control_disabled_text")
text: control.text; text: control.text;
@ -158,33 +164,37 @@ QtObject {
{ {
if (control.checked) if (control.checked)
{ {
return UM.Theme.getColor("topheader_button_text_active") return UM.Theme.getColor("topheader_button_text_active");
} }
else else
{ {
if (control.hovered) if (control.hovered)
{ {
return UM.Theme.getColor("topheader_button_text_hovered") return UM.Theme.getColor("topheader_button_text_hovered");
} }
return UM.Theme.getColor("topheader_button_text_inactive") return UM.Theme.getColor("topheader_button_text_inactive");
} }
} }
} }
Component.onCompleted: Component.onCompleted:
{ {
buttonWidth = width buttonWidth = width;
} }
} }
} }
} }
property Component tool_button: Component { property Component tool_button: Component
ButtonStyle { {
background: Item { ButtonStyle
{
background: Item
{
implicitWidth: Theme.getSize("button").width; implicitWidth: Theme.getSize("button").width;
implicitHeight: Theme.getSize("button").height; implicitHeight: Theme.getSize("button").height;
UM.PointingRectangle { UM.PointingRectangle
{
id: button_tooltip id: button_tooltip
anchors.left: parent.right anchors.left: parent.right
@ -203,7 +213,8 @@ QtObject {
Behavior on width { NumberAnimation { duration: 100; } } Behavior on width { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
Label { Label
{
id: button_tip id: button_tip
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@ -215,7 +226,8 @@ QtObject {
} }
} }
Rectangle { Rectangle
{
id: buttonFace; id: buttonFace;
anchors.fill: parent; anchors.fill: parent;
@ -249,7 +261,8 @@ QtObject {
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border") border.color: Theme.getColor("tool_button_border")
UM.RecolorImage { UM.RecolorImage
{
id: tool_button_arrow id: tool_button_arrow
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("button").width - Math.round(Theme.getSize("button_icon").width / 4) anchors.rightMargin: Theme.getSize("button").width - Math.round(Theme.getSize("button_icon").width / 4)
@ -284,8 +297,10 @@ QtObject {
} }
} }
label: Item { label: Item
UM.RecolorImage { {
UM.RecolorImage
{
anchors.centerIn: parent; anchors.centerIn: parent;
opacity: !control.enabled ? 0.2 : 1.0 opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource; source: control.iconSource;
@ -317,13 +332,17 @@ QtObject {
} }
} }
property Component small_tool_button: Component { property Component small_tool_button: Component
ButtonStyle { {
background: Item { ButtonStyle
{
background: Item
{
implicitWidth: Theme.getSize("small_button").width; implicitWidth: Theme.getSize("small_button").width;
implicitHeight: Theme.getSize("small_button").height; implicitHeight: Theme.getSize("small_button").height;
Rectangle { Rectangle
{
id: smallButtonFace; id: smallButtonFace;
anchors.fill: parent; anchors.fill: parent;
@ -357,7 +376,8 @@ QtObject {
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border") border.color: Theme.getColor("tool_button_border")
UM.RecolorImage { UM.RecolorImage
{
id: smallToolButtonArrow id: smallToolButtonArrow
width: 5 width: 5
@ -389,13 +409,15 @@ QtObject {
} }
} }
label: Item { label: Item
UM.RecolorImage { {
anchors.centerIn: parent; UM.RecolorImage
{
anchors.centerIn: parent
opacity: !control.enabled ? 0.2 : 1.0 opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource; source: control.iconSource;
width: Theme.getSize("small_button_icon").width; width: Theme.getSize("small_button_icon").width
height: Theme.getSize("small_button_icon").height; height: Theme.getSize("small_button_icon").height
color: color:
{ {
if(control.checkable && control.checked && control.hovered) if(control.checkable && control.checked && control.hovered)
@ -422,14 +444,18 @@ QtObject {
} }
} }
property Component progressbar: Component{ property Component progressbar: Component
ProgressBarStyle { {
background: Rectangle { ProgressBarStyle
{
background: Rectangle
{
implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2) implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2)
implicitHeight: Theme.getSize("progressbar").height implicitHeight: Theme.getSize("progressbar").height
color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : Theme.getColor("progressbar_background") color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : Theme.getColor("progressbar_background")
} }
progress: Rectangle { progress: Rectangle
{
color: color:
{ {
if(control.indeterminate) if(control.indeterminate)
@ -446,14 +472,16 @@ QtObject {
} }
} }
radius: Theme.getSize("progressbar_radius").width radius: Theme.getSize("progressbar_radius").width
Rectangle{ Rectangle
{
radius: Theme.getSize("progressbar_radius").width radius: Theme.getSize("progressbar_radius").width
color: control.hasOwnProperty("controlColor") ? control.controlColor : Theme.getColor("progressbar_control") color: control.hasOwnProperty("controlColor") ? control.controlColor : Theme.getColor("progressbar_control")
width: Theme.getSize("progressbar_control").width width: Theme.getSize("progressbar_control").width
height: Theme.getSize("progressbar_control").height height: Theme.getSize("progressbar_control").height
visible: control.indeterminate visible: control.indeterminate
SequentialAnimation on x { SequentialAnimation on x
{
id: xAnim id: xAnim
property int animEndPoint: Theme.getSize("message").width - Math.round((Theme.getSize("default_margin").width * 2.5)) - Theme.getSize("progressbar_control").width property int animEndPoint: Theme.getSize("message").width - Math.round((Theme.getSize("default_margin").width * 2.5)) - Theme.getSize("progressbar_control").width
running: control.indeterminate && control.visible running: control.indeterminate && control.visible
@ -466,59 +494,88 @@ QtObject {
} }
} }
property Component sidebar_category: Component { property Component sidebar_category: Component
ButtonStyle { {
background: Rectangle { ButtonStyle
anchors.fill: parent; {
background: Rectangle
{
anchors.fill: parent
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Theme.getSize("sidebar_margin").width anchors.leftMargin: Theme.getSize("sidebar_margin").width
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Theme.getSize("sidebar_margin").width anchors.rightMargin: Theme.getSize("sidebar_margin").width
implicitHeight: Theme.getSize("section").height; implicitHeight: Theme.getSize("section").height
color: { color:
if(control.color) { {
if(control.color)
{
return control.color; return control.color;
} else if(!control.enabled) { }
else if(!control.enabled)
{
return Theme.getColor("setting_category_disabled"); return Theme.getColor("setting_category_disabled");
} else if(control.hovered && control.checkable && control.checked) { }
else if(control.hovered && control.checkable && control.checked)
{
return Theme.getColor("setting_category_active_hover"); return Theme.getColor("setting_category_active_hover");
} else if(control.pressed || (control.checkable && control.checked)) { }
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("setting_category_active"); return Theme.getColor("setting_category_active");
} else if(control.hovered) { }
else if(control.hovered)
{
return Theme.getColor("setting_category_hover"); return Theme.getColor("setting_category_hover");
} else { }
else
{
return Theme.getColor("setting_category"); return Theme.getColor("setting_category");
} }
} }
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
Rectangle { Rectangle
{
height: Theme.getSize("default_lining").height height: Theme.getSize("default_lining").height
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
color: { color:
if(!control.enabled) { {
if(!control.enabled)
{
return Theme.getColor("setting_category_disabled_border"); return Theme.getColor("setting_category_disabled_border");
} else if((control.hovered || control.activeFocus) && control.checkable && control.checked) { }
else if((control.hovered || control.activeFocus) && control.checkable && control.checked)
{
return Theme.getColor("setting_category_active_hover_border"); return Theme.getColor("setting_category_active_hover_border");
} else if(control.pressed || (control.checkable && control.checked)) { }
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("setting_category_active_border"); return Theme.getColor("setting_category_active_border");
} else if(control.hovered || control.activeFocus) { }
else if(control.hovered || control.activeFocus)
{
return Theme.getColor("setting_category_hover_border"); return Theme.getColor("setting_category_hover_border");
} else { }
else
{
return Theme.getColor("setting_category_border"); return Theme.getColor("setting_category_border");
} }
} }
} }
} }
label: Item { label: Item
anchors.fill: parent; {
anchors.fill: parent
anchors.left: parent.left anchors.left: parent.left
Item{ Item
id: icon; {
id: icon
anchors.left: parent.left anchors.left: parent.left
height: parent.height height: parent.height
width: Theme.getSize("section_icon_column").width width: Theme.getSize("section_icon_column").width
UM.RecolorImage { UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Theme.getSize("sidebar_margin").width anchors.leftMargin: Theme.getSize("sidebar_margin").width
@ -553,15 +610,17 @@ QtObject {
} }
} }
Label { Label
anchors { {
left: icon.right; anchors
leftMargin: Theme.getSize("default_margin").width; {
right: parent.right; left: icon.right
verticalCenter: parent.verticalCenter; leftMargin: Theme.getSize("default_margin").width
right: parent.right
verticalCenter: parent.verticalCenter
} }
text: control.text; text: control.text
font: Theme.getFont("setting_category"); font: Theme.getFont("setting_category")
color: color:
{ {
if(!control.enabled) if(!control.enabled)
@ -585,10 +644,11 @@ QtObject {
return Theme.getColor("setting_category_text"); return Theme.getColor("setting_category_text");
} }
} }
fontSizeMode: Text.HorizontalFit; fontSizeMode: Text.HorizontalFit
minimumPointSize: 8 minimumPointSize: 8
} }
UM.RecolorImage { UM.RecolorImage
{
id: category_arrow id: category_arrow
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
@ -626,20 +686,24 @@ QtObject {
} }
} }
property Component scrollview: Component { property Component scrollview: Component
ScrollViewStyle { {
ScrollViewStyle
{
decrementControl: Item { } decrementControl: Item { }
incrementControl: Item { } incrementControl: Item { }
transientScrollBars: false transientScrollBars: false
scrollBarBackground: Rectangle { scrollBarBackground: Rectangle
{
implicitWidth: Theme.getSize("scrollbar").width implicitWidth: Theme.getSize("scrollbar").width
radius: Math.round(implicitWidth / 2) radius: Math.round(implicitWidth / 2)
color: Theme.getColor("scrollbar_background"); color: Theme.getColor("scrollbar_background");
} }
handle: Rectangle { handle: Rectangle
{
id: scrollViewHandle id: scrollViewHandle
implicitWidth: Theme.getSize("scrollbar").width; implicitWidth: Theme.getSize("scrollbar").width;
radius: Math.round(implicitWidth / 2) radius: Math.round(implicitWidth / 2)
@ -650,10 +714,13 @@ QtObject {
} }
} }
property Component combobox: Component { property Component combobox: Component
ComboBoxStyle { {
ComboBoxStyle
{
background: Rectangle { background: Rectangle
{
implicitHeight: Theme.getSize("setting_control").height; implicitHeight: Theme.getSize("setting_control").height;
implicitWidth: Theme.getSize("setting_control").width; implicitWidth: Theme.getSize("setting_control").width;
@ -664,28 +731,31 @@ QtObject {
border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border"); border.color: control.hovered ? Theme.getColor("setting_control_border_highlight") : Theme.getColor("setting_control_border");
} }
label: Item { label: Item
{
Label { Label
anchors.left: parent.left; {
anchors.left: parent.left
anchors.leftMargin: Theme.getSize("default_lining").width anchors.leftMargin: Theme.getSize("default_lining").width
anchors.right: downArrow.left; anchors.right: downArrow.left
anchors.rightMargin: Theme.getSize("default_lining").width; anchors.rightMargin: Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter
text: control.currentText; text: control.currentText
font: Theme.getFont("default"); font: Theme.getFont("default");
color: !enabled ? Theme.getColor("setting_control_disabled_text") : Theme.getColor("setting_control_text"); color: !enabled ? Theme.getColor("setting_control_disabled_text") : Theme.getColor("setting_control_text")
elide: Text.ElideRight; elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter
} }
UM.RecolorImage { UM.RecolorImage
{
id: downArrow id: downArrow
anchors.right: parent.right; anchors.right: parent.right
anchors.rightMargin: Theme.getSize("default_lining").width * 2; anchors.rightMargin: Theme.getSize("default_lining").width * 2
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter
source: Theme.getIcon("arrow_bottom") source: Theme.getIcon("arrow_bottom")
width: Theme.getSize("standard_arrow").width width: Theme.getSize("standard_arrow").width
@ -700,19 +770,24 @@ QtObject {
} }
// Combobox with items with colored rectangles // Combobox with items with colored rectangles
property Component combobox_color: Component { property Component combobox_color: Component
{
ComboBoxStyle { ComboBoxStyle
{
background: Rectangle { background: Rectangle
{
color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control") color: !enabled ? UM.Theme.getColor("setting_control_disabled") : control._hovered ? UM.Theme.getColor("setting_control_highlight") : UM.Theme.getColor("setting_control")
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control._hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
} }
label: Item { label: Item
{
Label { Label
{
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: swatch.left anchors.right: swatch.left
@ -727,7 +802,8 @@ QtObject {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
Rectangle { Rectangle
{
id: swatch id: swatch
height: Math.round(UM.Theme.getSize("setting_control").height / 2) height: Math.round(UM.Theme.getSize("setting_control").height / 2)
width: height width: height
@ -740,7 +816,8 @@ QtObject {
color: (control.color_override !== "") ? control.color_override : control.color color: (control.color_override !== "") ? control.color_override : control.color
} }
UM.RecolorImage { UM.RecolorImage
{
id: downArrow id: downArrow
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2 anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
@ -758,22 +835,26 @@ QtObject {
} }
} }
property Component checkbox: Component { property Component checkbox: Component
CheckBoxStyle { {
CheckBoxStyle
{
background: Item { } background: Item { }
indicator: Rectangle { indicator: Rectangle
implicitWidth: Theme.getSize("checkbox").width; {
implicitHeight: Theme.getSize("checkbox").height; implicitWidth: Theme.getSize("checkbox").width
implicitHeight: Theme.getSize("checkbox").height
color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox")
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0 radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0
border.width: Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border")
UM.RecolorImage { UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(parent.width / 2.5) width: Math.round(parent.width / 2.5)
@ -786,7 +867,8 @@ QtObject {
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
} }
} }
label: Label { label: Label
{
text: control.text text: control.text
color: Theme.getColor("checkbox_text") color: Theme.getColor("checkbox_text")
font: Theme.getFont("default") font: Theme.getFont("default")
@ -795,12 +877,15 @@ QtObject {
} }
} }
property Component partially_checkbox: Component { property Component partially_checkbox: Component
CheckBoxStyle { {
CheckBoxStyle
{
background: Item { } background: Item { }
indicator: Rectangle { indicator: Rectangle
implicitWidth: Theme.getSize("checkbox").width; {
implicitHeight: Theme.getSize("checkbox").height; implicitWidth: Theme.getSize("checkbox").width
implicitHeight: Theme.getSize("checkbox").height
color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox"); color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox");
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
@ -810,7 +895,8 @@ QtObject {
border.width: Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width;
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border"); border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
UM.RecolorImage { UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(parent.width / 2.5) width: Math.round(parent.width / 2.5)
@ -818,50 +904,60 @@ QtObject {
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: Theme.getColor("checkbox_mark") color: Theme.getColor("checkbox_mark")
source: { source:
if (control.checkbox_state == 2){ {
return Theme.getIcon("solid") if (control.checkbox_state == 2)
{
return Theme.getIcon("solid");
} }
else{ else
return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check") {
return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check");
} }
} }
opacity: control.checked opacity: control.checked
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
} }
} }
label: Label { label: Label
text: control.text; {
color: Theme.getColor("checkbox_text"); text: control.text
font: Theme.getFont("default"); color: Theme.getColor("checkbox_text")
font: Theme.getFont("default")
} }
} }
} }
property Component slider: Component { property Component slider: Component
SliderStyle { {
groove: Rectangle { SliderStyle
implicitWidth: control.width; {
implicitHeight: Theme.getSize("slider_groove").height; groove: Rectangle
{
implicitWidth: control.width
implicitHeight: Theme.getSize("slider_groove").height
color: Theme.getColor("slider_groove"); color: Theme.getColor("slider_groove")
border.width: Theme.getSize("default_lining").width; border.width: Theme.getSize("default_lining").width
border.color: Theme.getColor("slider_groove_border"); border.color: Theme.getColor("slider_groove_border")
radius: Math.round(width / 2); radius: Math.round(width / 2)
Rectangle { Rectangle
anchors { {
left: parent.left; anchors
top: parent.top; {
bottom: parent.bottom; left: parent.left
top: parent.top
bottom: parent.bottom
} }
color: Theme.getColor("slider_groove_fill"); color: Theme.getColor("slider_groove_fill");
width: Math.round((control.value / (control.maximumValue - control.minimumValue)) * parent.width); width: Math.round((control.value / (control.maximumValue - control.minimumValue)) * parent.width);
radius: Math.round(width / 2); radius: Math.round(width / 2);
} }
} }
handle: Rectangle { handle: Rectangle
{
width: Theme.getSize("slider_handle").width; width: Theme.getSize("slider_handle").width;
height: Theme.getSize("slider_handle").height; height: Theme.getSize("slider_handle").height;
color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle"); color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle");
@ -873,11 +969,13 @@ QtObject {
} }
} }
property Component text_field: Component { property Component text_field: Component
TextFieldStyle { {
textColor: Theme.getColor("setting_control_text"); TextFieldStyle
{
textColor: Theme.getColor("setting_control_text")
placeholderTextColor: Theme.getColor("setting_control_text") placeholderTextColor: Theme.getColor("setting_control_text")
font: Theme.getFont("default"); font: Theme.getFont("default")
background: Rectangle background: Rectangle
{ {
@ -889,7 +987,8 @@ QtObject {
color: Theme.getColor("setting_validation_ok"); color: Theme.getColor("setting_validation_ok");
Label { Label
{
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("setting_unit_margin").width; anchors.rightMargin: Theme.getSize("setting_unit_margin").width;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
@ -902,7 +1001,8 @@ QtObject {
} }
} }
property Component sidebar_action_button: Component { property Component sidebar_action_button: Component
{
ButtonStyle ButtonStyle
{ {
background: Rectangle background: Rectangle
@ -911,26 +1011,42 @@ QtObject {
border.color: border.color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border"); return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border"); return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border"); return UM.Theme.getColor("action_button_hovered_border");
}
else else
{
return UM.Theme.getColor("action_button_border"); return UM.Theme.getColor("action_button_border");
} }
}
color: color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled"); return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("action_button_active"); return UM.Theme.getColor("action_button_active");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered"); return UM.Theme.getColor("action_button_hovered");
}
else else
{
return UM.Theme.getColor("action_button"); return UM.Theme.getColor("action_button");
} }
Behavior on color { ColorAnimation { duration: 50; } } }
Behavior on color { ColorAnimation { duration: 50 } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2) implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
@ -941,14 +1057,22 @@ QtObject {
color: color:
{ {
if(!control.enabled) if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text"); return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed) else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text"); return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered) else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text"); return UM.Theme.getColor("action_button_hovered_text");
}
else else
{
return UM.Theme.getColor("action_button_text"); return UM.Theme.getColor("action_button_text");
} }
}
font: UM.Theme.getFont("action_button") font: UM.Theme.getFont("action_button")
text: control.text text: control.text
} }
@ -957,7 +1081,8 @@ QtObject {
} }
} }
property Component toolbox_action_button: Component { property Component toolbox_action_button: Component
{
ButtonStyle ButtonStyle
{ {
background: Rectangle background: Rectangle
@ -968,17 +1093,17 @@ QtObject {
{ {
if (control.installed) if (control.installed)
{ {
return UM.Theme.getColor("action_button_disabled") return UM.Theme.getColor("action_button_disabled");
} }
else else
{ {
if (control.hovered) if (control.hovered)
{ {
return UM.Theme.getColor("primary_hover") return UM.Theme.getColor("primary_hover");
} }
else else
{ {
return UM.Theme.getColor("primary") return UM.Theme.getColor("primary");
} }
} }
@ -991,17 +1116,17 @@ QtObject {
{ {
if (control.installed) if (control.installed)
{ {
return UM.Theme.getColor("action_button_disabled_text") return UM.Theme.getColor("action_button_disabled_text");
} }
else else
{ {
if (control.hovered) if (control.hovered)
{ {
return UM.Theme.getColor("button_text_hover") return UM.Theme.getColor("button_text_hover");
} }
else else
{ {
return UM.Theme.getColor("button_text") return UM.Theme.getColor("button_text");
} }
} }
} }