Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::AppConfig Class Reference

#include <src/libslic3r/AppConfig.hpp>

+ Collaboration diagram for Slic3r::AppConfig:

Public Types

enum class  EAppMode : unsigned char { Editor , GCodeViewer }
 
typedef std::map< std::string, std::map< std::string, std::set< std::string > > > VendorMap
 

Public Member Functions

 AppConfig (EAppMode mode)
 
void reset ()
 
void set_defaults ()
 
std::string load ()
 
std::string load (const std::string &path)
 
void save ()
 
bool dirty () const
 
bool get (const std::string &section, const std::string &key, std::string &value) const
 
std::string get (const std::string &section, const std::string &key) const
 
bool get_bool (const std::string &section, const std::string &key) const
 
std::string get (const std::string &key) const
 
bool get_bool (const std::string &key) const
 
bool set (const std::string &section, const std::string &key, const std::string &value)
 
bool set (const std::string &key, const std::string &value)
 
bool has (const std::string &section, const std::string &key) const
 
bool has (const std::string &key) const
 
bool erase (const std::string &section, const std::string &key)
 
bool has_section (const std::string &section) const
 
const std::map< std::string, std::string > & get_section (const std::string &section) const
 
bool set_section (const std::string &section, std::map< std::string, std::string > data)
 
bool clear_section (const std::string &section)
 
bool get_variant (const std::string &vendor, const std::string &model, const std::string &variant) const
 
bool set_variant (const std::string &vendor, const std::string &model, const std::string &variant, bool enable)
 
bool set_vendors (const AppConfig &from)
 
bool set_vendors (const VendorMap &vendors)
 
bool set_vendors (VendorMap &&vendors)
 
const VendorMapvendors () const
 
std::string get_last_dir () const
 
bool update_config_dir (const std::string &dir)
 
bool update_skein_dir (const std::string &dir)
 
std::string get_last_output_dir (const std::string &alt, const bool removable=false) const
 
bool update_last_output_dir (const std::string &dir, const bool removable=false)
 
void reset_selections ()
 
std::string config_path () const
 
bool legacy_datadir () const
 
void set_legacy_datadir (bool value)
 
std::string version_check_url () const
 
std::string index_archive_url () const
 
std::string profile_folder_url () const
 
Semver orig_version () const
 
bool exists () const
 
std::vector< std::string > get_recent_projects () const
 
bool set_recent_projects (const std::vector< std::string > &recent_projects)
 
bool set_mouse_device (const std::string &name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed, bool swap_yz)
 
std::vector< std::string > get_mouse_device_names () const
 
bool get_mouse_device_translation_speed (const std::string &name, double &speed) const
 
bool get_mouse_device_translation_deadzone (const std::string &name, double &deadzone) const
 
bool get_mouse_device_rotation_speed (const std::string &name, float &speed) const
 
bool get_mouse_device_rotation_deadzone (const std::string &name, float &deadzone) const
 
bool get_mouse_device_zoom_speed (const std::string &name, double &speed) const
 
bool get_mouse_device_swap_yz (const std::string &name, bool &swap) const
 

Static Public Attributes

static const std::string SECTION_FILAMENTS = "filaments"
 
static const std::string SECTION_MATERIALS = "sla_materials"
 
static const std::string SECTION_EMBOSS_STYLE = "font"
 

Private Member Functions

template<typename T >
bool get_3dmouse_device_numeric_value (const std::string &device_name, const char *parameter_name, T &out) const
 

Private Attributes

EAppMode m_mode { EAppMode::Editor }
 
std::map< std::string, std::map< std::string, std::string > > m_storage
 
VendorMap m_vendors
 
bool m_dirty
 
Semver m_orig_version
 
bool m_legacy_datadir
 

Detailed Description

Member Typedef Documentation

◆ VendorMap

typedef std::map<std::string, std::map<std::string, std::set<std::string> > > Slic3r::AppConfig::VendorMap

Member Enumeration Documentation

◆ EAppMode

enum class Slic3r::AppConfig::EAppMode : unsigned char
strong
Enumerator
Editor 
GCodeViewer 

Constructor & Destructor Documentation

◆ AppConfig()

Slic3r::AppConfig::AppConfig ( EAppMode  mode)
inlineexplicit
24 :
25 m_mode(mode)
26 {
27 this->reset();
28 }
void reset()
Definition AppConfig.cpp:49
EAppMode m_mode
Definition AppConfig.hpp:191

References reset().

+ Here is the call graph for this function:

Member Function Documentation

◆ clear_section()

bool Slic3r::AppConfig::clear_section ( const std::string &  section)
515{
516 if (auto it_section = m_storage.find(section); it_section != m_storage.end() && ! it_section->second.empty()) {
517 it_section->second.clear();
518 m_dirty = true;
519 return true;
520 }
521 return false;
522}
std::map< std::string, std::map< std::string, std::string > > m_storage
Definition AppConfig.hpp:193
bool m_dirty
Definition AppConfig.hpp:197

References m_dirty, and m_storage.

Referenced by Slic3r::PresetBundle::export_selections(), Slic3r::GUI::Config::Snapshot::export_selections(), and Slic3r::GUI::EmbossStylesSerializable::store_styles().

+ Here is the caller graph for this function:

◆ config_path()

std::string Slic3r::AppConfig::config_path ( ) const
731{
732 std::string path = (m_mode == EAppMode::Editor) ?
733 (boost::filesystem::path(Slic3r::data_dir()) / (SLIC3R_APP_KEY ".ini")).make_preferred().string() :
734 (boost::filesystem::path(Slic3r::data_dir()) / (GCODEVIEWER_APP_KEY ".ini")).make_preferred().string();
735
736 return path;
737}
#define GCODEVIEWER_APP_KEY
Definition libslic3r.h:6
const std::string & data_dir()
Definition utils.cpp:206

References Slic3r::data_dir(), Editor, GCODEVIEWER_APP_KEY, and m_mode.

