Review feedback

Now with unified style as agreed upon by Simon & Ian.

Rules:

- ID before all other props.
- All props before children.
- All props after ID in alphabetical order.
- Empty line between children.
- Semi-colons.

Note: I didn't touch the DiscoverUM3Action because that's it's whole own UI part.
This commit is contained in:
Ian Paschal 2018-10-03 10:55:38 +02:00
parent 2c5095befb
commit 5ca0c599e9
18 changed files with 721 additions and 821 deletions

View file

@ -4,46 +4,37 @@
import QtQuick 2.3 import QtQuick 2.3
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import QtQuick.Controls 2.0 as Controls2
import QtGraphicalEffects 1.0
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Rectangle Rectangle {
{ property var iconSource: null;
property var iconSource: null color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary");
height: width;
radius: 0.5 * width;
width: 36 * screenScaleFactor;
width: 36 * screenScaleFactor UM.RecolorImage {
height: width id: icon;
radius: 0.5 * width anchors {
color: clickArea.containsMouse ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary") horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
UM.RecolorImage }
{ color: UM.Theme.getColor("primary_text");
id: icon height: width;
width: parent.width / 2 source: iconSource;
height: width width: parent.width / 2;
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: UM.Theme.getColor("primary_text")
source: iconSource
} }
MouseArea MouseArea {
{ id: clickArea;
id: clickArea anchors.fill: parent;
anchors.fill:parent hoverEnabled: true;
hoverEnabled: true onClicked: {
onClicked: if (OutputDevice.activeCamera !== null) {
{
if (OutputDevice.activeCamera !== null)
{
OutputDevice.setActiveCamera(null) OutputDevice.setActiveCamera(null)
} } else {
else OutputDevice.setActiveCamera(modelData.camera);
{
OutputDevice.setActiveCamera(modelData.camera)
} }
} }
} }

View file

@ -2,130 +2,108 @@
// 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.3 import QtQuick 2.3
import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls 2.0 as Controls2
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Component {
Rectangle {
id: base;
property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme.
property var shadowRadius: 5 * screenScaleFactor;
property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme.
anchors.fill: parent;
color: "white";
visible: OutputDevice != null;
Component UM.I18nCatalog {
{ id: catalog;
Rectangle name: "cura";
{
id: base
property var lineColor: "#DCDCDC" // TODO: Should be linked to theme.
property var shadowRadius: 5 * screenScaleFactor
property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme.
visible: OutputDevice != null
anchors.fill: parent
color: "white"
UM.I18nCatalog
{
id: catalog
name: "cura"
} }
Label Label {
{ id: printingLabel;
id: printingLabel anchors {
font: UM.Theme.getFont("large") left: parent.left;
anchors leftMargin: 4 * UM.Theme.getSize("default_margin").width;
{ margins: 2 * UM.Theme.getSize("default_margin").width;
margins: 2 * UM.Theme.getSize("default_margin").width right: parent.right;
leftMargin: 4 * UM.Theme.getSize("default_margin").width top: parent.top;
top: parent.top }
left: parent.left elide: Text.ElideRight;
right: parent.right font: UM.Theme.getFont("large");
text: catalog.i18nc("@label", "Printing");
} }
text: catalog.i18nc("@label", "Printing") Label {
elide: Text.ElideRight id: managePrintersLabel;
anchors {
bottom: printingLabel.bottom;
right: printerScrollView.right;
rightMargin: 4 * UM.Theme.getSize("default_margin").width;
}
color: UM.Theme.getColor("primary");
font: UM.Theme.getFont("default");
linkColor: UM.Theme.getColor("primary");
text: catalog.i18nc("@label link to connect manager", "Manage printers");
} }
Label MouseArea {
{ anchors.fill: managePrintersLabel;
id: managePrintersLabel hoverEnabled: true;
anchors.rightMargin: 4 * UM.Theme.getSize("default_margin").width onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel();
anchors.right: printerScrollView.right onEntered: managePrintersLabel.font.underline = true;
anchors.bottom: printingLabel.bottom onExited: managePrintersLabel.font.underline = false;
text: catalog.i18nc("@label link to connect manager", "Manage printers")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("primary")
linkColor: UM.Theme.getColor("primary")
}
MouseArea
{
anchors.fill: managePrintersLabel
hoverEnabled: true
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrinterControlPanel()
onEntered: managePrintersLabel.font.underline = true
onExited: managePrintersLabel.font.underline = false
} }
// Skeleton loading // Skeleton loading
Column Column {
{ id: skeletonLoader;
id: skeletonLoader anchors {
left: parent.left;
leftMargin: UM.Theme.getSize("wide_margin").width;
right: parent.right;
rightMargin: UM.Theme.getSize("wide_margin").width;
top: printingLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
}
spacing: UM.Theme.getSize("default_margin").height - 10;
visible: printerList.count === 0; visible: printerList.count === 0;
anchors
{
top: printingLabel.bottom
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
spacing: UM.Theme.getSize("default_margin").height - 10
PrinterCard PrinterCard {
{ printer: null;
printer: null
} }
PrinterCard PrinterCard {
{ printer: null;
printer: null
} }
} }
// Actual content // Actual content
ScrollView ScrollView {
{ id: printerScrollView;
id: printerScrollView anchors {
anchors
{
top: printingLabel.bottom
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
bottom: parent.bottom; bottom: parent.bottom;
left: parent.left;
right: parent.right;
top: printingLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
} }
style: UM.Theme.styles.scrollview;
style: UM.Theme.styles.scrollview ListView {
id: printerList;
ListView property var currentIndex: -1;
{ anchors {
id: printerList fill: parent;
property var currentIndex: -1 leftMargin: UM.Theme.getSize("wide_margin").width;
anchors rightMargin: UM.Theme.getSize("wide_margin").width;
{
fill: parent
leftMargin: UM.Theme.getSize("wide_margin").width
rightMargin: UM.Theme.getSize("wide_margin").width
} }
spacing: UM.Theme.getSize("default_margin").height - 10 delegate: PrinterCard {
model: OutputDevice.printers printer: modelData;
delegate: PrinterCard
{
printer: modelData
} }
model: OutputDevice.printers;
spacing: UM.Theme.getSize("default_margin").height - 10;
} }
} }
} }

View file

@ -4,141 +4,129 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Component Component {
{ Rectangle {
Rectangle id: monitorFrame;
{ property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight");
id: monitorFrame property var lineColor: "#DCDCDC"; // TODO: Should be linked to theme.
width: maximumWidth property var cornerRadius: 4 * screenScaleFactor; // TODO: Should be linked to theme.
height: maximumHeight color: UM.Theme.getColor("viewport_background");
color: UM.Theme.getColor("viewport_background") height: maximumHeight;
property var emphasisColor: UM.Theme.getColor("setting_control_border_highlight") onVisibleChanged: {
property var lineColor: "#DCDCDC" // TODO: Should be linked to theme. if (monitorFrame != null && !monitorFrame.visible) {
property var cornerRadius: 4 * screenScaleFactor // TODO: Should be linked to theme. OutputDevice.setActiveCamera(null);
}
}
width: maximumWidth;
UM.I18nCatalog UM.I18nCatalog {
{ id: catalog;
id: catalog name: "cura";
name: "cura"
} }
Label Label {
{ id: manageQueueLabel;
id: manageQueueLabel
anchors.rightMargin: 3 * UM.Theme.getSize("default_margin").width
anchors.right: queuedPrintJobs.right
anchors.bottom: queuedLabel.bottom
text: catalog.i18nc("@label link to connect manager", "Manage queue")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("primary")
linkColor: UM.Theme.getColor("primary")
}
MouseArea
{
anchors.fill: manageQueueLabel
hoverEnabled: true
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel()
onEntered: manageQueueLabel.font.underline = true
onExited: manageQueueLabel.font.underline = false
}
Label
{
id: queuedLabel
anchors.left: queuedPrintJobs.left
anchors.top: parent.top
anchors.topMargin: 2 * UM.Theme.getSize("default_margin").height
anchors.leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5
text: catalog.i18nc("@label", "Queued")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
}
Column
{
id: skeletonLoader
visible: printJobList.count === 0;
width: Math.min(800 * screenScaleFactor, maximumWidth)
anchors
{
top: queuedLabel.bottom
topMargin: UM.Theme.getSize("default_margin").height
horizontalCenter: parent.horizontalCenter
bottomMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
}
PrintJobInfoBlock
{
printJob: null // Use as skeleton
anchors
{
left: parent.left
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
leftMargin: UM.Theme.getSize("default_margin").width
}
}
PrintJobInfoBlock
{
printJob: null // Use as skeleton
anchors
{
left: parent.left
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
leftMargin: UM.Theme.getSize("default_margin").width
}
}
}
ScrollView
{
id: queuedPrintJobs
anchors { anchors {
top: queuedLabel.bottom bottom: queuedLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height right: queuedPrintJobs.right;
horizontalCenter: parent.horizontalCenter rightMargin: 3 * UM.Theme.getSize("default_margin").width;
bottomMargin: UM.Theme.getSize("default_margin").height }
bottom: parent.bottom color: UM.Theme.getColor("primary");
font: UM.Theme.getFont("default");
linkColor: UM.Theme.getColor("primary");
text: catalog.i18nc("@label link to connect manager", "Manage queue");
} }
style: UM.Theme.styles.scrollview
width: Math.min(800 * screenScaleFactor, maximumWidth)
ListView MouseArea {
{ anchors.fill: manageQueueLabel;
hoverEnabled: true;
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel();
onEntered: manageQueueLabel.font.underline = true;
onExited: manageQueueLabel.font.underline = false;
}
Label {
id: queuedLabel;
anchors {
left: queuedPrintJobs.left;
leftMargin: 3 * UM.Theme.getSize("default_margin").width + 5;
top: parent.top;
topMargin: 2 * UM.Theme.getSize("default_margin").height;
}
color: UM.Theme.getColor("text");
font: UM.Theme.getFont("large");
text: catalog.i18nc("@label", "Queued");
}
Column {
id: skeletonLoader;
anchors {
bottom: parent.bottom;
bottomMargin: UM.Theme.getSize("default_margin").height;
horizontalCenter: parent.horizontalCenter;
top: queuedLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
}
visible: printJobList.count === 0;
width: Math.min(800 * screenScaleFactor, maximumWidth);
PrintJobInfoBlock {
anchors {
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").width;
right: parent.right;
rightMargin: UM.Theme.getSize("default_margin").width;
}
printJob: null; // Use as skeleton
}
PrintJobInfoBlock {
anchors {
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").width;
right: parent.right;
rightMargin: UM.Theme.getSize("default_margin").width;
}
printJob: null; // Use as skeleton
}
}
ScrollView {
id: queuedPrintJobs;
anchors {
top: queuedLabel.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
horizontalCenter: parent.horizontalCenter;
bottomMargin: UM.Theme.getSize("default_margin").height;
bottom: parent.bottom;
}
style: UM.Theme.styles.scrollview;
width: Math.min(800 * screenScaleFactor, maximumWidth);
ListView {
id: printJobList; id: printJobList;
anchors.fill: parent anchors.fill: parent;
spacing: UM.Theme.getSize("default_margin").height - 10 // 2x the shadow radius delegate: PrintJobInfoBlock; {
model: OutputDevice.queuedPrintJobs anchors {
delegate: PrintJobInfoBlock left: parent.left;
{ leftMargin: UM.Theme.getSize("default_margin").width;
printJob: modelData right: parent.right;
anchors.left: parent.left rightMargin: UM.Theme.getSize("default_margin").width;
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.leftMargin: UM.Theme.getSize("default_margin").width
} }
printJob: modelData;
}
model: OutputDevice.queuedPrintJobs;
spacing: UM.Theme.getSize("default_margin").height - 10; // 2x the shadow radius
} }
} }
PrinterVideoStream PrinterVideoStream {
{ anchors.fill: parent;
visible: OutputDevice.activeCamera != null camera: OutputDevice.activeCamera;
anchors.fill: parent visible: OutputDevice.activeCamera != null;
camera: OutputDevice.activeCamera
}
onVisibleChanged:
{
if (monitorFrame != null && !monitorFrame.visible)
{
OutputDevice.setActiveCamera(null)
}
} }
} }
} }

View file

@ -10,7 +10,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import UM 1.3 as UM import UM 1.3 as UM
Rectangle { Item {
id: root; id: root;
property var job: null; property var job: null;
property var materialsAreKnown: { property var materialsAreKnown: {
@ -24,7 +24,6 @@ Rectangle {
} }
return true; return true;
} }
color: "pink";
width: parent.width; width: parent.width;
height: childrenRect.height; height: childrenRect.height;
@ -34,6 +33,11 @@ Rectangle {
// Config change toggle // Config change toggle
Rectangle { Rectangle {
anchors {
left: parent.left;
right: parent.right;
top: parent.top;
}
color: { color: {
if(configurationChangeToggle.containsMouse) { if(configurationChangeToggle.containsMouse) {
return UM.Theme.getColor("viewport_background"); // TODO: Theme! return UM.Theme.getColor("viewport_background"); // TODO: Theme!
@ -41,32 +45,29 @@ Rectangle {
return "transparent"; return "transparent";
} }
} }
width: parent.width;
height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme! height: UM.Theme.getSize("default_margin").height * 4; // TODO: Theme!
anchors { width: parent.width;
left: parent.left;
right: parent.right;
top: parent.top;
}
Rectangle { Rectangle {
width: parent.width;
height: UM.Theme.getSize("default_lining").height;
color: "#e6e6e6"; // TODO: Theme! color: "#e6e6e6"; // TODO: Theme!
height: UM.Theme.getSize("default_lining").height;
width: parent.width;
} }
UM.RecolorImage { UM.RecolorImage {
width: 23; // TODO: Theme!
height: 23; // TODO: Theme!
anchors { anchors {
right: configChangeToggleLabel.left; right: configChangeToggleLabel.left;
rightMargin: UM.Theme.getSize("default_margin").width; rightMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
sourceSize.width: width;
sourceSize.height: height;
source: "../svg/warning-icon.svg";
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text");
height: 23 * screenScaleFactor; // TODO: Theme!
source: "../svg/warning-icon.svg";
sourceSize {
width: width;
height: height;
}
width: 23 * screenScaleFactor; // TODO: Theme!
} }
Label { Label {
@ -79,15 +80,13 @@ Rectangle {
} }
UM.RecolorImage { UM.RecolorImage {
width: 15; // TODO: Theme!
height: 15; // TODO: Theme!
anchors { anchors {
left: configChangeToggleLabel.right; left: configChangeToggleLabel.right;
leftMargin: UM.Theme.getSize("default_margin").width; leftMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
sourceSize.width: width; color: UM.Theme.getColor("text");
sourceSize.height: height; height: 15 * screenScaleFactor; // TODO: Theme!
source: { source: {
if (configChangeDetails.visible) { if (configChangeDetails.visible) {
return UM.Theme.getIcon("arrow_top"); return UM.Theme.getIcon("arrow_top");
@ -95,7 +94,11 @@ Rectangle {
return UM.Theme.getIcon("arrow_bottom"); return UM.Theme.getIcon("arrow_bottom");
} }
} }
color: UM.Theme.getColor("text"); sourceSize {
width: width;
height: height;
}
width: 15 * screenScaleFactor; // TODO: Theme!
} }
MouseArea { MouseArea {
@ -111,26 +114,25 @@ Rectangle {
// Config change details // Config change details
Rectangle { Rectangle {
id: configChangeDetails id: configChangeDetails
color: "transparent";
width: parent.width;
visible: false;
height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0;
Behavior on height { NumberAnimation { duration: 100 } } Behavior on height { NumberAnimation { duration: 100 } }
color: "transparent";
height: visible ? UM.Theme.getSize("monitor_tab_config_override_box").height : 0;
visible: false;
width: parent.width;
Rectangle { Rectangle {
color: "transparent";
clip: true;
anchors { anchors {
fill: parent;
topMargin: UM.Theme.getSize("wide_margin").height;
bottomMargin: UM.Theme.getSize("wide_margin").height; bottomMargin: UM.Theme.getSize("wide_margin").height;
fill: parent;
leftMargin: UM.Theme.getSize("wide_margin").height * 4; leftMargin: UM.Theme.getSize("wide_margin").height * 4;
rightMargin: UM.Theme.getSize("wide_margin").height * 4; rightMargin: UM.Theme.getSize("wide_margin").height * 4;
topMargin: UM.Theme.getSize("wide_margin").height;
} }
color: "transparent";
clip: true;
Label { Label {
anchors.fill: parent; anchors.fill: parent;
wrapMode: Text.WordWrap;
elide: Text.ElideRight; elide: Text.ElideRight;
font: UM.Theme.getFont("large_nonbold"); font: UM.Theme.getFont("large_nonbold");
text: { text: {
@ -167,6 +169,7 @@ Rectangle {
} }
return result; return result;
} }
wrapMode: Text.WordWrap;
} }
Button { Button {
@ -174,6 +177,10 @@ Rectangle {
bottom: parent.bottom; bottom: parent.bottom;
left: parent.left; left: parent.left;
} }
onClicked: {
overrideConfirmationDialog.visible = true;
}
text: catalog.i18nc("@label", "Override");
visible: { visible: {
var length = root.job.configurationChanges.length; var length = root.job.configurationChanges.length;
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
@ -184,10 +191,6 @@ Rectangle {
} }
return true; return true;
} }
text: catalog.i18nc("@label", "Override");
onClicked: {
overrideConfirmationDialog.visible = true;
}
} }
} }
} }
@ -195,16 +198,16 @@ Rectangle {
MessageDialog { MessageDialog {
id: overrideConfirmationDialog; id: overrideConfirmationDialog;
title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); Component.onCompleted: visible = false;
icon: StandardIcon.Warning; icon: StandardIcon.Warning;
onYes: OutputDevice.forceSendJob(root.job.key);
standardButtons: StandardButton.Yes | StandardButton.No;
text: { text: {
var printJobName = formatPrintJobName(root.job.name); var printJobName = formatPrintJobName(root.job.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName); var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText; return confirmText;
} }
standardButtons: StandardButton.Yes | StandardButton.No; title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
Component.onCompleted: visible = false;
onYes: OutputDevice.forceSendJob(root.job.key);
} }
// Utils // Utils

View file

@ -2,56 +2,45 @@
// 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
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Component Component {
{ Item {
Item height: maximumHeight;
{ width: maximumWidth;
width: maximumWidth
height: maximumHeight Image {
Image id: cameraImage;
{ anchors {
id: cameraImage horizontalCenter: parent.horizontalCenter;
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) verticalCenter: parent.verticalCenter;
height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width) }
anchors.horizontalCenter: parent.horizontalCenter Component.onCompleted: {
anchors.verticalCenter: parent.verticalCenter if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
z: 1 OutputDevice.activePrinter.camera.start();
Component.onCompleted:
{
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null)
{
OutputDevice.activePrinter.camera.start()
} }
} }
onVisibleChanged: height: Math.floor((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width);
{ onVisibleChanged: {
if(visible) if (visible) {
{ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) OutputDevice.activePrinter.camera.start();
{
OutputDevice.activePrinter.camera.start()
} }
} else } else {
{ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) {
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null) OutputDevice.activePrinter.camera.stop();
{
OutputDevice.activePrinter.camera.stop()
} }
} }
} }
source: source: {
{ if (OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage) {
if(OutputDevice.activePrinter != null && OutputDevice.activePrinter.camera != null && OutputDevice.activePrinter.camera.latestImage)
{
return OutputDevice.activePrinter.camera.latestImage; return OutputDevice.activePrinter.camera.latestImage;
} }
return ""; return "";
} }
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth);
z: 1;
} }
} }
} }

View file

@ -7,34 +7,29 @@ import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM import UM 1.2 as UM
Item { Item {
id: extruderInfo id: extruderInfo;
property var printCoreConfiguration: null; property var printCoreConfiguration: null;
width: Math.round(parent.width / 2);
height: childrenRect.height; height: childrenRect.height;
width: Math.round(parent.width / 2);
// Extruder circle // Extruder circle
Item { Item {
id: extruderCircle id: extruderCircle;
width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
// Loading skeleton // Loading skeleton
Rectangle { Rectangle {
visible: !printCoreConfiguration;
anchors.fill: parent; anchors.fill: parent;
radius: Math.round(width / 2);
color: UM.Theme.getColor("viewport_background"); color: UM.Theme.getColor("viewport_background");
radius: Math.round(width / 2);
visible: !printCoreConfiguration;
} }
// Actual content // Actual content
Rectangle { Rectangle {
visible: printCoreConfiguration;
anchors.fill: parent; anchors.fill: parent;
radius: Math.round(width / 2);
border.width: UM.Theme.getSize("monitor_tab_thick_lining").width; border.width: UM.Theme.getSize("monitor_tab_thick_lining").width;
border.color: UM.Theme.getColor("monitor_tab_lining_active"); border.color: UM.Theme.getColor("monitor_tab_lining_active");
opacity: { opacity: {
@ -43,6 +38,8 @@ Item {
} }
return 1; return 1;
} }
radius: Math.round(width / 2);
visible: printCoreConfiguration;
Label { Label {
anchors.centerIn: parent; anchors.centerIn: parent;
@ -55,68 +52,66 @@ Item {
// Print core and material labels // Print core and material labels
Item { Item {
id: materialLabel id: materialLabel
anchors { anchors {
left: extruderCircle.right; left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width; leftMargin: UM.Theme.getSize("default_margin").width;
top: parent.top;
right: parent.right; right: parent.right;
top: parent.top;
} }
height: UM.Theme.getSize("monitor_tab_text_line").height; height: UM.Theme.getSize("monitor_tab_text_line").height;
// Loading skeleton // Loading skeleton
Rectangle { Rectangle {
visible: !extruderInfo.printCoreConfiguration;
anchors.fill: parent; anchors.fill: parent;
color: UM.Theme.getColor("viewport_background"); color: UM.Theme.getColor("viewport_background");
visible: !extruderInfo.printCoreConfiguration;
} }
// Actual content // Actual content
Label { Label {
visible: extruderInfo.printCoreConfiguration;
anchors.fill: parent; anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: { text: {
if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) { if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) {
return printCoreConfiguration.activeMaterial.name; return printCoreConfiguration.activeMaterial.name;
} }
return ""; return "";
} }
font: UM.Theme.getFont("default"); visible: extruderInfo.printCoreConfiguration;
elide: Text.ElideRight;
} }
} }
Item { Item {
id: printCoreLabel; id: printCoreLabel;
anchors { anchors {
right: parent.right; bottom: parent.bottom;
left: extruderCircle.right; left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width; leftMargin: UM.Theme.getSize("default_margin").width;
bottom: parent.bottom; right: parent.right;
} }
height: UM.Theme.getSize("monitor_tab_text_line").height; height: UM.Theme.getSize("monitor_tab_text_line").height;
// Loading skeleton // Loading skeleton
Rectangle { Rectangle {
color: UM.Theme.getColor("viewport_background");
height: parent.height;
visible: !extruderInfo.printCoreConfiguration; visible: !extruderInfo.printCoreConfiguration;
width: parent.width / 3; width: parent.width / 3;
height: parent.height;
color: UM.Theme.getColor("viewport_background");
} }
// Actual content // Actual content
Label { Label {
visible: extruderInfo.printCoreConfiguration; elide: Text.ElideRight;
font: UM.Theme.getFont("default");
opacity: 0.6;
text: { text: {
if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) { if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) {
return printCoreConfiguration.hotendID; return printCoreConfiguration.hotendID;
} }
return ""; return "";
} }
elide: Text.ElideRight; visible: extruderInfo.printCoreConfiguration;
opacity: 0.6;
font: UM.Theme.getFont("default");
} }
} }
} }

View file

@ -2,17 +2,13 @@
// 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
import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import UM 1.3 as UM import UM 1.3 as UM
Item { Item {
id: root; id: root;
property var printJob: null; property var printJob: null;
property var running: isRunning(printJob); property var running: isRunning(printJob);
@ -55,16 +51,20 @@ Item {
} }
Item { Item {
id: pointedRectangle id: pointedRectangle;
width: parent.width - 10 * screenScaleFactor; // Because of the shadow anchors {
horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter;
}
height: parent.height - 10 * screenScaleFactor; // Because of the shadow height: parent.height - 10 * screenScaleFactor; // Because of the shadow
anchors.horizontalCenter: parent.horizontalCenter; width: parent.width - 10 * screenScaleFactor; // Because of the shadow
anchors.verticalCenter: parent.verticalCenter;
Rectangle { Rectangle {
id: point id: point;
anchors.right: bloop.right; anchors {
anchors.rightMargin: 24; right: bloop.right;
rightMargin: 24;
}
color: UM.Theme.getColor("setting_control"); color: UM.Theme.getColor("setting_control");
height: 14 * screenScaleFactor; height: 14 * screenScaleFactor;
transform: Rotation { transform: Rotation {
@ -75,7 +75,7 @@ Item {
} }
Rectangle { Rectangle {
id: bloop id: bloop;
anchors { anchors {
bottom: parent.bottom; bottom: parent.bottom;
bottomMargin: 8 * screenScaleFactor; // Because of the shadow bottomMargin: 8 * screenScaleFactor; // Because of the shadow

View file

@ -11,13 +11,11 @@ import QtQuick.Dialogs 1.1
import UM 1.3 as UM import UM 1.3 as UM
Item { Item {
id: root id: root;
property var shadowRadius: 5 * screenScaleFactor;
property var shadowRadius: 5; property var shadowOffset: 2 * screenScaleFactor;
property var shadowOffset: 2;
property var debug: false; property var debug: false;
property var printJob: null; property var printJob: null;
width: parent.width; // Bubbles downward width: parent.width; // Bubbles downward
height: childrenRect.height + shadowRadius * 2; // Bubbles upward height: childrenRect.height + shadowRadius * 2; // Bubbles upward
@ -28,87 +26,84 @@ Item {
// The actual card (white block) // The actual card (white block)
Rectangle { Rectangle {
color: "white"; // TODO: Theme!
height: childrenRect.height;
width: parent.width - shadowRadius * 2;
// 5px margin, but shifted 2px vertically because of the shadow // 5px margin, but shifted 2px vertically because of the shadow
anchors { anchors {
topMargin: root.shadowRadius - root.shadowOffset;
bottomMargin: root.shadowRadius + root.shadowOffset; bottomMargin: root.shadowRadius + root.shadowOffset;
leftMargin: root.shadowRadius; leftMargin: root.shadowRadius;
rightMargin: root.shadowRadius; rightMargin: root.shadowRadius;
topMargin: root.shadowRadius - root.shadowOffset;
} }
color: "white"; // TODO: Theme!
height: childrenRect.height;
layer.enabled: true layer.enabled: true
layer.effect: DropShadow { layer.effect: DropShadow {
radius: root.shadowRadius radius: root.shadowRadius
verticalOffset: 2 * screenScaleFactor verticalOffset: 2 * screenScaleFactor
color: "#3F000000" // 25% shadow color: "#3F000000" // 25% shadow
} }
width: parent.width - shadowRadius * 2;
Column { Column {
width: parent.width;
height: childrenRect.height; height: childrenRect.height;
width: parent.width;
// Main content // Main content
Item { Item {
id: mainContent; id: mainContent;
height: 200 * screenScaleFactor; // TODO: Theme!
width: parent.width; width: parent.width;
height: 200; // TODO: Theme!
// Left content // Left content
Item { Item {
anchors { anchors {
bottom: parent.bottom;
left: parent.left; left: parent.left;
margins: UM.Theme.getSize("wide_margin").width;
right: parent.horizontalCenter; right: parent.horizontalCenter;
top: parent.top; top: parent.top;
bottom: parent.bottom;
margins: UM.Theme.getSize("wide_margin").width
} }
Item { Item {
id: printJobName; id: printJobName;
width: parent.width; width: parent.width;
height: UM.Theme.getSize("monitor_tab_text_line").height; height: UM.Theme.getSize("monitor_tab_text_line").height;
Rectangle { Rectangle {
visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: parent.height; height: parent.height;
visible: !printJob;
width: parent.width / 3; width: parent.width / 3;
} }
Label { Label {
visible: printJob;
text: printJob ? printJob.name : ""; // Supress QML warnings
font: UM.Theme.getFont("default_bold");
elide: Text.ElideRight;
anchors.fill: parent; anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: printJob ? printJob.name : ""; // Supress QML warnings
visible: printJob;
} }
} }
Item { Item {
id: printJobOwnerName; id: printJobOwnerName;
width: parent.width;
height: UM.Theme.getSize("monitor_tab_text_line").height;
anchors { anchors {
top: printJobName.bottom; top: printJobName.bottom;
topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2); topMargin: Math.floor(UM.Theme.getSize("default_margin").height / 2);
} }
height: UM.Theme.getSize("monitor_tab_text_line").height;
width: parent.width;
Rectangle { Rectangle {
visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
height: parent.height; height: parent.height;
visible: !printJob;
width: parent.width / 2; width: parent.width / 2;
} }
Label { Label {
visible: printJob;
text: printJob ? printJob.owner : ""; // Supress QML warnings
font: UM.Theme.getFont("default");
elide: Text.ElideRight;
anchors.fill: parent; anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: printJob ? printJob.owner : ""; // Supress QML warnings
visible: printJob;
} }
} }
@ -116,90 +111,96 @@ Item {
id: printJobPreview; id: printJobPreview;
property var useUltibot: false; property var useUltibot: false;
anchors { anchors {
top: printJobOwnerName.bottom;
horizontalCenter: parent.horizontalCenter;
topMargin: UM.Theme.getSize("default_margin").height;
bottom: parent.bottom; bottom: parent.bottom;
horizontalCenter: parent.horizontalCenter;
top: printJobOwnerName.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
} }
width: height; width: height;
// Skeleton // Skeleton
Rectangle { Rectangle {
visible: !printJob;
anchors.fill: parent; anchors.fill: parent;
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
visible: !printJob;
} }
// Actual content // Actual content
Image { Image {
id: previewImage; id: previewImage;
visible: printJob;
source: printJob ? printJob.previewImageUrl : "";
opacity: printJob && printJob.state == "error" ? 0.5 : 1.0;
anchors.fill: parent; anchors.fill: parent;
opacity: printJob && printJob.state == "error" ? 0.5 : 1.0;
source: printJob ? printJob.previewImageUrl : "";
visible: printJob;
} }
UM.RecolorImage { UM.RecolorImage {
id: ultiBotImage; id: ultiBotImage;
anchors.centerIn: printJobPreview; anchors.centerIn: printJobPreview;
color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
height: printJobPreview.height;
source: "../svg/ultibot.svg"; source: "../svg/ultibot.svg";
sourceSize {
height: height;
width: width;
}
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */ not in order to determine if we show the placeholder (ultibot) image instead. */
visible: printJob && previewImage.status == Image.Error; visible: printJob && previewImage.status == Image.Error;
width: printJobPreview.width; width: printJobPreview.width;
height: printJobPreview.height;
sourceSize.width: width;
sourceSize.height: height;
color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
} }
UM.RecolorImage { UM.RecolorImage {
id: statusImage; id: statusImage;
anchors.centerIn: printJobPreview; anchors.centerIn: printJobPreview;
color: "black";
height: 0.5 * printJobPreview.height;
source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : ""; source: printJob && printJob.state == "error" ? "../svg/aborted-icon.svg" : "";
sourceSize {
height: height;
width: width;
}
visible: source != ""; visible: source != "";
width: 0.5 * printJobPreview.width; width: 0.5 * printJobPreview.width;
height: 0.5 * printJobPreview.height;
sourceSize.width: width;
sourceSize.height: height;
color: "black";
} }
} }
} }
// Divider // Divider
Rectangle { Rectangle {
height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
width: UM.Theme.getSize("default_lining").width;
color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
anchors { anchors {
horizontalCenter: parent.horizontalCenter; horizontalCenter: parent.horizontalCenter;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
color: !printJob ? UM.Theme.getColor("viewport_background") : "#e6e6e6"; // TODO: Theme!
height: parent.height - 2 * UM.Theme.getSize("default_margin").height;
width: UM.Theme.getSize("default_lining").width;
} }
// Right content // Right content
Item { Item {
anchors { anchors {
bottom: parent.bottom;
left: parent.horizontalCenter; left: parent.horizontalCenter;
margins: UM.Theme.getSize("wide_margin").width;
right: parent.right; right: parent.right;
top: parent.top; top: parent.top;
bottom: parent.bottom;
margins: UM.Theme.getSize("wide_margin").width;
} }
Item { Item {
id: targetPrinterLabel; id: targetPrinterLabel;
width: parent.width;
height: UM.Theme.getSize("monitor_tab_text_line").height; height: UM.Theme.getSize("monitor_tab_text_line").height;
width: parent.width;
Rectangle { Rectangle {
visible: !printJob; visible: !printJob;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
anchors.fill: parent; anchors.fill: parent;
} }
Label { Label {
visible: printJob;
elide: Text.ElideRight; elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold"); font: UM.Theme.getFont("default_bold");
text: { text: {
@ -215,13 +216,14 @@ Item {
} }
return ""; return "";
} }
visible: printJob;
} }
} }
PrinterInfoBlock { PrinterInfoBlock {
anchors.bottom: parent.bottom;
printer: root.printJob.assignedPrinter; printer: root.printJob.assignedPrinter;
printJob: root.printJob; printJob: root.printJob;
anchors.bottom: parent.bottom;
} }
} }
@ -240,15 +242,15 @@ Item {
Item { Item {
id: configChangesBox; id: configChangesBox;
width: parent.width;
height: childrenRect.height; height: childrenRect.height;
visible: printJob && printJob.configurationChanges.length !== 0; visible: printJob && printJob.configurationChanges.length !== 0;
width: parent.width;
// Config change toggle // Config change toggle
Rectangle { Rectangle {
id: configChangeToggle; id: configChangeToggle;
color: { color: {
if(configChangeToggleArea.containsMouse) { if (configChangeToggleArea.containsMouse) {
return UM.Theme.getColor("viewport_background"); // TODO: Theme! return UM.Theme.getColor("viewport_background"); // TODO: Theme!
} else { } else {
return "transparent"; return "transparent";
@ -263,23 +265,25 @@ Item {
} }
Rectangle { Rectangle {
width: parent.width;
height: UM.Theme.getSize("default_lining").height;
color: "#e6e6e6"; // TODO: Theme! color: "#e6e6e6"; // TODO: Theme!
height: UM.Theme.getSize("default_lining").height;
width: parent.width;
} }
UM.RecolorImage { UM.RecolorImage {
width: 23; // TODO: Theme!
height: 23; // TODO: Theme!
anchors { anchors {
right: configChangeToggleLabel.left; right: configChangeToggleLabel.left;
rightMargin: UM.Theme.getSize("default_margin").width; rightMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
sourceSize.width: width;
sourceSize.height: height;
source: "../svg/warning-icon.svg";
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text");
height: 23 * screenScaleFactor; // TODO: Theme!
source: "../svg/warning-icon.svg";
sourceSize {
height: height;
width: width;
}
width: 23 * screenScaleFactor; // TODO: Theme!
} }
Label { Label {
@ -292,15 +296,13 @@ Item {
} }
UM.RecolorImage { UM.RecolorImage {
width: 15; // TODO: Theme!
height: 15; // TODO: Theme!
anchors { anchors {
left: configChangeToggleLabel.right; left: configChangeToggleLabel.right;
leftMargin: UM.Theme.getSize("default_margin").width; leftMargin: UM.Theme.getSize("default_margin").width;
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
sourceSize.width: width; color: UM.Theme.getColor("text");
sourceSize.height: height; height: 15 * screenScaleFactor; // TODO: Theme!
source: { source: {
if (configChangeDetails.visible) { if (configChangeDetails.visible) {
return UM.Theme.getIcon("arrow_top"); return UM.Theme.getIcon("arrow_top");
@ -308,7 +310,11 @@ Item {
return UM.Theme.getIcon("arrow_bottom"); return UM.Theme.getIcon("arrow_bottom");
} }
} }
color: UM.Theme.getColor("text"); sourceSize {
width: width;
height: height;
}
width: 15 * screenScaleFactor; // TODO: Theme!
} }
MouseArea { MouseArea {
@ -324,26 +330,25 @@ Item {
// Config change details // Config change details
Item { Item {
id: configChangeDetails; id: configChangeDetails;
width: parent.width; anchors.top: configChangeToggle.bottom;
visible: false; Behavior on height { NumberAnimation { duration: 100 } }
// In case of really massive multi-line configuration changes // In case of really massive multi-line configuration changes
height: visible ? Math.max(UM.Theme.getSize("monitor_tab_config_override_box").height, childrenRect.height) : 0; height: visible ? Math.max(UM.Theme.getSize("monitor_tab_config_override_box").height, childrenRect.height) : 0;
Behavior on height { NumberAnimation { duration: 100 } } visible: false;
anchors.top: configChangeToggle.bottom; width: parent.width;
Item { Item {
clip: true;
anchors { anchors {
fill: parent;
topMargin: UM.Theme.getSize("wide_margin").height;
bottomMargin: UM.Theme.getSize("wide_margin").height; bottomMargin: UM.Theme.getSize("wide_margin").height;
fill: parent;
leftMargin: UM.Theme.getSize("wide_margin").height * 4; leftMargin: UM.Theme.getSize("wide_margin").height * 4;
rightMargin: UM.Theme.getSize("wide_margin").height * 4; rightMargin: UM.Theme.getSize("wide_margin").height * 4;
topMargin: UM.Theme.getSize("wide_margin").height;
} }
clip: true;
Label { Label {
anchors.fill: parent; anchors.fill: parent;
wrapMode: Text.WordWrap;
elide: Text.ElideRight; elide: Text.ElideRight;
font: UM.Theme.getFont("large_nonbold"); font: UM.Theme.getFont("large_nonbold");
text: { text: {
@ -380,6 +385,7 @@ Item {
} }
return result; return result;
} }
wrapMode: Text.WordWrap;
} }
Button { Button {
@ -387,6 +393,10 @@ Item {
bottom: parent.bottom; bottom: parent.bottom;
left: parent.left; left: parent.left;
} }
onClicked: {
overrideConfirmationDialog.visible = true;
}
text: catalog.i18nc("@label", "Override");
visible: { visible: {
var length = printJob.configurationChanges.length; var length = printJob.configurationChanges.length;
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
@ -397,26 +407,22 @@ Item {
} }
return true; return true;
} }
text: catalog.i18nc("@label", "Override");
onClicked: {
overrideConfirmationDialog.visible = true;
}
} }
} }
} }
MessageDialog { MessageDialog {
id: overrideConfirmationDialog; id: overrideConfirmationDialog;
title: catalog.i18nc("@window:title", "Override configuration configuration and start print"); Component.onCompleted: visible = false;
icon: StandardIcon.Warning; icon: StandardIcon.Warning;
onYes: OutputDevice.forceSendJob(printJob.key);
standardButtons: StandardButton.Yes | StandardButton.No;
text: { text: {
var printJobName = formatPrintJobName(printJob.name); var printJobName = formatPrintJobName(printJob.name);
var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName); var confirmText = catalog.i18nc("@label", "Starting a print job with an incompatible configuration could damage your 3D printer. Are you sure you want to override the configuration and print %1?").arg(printJobName);
return confirmText; return confirmText;
} }
standardButtons: StandardButton.Yes | StandardButton.No; title: catalog.i18nc("@window:title", "Override configuration configuration and start print");
Component.onCompleted: visible = false;
onYes: OutputDevice.forceSendJob(printJob.key);
} }
} }
} }

View file

@ -14,15 +14,15 @@ import UM 1.3 as UM
Item { Item {
property var job: null; property var job: null;
property var useUltibot: false; property var useUltibot: false;
height: 100; height: 100 * screenScaleFactor;
width: height; width: height;
// Skeleton // Skeleton
Rectangle { Rectangle {
visible: !job;
anchors.fill: parent; anchors.fill: parent;
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
visible: !job;
} }
// Actual content // Actual content
@ -46,26 +46,30 @@ Item {
UM.RecolorImage { UM.RecolorImage {
id: ultibotImage; id: ultibotImage;
anchors.centerIn: parent; anchors.centerIn: parent;
color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
height: parent.height;
source: "../svg/ultibot.svg"; source: "../svg/ultibot.svg";
sourceSize {
height: height;
width: width;
}
/* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or /* Since print jobs ALWAYS have an image url, we have to check if that image URL errors or
not in order to determine if we show the placeholder (ultibot) image instead. */ not in order to determine if we show the placeholder (ultibot) image instead. */
visible: job && previewImage.status == Image.Error; visible: job && previewImage.status == Image.Error;
width: parent.width; width: parent.width;
height: parent.height;
sourceSize.width: width;
sourceSize.height: height;
color: UM.Theme.getColor("monitor_tab_placeholder_image"); // TODO: Theme!
} }
UM.RecolorImage { UM.RecolorImage {
id: statusImage; id: statusImage;
anchors.centerIn: parent; anchors.centerIn: parent;
color: "black"; // TODO: Theme!
height: 0.5 * parent.height;
source: job && job.state == "error" ? "../svg/aborted-icon.svg" : ""; source: job && job.state == "error" ? "../svg/aborted-icon.svg" : "";
sourceSize {
height: height;
width: width;
}
visible: source != ""; visible: source != "";
width: 0.5 * parent.width; width: 0.5 * parent.width;
height: 0.5 * parent.height;
sourceSize.width: width;
sourceSize.height: height;
color: "black";
} }
} }

View file

@ -17,17 +17,18 @@ Column {
width: parent.width; width: parent.width;
Rectangle { Rectangle {
visible: !job;
color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
height: parent.height; height: parent.height;
visible: !job;
width: parent.width / 3; width: parent.width / 3;
} }
Label { Label {
visible: job;
text: job ? job.name : "";
font: UM.Theme.getFont("default_bold");
elide: Text.ElideRight;
anchors.fill: parent; anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default_bold");
text: job ? job.name : "";
visible: job;
} }
} }
@ -37,17 +38,18 @@ Column {
width: parent.width; width: parent.width;
Rectangle { Rectangle {
visible: !job;
color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color color: UM.Theme.getColor("viewport_background"); // TODO: Use explicit theme color
height: parent.height; height: parent.height;
visible: !job;
width: parent.width / 2; width: parent.width / 2;
} }
Label { Label {
visible: job;
text: job ? job.owner : "";
font: UM.Theme.getFont("default");
elide: Text.ElideRight;
anchors.fill: parent; anchors.fill: parent;
elide: Text.ElideRight;
font: UM.Theme.getFont("default");
text: job ? job.owner : "";
visible: job;
} }
} }
} }

View file

@ -4,112 +4,101 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import UM 1.1 as UM import UM 1.1 as UM
UM.Dialog UM.Dialog {
{
id: base; id: base;
property var printersModel: {
minimumWidth: 500 * screenScaleFactor return ListModel{};
minimumHeight: 140 * screenScaleFactor
maximumWidth: minimumWidth
maximumHeight: minimumHeight
width: minimumWidth
height: minimumHeight
visible: true
modality: Qt.ApplicationModal
onVisibleChanged:
{
if(visible)
{
resetPrintersModel()
} }
else height: minimumHeight;
{
OutputDevice.cancelPrintSelection()
}
}
title: catalog.i18nc("@title:window", "Print over network")
property var printersModel: ListModel{}
function resetPrintersModel() {
printersModel.clear()
printersModel.append({ name: "Automatic", key: ""})
for (var index in OutputDevice.printers)
{
printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key})
}
}
Column
{
id: printerSelection
anchors.fill: parent
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.rightMargin: UM.Theme.getSize("default_margin").width
height: 50 * screenScaleFactor
Label
{
id: manualPrinterSelectionLabel
anchors
{
left: parent.left
topMargin: UM.Theme.getSize("default_margin").height
right: parent.right
}
text: catalog.i18nc("@label", "Printer selection")
wrapMode: Text.Wrap
height: 20 * screenScaleFactor
}
ComboBox
{
id: printerSelectionCombobox
model: base.printersModel
textRole: "name"
width: parent.width
height: 40 * screenScaleFactor
Behavior on height { NumberAnimation { duration: 100 } }
}
SystemPalette
{
id: palette
}
UM.I18nCatalog { id: catalog; name: "cura"; }
}
leftButtons: [ leftButtons: [
Button Button {
{ enabled: true;
text: catalog.i18nc("@action:button","Cancel")
enabled: true
onClicked: { onClicked: {
base.visible = false; base.visible = false;
printerSelectionCombobox.currentIndex = 0 printerSelectionCombobox.currentIndex = 0;
OutputDevice.cancelPrintSelection() OutputDevice.cancelPrintSelection();
} }
text: catalog.i18nc("@action:button","Cancel");
} }
] ]
maximumHeight: minimumHeight;
maximumWidth: minimumWidth;
minimumHeight: 140 * screenScaleFactor;
minimumWidth: 500 * screenScaleFactor;
modality: Qt.ApplicationModal;
onVisibleChanged: {
if (visible) {
resetPrintersModel();
} else {
OutputDevice.cancelPrintSelection();
}
}
rightButtons: [ rightButtons: [
Button Button {
{ enabled: true;
text: catalog.i18nc("@action:button","Print")
enabled: true
onClicked: { onClicked: {
base.visible = false; base.visible = false;
OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key) OutputDevice.selectPrinter(printerSelectionCombobox.model.get(printerSelectionCombobox.currentIndex).key);
// reset to defaults // reset to defaults
printerSelectionCombobox.currentIndex = 0 printerSelectionCombobox.currentIndex = 0;
} }
text: catalog.i18nc("@action:button","Print");
} }
] ]
title: catalog.i18nc("@title:window", "Print over network");
visible: true;
width: minimumWidth;
Column {
id: printerSelection;
anchors {
fill: parent;
leftMargin: UM.Theme.getSize("default_margin").width;
rightMargin: UM.Theme.getSize("default_margin").width;
top: parent.top;
topMargin: UM.Theme.getSize("default_margin").height;
}
height: 50 * screenScaleFactor;
SystemPalette {
id: palette;
}
UM.I18nCatalog {
id: catalog;
name: "cura";
}
Label {
id: manualPrinterSelectionLabel;
anchors {
left: parent.left;
right: parent.right;
topMargin: UM.Theme.getSize("default_margin").height;
}
height: 20 * screenScaleFactor;
text: catalog.i18nc("@label", "Printer selection");
wrapMode: Text.Wrap;
}
ComboBox {
id: printerSelectionCombobox;
Behavior on height { NumberAnimation { duration: 100 } }
height: 40 * screenScaleFactor;
model: base.printersModel;
textRole: "name";
width: parent.width;
}
}
// Utils
function resetPrintersModel() {
printersModel.clear();
printersModel.append({ name: "Automatic", key: ""});
for (var index in OutputDevice.printers) {
printersModel.append({name: OutputDevice.printers[index].name, key: OutputDevice.printers[index].key});
}
}
} }

View file

@ -6,17 +6,14 @@ import QtQuick.Dialogs 1.1
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Controls 1.4 as LegacyControls
import UM 1.3 as UM import UM 1.3 as UM
Item { Item {
id: root; id: root;
property var shadowRadius: 5; property var shadowRadius: 5;
property var shadowOffset: 2; property var shadowOffset: 2;
property var printer: null; property var printer: null;
property var collapsed: true; property var collapsed: true;
height: childrenRect.height + shadowRadius * 2; // Bubbles upward height: childrenRect.height + shadowRadius * 2; // Bubbles upward
width: parent.width; // Bubbles downward width: parent.width; // Bubbles downward
@ -24,10 +21,10 @@ Item {
Rectangle { Rectangle {
// 5px margin, but shifted 2px vertically because of the shadow // 5px margin, but shifted 2px vertically because of the shadow
anchors { anchors {
topMargin: root.shadowRadius - root.shadowOffset;
bottomMargin: root.shadowRadius + root.shadowOffset; bottomMargin: root.shadowRadius + root.shadowOffset;
leftMargin: root.shadowRadius; leftMargin: root.shadowRadius;
rightMargin: root.shadowRadius; rightMargin: root.shadowRadius;
topMargin: root.shadowRadius - root.shadowOffset;
} }
color: { color: {
if (printer.state == "disabled") { if (printer.state == "disabled") {
@ -46,8 +43,8 @@ Item {
width: parent.width - 2 * shadowRadius; width: parent.width - 2 * shadowRadius;
Column { Column {
width: parent.width;
height: childrenRect.height; height: childrenRect.height;
width: parent.width;
// Main card // Main card
Item { Item {
@ -65,15 +62,12 @@ Item {
margins: UM.Theme.getSize("default_margin").width; margins: UM.Theme.getSize("default_margin").width;
top: parent.top; top: parent.top;
} }
height: 58; height: 58 * screenScaleFactor;
width: 58; width: 58 * screenScaleFactor;
// Skeleton // Skeleton
Rectangle { Rectangle {
anchors { anchors.fill: parent;
fill: parent;
// margins: Math.round(UM.Theme.getSize("default_margin").width / 4);
}
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
radius: UM.Theme.getSize("default_margin").width; // TODO: Theme! radius: UM.Theme.getSize("default_margin").width; // TODO: Theme!
visible: !printer; visible: !printer;
@ -153,7 +147,6 @@ Item {
height: UM.Theme.getSize("monitor_tab_text_line").height; height: UM.Theme.getSize("monitor_tab_text_line").height;
width: parent.width * 0.75; width: parent.width * 0.75;
// Skeleton // Skeleton
Rectangle { Rectangle {
anchors.fill: parent; anchors.fill: parent;
@ -192,12 +185,14 @@ Item {
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text");
height: 15; // TODO: Theme! height: 15 * screenScaleFactor; // TODO: Theme!
source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom"); source: root.collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom");
sourceSize.height: height; sourceSize {
sourceSize.width: width; height: height;
width: width;
}
visible: printer; visible: printer;
width: 15; // TODO: Theme! width: 15 * screenScaleFactor; // TODO: Theme!
} }
MouseArea { MouseArea {
@ -213,7 +208,7 @@ Item {
} }
Connections { Connections {
target: printerList target: printerList;
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (!model) { if (!model) {
return; return;

View file

@ -10,17 +10,14 @@ import QtQuick.Controls 1.4 as LegacyControls
import UM 1.3 as UM import UM 1.3 as UM
Item { Item {
property var printer: null; property var printer: null;
property var printJob: printer ? printer.activePrintJob : null; property var printJob: printer ? printer.activePrintJob : null;
property var collapsed: true; property var collapsed: true;
Behavior on height { NumberAnimation { duration: 100 } } Behavior on height { NumberAnimation { duration: 100 } }
Behavior on opacity { NumberAnimation { duration: 100 } } Behavior on opacity { NumberAnimation { duration: 100 } }
width: parent.width;
height: collapsed ? 0 : childrenRect.height; height: collapsed ? 0 : childrenRect.height;
opacity: collapsed ? 0 : 1; opacity: collapsed ? 0 : 1;
width: parent.width;
Column { Column {
id: contentColumn; id: contentColumn;
@ -44,8 +41,8 @@ Item {
HorizontalLine {} HorizontalLine {}
Row { Row {
width: parent.width;
height: childrenRect.height; height: childrenRect.height;
width: parent.width;
PrintJobTitle { PrintJobTitle {
job: root.printer.activePrintJob; job: root.printer.activePrintJob;

View file

@ -17,107 +17,90 @@ ProgressBar {
} }
return result; return result;
} }
value: progress;
width: parent.width;
style: ProgressBarStyle { style: ProgressBarStyle {
property var remainingTime: property var remainingTime: {
{ if (printer.activePrintJob == null) {
if(printer.activePrintJob == null) return 0;
{
return 0
} }
/* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining /* Sometimes total minus elapsed is less than 0. Use Math.max() to prevent remaining
time from ever being less than 0. Negative durations cause strange behavior such time from ever being less than 0. Negative durations cause strange behavior such
as displaying "-1h -1m". */ as displaying "-1h -1m". */
var activeJob = printer.activePrintJob var activeJob = printer.activePrintJob;
return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0); return Math.max(activeJob.timeTotal - activeJob.timeElapsed, 0);
} }
property var progressText: property var progressText: {
{ if (printer.activePrintJob == null) {
if(printer.activePrintJob == null) return "";
{
return ""
} }
switch(printer.activePrintJob.state) switch (printer.activePrintJob.state) {
{
case "wait_cleanup": case "wait_cleanup":
if(printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed) if (printer.activePrintJob.timeTotal > printer.activePrintJob.timeElapsed) {
{ return catalog.i18nc("@label:status", "Aborted");
return catalog.i18nc("@label:status", "Aborted")
} }
return catalog.i18nc("@label:status", "Finished") return catalog.i18nc("@label:status", "Finished");
case "pre_print": case "pre_print":
case "sent_to_printer": case "sent_to_printer":
return catalog.i18nc("@label:status", "Preparing") return catalog.i18nc("@label:status", "Preparing");
case "aborted": case "aborted":
return catalog.i18nc("@label:status", "Aborted") return catalog.i18nc("@label:status", "Aborted");
case "wait_user_action": case "wait_user_action":
return catalog.i18nc("@label:status", "Aborted") return catalog.i18nc("@label:status", "Aborted");
case "pausing": case "pausing":
return catalog.i18nc("@label:status", "Pausing") return catalog.i18nc("@label:status", "Pausing");
case "paused": case "paused":
return OutputDevice.formatDuration( remainingTime ) return OutputDevice.formatDuration( remainingTime );
case "resuming": case "resuming":
return catalog.i18nc("@label:status", "Resuming") return catalog.i18nc("@label:status", "Resuming");
case "queued": case "queued":
return catalog.i18nc("@label:status", "Action required") return catalog.i18nc("@label:status", "Action required");
default: default:
return OutputDevice.formatDuration( remainingTime ) return OutputDevice.formatDuration( remainingTime );
} }
} }
background: Rectangle {
background: Rectangle color: UM.Theme.getColor("viewport_background");
{ implicitHeight: visible ? 24 : 0;
implicitWidth: 100 implicitWidth: 100;
implicitHeight: visible ? 24 : 0
color: UM.Theme.getColor("viewport_background")
} }
progress: Rectangle {
progress: Rectangle id: progressItem;
{ color: {
color:
{
var state = printer.activePrintJob.state var state = printer.activePrintJob.state
var inactiveStates = [ var inactiveStates = [
"pausing", "pausing",
"paused", "paused",
"resuming", "resuming",
"wait_cleanup" "wait_cleanup"
] ];
if(inactiveStates.indexOf(state) > -1 && remainingTime > 0) if (inactiveStates.indexOf(state) > -1 && remainingTime > 0) {
{ return UM.Theme.getColor("monitor_tab_text_inactive");
return UM.Theme.getColor("monitor_tab_text_inactive") } else {
} return UM.Theme.getColor("primary");
else
{
return UM.Theme.getColor("primary")
}
}
id: progressItem
function getTextOffset()
{
if(progressItem.width + progressLabel.width + 16 < control.width)
{
return progressItem.width + UM.Theme.getSize("default_margin").width
}
else
{
return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width
} }
} }
Label Label {
{ id: progressLabel;
id: progressLabel anchors {
anchors.left: parent.left left: parent.left;
anchors.leftMargin: getTextOffset() leftMargin: getTextOffset();
text: progressText }
anchors.verticalCenter: parent.verticalCenter text: progressText;
color: progressItem.width + progressLabel.width < control.width ? "black" : "white" anchors.verticalCenter: parent.verticalCenter;
width: contentWidth color: progressItem.width + progressLabel.width < control.width ? "black" : "white";
font: UM.Theme.getFont("default") width: contentWidth;
font: UM.Theme.getFont("default");
}
function getTextOffset() {
if (progressItem.width + progressLabel.width + 16 < control.width) {
return progressItem.width + UM.Theme.getSize("default_margin").width;
} else {
return progressItem.width - progressLabel.width - UM.Theme.getSize("default_margin").width;
} }
} }
} }
}
value: progress;
width: parent.width;
} }

View file

@ -5,26 +5,27 @@ import QtQuick 2.2
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import UM 1.2 as UM import UM 1.2 as UM
Item Item {
{ property alias text: familyNameLabel.text;
property alias text: familyNameLabel.text
property var padding: 3 * screenScaleFactor; // TODO: Theme! property var padding: 3 * screenScaleFactor; // TODO: Theme!
implicitHeight: familyNameLabel.contentHeight + 2 * padding // Apply the padding to top and bottom. implicitHeight: familyNameLabel.contentHeight + 2 * padding; // Apply the padding to top and bottom.
implicitWidth: familyNameLabel.contentWidth + implicitHeight // The extra height is added to ensure the radius doesn't cut something off. implicitWidth: familyNameLabel.contentWidth + implicitHeight; // The extra height is added to ensure the radius doesn't cut something off.
Rectangle
{ Rectangle {
id: background id: background;
height: parent.height anchors {
width: parent.width horizontalCenter: parent.horizontalCenter;
color: UM.Theme.getColor("viewport_background"); // TODO: Theme! right: parent.right;
anchors.right: parent.right
anchors.horizontalCenter: parent.horizontalCenter
radius: 0.5 * height
} }
Label color: UM.Theme.getColor("viewport_background"); // TODO: Theme!
{ height: parent.height;
id: familyNameLabel radius: 0.5 * height;
anchors.centerIn: parent width: parent.width;
text: "" }
Label {
id: familyNameLabel;
anchors.centerIn: parent;
text: "";
} }
} }

View file

@ -13,17 +13,14 @@ import UM 1.3 as UM
Item { Item {
id: root; id: root;
property var printer: null; property var printer: null;
property var printJob: null; property var printJob: null;
width: parent.width; width: parent.width;
height: childrenRect.height; height: childrenRect.height;
// Printer family pills // Printer family pills
Row { Row {
id: printerFamilyPills; id: printerFamilyPills;
anchors { anchors {
left: parent.left; left: parent.left;
right: parent.right; right: parent.right;
@ -35,21 +32,23 @@ Item {
Repeater { Repeater {
id: compatiblePills; id: compatiblePills;
visible: printJob; delegate: PrinterFamilyPill {
text: modelData;
}
model: printJob ? printJob.compatibleMachineFamilies : []; model: printJob ? printJob.compatibleMachineFamilies : [];
delegate: PrinterFamilyPill { text: modelData; } visible: printJob;
} }
PrinterFamilyPill { PrinterFamilyPill {
visible: !compatiblePills.visible && printer;
text: printer.type; text: printer.type;
visible: !compatiblePills.visible && printer;
} }
} }
// Extruder info // Extruder info
Row { Row {
id: extrudersInfo; id: extrudersInfo;
anchors { anchors {
left: parent.left; left: parent.left;
right: parent.right; right: parent.right;

View file

@ -4,84 +4,66 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import UM 1.3 as UM import UM 1.3 as UM
Item {
property var camera: null;
Item Rectangle {
{ anchors.fill:parent;
property var camera: null color: UM.Theme.getColor("viewport_overlay");
opacity: 0.5;
Rectangle
{
anchors.fill:parent
color: UM.Theme.getColor("viewport_overlay")
opacity: 0.5
} }
MouseArea MouseArea {
{ anchors.fill: parent;
anchors.fill: parent onClicked: OutputDevice.setActiveCamera(null);
onClicked: OutputDevice.setActiveCamera(null) z: 0;
z: 0
} }
CameraButton CameraButton {
{ id: closeCameraButton;
id: closeCameraButton anchors {
iconSource: UM.Theme.getIcon("cross1")
anchors
{
top: cameraImage.top
topMargin: UM.Theme.getSize("default_margin").height
right: cameraImage.right right: cameraImage.right
rightMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width
top: cameraImage.top
topMargin: UM.Theme.getSize("default_margin").height
} }
z: 999 iconSource: UM.Theme.getIcon("cross1");
z: 999;
} }
Image Image {
{
id: cameraImage id: cameraImage
width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth) anchors.horizontalCenter: parent.horizontalCenter;
height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width) anchors.verticalCenter: parent.verticalCenter;
anchors.horizontalCenter: parent.horizontalCenter height: Math.round((sourceSize.height === 0 ? 600 * screenScaleFactor : sourceSize.height) * width / sourceSize.width);
anchors.verticalCenter: parent.verticalCenter onVisibleChanged: {
z: 1 if (visible) {
onVisibleChanged: if (camera != null) {
{ camera.start();
if(visible)
{
if(camera != null)
{
camera.start()
} }
} else } else {
{ if (camera != null) {
if(camera != null) camera.stop();
{
camera.stop()
} }
} }
} }
source: {
source: if (camera != null && camera.latestImage != null) {
{
if(camera != null && camera.latestImage != null)
{
return camera.latestImage; return camera.latestImage;
} }
return ""; return "";
} }
} width: Math.min(sourceSize.width === 0 ? 800 * screenScaleFactor : sourceSize.width, maximumWidth);
MouseArea
{
anchors.fill: cameraImage
onClicked:
{
OutputDevice.setActiveCamera(null)
}
z: 1 z: 1
} }
MouseArea {
anchors.fill: cameraImage;
onClicked: {
OutputDevice.setActiveCamera(null);
}
z: 1;
}
} }

View file

@ -1,128 +1,126 @@
// Copyright (c) 2018 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 UM 1.2 as UM
import Cura 1.0 as Cura
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import UM 1.2 as UM
import Cura 1.0 as Cura
Item Item {
{ id: base;
id: base property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId;
property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null;
property bool printerConnected: Cura.MachineManager.printerConnected;
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands;
property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5); // AuthState.AuthenticationRequested or AuthenticationReceived.
property string activeQualityDefinitionId: Cura.MachineManager.activeQualityDefinitionId UM.I18nCatalog {
property bool isUM3: activeQualityDefinitionId == "ultimaker3" || activeQualityDefinitionId.match("ultimaker_") != null id: catalog;
property bool printerConnected: Cura.MachineManager.printerConnected name: "cura";
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property bool authenticationRequested: printerConnected && (Cura.MachineManager.printerOutputDevices[0].authenticationState == 2 || Cura.MachineManager.printerOutputDevices[0].authenticationState == 5) // AuthState.AuthenticationRequested or AuthenticationReceived.
Row
{
objectName: "networkPrinterConnectButton"
visible: isUM3
spacing: UM.Theme.getSize("default_margin").width
Button
{
height: UM.Theme.getSize("save_button_save_to_button").height
tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
text: catalog.i18nc("@action:button", "Request Access")
style: UM.Theme.styles.sidebar_action_button
onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
} }
Button Row {
{ objectName: "networkPrinterConnectButton";
height: UM.Theme.getSize("save_button_save_to_button").height spacing: UM.Theme.getSize("default_margin").width;
tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer") visible: isUM3;
text: catalog.i18nc("@action:button", "Connect")
style: UM.Theme.styles.sidebar_action_button Button {
onClicked: connectActionDialog.show() height: UM.Theme.getSize("save_button_save_to_button").height;
visible: !printerConnected onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication();
style: UM.Theme.styles.sidebar_action_button;
text: catalog.i18nc("@action:button", "Request Access");
tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer");
visible: printerConnected && !printerAcceptsCommands && !authenticationRequested;
}
Button {
height: UM.Theme.getSize("save_button_save_to_button").height;
onClicked: connectActionDialog.show();
style: UM.Theme.styles.sidebar_action_button;
text: catalog.i18nc("@action:button", "Connect");
tooltip: catalog.i18nc("@info:tooltip", "Connect to a printer");
visible: !printerConnected;
} }
} }
UM.Dialog UM.Dialog {
{ id: connectActionDialog;
id: connectActionDialog rightButtons: Button {
Loader iconName: "dialog-close";
{ onClicked: connectActionDialog.reject();
anchors.fill: parent text: catalog.i18nc("@action:button", "Close");
source: "DiscoverUM3Action.qml"
} }
rightButtons: Button
{ Loader {
text: catalog.i18nc("@action:button", "Close") anchors.fill: parent;
iconName: "dialog-close" source: "DiscoverUM3Action.qml";
onClicked: connectActionDialog.reject()
} }
} }
Column {
anchors.fill: parent;
objectName: "networkPrinterConnectionInfo";
spacing: UM.Theme.getSize("default_margin").width;
visible: isUM3;
Column Button {
{ onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication();
objectName: "networkPrinterConnectionInfo" text: catalog.i18nc("@action:button", "Request Access");
visible: isUM3 tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer");
spacing: UM.Theme.getSize("default_margin").width visible: printerConnected && !printerAcceptsCommands && !authenticationRequested;
anchors.fill: parent
Button
{
tooltip: catalog.i18nc("@info:tooltip", "Send access request to the printer")
text: catalog.i18nc("@action:button", "Request Access")
onClicked: Cura.MachineManager.printerOutputDevices[0].requestAuthentication()
visible: printerConnected && !printerAcceptsCommands && !authenticationRequested
} }
Row Row {
{ anchors {
visible: printerConnected left: parent.left;
spacing: UM.Theme.getSize("default_margin").width right: parent.right;
}
height: childrenRect.height;
spacing: UM.Theme.getSize("default_margin").width;
visible: printerConnected;
anchors.left: parent.left Column {
anchors.right: parent.right Repeater {
height: childrenRect.height model: Cura.ExtrudersModel {
simpleNames: true;
}
Column Label {
{ text: model.name;
Repeater
{
model: Cura.ExtrudersModel { simpleNames: true }
Label { text: model.name }
}
}
Column
{
Repeater
{
id: nozzleColumn
model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null
Label { text: nozzleColumn.model[index] }
}
}
Column
{
Repeater
{
id: materialColumn
model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null
Label { text: materialColumn.model[index] }
} }
} }
} }
Button Column {
{ Repeater {
tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura") id: nozzleColumn;
text: catalog.i18nc("@action:button", "Activate Configuration") model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].hotendIds : null;
visible: false // printerConnected && !isClusterPrinter()
onClicked: manager.loadConfigurationFromPrinter() Label {
text: nozzleColumn.model[index];
}
} }
} }
UM.I18nCatalog{id: catalog; name:"cura"} Column {
Repeater {
id: materialColumn;
model: printerConnected ? Cura.MachineManager.printerOutputDevices[0].materialNames : null;
Label {
text: materialColumn.model[index];
}
}
}
}
Button {
onClicked: manager.loadConfigurationFromPrinter();
text: catalog.i18nc("@action:button", "Activate Configuration");
tooltip: catalog.i18nc("@info:tooltip", "Load the configuration of the printer into Cura");
visible: false; // printerConnected && !isClusterPrinter()
}
}
} }