Add "Update Current Profile" and "Reset Current Profile" menu items to profile dropdowns

CURA-970
This commit is contained in:
fieldOfView 2016-04-28 10:29:51 +02:00
parent d7aa8e71bf
commit f6ce963b73
4 changed files with 42 additions and 6 deletions

View File

@ -32,6 +32,8 @@ Item
property alias addMachine: addMachineAction;
property alias configureMachines: settingsAction;
property alias addProfile: addProfileAction;
property alias updateProfile: updateProfileAction;
property alias resetProfile: resetProfileAction;
property alias manageProfiles: manageProfilesAction;
property alias preferences: preferencesAction;
@ -96,11 +98,25 @@ Item
iconName: "configure";
}
Action
{
id: updateProfileAction;
enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Update Current Profile");
}
Action
{
id: resetProfileAction;
enabled: UM.ActiveProfile.valid && !UM.ActiveProfile.readOnly && UM.ActiveProfile.hasCustomisedValues
text: catalog.i18nc("@action:inmenu menubar:profile","&Reset Current Profile");
}
Action
{
id: addProfileAction;
enabled: UM.ActiveProfile.valid
text: catalog.i18nc("@action:inmenu menubar:profile","&Add Profile...");
text: catalog.i18nc("@action:inmenu menubar:profile","&Create New Profile...");
}
Action

View File

@ -229,7 +229,7 @@ UM.MainWindow
//Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
profileMenu.addSeparator();
profileMenu.insertSeparator(index);
separatorIndex = index;
}
}
@ -277,7 +277,10 @@ UM.MainWindow
MenuSeparator { id: profileMenuSeparator }
MenuItem { action: actions.updateProfile; }
MenuItem { action: actions.resetProfile; }
MenuItem { action: actions.addProfile; }
MenuSeparator { }
MenuItem { action: actions.manageProfiles; }
}
@ -513,6 +516,8 @@ UM.MainWindow
addMachineAction: actions.addMachine;
configureMachinesAction: actions.configureMachines;
addProfileAction: actions.addProfile;
updateProfileAction: actions.updateProfile;
resetProfileAction: actions.resetProfile;
manageProfilesAction: actions.manageProfiles;
configureSettingsAction: Action
@ -623,6 +628,8 @@ UM.MainWindow
addMachine.onTriggered: addMachineWizard.visible = true;
addProfile.onTriggered: { UM.MachineManager.createProfile(); preferences.visible = true; preferences.setPage(4); }
updateProfile.onTriggered: { UM.ActiveProfile.updateProfile() }
resetProfile.onTriggered: { UM.ActiveProfile.discardChanges() }
preferences.onTriggered: { preferences.visible = true; }
configureMachines.onTriggered: { preferences.visible = true; preferences.setPage(3); }

View File

@ -14,6 +14,8 @@ Item{
property int totalHeightProfileSetup: childrenRect.height
property Action manageProfilesAction
property Action addProfileAction
property Action updateProfileAction
property Action resetProfileAction
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
@ -67,7 +69,7 @@ Item{
//Insert a separator between readonly and custom profiles
if(separatorIndex < 0 && index > 0) {
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
profileSelectionMenu.addSeparator();
profileSelectionMenu.insertSeparator(index);
separatorIndex = index;
}
}
@ -113,9 +115,16 @@ Item{
}
MenuSeparator { }
MenuItem {
action: base.updateProfileAction;
}
MenuItem {
action: base.resetProfileAction;
}
MenuItem {
action: base.addProfileAction;
}
MenuSeparator { }
MenuItem {
action: base.manageProfilesAction;
}

View File

@ -15,6 +15,8 @@ Rectangle
property Action addMachineAction;
property Action configureMachinesAction;
property Action addProfileAction;
property Action updateProfileAction;
property Action resetProfileAction;
property Action manageProfilesAction;
property Action configureSettingsAction;
property int currentModeIndex;
@ -66,6 +68,8 @@ Rectangle
ProfileSetup {
id: profileItem
addProfileAction: base.addProfileAction
updateProfileAction: base.updateProfileAction
resetProfileAction: base.resetProfileAction
manageProfilesAction: base.manageProfilesAction
anchors.top: settingsModeSelection.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height