mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-12 21:09:03 +08:00
Add debug string translation for presets.
This commit is contained in:
parent
17fd8e26cd
commit
d3e4b3ae5f
@ -128,6 +128,18 @@ bool Preset::compatible(const std::string& printer_name) const {
|
||||
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; });
|
||||
|
||||
const std::string preset_name(preset_t group) {
|
||||
switch(group) {
|
||||
case preset_t::Print:
|
||||
return "Print"s;
|
||||
case preset_t::Printer:
|
||||
return "Printer"s;
|
||||
case preset_t::Material:
|
||||
return "Material"s;
|
||||
default:
|
||||
return "N/A"s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#endif
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
/// Preset types list. We assign numbers to permit static_casts and use as preset tab indices.
|
||||
/// Don't skip numbers in the enumeration, we use this as an index into vectors (instead of using std::map).
|
||||
@ -30,6 +30,10 @@ constexpr preset_t to_preset(uint8_t preset) { return static_cast<preset_t>(pres
|
||||
/// Convenience counter to determine how many preset tabs exist.
|
||||
constexpr size_t preset_types = get_preset(preset_t::Last);
|
||||
|
||||
/// Convenience/debug method to get a useful name from the enumeration.
|
||||
const std::string preset_name(preset_t group);
|
||||
|
||||
|
||||
class Preset;
|
||||
|
||||
using Presets = std::vector<Preset>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user