mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 17:45:57 +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]));
|
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);
|
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*/)
|
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
|
// there are not aliases for Printers profiles
|
||||||
|
@ -87,6 +87,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const PresetCollection& get_presets(Preset::Type preset_type) const;
|
||||||
PresetCollection& get_presets(Preset::Type preset_type);
|
PresetCollection& get_presets(Preset::Type preset_type);
|
||||||
|
|
||||||
// The project configuration values are kept separated from the print/filament/printer preset,
|
// The project configuration values are kept separated from the print/filament/printer preset,
|
||||||
|
@ -33,7 +33,7 @@ constexpr auto BORDER_W = 10;
|
|||||||
|
|
||||||
std::string SavePresetDialog::Item::get_init_preset_name(const std::string &suffix)
|
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)
|
if (!preset_bundle)
|
||||||
preset_bundle = wxGetApp().preset_bundle;
|
preset_bundle = wxGetApp().preset_bundle;
|
||||||
m_presets = &preset_bundle->get_presets(m_type);
|
m_presets = &preset_bundle->get_presets(m_type);
|
||||||
|
@ -74,8 +74,8 @@ public:
|
|||||||
wxTextCtrl* m_text_ctrl {nullptr};
|
wxTextCtrl* m_text_ctrl {nullptr};
|
||||||
wxStaticText* m_valid_label {nullptr};
|
wxStaticText* m_valid_label {nullptr};
|
||||||
|
|
||||||
PresetCollection* m_presets {nullptr};
|
const PresetCollection* m_presets {nullptr};
|
||||||
PresetBundle* m_preset_bundle {nullptr};
|
const PresetBundle* m_preset_bundle {nullptr};
|
||||||
|
|
||||||
std::vector<PresetName> m_casei_preset_names;
|
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);
|
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();
|
||||||
std::string get_name(Preset::Type type);
|
std::string get_name(Preset::Type type);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user