Add notification icon to the installed tab of the toolbox

CURA-6151
This commit is contained in:
Jaime van Kessel 2019-03-28 13:31:51 +01:00
parent 6c26dd38ec
commit ffd7a001fb
3 changed files with 37 additions and 2 deletions

View file

@ -50,6 +50,7 @@ Item
} }
} }
} }
ToolboxTabButton ToolboxTabButton
{ {
id: installedTabButton id: installedTabButton
@ -62,7 +63,43 @@ Item
rightMargin: UM.Theme.getSize("default_margin").width rightMargin: UM.Theme.getSize("default_margin").width
} }
onClicked: toolbox.viewCategory = "installed" onClicked: toolbox.viewCategory = "installed"
width: UM.Theme.getSize("toolbox_header_tab").width + marketplaceNotificationIcon.width - UM.Theme.getSize("default_margin").width
} }
Rectangle
{
id: marketplaceNotificationIcon
color: UM.Theme.getColor("notification_icon")
width: installedTabButton.height / 3
height: width
radius: 0.5 * width
visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
anchors.right: installedTabButton.right
anchors.verticalCenter: installedTabButton.verticalCenter
Label
{
id: marketplaceNotificationText
anchors.centerIn: parent
anchors.fill: parent
text:
{
if(CuraApplication.getPackageManager().packagesWithUpdate.length > 9)
{
return "9+" // More than 2 characters don't fit.
}
return CuraApplication.getPackageManager().packagesWithUpdate.length
}
color: UM.Theme.getColor("primary_text")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font: UM.Theme.getFont("small")
}
}
ToolboxShadow ToolboxShadow
{ {
anchors.top: bar.bottom anchors.top: bar.bottom

View file

@ -214,7 +214,6 @@
"toolbox_header_button_text_active": [255, 255, 255, 255], "toolbox_header_button_text_active": [255, 255, 255, 255],
"toolbox_header_button_text_inactive": [128, 128, 128, 255], "toolbox_header_button_text_inactive": [128, 128, 128, 255],
"toolbox_header_button_text_hovered": [255, 255, 255, 255],
"monitor_printer_family_tag": [86, 86, 106, 255], "monitor_printer_family_tag": [86, 86, 106, 255],
"monitor_text_primary": [229, 229, 229, 255], "monitor_text_primary": [229, 229, 229, 255],

View file

@ -386,7 +386,6 @@
"toolbox_header_button_text_active": [0, 0, 0, 255], "toolbox_header_button_text_active": [0, 0, 0, 255],
"toolbox_header_button_text_inactive": [0, 0, 0, 255], "toolbox_header_button_text_inactive": [0, 0, 0, 255],
"toolbox_header_button_text_hovered": [0, 0, 0, 255],
"favorites_header_bar": [245, 245, 245, 255], "favorites_header_bar": [245, 245, 245, 255],
"favorites_header_hover": [245, 245, 245, 255], "favorites_header_hover": [245, 245, 245, 255],