mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
1dba5629f7
10 changed files with 234 additions and 237 deletions
|
|
@ -1,8 +1,8 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
|
@ -12,44 +12,26 @@ Menu
|
|||
id: menu
|
||||
title: catalog.i18nc("@action:inmenu", "Visible Settings")
|
||||
|
||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||
property bool showingSearchResults
|
||||
property bool showingAllSettings
|
||||
|
||||
signal showAllSettings()
|
||||
signal showSettingVisibilityProfile()
|
||||
|
||||
MenuItem
|
||||
{
|
||||
text: catalog.i18nc("@action:inmenu", "Custom selection")
|
||||
checkable: true
|
||||
checked: !showingSearchResults && !showingAllSettings && Cura.SettingVisibilityPresetsModel.activePreset == "custom"
|
||||
exclusiveGroup: group
|
||||
onTriggered:
|
||||
{
|
||||
Cura.SettingVisibilityPresetsModel.setActivePreset("custom");
|
||||
// Restore custom set from preference
|
||||
UM.Preferences.setValue("general/visible_settings", UM.Preferences.getValue("cura/custom_visible_settings"));
|
||||
showSettingVisibilityProfile();
|
||||
}
|
||||
}
|
||||
MenuSeparator { }
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.SettingVisibilityPresetsModel
|
||||
model: settingVisibilityPresetsModel
|
||||
|
||||
MenuItem
|
||||
{
|
||||
text: model.name
|
||||
checkable: true
|
||||
checked: model.id == Cura.SettingVisibilityPresetsModel.activePreset
|
||||
checked: model.id == settingVisibilityPresetsModel.activePreset
|
||||
exclusiveGroup: group
|
||||
onTriggered:
|
||||
{
|
||||
Cura.SettingVisibilityPresetsModel.setActivePreset(model.id);
|
||||
|
||||
UM.Preferences.setValue("general/visible_settings", model.settings.join(";"));
|
||||
|
||||
settingVisibilityPresetsModel.setActivePreset(model.id);
|
||||
showSettingVisibilityProfile();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ UM.PreferencesPage
|
|||
{
|
||||
title: catalog.i18nc("@title:tab", "Setting Visibility");
|
||||
|
||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||
|
||||
property int scrollToIndex: 0
|
||||
|
||||
signal scrollToSection( string key )
|
||||
|
|
@ -27,8 +29,7 @@ UM.PreferencesPage
|
|||
|
||||
// After calling this function update Setting visibility preset combobox.
|
||||
// Reset should set default setting preset ("Basic")
|
||||
visibilityPreset.setDefaultPreset()
|
||||
|
||||
visibilityPreset.currentIndex = 1
|
||||
}
|
||||
resetEnabled: true;
|
||||
|
||||
|
|
@ -37,8 +38,6 @@ UM.PreferencesPage
|
|||
id: base;
|
||||
anchors.fill: parent;
|
||||
|
||||
property bool inhibitSwitchToCustom: false
|
||||
|
||||
CheckBox
|
||||
{
|
||||
id: toggleVisibleSettings
|
||||
|
|
@ -112,11 +111,6 @@ UM.PreferencesPage
|
|||
|
||||
ComboBox
|
||||
{
|
||||
function setDefaultPreset()
|
||||
{
|
||||
visibilityPreset.currentIndex = 0
|
||||
}
|
||||
|
||||
id: visibilityPreset
|
||||
width: 150 * screenScaleFactor
|
||||
anchors
|
||||
|
|
@ -125,51 +119,25 @@ UM.PreferencesPage
|
|||
right: parent.right
|
||||
}
|
||||
|
||||
model: ListModel
|
||||
{
|
||||
id: visibilityPresetsModel
|
||||
Component.onCompleted:
|
||||
{
|
||||
visibilityPresetsModel.append({text: catalog.i18nc("@action:inmenu", "Custom selection"), id: "custom"});
|
||||
|
||||
var presets = Cura.SettingVisibilityPresetsModel;
|
||||
for(var i = 0; i < presets.rowCount(); i++)
|
||||
{
|
||||
visibilityPresetsModel.append({text: presets.getItem(i)["name"], id: presets.getItem(i)["id"]});
|
||||
}
|
||||
}
|
||||
}
|
||||
model: settingVisibilityPresetsModel
|
||||
textRole: "name"
|
||||
|
||||
currentIndex:
|
||||
{
|
||||
// Load previously selected preset.
|
||||
var index = Cura.SettingVisibilityPresetsModel.find("id", Cura.SettingVisibilityPresetsModel.activePreset);
|
||||
if(index == -1)
|
||||
var index = settingVisibilityPresetsModel.find("id", settingVisibilityPresetsModel.activePreset)
|
||||
if (index == -1)
|
||||
{
|
||||
return 0;
|
||||
return 0
|
||||
}
|
||||
|
||||
return index + 1; // "Custom selection" entry is added in front, so index is off by 1
|
||||
return index
|
||||
}
|
||||
|
||||
onActivated:
|
||||
{
|
||||
base.inhibitSwitchToCustom = true;
|
||||
var preset_id = visibilityPresetsModel.get(index).id;
|
||||
Cura.SettingVisibilityPresetsModel.setActivePreset(preset_id);
|
||||
|
||||
UM.Preferences.setValue("cura/active_setting_visibility_preset", preset_id);
|
||||
if (preset_id != "custom")
|
||||
{
|
||||
UM.Preferences.setValue("general/visible_settings", Cura.SettingVisibilityPresetsModel.getItem(index - 1).settings.join(";"));
|
||||
// "Custom selection" entry is added in front, so index is off by 1
|
||||
}
|
||||
else
|
||||
{
|
||||
// Restore custom set from preference
|
||||
UM.Preferences.setValue("general/visible_settings", UM.Preferences.getValue("cura/custom_visible_settings"));
|
||||
}
|
||||
base.inhibitSwitchToCustom = false;
|
||||
var preset_id = settingVisibilityPresetsModel.getItem(index).id;
|
||||
settingVisibilityPresetsModel.setActivePreset(preset_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -199,16 +167,7 @@ UM.PreferencesPage
|
|||
exclude: ["machine_settings", "command_line_settings"]
|
||||
showAncestors: true
|
||||
expanded: ["*"]
|
||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler
|
||||
{
|
||||
onVisibilityChanged:
|
||||
{
|
||||
if(Cura.SettingVisibilityPresetsModel.activePreset != "" && !base.inhibitSwitchToCustom)
|
||||
{
|
||||
Cura.SettingVisibilityPresetsModel.setActivePreset("custom");
|
||||
}
|
||||
}
|
||||
}
|
||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
|
||||
}
|
||||
|
||||
delegate: Loader
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ Item
|
|||
{
|
||||
id: base;
|
||||
|
||||
property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
|
||||
property Action configureSettings
|
||||
property bool findingSettings
|
||||
property bool showingAllSettings
|
||||
|
|
@ -562,9 +563,9 @@ Item
|
|||
{
|
||||
definitionsModel.hide(contextMenu.key);
|
||||
// visible settings have changed, so we're no longer showing a preset
|
||||
if (Cura.SettingVisibilityPresetsModel.activePreset != "" && !showingAllSettings)
|
||||
if (settingVisibilityPresetsModel.activePreset != "" && !showingAllSettings)
|
||||
{
|
||||
Cura.SettingVisibilityPresetsModel.setActivePreset("custom");
|
||||
settingVisibilityPresetsModel.setActivePreset("custom");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -594,16 +595,16 @@ Item
|
|||
definitionsModel.show(contextMenu.key);
|
||||
}
|
||||
// visible settings have changed, so we're no longer showing a preset
|
||||
if (Cura.SettingVisibilityPresetsModel.activePreset != "" && !showingAllSettings)
|
||||
if (settingVisibilityPresetsModel.activePreset != "" && !showingAllSettings)
|
||||
{
|
||||
Cura.SettingVisibilityPresetsModel.setActivePreset("custom");
|
||||
settingVisibilityPresetsModel.setActivePreset("custom");
|
||||
}
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
//: Settings context menu action
|
||||
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
|
||||
text: catalog.i18nc("@action:menu", "Configure setting visibility...");
|
||||
|
||||
onTriggered: Cura.Actions.configureSettingVisibility.trigger(contextMenu);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue