preferences option to suppress common

This commit is contained in:
David Kocik 2022-02-08 10:28:54 +01:00
parent 5ca4760f2d
commit 25526aa9e1
4 changed files with 22 additions and 2 deletions

View File

@ -67,6 +67,8 @@ void AppConfig::set_defaults()
// If set, the "- default -" selections of print/filament/printer are suppressed, if there is a valid preset available.
if (get("no_defaults").empty())
set("no_defaults", "1");
if (get("no_common").empty())
set("no_common", "0");
if (get("show_incompatible_presets").empty())
set("show_incompatible_presets", "0");

View File

@ -719,7 +719,11 @@ void PageMaterials::reload_presets()
clear();
list_printer->append(_L("(All)"), &EMPTY);
list_printer->append(_L("(Custom)"), &CUSTOM);
const AppConfig* app_config = wxGetApp().app_config;
if (app_config->get("no_common") == "0")
list_printer->append(_L("(Custom)"), &CUSTOM);
//list_printer->SetLabelMarkup("<b>bald</b>");
for (const Preset* printer : materials->printers) {
list_printer->append(printer->name, &printer->name);

View File

@ -187,6 +187,13 @@ void PreferencesDialog::build(size_t selected_tab)
option = Option(def, "no_defaults");
m_optgroup_general->append_single_option_line(option);
def.label = L("Suppress \" Common \" filament presets");
def.type = coBool;
def.tooltip = L("Suppress \" Common \" filament presets in configuration wizard and sidebar visibility.");
def.set_default_value(new ConfigOptionBool{ app_config->get("no_common") == "1" });
option = Option(def, "no_common");
m_optgroup_general->append_single_option_line(option);
def.label = L("Show incompatible print and filament presets");
def.type = coBool;
def.tooltip = L("When checked, the print and filament presets are shown in the preset editor "
@ -569,6 +576,8 @@ void PreferencesDialog::accept(wxEvent&)
{
// if (m_values.find("no_defaults") != m_values.end()
// warning_catcher(this, wxString::Format(_L("You need to restart %s to make the changes effective."), SLIC3R_APP_NAME));
bool update_filament_sidebar = (m_values.find("no_common") != m_values.end());
std::vector<std::string> options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled" };
@ -653,6 +662,9 @@ void PreferencesDialog::accept(wxEvent&)
else
// Nothify the UI to update itself from the ini file.
wxGetApp().update_ui_from_settings();
if (update_filament_sidebar)
wxGetApp().plater()->sidebar().update_presets(Preset::Type::TYPE_FILAMENT);
}
void PreferencesDialog::on_dpi_changed(const wxRect &suggested_rect)

View File

@ -857,7 +857,9 @@ void PlaterPresetComboBox::update()
if (i + 1 == m_collection->num_default_presets())
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
}
if (!common_presets.empty())
const AppConfig* app_config = wxGetApp().app_config;
if (!common_presets.empty() && app_config->get("no_common") == "0")
{
set_label_marker(Append(separator(L("Common presets")), wxNullBitmap));
for (std::map<wxString, wxBitmap*>::iterator it = common_presets.begin(); it != common_presets.end(); ++it) {