Fix Profile (application-)menu and add separators to profiles dropdown

CURA-1585
This commit is contained in:
fieldOfView 2016-06-06 17:10:56 +02:00
parent 03914674c7
commit a2def606c6
2 changed files with 30 additions and 31 deletions

View file

@ -88,13 +88,13 @@ Item{
{
//Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
if(model.getItem(index-1).metadata.read_only != model.getItem(index).metadata.read_only) {
profileSelectionMenu.insertSeparator(index);
separatorIndex = index;
}
}
//Because of the separator, custom profiles move one index lower
profileSelectionMenu.insertItem((model.getItem(index).readOnly) ? index : index + 1, object.item);
profileSelectionMenu.insertItem((model.getItem(index).metadata.read_only) ? index : index + 1, object.item);
}
onObjectRemoved:
{
@ -117,20 +117,10 @@ Item{
{
id: item
text: model_data ? model_data.name : ""
checkable: true;
checkable: true
checked: Cura.MachineManager.activeQualityId == model_data.id
exclusiveGroup: profileSelectionMenuGroup;
onTriggered:
{
Cura.MachineManager.setActiveQuality(model_data.id);
/*if (!model_data.active) {
//Selecting a profile was canceled; undo menu selection
profileSelectionInstantiator.model.setProperty(model_index, "active", false);
var activeProfileName = UM.MachineManager.activeProfile;
var activeProfileIndex = profileSelectionInstantiator.model.find("name", activeProfileName);
profileSelectionInstantiator.model.setProperty(activeProfileIndex, "active", true);
}*/
}
onTriggered: Cura.MachineManager.setActiveQuality(model_data.id)
}
}