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
anchors.fill: parent;
UM.I18nCatalog { id: catalog; name:"cura"}
UM.I18nCatalog { id: catalog; name: "cura"}
spacing: UM.Theme.getSize("default_margin").height
Label

View file

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

View file

@ -16,7 +16,7 @@ Button
{
id: modelCheckerButton
UM.I18nCatalog{id: catalog; name:"cura"}
UM.I18nCatalog{id: catalog; name: "cura"}
visible: manager.hasWarnings
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
{
UM.I18nCatalog{id: catalog; name:"cura"}
UM.I18nCatalog{id: catalog; name: "cura"}
id: base
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)

View file

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

View file

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

View file

@ -54,7 +54,7 @@ Cura.MachineAction
spacing: UM.Theme.getSize("default_margin").height
SystemPalette { id: palette }
UM.I18nCatalog { id: catalog; name:"cura" }
UM.I18nCatalog { id: catalog; name: "cura" }
Label
{
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 printerConnected: Cura.MachineManager.printerConnected
UM.I18nCatalog { id: catalog; name:"cura"}
UM.I18nCatalog { id: catalog; name: "cura"}
Label
{
id: pageTitle

View file

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

View file

@ -40,7 +40,7 @@ Button
id: popup
y: parent.height + UM.Theme.getSize("default_arrow").height
x: (parent.width - width)
x: parent.width - width
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.
pragma Singleton
@ -67,7 +67,7 @@ Item
property alias browsePackages: browsePackagesAction
UM.I18nCatalog{id: catalog; name:"cura"}
UM.I18nCatalog{id: catalog; name: "cura"}
Action
{

View file

@ -26,7 +26,7 @@ UM.MainWindow
UM.I18nCatalog
{
id: catalog
name:"cura"
name: "cura"
}
function showTooltip(item, position, text)
@ -236,7 +236,7 @@ UM.MainWindow
textRole: "name"
// update the model's active index
function updateItemActiveFlags ()
function updateItemActiveFlags()
{
currentIndex = getActiveIndex()
for (var i = 0; i < model.rowCount(); i++)
@ -316,7 +316,7 @@ UM.MainWindow
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
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.
import QtQuick 2.2
@ -45,7 +45,7 @@ UM.Dialog
anchors.topMargin: ((base.minimumWidth - width) / 2) | 0
anchors.horizontalCenter: parent.horizontalCenter
UM.I18nCatalog{id: catalog; name:"cura"}
UM.I18nCatalog{id: catalog; name: "cura"}
}
Label
@ -129,32 +129,32 @@ UM.Dialog
}
Component.onCompleted:
{
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:"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: "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: "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:"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:"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:"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:"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:"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:"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:"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:"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:"Requests", description: catalog.i18nc("@Label", "Python HTTP library"), license: "GPL", url: "http://docs.python-requests.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: "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: "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: "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: "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: "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: "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: "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: "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:"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: "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: "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.
import QtQuick 2.2
@ -15,7 +15,7 @@ Item {
property bool activity: CuraApplication.platformActivity
property string fileBaseName: PrintInformation.baseName
UM.I18nCatalog { id: catalog; name:"cura"}
UM.I18nCatalog { id: catalog; name: "cura"}
height: childrenRect.height

View file

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

View file

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

View file

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Item
{
id: base;
UM.I18nCatalog { id: catalog; name:"cura"}
UM.I18nCatalog { id: catalog; name: "cura"}
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.
import QtQuick 2.7
@ -31,7 +31,7 @@ Rectangle
property variant printMaterialNames: PrintInformation.materialNames
color: UM.Theme.getColor("sidebar")
UM.I18nCatalog { id: catalog; name:"cura"}
UM.I18nCatalog { id: catalog; name: "cura"}
Timer {
id: tooltipDelayTimer
@ -70,7 +70,7 @@ Rectangle
time -= minutes * 60
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;
}

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.
import QtQuick 2.1
@ -134,7 +134,7 @@ UM.PreferencesPage
UM.PluginsModel { id: plugins }
//: Language selection label
UM.I18nCatalog{id: catalog; name:"cura"}
UM.I18nCatalog{id: catalog; name: "cura"}
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.
import QtQuick 2.7
@ -26,7 +26,7 @@ Rectangle
property variant printMaterialNames: PrintInformation.materialNames
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.
signal showTooltip(Item item, point location, string text)
@ -59,7 +59,7 @@ Rectangle
time -= minutes * 60
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;
}
@ -152,7 +152,7 @@ Rectangle
background: Rectangle
{
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
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.
import QtQuick 2.7
@ -173,7 +173,8 @@ Rectangle
var weights = [];
var costs = [];
var someCostsKnown = false;
if(base.printMaterialLengths) {
if(base.printMaterialLengths)
{
for(var index = 0; index < base.printMaterialLengths.length; index++)
{
if(base.printMaterialLengths[index] > 0)

View file

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Item
{
id: base;
UM.I18nCatalog { id: catalog; name:"cura"}
UM.I18nCatalog { id: catalog; name: "cura"}
property real progress: UM.Backend.progress
property int backendState: UM.Backend.state
@ -36,7 +36,7 @@ Item
case 2:
return catalog.i18nc("@label:PrintjobStatus", "Slicing...");
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:
return catalog.i18nc("@label:PrintjobStatus", "Unable to Slice");
case 5:
@ -48,16 +48,20 @@ Item
function sliceOrStopSlicing()
{
try {
try
{
if ([1, 5].indexOf(base.backendState) != -1)
{
CuraApplication.backend.forceSlice();
} else {
}
else
{
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();
}
style: ButtonStyle {
style: ButtonStyle
{
background: Rectangle
{
border.width: UM.Theme.getSize("default_lining").width
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
else
{
return UM.Theme.getColor("action_button_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
else
{
return UM.Theme.getColor("action_button");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
Label {
Label
{
id: actualLabel
anchors.centerIn: parent
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
else
{
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("action_button")
text: control.text;
}
@ -287,43 +317,61 @@ Item
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered_border");
}
else
{
return UM.Theme.getColor("print_button_ready_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("print_button_ready_pressed");
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered");
}
else
{
return UM.Theme.getColor("print_button_ready");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
Label {
Label
{
id: actualLabel
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")
text: control.text;
text: control.text
}
}
label: Item { }
}
}
Button {
Button
{
id: deviceSelectionMenu
tooltip: catalog.i18nc("@info:tooltip","Select the active output device");
anchors.top: parent.top
@ -349,13 +397,16 @@ Item
if(!control.enabled)
{
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")
} else if(control.hovered)
}
else if(control.hovered)
{
return UM.Theme.getColor("print_button_ready_hovered_border")
} else
}
else
{
return UM.Theme.getColor("print_button_ready_border")
}
@ -365,13 +416,16 @@ Item
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled")
} else if(control.pressed)
}
else if(control.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")
} else
}
else
{
return UM.Theme.getColor("print_button_ready")
}
@ -391,7 +445,7 @@ Item
sourceSize.width: width
sourceSize.height: height
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
checkable: true;
checked: model.id == UM.OutputDeviceManager.activeDevice;
exclusiveGroup: devicesMenuGroup;
checked: model.id == UM.OutputDeviceManager.activeDevice
exclusiveGroup: devicesMenuGroup
onTriggered:
{
UM.OutputDeviceManager.setActiveDevice(model.id);
@ -416,9 +470,9 @@ Item
onObjectAdded: devicesMenu.insertItem(index, 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.
import QtQuick 2.1
@ -7,10 +7,14 @@ import QtQuick.Controls.Styles 1.1
import UM 1.1 as UM
QtObject {
property Component sidebar_header_button: Component {
ButtonStyle {
background: Rectangle {
QtObject
{
property Component sidebar_header_button: Component
{
ButtonStyle
{
background: Rectangle
{
color:
{
if(control.enabled)
@ -61,7 +65,8 @@ QtObject {
return Theme.getColor("setting_control_disabled_border");
}
}
UM.RecolorImage {
UM.RecolorImage
{
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
@ -73,7 +78,8 @@ QtObject {
color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text")
source: Theme.getIcon("arrow_bottom")
}
Label {
Label
{
id: sidebarComboBoxLabel
color: control.enabled ? Theme.getColor("setting_control_text") : Theme.getColor("setting_control_disabled_text")
text: control.text;
@ -158,33 +164,37 @@ QtObject {
{
if (control.checked)
{
return UM.Theme.getColor("topheader_button_text_active")
return UM.Theme.getColor("topheader_button_text_active");
}
else
{
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:
{
buttonWidth = width
buttonWidth = width;
}
}
}
}
property Component tool_button: Component {
ButtonStyle {
background: Item {
property Component tool_button: Component
{
ButtonStyle
{
background: Item
{
implicitWidth: Theme.getSize("button").width;
implicitHeight: Theme.getSize("button").height;
UM.PointingRectangle {
UM.PointingRectangle
{
id: button_tooltip
anchors.left: parent.right
@ -203,7 +213,8 @@ QtObject {
Behavior on width { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } }
Label {
Label
{
id: button_tip
anchors.horizontalCenter: parent.horizontalCenter
@ -215,7 +226,8 @@ QtObject {
}
}
Rectangle {
Rectangle
{
id: buttonFace;
anchors.fill: parent;
@ -249,7 +261,8 @@ QtObject {
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border")
UM.RecolorImage {
UM.RecolorImage
{
id: tool_button_arrow
anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("button").width - Math.round(Theme.getSize("button_icon").width / 4)
@ -284,8 +297,10 @@ QtObject {
}
}
label: Item {
UM.RecolorImage {
label: Item
{
UM.RecolorImage
{
anchors.centerIn: parent;
opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource;
@ -317,13 +332,17 @@ QtObject {
}
}
property Component small_tool_button: Component {
ButtonStyle {
background: Item {
property Component small_tool_button: Component
{
ButtonStyle
{
background: Item
{
implicitWidth: Theme.getSize("small_button").width;
implicitHeight: Theme.getSize("small_button").height;
Rectangle {
Rectangle
{
id: smallButtonFace;
anchors.fill: parent;
@ -357,7 +376,8 @@ QtObject {
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border")
UM.RecolorImage {
UM.RecolorImage
{
id: smallToolButtonArrow
width: 5
@ -389,13 +409,15 @@ QtObject {
}
}
label: Item {
UM.RecolorImage {
anchors.centerIn: parent;
label: Item
{
UM.RecolorImage
{
anchors.centerIn: parent
opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource;
width: Theme.getSize("small_button_icon").width;
height: Theme.getSize("small_button_icon").height;
width: Theme.getSize("small_button_icon").width
height: Theme.getSize("small_button_icon").height
color:
{
if(control.checkable && control.checked && control.hovered)
@ -422,14 +444,18 @@ QtObject {
}
}
property Component progressbar: Component{
ProgressBarStyle {
background: Rectangle {
property Component progressbar: Component
{
ProgressBarStyle
{
background: Rectangle
{
implicitWidth: Theme.getSize("message").width - (Theme.getSize("default_margin").width * 2)
implicitHeight: Theme.getSize("progressbar").height
color: control.hasOwnProperty("backgroundColor") ? control.backgroundColor : Theme.getColor("progressbar_background")
}
progress: Rectangle {
progress: Rectangle
{
color:
{
if(control.indeterminate)
@ -446,14 +472,16 @@ QtObject {
}
}
radius: Theme.getSize("progressbar_radius").width
Rectangle{
Rectangle
{
radius: Theme.getSize("progressbar_radius").width
color: control.hasOwnProperty("controlColor") ? control.controlColor : Theme.getColor("progressbar_control")
width: Theme.getSize("progressbar_control").width
height: Theme.getSize("progressbar_control").height
visible: control.indeterminate
SequentialAnimation on x {
SequentialAnimation on x
{
id: xAnim
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
@ -466,59 +494,88 @@ QtObject {
}
}
property Component sidebar_category: Component {
ButtonStyle {
background: Rectangle {
anchors.fill: parent;
property Component sidebar_category: Component
{
ButtonStyle
{
background: Rectangle
{
anchors.fill: parent
anchors.left: parent.left
anchors.leftMargin: Theme.getSize("sidebar_margin").width
anchors.right: parent.right
anchors.rightMargin: Theme.getSize("sidebar_margin").width
implicitHeight: Theme.getSize("section").height;
color: {
if(control.color) {
implicitHeight: Theme.getSize("section").height
color:
{
if(control.color)
{
return control.color;
} else if(!control.enabled) {
}
else if(!control.enabled)
{
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");
} else if(control.pressed || (control.checkable && control.checked)) {
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("setting_category_active");
} else if(control.hovered) {
}
else if(control.hovered)
{
return Theme.getColor("setting_category_hover");
} else {
}
else
{
return Theme.getColor("setting_category");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
Rectangle {
Rectangle
{
height: Theme.getSize("default_lining").height
width: parent.width
anchors.bottom: parent.bottom
color: {
if(!control.enabled) {
color:
{
if(!control.enabled)
{
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");
} else if(control.pressed || (control.checkable && control.checked)) {
}
else if(control.pressed || (control.checkable && control.checked))
{
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");
} else {
}
else
{
return Theme.getColor("setting_category_border");
}
}
}
}
label: Item {
anchors.fill: parent;
label: Item
{
anchors.fill: parent
anchors.left: parent.left
Item{
id: icon;
Item
{
id: icon
anchors.left: parent.left
height: parent.height
width: Theme.getSize("section_icon_column").width
UM.RecolorImage {
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: Theme.getSize("sidebar_margin").width
@ -553,15 +610,17 @@ QtObject {
}
}
Label {
anchors {
left: icon.right;
leftMargin: Theme.getSize("default_margin").width;
right: parent.right;
verticalCenter: parent.verticalCenter;
Label
{
anchors
{
left: icon.right
leftMargin: Theme.getSize("default_margin").width
right: parent.right
verticalCenter: parent.verticalCenter
}
text: control.text;
font: Theme.getFont("setting_category");
text: control.text
font: Theme.getFont("setting_category")
color:
{
if(!control.enabled)
@ -585,10 +644,11 @@ QtObject {
return Theme.getColor("setting_category_text");
}
}
fontSizeMode: Text.HorizontalFit;
fontSizeMode: Text.HorizontalFit
minimumPointSize: 8
}
UM.RecolorImage {
UM.RecolorImage
{
id: category_arrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
@ -626,20 +686,24 @@ QtObject {
}
}
property Component scrollview: Component {
ScrollViewStyle {
property Component scrollview: Component
{
ScrollViewStyle
{
decrementControl: Item { }
incrementControl: Item { }
transientScrollBars: false
scrollBarBackground: Rectangle {
scrollBarBackground: Rectangle
{
implicitWidth: Theme.getSize("scrollbar").width
radius: Math.round(implicitWidth / 2)
color: Theme.getColor("scrollbar_background");
}
handle: Rectangle {
handle: Rectangle
{
id: scrollViewHandle
implicitWidth: Theme.getSize("scrollbar").width;
radius: Math.round(implicitWidth / 2)
@ -650,10 +714,13 @@ QtObject {
}
}
property Component combobox: Component {
ComboBoxStyle {
property Component combobox: Component
{
ComboBoxStyle
{
background: Rectangle {
background: Rectangle
{
implicitHeight: Theme.getSize("setting_control").height;
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");
}
label: Item {
label: Item
{
Label {
anchors.left: parent.left;
Label
{
anchors.left: parent.left
anchors.leftMargin: Theme.getSize("default_lining").width
anchors.right: downArrow.left;
anchors.rightMargin: Theme.getSize("default_lining").width;
anchors.verticalCenter: parent.verticalCenter;
anchors.right: downArrow.left
anchors.rightMargin: Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter
text: control.currentText;
text: control.currentText
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;
verticalAlignment: Text.AlignVCenter;
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
UM.RecolorImage {
UM.RecolorImage
{
id: downArrow
anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("default_lining").width * 2;
anchors.verticalCenter: parent.verticalCenter;
anchors.right: parent.right
anchors.rightMargin: Theme.getSize("default_lining").width * 2
anchors.verticalCenter: parent.verticalCenter
source: Theme.getIcon("arrow_bottom")
width: Theme.getSize("standard_arrow").width
@ -700,19 +770,24 @@ QtObject {
}
// 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")
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")
}
label: Item {
label: Item
{
Label {
Label
{
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width
anchors.right: swatch.left
@ -727,7 +802,8 @@ QtObject {
verticalAlignment: Text.AlignVCenter
}
Rectangle {
Rectangle
{
id: swatch
height: Math.round(UM.Theme.getSize("setting_control").height / 2)
width: height
@ -740,7 +816,8 @@ QtObject {
color: (control.color_override !== "") ? control.color_override : control.color
}
UM.RecolorImage {
UM.RecolorImage
{
id: downArrow
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
@ -758,22 +835,26 @@ QtObject {
}
}
property Component checkbox: Component {
CheckBoxStyle {
property Component checkbox: Component
{
CheckBoxStyle
{
background: Item { }
indicator: Rectangle {
implicitWidth: Theme.getSize("checkbox").width;
implicitHeight: Theme.getSize("checkbox").height;
indicator: Rectangle
{
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; } }
radius: control.exclusiveGroup ? Math.round(Theme.getSize("checkbox").width / 2) : 0
border.width: Theme.getSize("default_lining").width;
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
border.width: Theme.getSize("default_lining").width
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border")
UM.RecolorImage {
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(parent.width / 2.5)
@ -786,7 +867,8 @@ QtObject {
Behavior on opacity { NumberAnimation { duration: 100; } }
}
}
label: Label {
label: Label
{
text: control.text
color: Theme.getColor("checkbox_text")
font: Theme.getFont("default")
@ -795,12 +877,15 @@ QtObject {
}
}
property Component partially_checkbox: Component {
CheckBoxStyle {
property Component partially_checkbox: Component
{
CheckBoxStyle
{
background: Item { }
indicator: Rectangle {
implicitWidth: Theme.getSize("checkbox").width;
implicitHeight: Theme.getSize("checkbox").height;
indicator: Rectangle
{
implicitWidth: Theme.getSize("checkbox").width
implicitHeight: Theme.getSize("checkbox").height
color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox");
Behavior on color { ColorAnimation { duration: 50; } }
@ -810,7 +895,8 @@ QtObject {
border.width: Theme.getSize("default_lining").width;
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
UM.RecolorImage {
UM.RecolorImage
{
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: Math.round(parent.width / 2.5)
@ -818,50 +904,60 @@ QtObject {
sourceSize.width: width
sourceSize.height: width
color: Theme.getColor("checkbox_mark")
source: {
if (control.checkbox_state == 2){
return Theme.getIcon("solid")
source:
{
if (control.checkbox_state == 2)
{
return Theme.getIcon("solid");
}
else{
return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check")
else
{
return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check");
}
}
opacity: control.checked
Behavior on opacity { NumberAnimation { duration: 100; } }
}
}
label: Label {
text: control.text;
color: Theme.getColor("checkbox_text");
font: Theme.getFont("default");
label: Label
{
text: control.text
color: Theme.getColor("checkbox_text")
font: Theme.getFont("default")
}
}
}
property Component slider: Component {
SliderStyle {
groove: Rectangle {
implicitWidth: control.width;
implicitHeight: Theme.getSize("slider_groove").height;
property Component slider: Component
{
SliderStyle
{
groove: Rectangle
{
implicitWidth: control.width
implicitHeight: Theme.getSize("slider_groove").height
color: Theme.getColor("slider_groove");
border.width: Theme.getSize("default_lining").width;
border.color: Theme.getColor("slider_groove_border");
color: Theme.getColor("slider_groove")
border.width: Theme.getSize("default_lining").width
border.color: Theme.getColor("slider_groove_border")
radius: Math.round(width / 2);
radius: Math.round(width / 2)
Rectangle {
anchors {
left: parent.left;
top: parent.top;
bottom: parent.bottom;
Rectangle
{
anchors
{
left: parent.left
top: parent.top
bottom: parent.bottom
}
color: Theme.getColor("slider_groove_fill");
width: Math.round((control.value / (control.maximumValue - control.minimumValue)) * parent.width);
radius: Math.round(width / 2);
}
}
handle: Rectangle {
handle: Rectangle
{
width: Theme.getSize("slider_handle").width;
height: Theme.getSize("slider_handle").height;
color: control.hovered ? Theme.getColor("slider_handle_hover") : Theme.getColor("slider_handle");
@ -873,11 +969,13 @@ QtObject {
}
}
property Component text_field: Component {
TextFieldStyle {
textColor: Theme.getColor("setting_control_text");
property Component text_field: Component
{
TextFieldStyle
{
textColor: Theme.getColor("setting_control_text")
placeholderTextColor: Theme.getColor("setting_control_text")
font: Theme.getFont("default");
font: Theme.getFont("default")
background: Rectangle
{
@ -889,7 +987,8 @@ QtObject {
color: Theme.getColor("setting_validation_ok");
Label {
Label
{
anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("setting_unit_margin").width;
anchors.verticalCenter: parent.verticalCenter;
@ -902,7 +1001,8 @@ QtObject {
}
}
property Component sidebar_action_button: Component {
property Component sidebar_action_button: Component
{
ButtonStyle
{
background: Rectangle
@ -911,26 +1011,42 @@ QtObject {
border.color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_border");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_border");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_border");
}
else
{
return UM.Theme.getColor("action_button_border");
}
}
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered");
}
else
{
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)
@ -941,14 +1057,22 @@ QtObject {
color:
{
if(!control.enabled)
{
return UM.Theme.getColor("action_button_disabled_text");
}
else if(control.pressed)
{
return UM.Theme.getColor("action_button_active_text");
}
else if(control.hovered)
{
return UM.Theme.getColor("action_button_hovered_text");
}
else
{
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("action_button")
text: control.text
}
@ -957,7 +1081,8 @@ QtObject {
}
}
property Component toolbox_action_button: Component {
property Component toolbox_action_button: Component
{
ButtonStyle
{
background: Rectangle
@ -968,17 +1093,17 @@ QtObject {
{
if (control.installed)
{
return UM.Theme.getColor("action_button_disabled")
return UM.Theme.getColor("action_button_disabled");
}
else
{
if (control.hovered)
{
return UM.Theme.getColor("primary_hover")
return UM.Theme.getColor("primary_hover");
}
else
{
return UM.Theme.getColor("primary")
return UM.Theme.getColor("primary");
}
}
@ -991,17 +1116,17 @@ QtObject {
{
if (control.installed)
{
return UM.Theme.getColor("action_button_disabled_text")
return UM.Theme.getColor("action_button_disabled_text");
}
else
{
if (control.hovered)
{
return UM.Theme.getColor("button_text_hover")
return UM.Theme.getColor("button_text_hover");
}
else
{
return UM.Theme.getColor("button_text")
return UM.Theme.getColor("button_text");
}
}
}