mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 16:05:53 +08:00
Added some const to make it slightly nicer
This commit is contained in:
parent
444e5bdeec
commit
bc7d0af98c
@ -477,7 +477,7 @@ void PresetBundle::reset_extruder_filaments()
|
||||
this->extruders_filaments.emplace_back(ExtruderFilaments(&filaments, id, names[id]));
|
||||
}
|
||||
|
||||
PresetCollection&PresetBundle::get_presets(Preset::Type type)
|
||||
const PresetCollection& PresetBundle::get_presets(Preset::Type type) const
|
||||
{
|
||||
assert(type >= Preset::TYPE_PRINT && type <= Preset::TYPE_PRINTER);
|
||||
|
||||
@ -488,6 +488,12 @@ PresetCollection&PresetBundle::get_presets(Preset::Type type)
|
||||
}
|
||||
|
||||
|
||||
PresetCollection& PresetBundle::get_presets(Preset::Type type)
|
||||
{
|
||||
return const_cast<PresetCollection&>(const_cast<const PresetBundle*>(this)->get_presets(type));
|
||||
}
|
||||
|
||||
|
||||
const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& preset_type, const std::string& alias, int extruder_id /*= -1*/)
|
||||
{
|
||||
// there are not aliases for Printers profiles
|
||||
|
@ -87,7 +87,8 @@ public:
|
||||
|
||||
|
||||
|
||||
PresetCollection& get_presets(Preset::Type preset_type);
|
||||
const PresetCollection& get_presets(Preset::Type preset_type) const;
|
||||
PresetCollection& get_presets(Preset::Type preset_type);
|
||||
|
||||
// The project configuration values are kept separated from the print/filament/printer preset,
|
||||
// they are being serialized / deserialized from / to the .amf, .3mf, .config, .gcode,
|
||||
|
@ -33,7 +33,7 @@ constexpr auto BORDER_W = 10;
|
||||
|
||||
std::string SavePresetDialog::Item::get_init_preset_name(const std::string &suffix)
|
||||
{
|
||||
PresetBundle* preset_bundle = dynamic_cast<SavePresetDialog*>(m_parent)->get_preset_bundle();
|
||||
const PresetBundle* preset_bundle = dynamic_cast<SavePresetDialog*>(m_parent)->get_preset_bundle();
|
||||
if (!preset_bundle)
|
||||
preset_bundle = wxGetApp().preset_bundle;
|
||||
m_presets = &preset_bundle->get_presets(m_type);
|
||||
|
@ -74,8 +74,8 @@ public:
|
||||
wxTextCtrl* m_text_ctrl {nullptr};
|
||||
wxStaticText* m_valid_label {nullptr};
|
||||
|
||||
PresetCollection* m_presets {nullptr};
|
||||
PresetBundle* m_preset_bundle {nullptr};
|
||||
const PresetCollection* m_presets {nullptr};
|
||||
const PresetBundle* m_preset_bundle {nullptr};
|
||||
|
||||
std::vector<PresetName> m_casei_preset_names;
|
||||
|
||||
@ -112,7 +112,7 @@ public:
|
||||
|
||||
void AddItem(Preset::Type type, const std::string& suffix, bool is_for_multiple_save);
|
||||
|
||||
PresetBundle* get_preset_bundle() const { return m_preset_bundle; }
|
||||
const PresetBundle* get_preset_bundle() const { return m_preset_bundle; }
|
||||
std::string get_name();
|
||||
std::string get_name(Preset::Type type);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user