Referenced by Slic3r::GUI::GUI_App::check_older_app_config(), exists(), Slic3r::GUI::GUI_App::init_app_config(), load(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dirty()

bool Slic3r::AppConfig::dirty ( ) const
inline
44{ return m_dirty; }

References m_dirty.

Referenced by Slic3r::GUI::GUI_App::window_pos_save().

+ Here is the caller graph for this function:

◆ erase()

bool Slic3r::AppConfig::erase ( const std::string &  section,
const std::string &  key 
)
485{
486 if (auto it_storage = m_storage.find(section); it_storage != m_storage.end()) {
487 auto &section = it_storage->second;
488 auto it = section.find(key);
489 if (it != section.end()) {
490 section.erase(it);
491 m_dirty = true;
492 return true;
493 }
494 }
495 return false;
496}

References m_dirty, and m_storage.

Referenced by set_defaults().

+ Here is the caller graph for this function:

◆ exists()

bool Slic3r::AppConfig::exists ( ) const
766{
767 return boost::filesystem::exists(config_path());
768}
std::string config_path() const
Definition AppConfig.cpp:730

References config_path().

Referenced by Slic3r::GUI::GUI_App::init_app_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get() [1/3]

std::string Slic3r::AppConfig::get ( const std::string &  key) const
inline
64 { std::string value; this->get("", key, value); return value; }
bool get(const std::string &section, const std::string &key, std::string &value) const
Definition AppConfig.hpp:47

References get().

+ Here is the call graph for this function:

◆ get() [2/3]

std::string Slic3r::AppConfig::get ( const std::string &  section,
const std::string &  key 
) const
inline
60 { std::string value; this->get(section, key, value); return value; }

References get().

+ Here is the call graph for this function:

◆ get() [3/3]

bool Slic3r::AppConfig::get ( const std::string &  section,
const std::string &  key,
std::string &  value 
) const
inline
48 {
49 value.clear();
50 auto it = m_storage.find(section);
51 if (it == m_storage.end())
52 return false;
53 auto it2 = it->second.find(key);
54 if (it2 == it->second.end())
55 return false;
56 value = it2->second;
57 return true;
58 }

References m_storage.

Referenced by Slic3r::GUI::PageUpdate::PageUpdate(), Slic3r::GUI::PrintHostSendDialog::PrintHostSendDialog(), Slic3r::GUI::GUI_App::add_config_menu(), get(), get(), get_bool(), get_bool(), Slic3r::GUI::GUI_App::get_mode(), Slic3r::GUI::OptionsGroup::get_url(), index_archive_url(), Slic3r::DoubleSlider::Control::is_lower_thumb_editable(), Slic3r::GUI::Config::SnapshotDB::is_on_snapshot(), load(), Slic3r::GUI::GUI_App::load_language(), Slic3r::GUI::ConfigWizard::priv::load_pages(), Slic3r::PresetBundle::load_selections(), Slic3r::GUI::GUI_App::on_init_inner(), Slic3r::GUI::GUI_App::on_version_read(), Slic3r::GUI::GUI_App::open_browser_with_warning_dialog(), profile_folder_url(), Slic3r::GUI::GUI_App::recreate_GUI(), Slic3r::GUI::PageMaterials::reload_presets(), set_defaults(), Slic3r::PresetUpdater::priv::set_download_prefs(), Slic3r::GUI::GUI_App::show_downloader_registration_dialog(), Slic3r::GUI::GUI_App::start_download(), Slic3r::GUI::Config::SnapshotDB::take_snapshot(), Slic3r::GUI::GUI_App::toolbar_icon_scale(), Slic3r::GUI::GUI_App::update_ui_colours_from_appconfig(), version_check_url(), and Slic3r::GUI::GUI_App::window_pos_restore().

+ Here is the caller graph for this function:

◆ get_3dmouse_device_numeric_value()

template<typename T >
bool Slic3r::AppConfig::get_3dmouse_device_numeric_value ( const std::string &  device_name,
const char *  parameter_name,
T &  out 
) const
inlineprivate
178 {
179 std::string key = std::string("mouse_device:") + device_name;
180 auto it = m_storage.find(key);
181 if (it == m_storage.end())
182 return false;
183 auto it_val = it->second.find(parameter_name);
184 if (it_val == it->second.end())
185 return false;
186 out = T(string_to_double_decimal_point(it_val->second));
187 return true;
188 }
double string_to_double_decimal_point(const std::string_view str, size_t *pos)
Definition LocalesUtils.cpp:64

References m_storage, and Slic3r::string_to_double_decimal_point().

Referenced by get_mouse_device_rotation_deadzone(), get_mouse_device_rotation_speed(), get_mouse_device_swap_yz(), get_mouse_device_translation_deadzone(), get_mouse_device_translation_speed(), and get_mouse_device_zoom_speed().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_bool() [1/2]

bool Slic3r::AppConfig::get_bool ( const std::string &  key) const
inline
66 { return this->get(key) == "1"; }

References get().

+ Here is the call graph for this function:

◆ get_bool() [2/2]

◆ get_last_dir()

std::string Slic3r::AppConfig::get_last_dir ( ) const
576{
577 const auto it = m_storage.find("recent");
578 if (it != m_storage.end()) {
579 {
580 const auto it2 = it->second.find("skein_directory");
581 if (it2 != it->second.end() && ! it2->second.empty())
582 return it2->second;
583 }
584 {
585 const auto it2 = it->second.find("config_directory");
586 if (it2 != it->second.end() && ! it2->second.empty())
587 return it2->second;
588 }
589 }
590 return std::string();
591}

References m_storage.

Referenced by get_last_output_dir(), Slic3r::GUI::GUI_App::import_model(), Slic3r::GUI::GUI_App::import_zip(), Slic3r::GUI::GUI_App::load_gcode(), and Slic3r::GUI::GUI_App::load_project().

+ Here is the caller graph for this function:

◆ get_last_output_dir()

std::string Slic3r::AppConfig::get_last_output_dir ( const std::string &  alt,
const bool  removable = false 
) const
697{
698 std::string s1 = (removable ? "last_output_path_removable" : "last_output_path");
699 std::string s2 = (removable ? "remember_output_path_removable" : "remember_output_path");
700 const auto it = m_storage.find("");
701 if (it != m_storage.end()) {
702 const auto it2 = it->second.find(s1);
703 const auto it3 = it->second.find(s2);
704 if (it2 != it->second.end() && it3 != it->second.end() && !it2->second.empty() && it3->second == "1")
705 return it2->second;
706 }
707 return is_shapes_dir(alt) ? get_last_dir() : alt;
708}
std::string get_last_dir() const
Definition AppConfig.cpp:575
bool is_shapes_dir(const std::string &dir)
Definition utils.cpp:804

References get_last_dir(), Slic3r::is_shapes_dir(), and m_storage.

Referenced by Slic3r::GUI::Plater::export_gcode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mouse_device_names()

std::vector< std::string > Slic3r::AppConfig::get_mouse_device_names ( ) const
656{
657 static constexpr const char *prefix = "mouse_device:";
658 static const size_t prefix_len = strlen(prefix);
659 std::vector<std::string> out;
660 for (const auto& key_value_pair : m_storage)
661 if (boost::starts_with(key_value_pair.first, prefix) && key_value_pair.first.size() > prefix_len)
662 out.emplace_back(key_value_pair.first.substr(prefix_len));
663 return out;
664}
if(!(yy_init))
Definition lexer.c:1190
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183
Definition args.hpp:18

References m_storage.

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the caller graph for this function:

◆ get_mouse_device_rotation_deadzone()

bool Slic3r::AppConfig::get_mouse_device_rotation_deadzone ( const std::string &  name,
float &  deadzone 
) const
inline
165 { return get_3dmouse_device_numeric_value(name, "rotation_deadzone", deadzone); }
bool get_3dmouse_device_numeric_value(const std::string &device_name, const char *parameter_name, T &out) const
Definition AppConfig.hpp:177

References get_3dmouse_device_numeric_value().

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mouse_device_rotation_speed()

bool Slic3r::AppConfig::get_mouse_device_rotation_speed ( const std::string &  name,
float &  speed 
) const
inline
163 { return get_3dmouse_device_numeric_value(name, "rotation_speed", speed); }

References get_3dmouse_device_numeric_value().

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mouse_device_swap_yz()

bool Slic3r::AppConfig::get_mouse_device_swap_yz ( const std::string &  name,
bool &  swap 
) const
inline
169 { return get_3dmouse_device_numeric_value(name, "swap_yz", swap); }

References get_3dmouse_device_numeric_value().

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mouse_device_translation_deadzone()

bool Slic3r::AppConfig::get_mouse_device_translation_deadzone ( const std::string &  name,
double &  deadzone 
) const
inline
161 { return get_3dmouse_device_numeric_value(name, "translation_deadzone", deadzone); }

References get_3dmouse_device_numeric_value().

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mouse_device_translation_speed()

bool Slic3r::AppConfig::get_mouse_device_translation_speed ( const std::string &  name,
double &  speed 
) const
inline
159 { return get_3dmouse_device_numeric_value(name, "translation_speed", speed); }

References get_3dmouse_device_numeric_value().

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_mouse_device_zoom_speed()

bool Slic3r::AppConfig::get_mouse_device_zoom_speed ( const std::string &  name,
double &  speed 
) const
inline
167 { return get_3dmouse_device_numeric_value(name, "zoom_speed", speed); }

References get_3dmouse_device_numeric_value().

Referenced by Slic3r::GUI::Mouse3DController::load_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_recent_projects()

std::vector< std::string > Slic3r::AppConfig::get_recent_projects ( ) const
594{
595 std::vector<std::string> ret;
596 const auto it = m_storage.find("recent_projects");
597 if (it != m_storage.end())
598 {
599 for (const std::map<std::string, std::string>::value_type& item : it->second)
600 {
601 ret.push_back(item.second);
602 }
603 }
604 return ret;
605}

References m_storage.

◆ get_section()

const std::map< std::string, std::string > & Slic3r::AppConfig::get_section ( const std::string &  section) const
inline
103 { auto it = m_storage.find(section); assert(it != m_storage.end()); return it->second; }

References m_storage.

Referenced by Slic3r::GUI::ConfigWizard::priv::apply_config(), Slic3r::GUI::EmbossStylesSerializable::load_style_index(), Slic3r::GUI::EmbossStylesSerializable::load_styles(), Slic3r::GUI::ConfigWizard::priv::load_vendors(), and Slic3r::Preset::set_visible_from_appconfig().

+ Here is the caller graph for this function:

◆ get_variant()

bool Slic3r::AppConfig::get_variant ( const std::string &  vendor,
const std::string &  model,
const std::string &  variant 
) const
525{
526 const auto it_v = m_vendors.find(vendor);
527 if (it_v == m_vendors.end()) { return false; }
528 const auto it_m = it_v->second.find(model);
529 return it_m == it_v->second.end() ? false : it_m->second.find(variant) != it_m->second.end();
530}
VendorMap m_vendors
Definition AppConfig.hpp:195

References m_vendors.

Referenced by Slic3r::GUI::PrinterPicker::PrinterPicker(), set_variant(), and Slic3r::Preset::set_visible_from_appconfig().

+ Here is the caller graph for this function:

◆ has() [1/2]

bool Slic3r::AppConfig::has ( const std::string &  key) const
inline
96 { return this->has("", key); }
bool has(const std::string &section, const std::string &key) const
Definition AppConfig.hpp:87

References has().

+ Here is the call graph for this function:

◆ has() [2/2]

bool Slic3r::AppConfig::has ( const std::string &  section,
const std::string &  key 
) const
inline
88 {
89 auto it = m_storage.find(section);
90 if (it == m_storage.end())
91 return false;
92 auto it2 = it->second.find(key);
93 return it2 != it->second.end() && ! it2->second.empty();
94 }

References m_storage.

Referenced by Slic3r::GUI::PageDownloader::PageDownloader(), Slic3r::GUI::GUI_App::dark_mode(), Slic3r::GUI::GUI_App::get_mode(), has(), Slic3r::PresetBundle::load_selections(), Slic3r::GUI::GUI_App::on_init_inner(), Slic3r::GUI::GUI_App::recreate_GUI(), Slic3r::GUI::Config::SnapshotDB::take_snapshot(), Slic3r::GUI::PageMaterials::update_lists(), Slic3r::GUI::GUI_App::update_ui_colours_from_appconfig(), and Slic3r::GUI::GUI_App::window_pos_restore().

+ Here is the caller graph for this function:

◆ has_section()

bool Slic3r::AppConfig::has_section ( const std::string &  section) const
inline

◆ index_archive_url()

std::string Slic3r::AppConfig::index_archive_url ( ) const
746{
747#if 0
748 // this code is for debug & testing purposes only - changed url wont get trough inner checks anyway.
749 auto from_settings = get("index_archive_url");
750 return from_settings.empty() ? INDEX_ARCHIVE_URL : from_settings;
751#endif
752 return INDEX_ARCHIVE_URL;
753}
static const std::string INDEX_ARCHIVE_URL
Definition AppConfig.cpp:41

References get(), and Slic3r::INDEX_ARCHIVE_URL.

+ Here is the call graph for this function:

◆ legacy_datadir()

bool Slic3r::AppConfig::legacy_datadir ( ) const
inline
134{ return m_legacy_datadir; }
bool m_legacy_datadir
Definition AppConfig.hpp:201

References m_legacy_datadir.

Referenced by Slic3r::GUI::ConfigWizard::priv::load_vendors(), and Slic3r::PresetUpdater::priv::set_download_prefs().

+ Here is the caller graph for this function:

◆ load() [1/2]

std::string Slic3r::AppConfig::load ( )
408{
409 return this->load(AppConfig::config_path());
410}
std::string load()
Definition AppConfig.cpp:407

References config_path(), and load().

Referenced by Slic3r::GUI::GUI_App::check_older_app_config(), Slic3r::GUI::GUI_App::init_app_config(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load() [2/2]

std::string Slic3r::AppConfig::load ( const std::string &  path)
277{
278 this->reset();
279
280 // 1) Read the complete config file into a boost::property_tree.
281 namespace pt = boost::property_tree;
282 pt::ptree tree;
283 boost::nowide::ifstream ifs;
284 bool recovered = false;
285
286 try {
287 ifs.open(path);
288#ifdef WIN32
289 // Verify the checksum of the config file without taking just for debugging purpose.
290 const ConfigFileInfo config_file_info = check_config_file_and_verify_checksum(ifs);
291 if (!config_file_info.correct_checksum)
292 BOOST_LOG_TRIVIAL(info)
293 << "The configuration file " << path
294 << " has a wrong MD5 checksum or the checksum is missing. This may indicate a file corruption or a harmless user edit.";
295
296 if (!config_file_info.correct_checksum && config_file_info.contains_null) {
297 BOOST_LOG_TRIVIAL(info) << "The configuration file " + path + " is corrupted, because it is contains null characters.";
298 throw Slic3r::CriticalException("The configuration file contains null characters.");
299 }
300
301 ifs.seekg(0, boost::nowide::ifstream::beg);
302#endif
303 try {
304 pt::read_ini(ifs, tree);
305 } catch (pt::ptree_error &ex) {
306 throw Slic3r::CriticalException(ex.what());
307 }
308 } catch (Slic3r::CriticalException &ex) {
309#ifdef WIN32
310 // The configuration file is corrupted, try replacing it with the backup configuration.
311 ifs.close();
312 std::string backup_path = (boost::format("%1%.bak") % path).str();
313 if (boost::filesystem::exists(backup_path)) {
314 // Compute checksum of the configuration backup file and try to load configuration from it when the checksum is correct.
315 boost::nowide::ifstream backup_ifs(backup_path);
316 if (const ConfigFileInfo config_file_info = check_config_file_and_verify_checksum(backup_ifs); !config_file_info.correct_checksum || config_file_info.contains_null) {
317 BOOST_LOG_TRIVIAL(error) << format(R"(Both "%1%" and "%2%" are corrupted. It isn't possible to restore configuration from the backup.)", path, backup_path);
318 backup_ifs.close();
319 boost::filesystem::remove(backup_path);
320 } else if (std::string error_message; copy_file(backup_path, path, error_message, false) != SUCCESS) {
321 BOOST_LOG_TRIVIAL(error) << format(R"(Configuration file "%1%" is corrupted. Failed to restore from backup "%2%": %3%)", path, backup_path, error_message);
322 backup_ifs.close();
323 boost::filesystem::remove(backup_path);
324 } else {
325 BOOST_LOG_TRIVIAL(info) << format(R"(Configuration file "%1%" was corrupted. It has been successfully restored from the backup "%2%".)", path, backup_path);
326 // Try parse configuration file after restore from backup.
327 try {
328 ifs.open(path);
329 pt::read_ini(ifs, tree);
330 recovered = true;
331 } catch (pt::ptree_error& ex) {
332 BOOST_LOG_TRIVIAL(info) << format(R"(Failed to parse configuration file "%1%" after it has been restored from backup: %2%)", path, ex.what());
333 }
334 }
335 } else
336#endif // WIN32
337 BOOST_LOG_TRIVIAL(info) << format(R"(Failed to parse configuration file "%1%": %2%)", path, ex.what());
338 if (!recovered) {
339 // Report the initial error of parsing PrusaSlicer.ini.
340 // Error while parsing config file. We'll customize the error message and rethrow to be displayed.
341 // ! But to avoid the use of _utf8 (related to use of wxWidgets)
342 // we will rethrow this exception from the place of load() call, if returned value wouldn't be empty
343 return ex.what();
344 }
345 }
346
347 // 2) Parse the property_tree, extract the sections and key / value pairs.
348 for (const auto &section : tree) {
349 if (section.second.empty()) {
350 // This may be a top level (no section) entry, or an empty section.
351 std::string data = section.second.data();
352 if (! data.empty())
353 // If there is a non-empty data, then it must be a top-level (without a section) config entry.
354 m_storage[""][section.first] = data;
355 } else if (boost::starts_with(section.first, VENDOR_PREFIX)) {
356 // This is a vendor section listing enabled model / variants
357 const auto vendor_name = section.first.substr(VENDOR_PREFIX.size());
358 auto &vendor = m_vendors[vendor_name];
359 for (const auto &kvp : section.second) {
360 if (! boost::starts_with(kvp.first, MODEL_PREFIX)) { continue; }
361 const auto model_name = kvp.first.substr(MODEL_PREFIX.size());
362 std::vector<std::string> variants;
363 if (! unescape_strings_cstyle(kvp.second.data(), variants)) { continue; }
364 for (const auto &variant : variants) {
365 vendor[model_name].insert(variant);
366 }
367 }
368 } else {
369 // This must be a section name. Read the entries of a section.
370 std::map<std::string, std::string> &storage = m_storage[section.first];
371 for (auto &kvp : section.second)
372 storage[kvp.first] = kvp.second.data();
373 }
374 }
375
376 // Figure out if datadir has legacy presets
377 auto ini_ver = Semver::parse(get("version"));
378 m_legacy_datadir = false;
379 if (ini_ver) {
380 m_orig_version = *ini_ver;
381 // Make 1.40.0 alphas compare well
382 ini_ver->set_metadata(boost::none);
383 ini_ver->set_prerelease(boost::none);
384 m_legacy_datadir = ini_ver < Semver(1, 40, 0);
385 }
386
387 // Legacy conversion
388 if (m_mode == EAppMode::Editor) {
389 // Convert [extras] "physical_printer" to [presets] "physical_printer",
390 // remove the [extras] section if it becomes empty.
391 if (auto it_section = m_storage.find("extras"); it_section != m_storage.end()) {
392 if (auto it_physical_printer = it_section->second.find("physical_printer"); it_physical_printer != it_section->second.end()) {
393 m_storage["presets"]["physical_printer"] = it_physical_printer->second;
394 it_section->second.erase(it_physical_printer);
395 }
396 if (it_section->second.empty())
397 m_storage.erase(it_section);
398 }
399 }
400
401 // Override missing or keys with their defaults.
402 this->set_defaults();
403 m_dirty = false;
404 return "";
405}
Semver m_orig_version
Definition AppConfig.hpp:199
void set_defaults()
Definition AppConfig.cpp:60
static boost::optional< Semver > parse(const std::string &str)
Definition Semver.hpp:58
void set_metadata(boost::optional< const std::string & > meta)
Definition Semver.hpp:113
bool unescape_strings_cstyle(const std::string &str, std::vector< std::string > &out)
Definition Config.cpp:130
CopyFileResult copy_file(const std::string &from, const std::string &to, std::string &error_message, const bool with_check)
Definition utils.cpp:707
@ SUCCESS
Definition Utils.hpp:81
static const std::string MODEL_PREFIX
Definition AppConfig.cpp:32
static const std::string VENDOR_PREFIX
Definition AppConfig.cpp:31
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:44
constexpr auto data(C &c) -> decltype(c.data())
Definition span.hpp:195
static char error[256]
Definition tga.cpp:50

References Slic3r::copy_file(), Editor, error, Slic3r::format(), get(), m_dirty, m_legacy_datadir, m_mode, m_orig_version, m_storage, m_vendors, Slic3r::MODEL_PREFIX, Slic3r::Semver::parse(), reset(), set_defaults(), Slic3r::Semver::set_metadata(), Slic3r::SUCCESS, Slic3r::unescape_strings_cstyle(), and Slic3r::VENDOR_PREFIX.

+ Here is the call graph for this function:

◆ orig_version()

Semver Slic3r::AppConfig::orig_version ( ) const
inline
148{ return m_orig_version; }

References m_orig_version.

Referenced by Slic3r::GUI::GUI_App::check_updates(), Slic3r::GUI::GUI_App::on_init_inner(), and Slic3r::GUI::GUI_App::run_wizard().

+ Here is the caller graph for this function:

◆ profile_folder_url()

std::string Slic3r::AppConfig::profile_folder_url ( ) const
756{
757#if 0
758 // this code is for debug & testing purposes only - changed url wont get trough inner checks anyway.
759 auto from_settings = get("profile_folder_url");
760 return from_settings.empty() ? PROFILE_FOLDER_URL : from_settings;
761#endif
762 return PROFILE_FOLDER_URL;
763}
static const std::string PROFILE_FOLDER_URL
Definition AppConfig.cpp:43

References get(), and Slic3r::PROFILE_FOLDER_URL.

+ Here is the call graph for this function:

◆ reset()

void Slic3r::AppConfig::reset ( )
50{
51 m_storage.clear();
52 m_vendors.clear();
53 m_dirty = false;
55 m_legacy_datadir = false;
57};
static const Semver invalid()
Definition Semver.hpp:76

References Slic3r::Semver::invalid(), m_dirty, m_legacy_datadir, m_orig_version, m_storage, m_vendors, and set_defaults().

Referenced by AppConfig(), and load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_selections()

void Slic3r::AppConfig::reset_selections ( )
717{
718 auto it = m_storage.find("presets");
719 if (it != m_storage.end()) {
720 it->second.erase("print");
721 it->second.erase("filament");
722 it->second.erase("sla_print");
723 it->second.erase("sla_material");
724 it->second.erase("printer");
725 it->second.erase("physical_printer");
726 m_dirty = true;
727 }
728}

References m_dirty, and m_storage.

◆ save()

void Slic3r::AppConfig::save ( )
413{
414 if (! is_main_thread_active())
415 throw CriticalException("Calling AppConfig::save() from a worker thread!");
416
417 // The config is first written to a file with a PID suffix and then moved
418 // to avoid race conditions with multiple instances of Slic3r
419 const auto path = config_path();
420 std::string path_pid = (boost::format("%1%.%2%") % path % get_current_pid()).str();
421
422 std::stringstream config_ss;
424 config_ss << "# " << Slic3r::header_slic3r_generated() << std::endl;
425 else
426 config_ss << "# " << Slic3r::header_gcodeviewer_generated() << std::endl;
427 // Make sure the "no" category is written first.
428 for (const auto& kvp : m_storage[""])
429 config_ss << kvp.first << " = " << kvp.second << std::endl;
430 // Write the other categories.
431 for (const auto& category : m_storage) {
432 if (category.first.empty())
433 continue;
434 config_ss << std::endl << "[" << category.first << "]" << std::endl;
435 for (const auto& kvp : category.second)
436 config_ss << kvp.first << " = " << kvp.second << std::endl;
437 }
438 // Write vendor sections
439 for (const auto &vendor : m_vendors) {
440 size_t size_sum = 0;
441 for (const auto &model : vendor.second) { size_sum += model.second.size(); }
442 if (size_sum == 0) { continue; }
443
444 config_ss << std::endl << "[" << VENDOR_PREFIX << vendor.first << "]" << std::endl;
445
446 for (const auto &model : vendor.second) {
447 if (model.second.empty()) { continue; }
448 const std::vector<std::string> variants(model.second.begin(), model.second.end());
449 const auto escaped = escape_strings_cstyle(variants);
450 config_ss << MODEL_PREFIX << model.first << " = " << escaped << std::endl;
451 }
452 }
453 // One empty line before the MD5 sum.
454 config_ss << std::endl;
455
456 std::string config_str = config_ss.str();
457 boost::nowide::ofstream c;
458 c.open(path_pid, std::ios::out | std::ios::trunc);
459 c << config_str;
460#ifdef WIN32
461 // WIN32 specific: The final "rename_file()" call is not safe in case of an application crash, there is no atomic "rename file" API
462 // provided by Windows (sic!). Therefore we save a MD5 checksum to be able to verify file corruption. In addition,
463 // we save the config file into a backup first before moving it to the final destination.
464 c << appconfig_md5_hash_line(config_str);
465#endif
466 c.close();
467
468#ifdef WIN32
469 // Make a backup of the configuration file before copying it to the final destination.
470 std::string error_message;
471 std::string backup_path = (boost::format("%1%.bak") % path).str();
472 // Copy configuration file with PID suffix into the configuration file with "bak" suffix.
473 if (copy_file(path_pid, backup_path, error_message, false) != SUCCESS)
474 BOOST_LOG_TRIVIAL(error) << "Copying from " << path_pid << " to " << backup_path << " failed. Failed to create a backup configuration.";
475#endif
476
477 // Rename the config atomically.
478 // On Windows, the rename is likely NOT atomic, thus it may fail if PrusaSlicer crashes on another thread in the meanwhile.
479 // To cope with that, we already made a backup of the config on Windows.
480 rename_file(path_pid, path);
481 m_dirty = false;
482}
std::string header_slic3r_generated()
Definition utils.cpp:914
unsigned get_current_pid()
Definition utils.cpp:924
std::error_code rename_file(const std::string &from, const std::string &to)
Definition utils.cpp:468
bool is_main_thread_active()
Definition Thread.cpp:209
std::string header_gcodeviewer_generated()
Definition utils.cpp:919
std::string escape_strings_cstyle(const std::vector< std::string > &strs)
Definition Config.cpp:56
STL namespace.

References config_path(), Slic3r::copy_file(), Editor, error, Slic3r::escape_strings_cstyle(), Slic3r::get_current_pid(), Slic3r::header_gcodeviewer_generated(), Slic3r::header_slic3r_generated(), Slic3r::is_main_thread_active(), m_dirty, m_mode, m_storage, m_vendors, Slic3r::MODEL_PREFIX, Slic3r::rename_file(), Slic3r::SUCCESS, and Slic3r::VENDOR_PREFIX.

Referenced by Slic3r::GUI::GUI_App::on_init_inner(), Slic3r::GUI::GUI_App::window_pos_restore(), and Slic3r::GUI::GUI_App::window_pos_save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set() [1/2]

bool Slic3r::AppConfig::set ( const std::string &  key,
const std::string &  value 
)
inline
86 { return this->set("", key, value); }
bool set(const std::string &section, const std::string &key, const std::string &value)
Definition AppConfig.hpp:67

References set().

+ Here is the call graph for this function:

◆ set() [2/2]

bool Slic3r::AppConfig::set ( const std::string &  section,
const std::string &  key,
const std::string &  value 
)
inline
68 {
69#ifndef NDEBUG
70 {
71 std::string key_trimmed = key;
72 boost::trim_all(key_trimmed);
73 assert(key_trimmed == key);
74 assert(! key_trimmed.empty());
75 }
76#endif // NDEBUG
77 std::string &old = m_storage[section][key];
78 if (old != value) {
79 old = value;
80 m_dirty = true;
81 return true;
82 }
83 return false;
84 }

References m_dirty, and m_storage.

Referenced by Slic3r::GUI::GUI_App::add_config_menu(), Slic3r::GUI::GUI_App::app_updater(), Slic3r::GUI::ConfigWizard::priv::apply_config(), Slic3r::GUI::PreferencesDialog::build(), Slic3r::GUI::GUI_App::check_older_app_config(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::PresetBundle::export_selections(), Slic3r::GUI::Config::Snapshot::export_selections(), Slic3r::GUI::Config::SnapshotDB::is_on_snapshot(), Slic3r::PresetBundle::load_installed_filaments(), Slic3r::PresetBundle::load_installed_sla_materials(), Slic3r::GUI::DownloaderUtils::Worker::on_finish(), Slic3r::GUI::GUI_App::on_init_inner(), Slic3r::GUI::GUI_App::on_version_read(), Slic3r::GUI::GUI_App::open_browser_with_warning_dialog(), Slic3r::GUI::GUI_App::post_init(), Slic3r::GUI::GUI_App::save_mode(), Slic3r::GUI::Plater::priv::save_project_if_dirty(), Slic3r::GUI::GUI_App::select_language(), Slic3r::GUI::PageMode::serialize_mode(), set(), Slic3r::GUI::GUI_App::set_auto_toolbar_icon_scale(), set_defaults(), Slic3r::GUI::GUI_App::set_label_clr_modified(), Slic3r::GUI::GUI_App::set_label_clr_sys(), Slic3r::GUI::GUI_App::set_mode_palette(), Slic3r::GUI::GUI_App::show_downloader_registration_dialog(), Slic3r::GUI::Plater::priv::undo_redo_to(), update_config_dir(), update_last_output_dir(), Slic3r::GUI::PageMaterials::update_lists(), update_skein_dir(), Slic3r::GUI::GUI_App::window_pos_restore(), and Slic3r::GUI::GUI_App::window_pos_save().

+ Here is the caller graph for this function:

◆ set_defaults()

void Slic3r::AppConfig::set_defaults ( )
61{
62 if (m_mode == EAppMode::Editor) {
63 // Reset the empty fields to defaults.
64 if (get("autocenter").empty())
65 set("autocenter", "0");
66 // Disable background processing by default as it is not stable.
67 if (get("background_processing").empty())
68 set("background_processing", "0");
69 // Enable support issues alerts by default
70 if (get("alert_when_supports_needed").empty())
71 set("alert_when_supports_needed", "1");
72 // If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
73 // By default, Prusa has the controller hidden.
74 if (get("no_controller").empty())
75 set("no_controller", "1");
76 // If set, the "- default -" selections of print/filament/printer are suppressed, if there is a valid preset available.
77 if (get("no_defaults").empty())
78 set("no_defaults", "1");
79 if (get("no_templates").empty())
80 set("no_templates", "0");
81 if (get("show_incompatible_presets").empty())
82 set("show_incompatible_presets", "0");
83
84 if (get("show_drop_project_dialog").empty())
85 set("show_drop_project_dialog", "1");
86 if (get("drop_project_action").empty())
87 set("drop_project_action", "1");
88
89 if (get("preset_update").empty())
90 set("preset_update", "1");
91
92 if (get("export_sources_full_pathnames").empty())
93 set("export_sources_full_pathnames", "0");
94
95#ifdef _WIN32
96 if (get("associate_3mf").empty())
97 set("associate_3mf", "0");
98 if (get("associate_stl").empty())
99 set("associate_stl", "0");
100
101 if (get("tabs_as_menu").empty())
102 set("tabs_as_menu", "0");
103#endif // _WIN32
104
105 // remove old 'use_legacy_opengl' parameter from this config, if present
106 if (!get("use_legacy_opengl").empty())
107 erase("", "use_legacy_opengl");
108
109#ifdef __APPLE__
110 if (get("use_retina_opengl").empty())
111 set("use_retina_opengl", "1");
112#endif
113
114 if (get("single_instance").empty())
115 set("single_instance",
116#ifdef __APPLE__
117 "1"
118#else // __APPLE__
119 "0"
120#endif // __APPLE__
121 );
122
123 if (get("remember_output_path").empty())
124 set("remember_output_path", "1");
125
126 if (get("remember_output_path_removable").empty())
127 set("remember_output_path_removable", "1");
128
129 if (get("use_custom_toolbar_size").empty())
130 set("use_custom_toolbar_size", "0");
131
132 if (get("custom_toolbar_size").empty())
133 set("custom_toolbar_size", "100");
134
135 if (get("auto_toolbar_size").empty())
136 set("auto_toolbar_size", "100");
137
138 if (get("notify_release").empty())
139 set("notify_release", "all"); // or "none" or "release"
140
141#if ENABLE_ENVIRONMENT_MAP
142 if (get("use_environment_map").empty())
143 set("use_environment_map", "0");
144#endif // ENABLE_ENVIRONMENT_MAP
145
146 if (get("use_inches").empty())
147 set("use_inches", "0");
148
149 if (get("default_action_on_close_application").empty())
150 set("default_action_on_close_application", "none"); // , "discard" or "save"
151
152 if (get("default_action_on_select_preset").empty())
153 set("default_action_on_select_preset", "none"); // , "transfer", "discard" or "save"
154
155 if (get("default_action_on_new_project").empty())
156 set("default_action_on_new_project", "none"); // , "keep(transfer)", "discard" or "save"
157
158 if (get("color_mapinulation_panel").empty())
159 set("color_mapinulation_panel", "0");
160
161 if (get("order_volumes").empty())
162 set("order_volumes", "1");
163
164 if (get("non_manifold_edges").empty())
165 set("non_manifold_edges", "1");
166
167 if (get("clear_undo_redo_stack_on_new_project").empty())
168 set("clear_undo_redo_stack_on_new_project", "1");
169 }
170 else {
171#ifdef _WIN32
172 if (get("associate_gcode").empty())
173 set("associate_gcode", "0");
174#endif // _WIN32
175 }
176
177 if (get("seq_top_layer_only").empty())
178 set("seq_top_layer_only", "1");
179
180 if (get("use_perspective_camera").empty())
181 set("use_perspective_camera", "1");
182
183 if (get("use_free_camera").empty())
184 set("use_free_camera", "0");
185
186 if (get("reverse_mouse_wheel_zoom").empty())
187 set("reverse_mouse_wheel_zoom", "0");
188
189 if (get("show_splash_screen").empty())
190 set("show_splash_screen", "1");
191
192 if (get("restore_win_position").empty())
193 set("restore_win_position", "1"); // allowed values - "1", "0", "crashed_at_..."
194
195 if (get("show_hints").empty())
196 set("show_hints", "1");
197
198 if (get("allow_auto_color_change").empty())
199 set("allow_auto_color_change", "1");
200
201 if (get("allow_ip_resolve").empty())
202 set("allow_ip_resolve", "1");
203
204#ifdef _WIN32
205 if (get("use_legacy_3DConnexion").empty())
206 set("use_legacy_3DConnexion", "0");
207
208 if (get("dark_color_mode").empty())
209 set("dark_color_mode", "0");
210
211 if (get("sys_menu_enabled").empty())
212 set("sys_menu_enabled", "1");
213#endif // _WIN32
214
215 // Remove legacy window positions/sizes
216 erase("", "main_frame_maximized");
217 erase("", "main_frame_pos");
218 erase("", "main_frame_size");
219 erase("", "object_settings_maximized");
220 erase("", "object_settings_pos");
221 erase("", "object_settings_size");
222}
bool erase(const std::string &section, const std::string &key)
Definition AppConfig.cpp:484
bool empty(const BoundingBoxBase< PointType, PointsType > &bb)
Definition BoundingBox.hpp:229

References Editor, Slic3r::empty(), erase(), get(), m_mode, and set().

Referenced by load(), and reset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_legacy_datadir()

void Slic3r::AppConfig::set_legacy_datadir ( bool  value)
inline
135{ m_legacy_datadir = value; }

References m_legacy_datadir.

Referenced by Slic3r::GUI::ConfigWizard::run().

+ Here is the caller graph for this function:

◆ set_mouse_device()

bool Slic3r::AppConfig::set_mouse_device ( const std::string &  name,
double  translation_speed,
double  translation_deadzone,
float  rotation_speed,
float  rotation_deadzone,
double  zoom_speed,
bool  swap_yz 
)
632{
633 const std::string key = std::string("mouse_device:") + name;
634 auto it_section = m_storage.find(key);
635 if (it_section == m_storage.end())
636 it_section = m_storage.insert({ key, {} }).first;
637 auto &dst = it_section->second;
638
639 std::map<std::string, std::string> src;
640 src["translation_speed"] = float_to_string_decimal_point(translation_speed);
641 src["translation_deadzone"] = float_to_string_decimal_point(translation_deadzone);
642 src["rotation_speed"] = float_to_string_decimal_point(rotation_speed);
643 src["rotation_deadzone"] = float_to_string_decimal_point(rotation_deadzone);
644 src["zoom_speed"] = float_to_string_decimal_point(zoom_speed);
645 src["swap_yz"] = swap_yz ? "1" : "0";
646
647 if (src != dst) {
648 dst = std::move(src);
649 m_dirty = true;
650 return true;
651 } else
652 return false;
653}
std::string float_to_string_decimal_point(double value, int precision)
Definition LocalesUtils.cpp:74

References Slic3r::float_to_string_decimal_point(), m_dirty, and m_storage.

Referenced by Slic3r::GUI::Mouse3DController::save_config().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_recent_projects()

bool Slic3r::AppConfig::set_recent_projects ( const std::vector< std::string > &  recent_projects)
608{
609 static constexpr const char *section = "recent_projects";
610 auto it_section = m_storage.find(section);
611 if (it_section == m_storage.end()) {
612 if (recent_projects.empty())
613 return false;
614 it_section = m_storage.insert({ std::string(section), {} }).first;
615 }
616 auto &dst = it_section->second;
617
618 std::map<std::string, std::string> src;
619 for (unsigned int i = 0; i < (unsigned int)recent_projects.size(); ++i)
620 src[std::to_string(i + 1)] = recent_projects[i];
621
622 if (src != dst) {
623 dst = std::move(src);
624 m_dirty = true;
625 return true;
626 } else
627 return false;
628}

References m_dirty, and m_storage.

◆ set_section()

bool Slic3r::AppConfig::set_section ( const std::string &  section,
std::map< std::string, std::string >  data 
)
499{
500 auto it_section = m_storage.find(section);
501 if (it_section == m_storage.end()) {
502 if (data.empty())
503 return false;
504 it_section = m_storage.insert({ section, {} }).first;
505 }
506 auto &dst = it_section->second;
507 if (dst == data)
508 return false;
509 dst = std::move(data);
510 m_dirty = true;
511 return true;
512}

References m_dirty, and m_storage.

Referenced by Slic3r::GUI::ConfigWizard::priv::apply_config(), Slic3r::GUI::EmbossStylesSerializable::store_style(), and Slic3r::GUI::EmbossStylesSerializable::store_style_index().

+ Here is the caller graph for this function:

◆ set_variant()

bool Slic3r::AppConfig::set_variant ( const std::string &  vendor,
const std::string &  model,
const std::string &  variant,
bool  enable 
)
533{
534 if (enable) {
535 if (get_variant(vendor, model, variant))
536 return false;
537 m_vendors[vendor][model].insert(variant);
538 } else {
539 auto it_v = m_vendors.find(vendor);
540 if (it_v == m_vendors.end())
541 return false;
542 auto it_m = it_v->second.find(model);
543 if (it_m == it_v->second.end())
544 return false;
545 auto it_var = it_m->second.find(variant);
546 if (it_var == it_m->second.end())
547 return false;
548 it_m->second.erase(it_var);
549 }
550 // If we got here, there was an update
551 m_dirty = true;
552 return true;
553}
bool get_variant(const std::string &vendor, const std::string &model, const std::string &variant) const
Definition AppConfig.cpp:524

References get_variant(), m_dirty, and m_vendors.

Referenced by Slic3r::GUI::PagePrinters::PagePrinters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_vendors() [1/3]

bool Slic3r::AppConfig::set_vendors ( const AppConfig from)
inline
110{ return this->set_vendors(from.vendors()); }
bool set_vendors(const AppConfig &from)
Definition AppConfig.hpp:110

References set_vendors(), and vendors().

Referenced by Slic3r::GUI::ConfigWizard::priv::apply_config(), Slic3r::GUI::Config::Snapshot::export_vendor_configs(), Slic3r::GUI::ConfigWizard::priv::load_vendors(), and set_vendors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_vendors() [2/3]

bool Slic3r::AppConfig::set_vendors ( const VendorMap vendors)
556{
557 if (m_vendors != vendors) {
559 m_dirty = true;
560 return true;
561 } else
562 return false;
563}
const VendorMap & vendors() const
Definition AppConfig.hpp:113

References m_dirty, m_vendors, and vendors().

+ Here is the call graph for this function:

◆ set_vendors() [3/3]

bool Slic3r::AppConfig::set_vendors ( VendorMap &&  vendors)
566{
567 if (m_vendors != vendors) {
568 m_vendors = std::move(vendors);
569 m_dirty = true;
570 return true;
571 } else
572 return false;
573}

References m_dirty, m_vendors, and vendors().

+ Here is the call graph for this function:

◆ update_config_dir()

bool Slic3r::AppConfig::update_config_dir ( const std::string &  dir)
667{
668 return this->set("recent", "config_directory", dir);
669}

References set().

+ Here is the call graph for this function:

◆ update_last_output_dir()

bool Slic3r::AppConfig::update_last_output_dir ( const std::string &  dir,
const bool  removable = false 
)
711{
712 return this->set("", (removable ? "last_output_path_removable" : "last_output_path"), dir);
713}

References set().

Referenced by Slic3r::GUI::Plater::export_gcode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_skein_dir()

bool Slic3r::AppConfig::update_skein_dir ( const std::string &  dir)
672{
673 if (is_shapes_dir(dir))
674 return false; // do not save "shapes gallery" directory
675 return this->set("recent", "skein_directory", dir);
676}

References Slic3r::is_shapes_dir(), and set().

+ Here is the call graph for this function:

◆ vendors()

const VendorMap & Slic3r::AppConfig::vendors ( ) const
inline
113{ return m_vendors; }

References m_vendors.

Referenced by Slic3r::GUI::PageVendors::PageVendors(), Slic3r::GUI::ConfigWizard::priv::apply_config(), Slic3r::GUI::Config::Snapshot::equal_to_active(), set_vendors(), set_vendors(), set_vendors(), and Slic3r::GUI::Config::SnapshotDB::take_snapshot().

+ Here is the caller graph for this function:

◆ version_check_url()

std::string Slic3r::AppConfig::version_check_url ( ) const
740{
741 auto from_settings = get("version_check_url");
742 return from_settings.empty() ? VERSION_CHECK_URL : from_settings;
743}
static const std::string VERSION_CHECK_URL
Definition AppConfig.cpp:38

References get(), and Slic3r::VERSION_CHECK_URL.

Referenced by Slic3r::GUI::GUI_App::app_version_check(), and Slic3r::PresetUpdater::priv::set_download_prefs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_dirty

◆ m_legacy_datadir

bool Slic3r::AppConfig::m_legacy_datadir
private

◆ m_mode

EAppMode Slic3r::AppConfig::m_mode { EAppMode::Editor }
private

Referenced by config_path(), load(), save(), and set_defaults().

◆ m_orig_version

Semver Slic3r::AppConfig::m_orig_version
private

Referenced by load(), orig_version(), and reset().

◆ m_storage

◆ m_vendors

VendorMap Slic3r::AppConfig::m_vendors
private

◆ SECTION_EMBOSS_STYLE

◆ SECTION_FILAMENTS

◆ SECTION_MATERIALS


The documentation for this class was generated from the following files: