mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-15 20:01:31 +00:00
* Stop Leaking json Through Headers and Drop Includes Kept Only for the Name AppConfig.hpp, DeviceManager.hpp and UserManager.hpp carried a global "using namespace nlohmann;", json_diff.hpp a global "using json = nlohmann::json;" and PrinterFileSystem.h a global "using nlohmann::json;". Every file that included one of them, directly or not, could write a bare json, and 63 did without declaring it. The last two also made the include checker treat json_diff.hpp and PrinterFileSystem.h as the headers that provide json, so they were included from files that use nothing else from them: 57 of the 59 includers of json_diff.hpp never name json_diff. The five statements are removed. Headers that use the type now spell nlohmann::json, source files declare their own "using json = nlohmann::json;", and the includes that only supplied the name are dropped or replaced by <nlohmann/json.hpp>. Eight files reached json_diff.hpp only through an include that is now gone and with it lost that header's "using namespace std;". The std names they used unqualified are qualified. * Declare json in OrcaSlicer.cpp on Every Platform OrcaSlicer.cpp had its "using namespace nlohmann;" and the json include inside the Linux-only include block, so on Windows and macOS it took json from AppConfig.hpp's global directive, which is gone. The include and a "using json = nlohmann::json;" now sit outside the block.
85 lines
3.0 KiB
C++
85 lines
3.0 KiB
C++
#pragma once
|
|
#include "libslic3r/CommonDefs.hpp"
|
|
|
|
#include <nlohmann/json.hpp>
|
|
#include <wx/string.h>
|
|
|
|
#include <limits>
|
|
#include <optional>
|
|
|
|
namespace Slic3r
|
|
{
|
|
|
|
//Previous definitions
|
|
class MachineObject;
|
|
|
|
|
|
class DevConfig
|
|
{
|
|
public:
|
|
DevConfig(MachineObject* obj) : m_obj(obj) {};
|
|
~DevConfig() = default;
|
|
|
|
public:
|
|
// chamber
|
|
bool HasChamber() const { return m_has_chamber; }
|
|
bool SupportChamberTempDisplay() const;
|
|
bool SupportChamberEdit() const { return m_support_chamber_edit; }
|
|
int GetChamberTempEditMin() const { return m_chamber_temp_edit_min; }
|
|
int GetChamberTempEditMax() const { return m_chamber_temp_edit_max; }
|
|
int GetChamberTempSwitchHeat() const { return m_chamber_temp_switch_heat; }
|
|
|
|
// print options
|
|
bool SupportFirstLayerInspect() const { return m_support_first_layer_inspect; }
|
|
bool SupportSaveRemotePrintFileToStorage() const { return m_support_save_remote_print_file_to_storage; }
|
|
bool SupportAIMonitor() const { return m_support_ai_monitor; }
|
|
|
|
bool SupportPrintWithoutSD() const { return m_support_print_without_sd; }
|
|
bool SupportPrintAllPlates() const { return m_support_print_all; }
|
|
|
|
// calibration options
|
|
bool SupportCalibrationLidar() const { return m_support_calibration_lidar; }
|
|
bool SupportCalibrationNozzleOffset() const { return m_support_calibration_nozzle_offset; }
|
|
bool SupportCalibrationHighTempBed() const { return m_support_calibration_high_temp_bed; }
|
|
bool SupportCaliClumpPos() const { return m_support_calibration_clump_pos; }
|
|
|
|
bool SupportCalibrationPA_FlowAuto() const { return m_support_calibration_pa_flow_auto; }
|
|
|
|
public:
|
|
/*Setters*/
|
|
void ParseConfig(const nlohmann::json& print_json);
|
|
|
|
void ParseChamberConfig(const nlohmann::json& print_json); // chamber
|
|
void ParsePrintOptionsConfig(const nlohmann::json& print_json); // print options
|
|
void ParseCalibrationConfig(const nlohmann::json& print_json); //cali
|
|
|
|
private:
|
|
[[maybe_unused]] MachineObject* m_obj;
|
|
|
|
/*configure vals*/
|
|
// chamber
|
|
bool m_has_chamber = false; // whether the machine has a chamber
|
|
std::optional<bool> m_support_chamber_temp_display;
|
|
bool m_support_chamber_edit = false;
|
|
int m_chamber_temp_edit_min = 0;
|
|
int m_chamber_temp_edit_max = 60;
|
|
int m_chamber_temp_switch_heat = std::numeric_limits<int>::max(); /* the min temp to start heating, default to max */
|
|
|
|
// print options
|
|
bool m_support_first_layer_inspect = false;
|
|
bool m_support_save_remote_print_file_to_storage = false;
|
|
bool m_support_ai_monitor = false;
|
|
|
|
bool m_support_print_without_sd = false;
|
|
bool m_support_print_all = false;
|
|
|
|
// calibration options
|
|
bool m_support_calibration_lidar = false;
|
|
bool m_support_calibration_nozzle_offset = false;
|
|
bool m_support_calibration_high_temp_bed = false; // High-temperature Heatbed Calibration
|
|
bool m_support_calibration_clump_pos = false; // clump position calibration
|
|
|
|
bool m_support_calibration_pa_flow_auto = false;// PA flow calibration. used in SendPrint
|
|
};
|
|
|
|
}; |