From c0d8e68606b9fbda4c576fd4e3dbb0e4c900d12d Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 28 Apr 2018 18:18:10 -0500 Subject: [PATCH] working on higher-level cpp Slic3r::Config that has a similar interface to the old Perl one. --- src/GUI/Settings.hpp | 7 ++++++- xs/src/libslic3r/Config.hpp | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 xs/src/libslic3r/Config.hpp diff --git a/src/GUI/Settings.hpp b/src/GUI/Settings.hpp index 9c135cec3..bc391ae87 100644 --- a/src/GUI/Settings.hpp +++ b/src/GUI/Settings.hpp @@ -25,7 +25,7 @@ enum class ReloadBehavior { }; /// Stub class to hold onto GUI-specific settings options. -/// TODO: Incorporate a copy of Slic3r::Config +/// TODO: Incorporate the system from libslic3r class Settings { public: bool show_host {false}; @@ -50,9 +50,14 @@ class Settings { const wxString version { wxString(SLIC3R_VERSION) }; void save_settings(); + void load_settings(); /// Storage for window positions std::map > window_pos { std::map >() }; + + private: + const std::string LogChannel {"GUI_Settings"}; //< Which log these messages should go to. + }; }} //namespace Slic3r::GUI diff --git a/xs/src/libslic3r/Config.hpp b/xs/src/libslic3r/Config.hpp new file mode 100644 index 000000000..265cc2201 --- /dev/null +++ b/xs/src/libslic3r/Config.hpp @@ -0,0 +1,21 @@ +#ifndef CONFIG_HPP +#define CONFIG_HPP + +#include "PrintConfig.hpp" + +namespace Slic3r { + +class Config : DynamicPrintConfig { +public: + static Config *new_from_defaults(); + static Config *new_from_cli(const &argc, const char* argv[]); + + void write_ini(const std::string& file) { save(file); } + void read_ini(const std::string& file) { load(file); } + + +}; + +} // namespace Slic3r + +#endif // CONFIG_HPP