mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 06:40:36 +08:00
Implemented Preset::compatible and improved doxygen comment.
This commit is contained in:
parent
8059bff31e
commit
54d40bbc04
@ -121,4 +121,14 @@ t_config_option_keys Preset::_group_overrides() const {
|
||||
}
|
||||
}
|
||||
|
||||
bool Preset::compatible(const std::string& printer_name) const {
|
||||
if (!this->_dirty_config->has("compatible_printers") || this->default_preset || this->group == preset_t::Printer) {
|
||||
return true;
|
||||
}
|
||||
auto compatible_list {this->_dirty_config->get<ConfigOptionStrings>("compatible_printers").values};
|
||||
if (compatible_list.size() == 0) return true;
|
||||
return std::any_of(compatible_list.cbegin(), compatible_list.cend(), [printer_name] (const std::string& x) -> bool { return x.compare(printer_name) == 0; });
|
||||
}
|
||||
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
@ -48,9 +48,10 @@ public:
|
||||
|
||||
/// Search the compatible_printers config option list for this preset name.
|
||||
/// Assume that Printer configs are compatible with other Printer configs
|
||||
bool compatible(std::string printer_name) { return true; }
|
||||
bool compatible(const wxString& printer_name) { if (group == preset_t::Printer) return true; return true; }
|
||||
bool compatible(const Preset& other) {return (this->group == preset_t::Printer || (compatible(other.name) && other.group == preset_t::Printer));}
|
||||
/// @param [in] Printer preset name to use to compare.
|
||||
bool compatible(const std::string& printer_name) const;
|
||||
bool compatible(const wxString& printer_name) const { return this->compatible(printer_name.ToStdString()); }
|
||||
bool compatible(const Preset& other) const {return (this->group == preset_t::Printer || (compatible(other.name) && other.group == preset_t::Printer));}
|
||||
|
||||
/// Format the name appropriately.
|
||||
wxString dropdown_name() { return (this->dirty() ? this->name << " " << _("(modified)") : this->name); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user