Browse Source

CURA-4870 Reintroduce the "Check compatibility" link in the sidebar

Diego Prado Gesto 7 years ago
parent
commit
c69987b824
1 changed files with 68 additions and 0 deletions
  1. 68 0
      resources/qml/SidebarHeader.qml

+ 68 - 0
resources/qml/SidebarHeader.qml

@@ -468,6 +468,74 @@ Column
         }
     }
 
+    // Material info row
+    Item
+    {
+        id: materialInfoRow
+        height: Math.round(UM.Theme.getSize("sidebar_setup").height / 2)
+        visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials) && !sidebar.monitoringPrint && !sidebar.hideSettings
+
+        anchors
+        {
+            left: parent.left
+            leftMargin: UM.Theme.getSize("sidebar_margin").width
+            right: parent.right
+            rightMargin: UM.Theme.getSize("sidebar_margin").width
+        }
+
+        Item {
+            height: UM.Theme.getSize("sidebar_setup").height
+            anchors.right: parent.right
+            width: Math.round(parent.width * 0.7 + UM.Theme.getSize("sidebar_margin").width)
+
+            UM.RecolorImage {
+                id: warningImage
+                anchors.right: materialInfoLabel.left
+                anchors.rightMargin: UM.Theme.getSize("default_margin").width
+                anchors.verticalCenter: parent.Bottom
+                source: UM.Theme.getIcon("warning")
+                width: UM.Theme.getSize("section_icon").width
+                height: UM.Theme.getSize("section_icon").height
+                color: UM.Theme.getColor("material_compatibility_warning")
+                visible: !Cura.MachineManager.isCurrentSetupSupported
+            }
+
+            Label {
+                id: materialInfoLabel
+                wrapMode: Text.WordWrap
+                text: "<a href='%1'>" + catalog.i18nc("@label", "Check compatibility") + "</a>"
+                font: UM.Theme.getFont("default")
+                color: UM.Theme.getColor("text")
+                linkColor: UM.Theme.getColor("text_link")
+                verticalAlignment: Text.AlignTop
+                anchors.top: parent.top
+                anchors.right: parent.right
+                anchors.bottom: parent.bottom
+
+                MouseArea {
+                    anchors.fill: parent
+                    hoverEnabled: true
+                    onClicked: {
+                        // open the material URL with web browser
+                        var version = UM.Application.version;
+                        var machineName = Cura.MachineManager.activeMachine.definition.id;
+                        var url = "https://ultimaker.com/materialcompatibility/" + version + "/" + machineName + "?utm_source=cura&utm_medium=software&utm_campaign=resources";
+                        Qt.openUrlExternally(url);
+                    }
+                    onEntered: {
+                        var content = catalog.i18nc("@tooltip", "Click to check the material compatibility on Ultimaker.com.");
+                        base.showTooltip(
+                            materialInfoRow,
+                            Qt.point(-UM.Theme.getSize("sidebar_margin").width, 0),
+                            catalog.i18nc("@tooltip", content)
+                        );
+                    }
+                    onExited: base.hideTooltip();
+                }
+            }
+        }
+    }
+
     UM.SettingPropertyProvider
     {
         id: machineExtruderCount