mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 04:08:02 -06:00
AppConfig modified to generate a separate config file for the standalone gcodeviewer
This commit is contained in:
parent
6a12e75194
commit
c94fb13369
9 changed files with 166 additions and 44 deletions
|
@ -15,11 +15,25 @@ namespace Slic3r {
|
|||
class AppConfig
|
||||
{
|
||||
public:
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
enum class EAppMode : unsigned char
|
||||
{
|
||||
Editor,
|
||||
GCodeViewer
|
||||
};
|
||||
|
||||
explicit AppConfig(EAppMode mode) :
|
||||
#else
|
||||
AppConfig() :
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
m_dirty(false),
|
||||
m_orig_version(Semver::invalid()),
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
m_mode(mode),
|
||||
#else
|
||||
m_save_enabled(true),
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
m_legacy_datadir(false)
|
||||
{
|
||||
|
@ -125,7 +139,11 @@ public:
|
|||
void reset_selections();
|
||||
|
||||
// Get the default config path from Slic3r::data_dir().
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
std::string config_path();
|
||||
#else
|
||||
static std::string config_path();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
|
||||
// Returns true if the user's data directory comes from before Slic3r 1.40.0 (no updating)
|
||||
bool legacy_datadir() const { return m_legacy_datadir; }
|
||||
|
@ -140,7 +158,11 @@ public:
|
|||
Semver orig_version() const { return m_orig_version; }
|
||||
|
||||
// Does the config file exist?
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
bool exists();
|
||||
#else
|
||||
static bool exists();
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
|
||||
std::vector<std::string> get_recent_projects() const;
|
||||
void set_recent_projects(const std::vector<std::string>& recent_projects);
|
||||
|
@ -161,7 +183,9 @@ public:
|
|||
{ return get_3dmouse_device_numeric_value(name, "swap_yz", swap); }
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
void enable_save(bool enable) { m_save_enabled = enable; }
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
static const std::string SECTION_FILAMENTS;
|
||||
|
@ -182,6 +206,10 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_APP_CONFIG
|
||||
EAppMode m_mode { EAppMode::Editor };
|
||||
#endif // ENABLE_GCODE_APP_CONFIG
|
||||
|
||||
// Map of section, name -> value
|
||||
std::map<std::string, std::map<std::string, std::string>> m_storage;
|
||||
// Map of enabled vendors / models / variants
|
||||
|
@ -191,8 +219,10 @@ private:
|
|||
// Original version found in the ini file before it was overwritten
|
||||
Semver m_orig_version;
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
#if !ENABLE_GCODE_APP_CONFIG
|
||||
// Whether or not calls to save() should take effect
|
||||
bool m_save_enabled;
|
||||
#endif // !ENABLE_GCODE_APP_CONFIG
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
// Whether the existing version is before system profiles & configuration updating
|
||||
bool m_legacy_datadir;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue