UnsavedChangesDialog : improvements
* Added "Remember my choice" checkbox * Center on the screen and set position in respect to the position of mainframe or settings dialog Preferences : Added checkboxes for enable/suppress showing of the UnsavedChangeDialog SearchImGui : close after parameter selection_is_changed_according_to_physical_printers PhysicalPrinterDialog, SavePresetDialog : Center on the screen
This commit is contained in:
parent
650bbb3484
commit
00a7799341
12 changed files with 171 additions and 58 deletions
src/slic3r/GUI
|
@ -24,7 +24,10 @@ void PreferencesDialog::build()
|
|||
m_optgroup_general = std::make_shared<ConfigOptionsGroup>(this, _L("General"));
|
||||
m_optgroup_general->label_width = 40;
|
||||
m_optgroup_general->m_on_change = [this](t_config_option_key opt_key, boost::any value) {
|
||||
m_values[opt_key] = boost::any_cast<bool>(value) ? "1" : "0";
|
||||
if (opt_key == "default_action_on_close_application" || opt_key == "default_action_on_select_preset")
|
||||
m_values[opt_key] = boost::any_cast<bool>(value) ? "none" : "discard";
|
||||
else
|
||||
m_values[opt_key] = boost::any_cast<bool>(value) ? "1" : "0";
|
||||
};
|
||||
|
||||
// TODO
|
||||
|
@ -148,6 +151,20 @@ void PreferencesDialog::build()
|
|||
m_optgroup_general->append_single_option_line(option);
|
||||
*/
|
||||
|
||||
def.label = L("Ask for unsaved changes when closing application");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("Always ask for unsaved changes when closing application");
|
||||
def.set_default_value(new ConfigOptionBool{ app_config->get("default_action_on_close_application") == "none" });
|
||||
option = Option(def, "default_action_on_close_application");
|
||||
m_optgroup_general->append_single_option_line(option);
|
||||
|
||||
def.label = L("Ask for unsaved changes when selecting new preset");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("Always ask for unsaved changes when selecting new preset");
|
||||
def.set_default_value(new ConfigOptionBool{ app_config->get("default_action_on_select_preset") == "none" });
|
||||
option = Option(def, "default_action_on_select_preset");
|
||||
m_optgroup_general->append_single_option_line(option);
|
||||
|
||||
// Show/Hide splash screen
|
||||
def.label = L("Show splash screen");
|
||||
def.type = coBool;
|
||||
|
@ -300,6 +317,13 @@ void PreferencesDialog::accept()
|
|||
}
|
||||
}
|
||||
|
||||
for (const std::string& key : {"default_action_on_close_application", "default_action_on_select_preset"})
|
||||
{
|
||||
auto it = m_values.find(key);
|
||||
if (it != m_values.end() && it->second != "none" && app_config->get(key) != "none")
|
||||
m_values.erase(it); // we shouldn't change value, if some of those parameters was selected, and then deselected
|
||||
}
|
||||
|
||||
for (std::map<std::string, std::string>::iterator it = m_values.begin(); it != m_values.end(); ++it)
|
||||
app_config->set(it->first, it->second);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue