Merge branch 'cura4.0_header' into cura4.0_action_panel

This commit is contained in:
Diego Prado Gesto 2018-11-06 09:23:39 +01:00
commit 257d482184
14 changed files with 119 additions and 174 deletions

View file

@ -11,6 +11,7 @@ Column
{
property var profile: null
property var loggedIn: false
property var profileImage: ""
padding: 2 * UM.Theme.getSize("default_margin").height
spacing: 2 * UM.Theme.getSize("default_margin").height
@ -21,7 +22,18 @@ Column
width: UM.Theme.getSize("avatar_image").width
height: UM.Theme.getSize("avatar_image").height
anchors.horizontalCenter: parent.horizontalCenter
source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user")
source:
{
if(loggedIn)
{
if(profileImage)
{
return profileImage
}
return UM.Theme.getImage("avatar_no_user")
}
return UM.Theme.getImage("avatar_no_user")
}
outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
}

View file

@ -25,7 +25,18 @@ Button
anchors.verticalCenter: accountWidget.verticalCenter
anchors.horizontalCenter: accountWidget.horizontalCenter
source: loggedIn ? profile["profile_image_url"] : UM.Theme.getImage("avatar_no_user")
source:
{
if(loggedIn)
{
if(profile["profile_image_url"])
{
return profile["profile_image_url"]
}
return UM.Theme.getImage("avatar_no_user")
}
return UM.Theme.getImage("avatar_no_user")
}
outlineColor: loggedIn ? UM.Theme.getColor("account_widget_outline_active") : UM.Theme.getColor("lining")
}
@ -45,6 +56,7 @@ Button
id: panel
profile: Cura.API.account.userProfile
loggedIn: Cura.API.account.isLoggedIn
profileImage: Cura.API.account.profileImageUrl
}
background: UM.PointingRectangle

View file

@ -24,6 +24,7 @@ Item
source: UM.Theme.getImage("avatar_default")
fillMode: Image.PreserveAspectCrop
visible: false
mipmap: true
}
Rectangle
@ -44,7 +45,10 @@ Item
UM.RecolorImage
{
id: profileImageOutline
anchors.fill: parent
anchors.centerIn: parent
// Make it a bit bigger than it has to, otherwise it sometimes shows a white border.
width: parent.width + 2
height: parent.height + 2
source: UM.Theme.getIcon("circle_outline")
sourceSize: Qt.size(parent.width, parent.height)
color: UM.Theme.getColor("account_widget_ouline_active")

View file

@ -25,7 +25,8 @@ UM.Dialog
width: minimumWidth
height: minimumHeight
flags: {
flags:
{
var window_flags = Qt.Dialog | Qt.CustomizeWindowHint | Qt.WindowTitleHint;
if (Cura.MachineManager.activeDefinitionId !== "") //Disallow closing the window if we have no active printer yet. You MUST add a printer.
{
@ -48,22 +49,28 @@ UM.Dialog
function getMachineName()
{
return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : "";
if (machineList.model.getItem(machineList.currentIndex) != undefined)
{
return machineList.model.getItem(machineList.currentIndex).name;
}
return "";
}
function getMachineMetaDataEntry(key)
{
var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined;
if (metadata)
if (machineList.model.getItem(machineList.currentIndex) != undefined)
{
return metadata[key];
return machineList.model.getItem(machineList.currentIndex).metadata[key];
}
return undefined;
return "";
}
Label {
Label
{
id: titleLabel
anchors {
anchors
{
top: parent.top
left: parent.left
topMargin: UM.Theme.getSize("default_margin")
@ -102,7 +109,8 @@ UM.Dialog
width: Math.round(parent.width * 0.45)
frameVisible: true;
Rectangle {
Rectangle
{
parent: viewport
anchors.fill: parent
color: palette.light
@ -159,11 +167,14 @@ UM.Dialog
onClicked:
{
base.activeCategory = section;
if (machineList.model.getItem(machineList.currentIndex).section != section) {
if (machineList.model.getItem(machineList.currentIndex).section != section)
{
// Find the first machine from this section
for(var i = 0; i < machineList.model.rowCount(); i++) {
for(var i = 0; i < machineList.model.rowCount(); i++)
{
var item = machineList.model.getItem(i);
if (item.section == section) {
if (item.section == section)
{
machineList.currentIndex = i;
break;
}

View file

@ -106,10 +106,10 @@ Rectangle
model: modesListModel
width: Math.round(parent.width * 0.55)
height: UM.Theme.getSize("print_setup_mode_toggle").height
visible: !hideSettings
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
anchors.top: settingsModeLabel.top
ButtonGroup
@ -191,6 +191,8 @@ Rectangle
anchors.right: parent.right
height: UM.Theme.getSize("print_setup_widget").height
visible: !hideSettings
// We load both of them at once (instead of using a loader) because the advanced sidebar can take
// quite some time to load. So in this case we sacrifice memory for speed.
SidebarAdvanced