diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 4a8a0c6a32..d5af3e939b 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -105,15 +105,6 @@ Rectangle anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0 } - onCurrentModeIndexChanged: - { - UM.Preferences.setValue("cura/active_mode", currentModeIndex); - if(modesListModel.count > base.currentModeIndex) - { - sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "replace": true }); - } - } - Label { id: settingsModeLabel text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified"); diff --git a/resources/qml/Sidebar/PrinterOutput.qml b/resources/qml/Sidebar/PrinterOutput.qml new file mode 100644 index 0000000000..5506944154 --- /dev/null +++ b/resources/qml/Sidebar/PrinterOutput.qml @@ -0,0 +1,65 @@ +// Copyright (c) 2017 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 + +import UM 1.2 as UM +import Cura 1.0 as Cura + +Item +{ + id: printerOutputSection + + UM.I18nCatalog { + id: catalog + name: "cura" + } + + color: UM.Theme.getColor("sidebar") + + // status + property bool isMonitoring: false + + // printer data + property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 + property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null + property int backendState: UM.Backend.state + + // print job data + property variant printDuration: PrintInformation.currentPrintTime + property variant printMaterialLengths: PrintInformation.materialLengths + property variant printMaterialWeights: PrintInformation.materialWeights + property variant printMaterialCosts: PrintInformation.materialCosts + property variant printMaterialNames: PrintInformation.materialNames + + // helper function for padding pretty time + function strPadLeft(string, pad, length) { + return (new Array(length + 1).join(pad) + string).slice(-length); + } + + // convert a timestamp to a human readable pretty time + function getPrettyTime (time) { + var hours = Math.floor(time / 3600) + time -= hours * 3600 + var minutes = Math.floor(time / 60) + time -= minutes * 60 + var seconds = Math.floor(time) + var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2) + return finalTime + } + + // TODO: change name of this component + MonitorButton + { + id: monitorButton + implicitWidth: base.width + anchors.top: footerSeparator.bottom + anchors.topMargin: UM.Theme.getSize("sidebar_margin").height + anchors.bottom: parent.bottom + visible: monitoringPrint + } +} diff --git a/resources/qml/Sidebar/Settings.qml b/resources/qml/Sidebar/Settings.qml new file mode 100644 index 0000000000..e69de29bb2