Browse Source

Merge pull request #6537 from Ultimaker/CURA-6862_truncate_profile_names

CURA-6862_truncate_profile_names
Remco Burema 5 years ago
parent
commit
9963c81294

+ 1 - 0
resources/qml/IconWithText.qml

@@ -19,6 +19,7 @@ Item
     property alias color: label.color
     property alias text: label.text
     property alias font: label.font
+    property alias elide: label.elide
     property real margin: UM.Theme.getSize("narrow_margin").width
 
     // These properties can be used in combination with layouts.

+ 2 - 0
resources/qml/Preferences/Materials/MaterialsDetailsPanel.qml

@@ -64,8 +64,10 @@ Item
             height: childrenRect.height
 
             Label {
+                width: parent.width
                 text: materialProperties.name
                 font: UM.Theme.getFont("large_bold")
+                elide: Text.ElideRight
             }
         }
 

+ 55 - 47
resources/qml/PrintSetupSelector/Custom/CustomPrintSetup.qml

@@ -4,6 +4,7 @@
 import QtQuick 2.10
 import QtQuick.Controls 2.3
 import QtQuick.Controls 1.4 as OldControls
+import QtQuick.Layouts 1.3
 
 import UM 1.3 as UM
 import Cura 1.6 as Cura
@@ -66,7 +67,6 @@ Item
         {
             id: intentSelection
             onClicked: menu.opened ? menu.close() : menu.open()
-            text: generateActiveQualityText()
 
             anchors.right: parent.right
             width: UM.Theme.getSize("print_setup_big_item").width
@@ -75,67 +75,76 @@ Item
 
             baselineOffset: null // If we don't do this, there is a binding loop. WHich is a bit weird, since we override the contentItem anyway...
 
-            contentItem: Label
+            contentItem: RowLayout
             {
-                id: textLabel
-                text: intentSelection.text
-                font: UM.Theme.getFont("default")
-                color: UM.Theme.getColor("text")
+                spacing: 0
                 anchors.left: parent.left
+                anchors.right: customisedSettings.left
                 anchors.leftMargin: UM.Theme.getSize("default_margin").width
-                anchors.verticalCenter: intentSelection.verticalCenter
-                height: contentHeight
-                verticalAlignment: Text.AlignVCenter
-                renderType: Text.NativeRendering
-            }
-
-            background: Rectangle
-            {
-                id: backgroundItem
-                border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
-                border.width: UM.Theme.getSize("default_lining").width
-                radius: UM.Theme.getSize("default_radius").width
-                color: UM.Theme.getColor("main_background")
-            }
 
-            function generateActiveQualityText()
-            {
-                var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
-                var resultMain = resultMap["main"]
-                var resultSuffix = resultMap["suffix"]
-                var result = ""
-
-                if (Cura.MachineManager.isActiveQualityExperimental)
+                Label
                 {
-                    resultSuffix += " (Experimental)"
+                    id: textLabel
+                    text: Cura.MachineManager.activeQualityDisplayNameMap["main"]
+                    font: UM.Theme.getFont("default")
+                    color: UM.Theme.getColor("text")
+                    Layout.margins: 0
+                    Layout.maximumWidth: Math.floor(parent.width * 0.7)  // Always leave >= 30% for the rest of the row.
+                    height: contentHeight
+                    verticalAlignment: Text.AlignVCenter
+                    renderType: Text.NativeRendering
+                    elide: Text.ElideRight
                 }
 
-                if (Cura.MachineManager.isActiveQualityCustom)
+                Label
                 {
-                    result = resultMain
-                }
-
-                if (Cura.MachineManager.isActiveQualitySupported)
-                {
-                    if (Cura.MachineManager.activeQualityLayerHeight > 0)
+                    text: activeQualityDetailText()
+                    font: UM.Theme.getFont("default")
+                    color: UM.Theme.getColor("text_detail")
+                    Layout.margins: 0
+                    Layout.fillWidth: true
+
+                    height: contentHeight
+                    verticalAlignment: Text.AlignVCenter
+                    renderType: Text.NativeRendering
+                    elide: Text.ElideRight
+
+                    function activeQualityDetailText()
                     {
-                        result = resultMain
-                        if (resultSuffix)
+                        var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
+                        var resultSuffix = resultMap["suffix"]
+                        var result = ""
+
+                        if (Cura.MachineManager.isActiveQualityExperimental)
                         {
-                            result += " - "
+                            resultSuffix += " (Experimental)"
                         }
-                        result += "<font color=\"" + UM.Theme.getColor("text_detail") + "\">"
-                        if (resultSuffix)
+
+                        if (Cura.MachineManager.isActiveQualitySupported)
                         {
-                            result +=  resultSuffix
+                            if (Cura.MachineManager.activeQualityLayerHeight > 0)
+                            {
+                                if (resultSuffix)
+                                {
+                                    result += " - " + resultSuffix
+                                }
+                                result += " - "
+                                result += Cura.MachineManager.activeQualityLayerHeight + "mm"
+                            }
                         }
-                        result += " - "
-                        result += Cura.MachineManager.activeQualityLayerHeight + "mm"
-                        result += "</font>"
+
+                        return result
                     }
                 }
+            }
 
-                return result
+            background: Rectangle
+            {
+                id: backgroundItem
+                border.color: intentSelection.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
+                border.width: UM.Theme.getSize("default_lining").width
+                radius: UM.Theme.getSize("default_radius").width
+                color: UM.Theme.getColor("main_background")
             }
 
             UM.SimpleButton
@@ -169,7 +178,6 @@ Item
             {
                 id: downArrow
 
-
                 source: UM.Theme.getIcon("arrow_bottom")
                 width: UM.Theme.getSize("standard_arrow").width
                 height: UM.Theme.getSize("standard_arrow").height

+ 1 - 0
resources/qml/PrintSetupSelector/PrintSetupSelectorHeader.qml

@@ -37,6 +37,7 @@ RowLayout
             return ""
         }
         font: UM.Theme.getFont("medium")
+        elide: Text.ElideMiddle
 
         UM.SettingPropertyProvider
         {