OptionsSearcher improvements: Fixed a key for option() and groups_and_categories.

It contains "preset_type;opt_key" now. This key helps to avoid a collisions by using a same options key from different type presets.
Example: Option "elefant_foot_compensation" is in Print presets and SLA_printer presets
This commit is contained in:
YuSanka 2021-03-24 10:45:37 +01:00
parent 10c3e82917
commit 991fa67fd1
7 changed files with 59 additions and 41 deletions

View file

@ -224,10 +224,11 @@ public:
ConfigOptionsGroup( wxWindow* parent) :
OptionsGroup(parent, wxEmptyString, true, nullptr) {}
const std::string& config_category() const throw() { return m_config_category; }
const wxString& config_category() const throw() { return m_config_category; }
int config_type() const throw() { return m_config_type; }
const t_opt_map& opt_map() const throw() { return m_opt_map; }
void set_config_category(const std::string &category) { this->m_config_category = category; }
void set_config_category_and_type(const wxString &category, int type) { this->m_config_category = category; this->m_config_type = type; }
void set_config(DynamicPrintConfig* config) { m_config = config; m_modelconfig = nullptr; }
Option get_option(const std::string& opt_key, int opt_index = -1);
Line create_single_option_line(const std::string& title, const wxString& path = wxEmptyString, int idx = -1) /*const*/{
@ -274,7 +275,8 @@ private:
// If the config is modelconfig, then ModelConfig::touch() has to be called after value change.
ModelConfig* m_modelconfig { nullptr };
t_opt_map m_opt_map;
std::string m_config_category;
wxString m_config_category;
int m_config_type;
// Change an option on m_config, possibly call ModelConfig::touch().
void change_opt_value(const t_config_option_key& opt_key, const boost::any& value, int opt_index = 0);