Fix string access in Preferences.cpp

This commit is contained in:
Vojtech Kral 2019-03-27 13:51:42 +01:00
parent 87febaacc0
commit 1e9e378659

View File

@ -35,7 +35,7 @@ void PreferencesDialog::build()
def.type = coBool;
def.tooltip = L("If this is enabled, Slic3r will prompt the last output directory "
"instead of the one containing the input files.");
def.default_value = new ConfigOptionBool{ app_config->has("remember_output_path") ? app_config->get("remember_output_path")[0] == '1' : true }; // 1;
def.default_value = new ConfigOptionBool{ app_config->has("remember_output_path") ? app_config->get("remember_output_path") == "1" : true };
Option option(def, "remember_output_path");
m_optgroup->append_single_option_line(option);
@ -43,7 +43,7 @@ void PreferencesDialog::build()
def.type = coBool;
def.tooltip = L("If this is enabled, Slic3r will auto-center objects "
"around the print bed center.");
def.default_value = new ConfigOptionBool{ app_config->get("autocenter")[0] == '1' }; // 1;
def.default_value = new ConfigOptionBool{ app_config->get("autocenter") == "1" };
option = Option (def,"autocenter");
m_optgroup->append_single_option_line(option);
@ -51,7 +51,7 @@ void PreferencesDialog::build()
def.type = coBool;
def.tooltip = L("If this is enabled, Slic3r will pre-process objects as soon "
"as they\'re loaded in order to save time when exporting G-code.");
def.default_value = new ConfigOptionBool{ app_config->get("background_processing")[0] == '1' }; // 1;
def.default_value = new ConfigOptionBool{ app_config->get("background_processing") == "1" };
option = Option (def,"background_processing");
m_optgroup->append_single_option_line(option);
@ -75,7 +75,7 @@ void PreferencesDialog::build()
def.type = coBool;
def.tooltip = L("Suppress \" - default - \" presets in the Print / Filament / Printer "
"selections once there are any other valid presets available.");
def.default_value = new ConfigOptionBool{ app_config->get("no_defaults")[0] == '1' }; // 1;
def.default_value = new ConfigOptionBool{ app_config->get("no_defaults") == "1" };
option = Option (def,"no_defaults");
m_optgroup->append_single_option_line(option);
@ -83,7 +83,7 @@ void PreferencesDialog::build()
def.type = coBool;
def.tooltip = L("When checked, the print and filament presets are shown in the preset editor "
"even if they are marked as incompatible with the active printer");
def.default_value = new ConfigOptionBool{ app_config->get("show_incompatible_presets")[0] == '1' }; // 1;
def.default_value = new ConfigOptionBool{ app_config->get("show_incompatible_presets") == "1" };
option = Option (def,"show_incompatible_presets");
m_optgroup->append_single_option_line(option);
@ -93,7 +93,7 @@ void PreferencesDialog::build()
def.tooltip = L("If you have rendering issues caused by a buggy OpenGL 2.0 driver, "
"you may try to check this checkbox. This will disable the layer height "
"editing and anti aliasing, so it is likely better to upgrade your graphics driver.");
def.default_value = new ConfigOptionBool{ app_config->get("use_legacy_opengl")[0] == '1' }; // 1;
def.default_value = new ConfigOptionBool{ app_config->get("use_legacy_opengl") == "1" };
option = Option (def,"use_legacy_opengl");
m_optgroup->append_single_option_line(option);