Просмотр исходного кода

Move Job Specs into viewport area

fieldOfView 9 лет назад
Родитель
Сommit
d41db89254

+ 11 - 0
resources/qml/Cura.qml

@@ -310,6 +310,17 @@ UM.MainWindow
                 }
             }
 
+            JobSpecs
+            {
+                anchors
+                {
+                    bottom: parent.bottom;
+                    right: sidebar.left;
+                    bottomMargin: UM.Theme.sizes.default_margin.height;
+                    rightMargin: UM.Theme.sizes.default_margin.width;
+                }
+            }
+
             UM.MessageStack
             {
                 anchors

+ 169 - 0
resources/qml/JobSpecs.qml

@@ -0,0 +1,169 @@
+// Copyright (c) 2015 Ultimaker B.V.
+// Cura is released under the terms of the AGPLv3 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.1 as UM
+
+Rectangle {
+    id: base;
+
+    property real progress: UM.Backend.progress;
+    property bool activity: Printer.getPlatformActivity;
+    Behavior on progress { NumberAnimation { duration: 250; } }
+    property int totalHeight: childrenRect.height + UM.Theme.sizes.default_margin.height*1.5
+    property string fileBaseName
+    property variant activeMachineInstance: UM.MachineManager.activeMachineInstance
+
+    onActiveMachineInstanceChanged:
+    {
+        base.createFileName()
+    }
+
+    UM.I18nCatalog { id: catalog; name:"cura"}
+
+    property variant printDuration: PrintInformation.currentPrintTime;
+    property real printMaterialAmount: PrintInformation.materialAmount;
+
+    width: 240
+    height: 50
+    color: "transparent"
+
+    function createFileName(){
+        var splitMachineName = UM.MachineManager.activeMachineInstance.split(" ")
+        var abbrMachine = ''
+            for (var i = 0; i < splitMachineName.length; i++){
+                if (splitMachineName[i].search(/ultimaker/i) != -1){
+                    abbrMachine += 'UM'
+                }
+                else{
+                    if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
+                        abbrMachine += splitMachineName[i].charAt(0)
+                }
+                var regExpAdditives = /[0-9\+]/g;
+                var resultAdditives = splitMachineName[i].match(regExpAdditives);
+                if (resultAdditives != null){
+                    for (var j = 0; j < resultAdditives.length; j++){
+                        abbrMachine += resultAdditives[j]
+
+                    }
+                }
+            }
+        printJobTextfield.text = abbrMachine + '_' + base.fileBaseName
+    }
+
+     Connections {
+        target: openDialog
+        onHasMesh: {
+            if(base.fileBaseName == ''){
+                base.fileBaseName = name
+                base.createFileName()
+            }
+        }
+    }
+
+    onActivityChanged: {
+        if (activity == false){
+            base.fileBaseName = ''
+            base.createFileName()
+        }
+    }
+
+
+    TextField {
+        id: printJobTextfield
+        anchors.right: parent.right
+        anchors.rightMargin: UM.Theme.sizes.default_margin.width;
+        height: UM.Theme.sizes.sidebar_inputFields.height
+        width: base.width
+        property int unremovableSpacing: 5
+        text: ''
+        horizontalAlignment: TextInput.AlignRight
+        onTextChanged: Printer.setJobName(text)
+        onEditingFinished: {
+            if (printJobTextfield.text != ''){
+                printJobTextfield.focus = false
+            }
+        }
+        validator: RegExpValidator {
+            regExp: /^[^\\ \/ \.]*$/
+        }
+        style: TextFieldStyle{
+            textColor: UM.Theme.colors.setting_control_text;
+            font: UM.Theme.fonts.default;
+            background: Rectangle {
+                opacity: 0
+                border.width: 0
+            }
+        }
+    }
+
+    Rectangle {
+        id: specsRow
+        implicitWidth: base.width
+        implicitHeight: UM.Theme.sizes.sidebar_specs_bar.height
+        anchors.top: printJobTextfield.bottom
+        color: "transparent"
+        visible: base.progress > 0.99 && base.activity == true
+        Item{
+            id: time
+            width: childrenRect.width;
+            height: parent.height
+            anchors.left: parent.left
+            anchors.leftMargin: UM.Theme.sizes.default_margin.width
+            anchors.top: parent.top
+            visible: base.printMaterialAmount > 0 ? true : false
+            UM.RecolorImage {
+                id: timeIcon
+                anchors.verticalCenter: parent.verticalCenter
+                anchors.left: parent.left
+                width: UM.Theme.sizes.save_button_specs_icons.width
+                height: UM.Theme.sizes.save_button_specs_icons.height
+                sourceSize.width: width
+                sourceSize.height: width
+                color: UM.Theme.colors.text_hover
+                source: UM.Theme.icons.print_time;
+            }
+            Label{
+                id: timeSpec
+                anchors.verticalCenter: parent.verticalCenter
+                anchors.left: timeIcon.right
+                anchors.leftMargin: UM.Theme.sizes.default_margin.width/2
+                font: UM.Theme.fonts.default
+                color: UM.Theme.colors.text
+                text: (!base.printDuration || !base.printDuration.valid) ? "" : base.printDuration.getDisplayString(UM.DurationFormat.Short)
+            }
+        }
+        Item{
+            width: parent.width / 100 * 55
+            height: parent.height
+            anchors.left: time.right
+            anchors.leftMargin: UM.Theme.sizes.default_margin.width;
+            anchors.top: parent.top
+            visible: base.printMaterialAmount > 0 ? true : false
+            UM.RecolorImage {
+                id: lengthIcon
+                anchors.verticalCenter: parent.verticalCenter
+                anchors.left: parent.left
+                width: UM.Theme.sizes.save_button_specs_icons.width
+                height: UM.Theme.sizes.save_button_specs_icons.height
+                sourceSize.width: width
+                sourceSize.height: width
+                color: UM.Theme.colors.text_hover
+                source: UM.Theme.icons.category_material;
+            }
+            Label{
+                id: lengthSpec
+                anchors.verticalCenter: parent.verticalCenter
+                anchors.left: lengthIcon.right
+                anchors.leftMargin: UM.Theme.sizes.default_margin.width/2
+                font: UM.Theme.fonts.default
+                color: UM.Theme.colors.text
+                text: base.printMaterialAmount <= 0 ? "" : catalog.i18nc("@label %1 is length of filament","%1 m").arg(base.printMaterialAmount)
+            }
+        }
+    }
+}

+ 1 - 162
resources/qml/SaveButton.qml

@@ -16,170 +16,9 @@ Rectangle {
     Behavior on progress { NumberAnimation { duration: 250; } }
     property int totalHeight: childrenRect.height + UM.Theme.sizes.default_margin.height*1.5
     property string fileBaseName
-    property variant activeMachineInstance: UM.MachineManager.activeMachineInstance
-
-    onActiveMachineInstanceChanged:
-    {
-        base.createFileName()
-    }
 
     UM.I18nCatalog { id: catalog; name:"cura"}
 
-    property variant printDuration: PrintInformation.currentPrintTime;
-    property real printMaterialAmount: PrintInformation.materialAmount;
-
-    function createFileName(){
-        var splitMachineName = UM.MachineManager.activeMachineInstance.split(" ")
-        var abbrMachine = ''
-            for (var i = 0; i < splitMachineName.length; i++){
-                if (splitMachineName[i].search(/ultimaker/i) != -1){
-                    abbrMachine += 'UM'
-                }
-                else{
-                    if (splitMachineName[i].charAt(0).search(/[0-9]/g) == -1)
-                        abbrMachine += splitMachineName[i].charAt(0)
-                }
-                var regExpAdditives = /[0-9\+]/g;
-                var resultAdditives = splitMachineName[i].match(regExpAdditives);
-                if (resultAdditives != null){
-                    for (var j = 0; j < resultAdditives.length; j++){
-                        abbrMachine += resultAdditives[j]
-
-                    }
-                }
-            }
-        //printJobTextfield.text = abbrMachine + '_' + base.fileBaseName
-    }
-
-     Connections {
-        target: openDialog
-        onHasMesh: {
-            if(base.fileBaseName == ''){
-                base.fileBaseName = name
-                base.createFileName()
-            }
-        }
-    }
-
-    onActivityChanged: {
-        if (activity == false){
-            base.fileBaseName = ''
-            base.createFileName()
-        }
-    }
-/*
-    Rectangle{
-        id: printJobRow
-        implicitWidth: base.width;
-        implicitHeight: UM.Theme.sizes.save_button_header.height
-        anchors.top: parent.top
-        color: UM.Theme.colors.sidebar_header_bar
-        Label{
-            id: printJobTextfieldLabel
-            text: catalog.i18nc("@label:textbox", "Printjob Name");
-            anchors.left: parent.left
-            anchors.leftMargin: UM.Theme.sizes.default_margin.width;
-            anchors.verticalCenter: parent.verticalCenter
-            font: UM.Theme.fonts.default;
-            color: UM.Theme.colors.text_white
-        }
-        TextField {
-            id: printJobTextfield
-            anchors.right: parent.right
-            anchors.rightMargin: UM.Theme.sizes.default_margin.width;
-            anchors.verticalCenter: parent.verticalCenter
-            width: parent.width/100*55
-            height: UM.Theme.sizes.sidebar_inputFields.height
-            property int unremovableSpacing: 5
-            text: ''
-            onTextChanged: Printer.setJobName(text)
-            onEditingFinished: {
-                if (printJobTextfield.text != ''){
-                    printJobTextfield.focus = false
-                }
-            }
-            validator: RegExpValidator {
-                regExp: /^[^\\ \/ \.]*$/
-            }
-            style: TextFieldStyle{
-                textColor: UM.Theme.colors.setting_control_text;
-                font: UM.Theme.fonts.default;
-                background: Rectangle {
-                    radius: 0
-                    implicitWidth: parent.width
-                    implicitHeight: parent.height
-                    border.width: 1;
-                    border.color: UM.Theme.colors.slider_groove_border;
-                }
-            }
-        }
-    }
-
-    Rectangle {
-        id: specsRow
-        implicitWidth: base.width
-        implicitHeight: UM.Theme.sizes.sidebar_specs_bar.height
-        anchors.top: printJobRow.bottom
-        visible: base.progress > 0.99 && base.activity == true
-        Item{
-            id: time
-            width: childrenRect.width;
-            height: parent.height
-            anchors.left: parent.left
-            anchors.leftMargin: UM.Theme.sizes.default_margin.width
-            anchors.top: parent.top
-            visible: base.printMaterialAmount > 0 ? true : false
-            UM.RecolorImage {
-                id: timeIcon
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.left: parent.left
-                width: UM.Theme.sizes.save_button_specs_icons.width
-                height: UM.Theme.sizes.save_button_specs_icons.height
-                sourceSize.width: width
-                sourceSize.height: width
-                color: UM.Theme.colors.text_hover
-                source: UM.Theme.icons.print_time;
-            }
-            Label{
-                id: timeSpec
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.left: timeIcon.right
-                anchors.leftMargin: UM.Theme.sizes.default_margin.width/2
-                font: UM.Theme.fonts.default
-                color: UM.Theme.colors.text
-                text: (!base.printDuration || !base.printDuration.valid) ? "" : base.printDuration.getDisplayString(UM.DurationFormat.Short)
-            }
-        }
-        Item{
-            width: parent.width / 100 * 55
-            height: parent.height
-            anchors.left: time.right
-            anchors.leftMargin: UM.Theme.sizes.default_margin.width;
-            anchors.top: parent.top
-            visible: base.printMaterialAmount > 0 ? true : false
-            UM.RecolorImage {
-                id: lengthIcon
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.left: parent.left
-                width: UM.Theme.sizes.save_button_specs_icons.width
-                height: UM.Theme.sizes.save_button_specs_icons.height
-                sourceSize.width: width
-                sourceSize.height: width
-                color: UM.Theme.colors.text_hover
-                source: UM.Theme.icons.category_material;
-            }
-            Label{
-                id: lengthSpec
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.left: lengthIcon.right
-                anchors.leftMargin: UM.Theme.sizes.default_margin.width/2
-                font: UM.Theme.fonts.default
-                color: UM.Theme.colors.text
-                text: base.printMaterialAmount <= 0 ? "" : catalog.i18nc("@label %1 is length of filament","%1 m").arg(base.printMaterialAmount)
-            }
-        }
-    }
-*/
     Rectangle{
         id: saveRow
         width: base.width
@@ -225,7 +64,7 @@ Rectangle {
                         color: !control.enabled ? UM.Theme.colors.action_button_disabled_text : 
                                    control.pressed ? UM.Theme.colors.action_button_active_text :
                                    control.hovered ? UM.Theme.colors.action_button_hovered_text : UM.Theme.colors.action_button_text
-                        font: UM.Theme.fonts.default
+                        font: UM.Theme.fonts.action_button
                         text: control.text;
                     }
                 }

+ 1 - 1
resources/qml/SidebarSimple.qml

@@ -45,7 +45,7 @@ Item
             text: infillModel.count > 0 && infillListView.activeIndex != -1 ? infillModel.get(infillListView.activeIndex).text : ""
             font: UM.Theme.fonts.caption
             wrapMode: Text.Wrap
-            color: UM.Theme.colors.text
+            color: UM.Theme.colors.text_subtext
             anchors.top: infillLabel.bottom
             anchors.left: parent.left
             anchors.leftMargin: UM.Theme.sizes.default_margin.width

+ 7 - 2
resources/themes/cura/theme.json

@@ -23,8 +23,7 @@
             "family": "Proxima Nova Rg"
         },
         "caption": {
-            "size": 0.75,
-            "italic": true,
+            "size": 1.0,
             "family": "Proxima Nova Rg"
         },
         "sidebar_header": {
@@ -46,6 +45,11 @@
         "setting_category": {
             "size": 1.0,
             "family": "Proxima Nova Rg"
+        },
+        "action_button": {
+            "size": 1.15,
+            "bold": true,
+            "family": "Proxima Nova Rg"
         }
     },
 
@@ -65,6 +69,7 @@
         "text_white": [255, 255, 255, 255],
         "text_hover": [35, 35, 35, 255],
         "text_pressed": [12, 169, 227, 255],
+        "text_subtext": [127, 127, 127, 255],
 
         "error": [255, 140, 0, 255],
         "sidebar_header_bar": [24, 41, 77, 255],