diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index ed6b0c1714..a2e4e20374 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -23,7 +23,6 @@ #include #include #include "libslic3r/PrintBase.hpp" -#include "slic3r/Utils/json_diff.hpp" #include #include #include @@ -78,12 +77,10 @@ #include #include #include -//add json logic -#include "nlohmann/json.hpp" - -using namespace nlohmann; #endif +#include "nlohmann/json.hpp" + #include #include #include @@ -157,6 +154,7 @@ using namespace nlohmann; #include namespace fs = boost::filesystem; +using json = nlohmann::json; #ifdef __WXGTK__ #if __has_include() @@ -3524,7 +3522,7 @@ int CLI::run(int argc, char **argv) ConfigOptionStrings *curr_variant_opt = m_print_config.option("filament_extruder_variant"); if (!curr_variant_opt) { curr_variant_opt = m_print_config.option("filament_extruder_variant", true); - std::vector& filament_variants = curr_variant_opt->values; + std::vector& filament_variants = curr_variant_opt->values; filament_variants.resize(filament_count, get_extruder_variant_string(etDirectDrive, nvtStandard)); } const ConfigOptionStrings *new_variant_opt = dynamic_cast(config.option("filament_extruder_variant", true)); @@ -6554,7 +6552,7 @@ int CLI::run(int argc, char **argv) std::vector result_filaments; //result_filaments.reserve(conflict_filaments.size()); std::set_intersection(conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), - unprintable_filament_vec[index].end(), insert_iterator>(result_filaments, result_filaments.begin())); + unprintable_filament_vec[index].end(), std::insert_iterator>(result_filaments, result_filaments.begin())); conflict_filament_vector = result_filaments; } } diff --git a/src/libslic3r/AppConfig.hpp b/src/libslic3r/AppConfig.hpp index 122ca83d11..3afb2bb138 100644 --- a/src/libslic3r/AppConfig.hpp +++ b/src/libslic3r/AppConfig.hpp @@ -15,8 +15,6 @@ #include "libslic3r/Semver.hpp" #include "calib.hpp" -using namespace nlohmann; - #define ENV_DEV_HOST "0" #define ENV_QAT_HOST "1" #define ENV_PRE_HOST "2" diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index a6936d70a9..dc4056dda1 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -87,6 +87,7 @@ #include "libslic3r/GCode/Thumbnails.hpp" namespace fs = boost::filesystem; +using json = nlohmann::json; using boost::property_tree::ptree; diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index eb8321e4bd..4edcc70656 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -87,6 +87,8 @@ // This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions. //#define SLIC3R_PROFILE_USE_PRESETS_SUBDIR +using json = nlohmann::json; + namespace Slic3r { // Project-level options imported from a loaded 3MF into project_config. s_project_options_published diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 77010cbf9d..339e545842 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -1587,7 +1587,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo { std::vector result_filaments; //result_filaments.reserve(conflict_filaments.size()); - std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), insert_iterator>(result_filaments, result_filaments.begin())); + std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), std::insert_iterator>(result_filaments, result_filaments.begin())); conflict_filament_vector = result_filaments; } } diff --git a/src/slic3r/GUI/Auxiliary.cpp b/src/slic3r/GUI/Auxiliary.cpp index bb952e8ae0..1827032b29 100644 --- a/src/slic3r/GUI/Auxiliary.cpp +++ b/src/slic3r/GUI/Auxiliary.cpp @@ -69,6 +69,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/Auxiliary.hpp b/src/slic3r/GUI/Auxiliary.hpp index c7fb89f920..4f25aab439 100644 --- a/src/slic3r/GUI/Auxiliary.hpp +++ b/src/slic3r/GUI/Auxiliary.hpp @@ -11,7 +11,7 @@ #include "slic3r/GUI/Widgets/Button.hpp" #include "slic3r/GUI/Widgets/ComboBox.hpp" #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -246,7 +246,7 @@ public: void create_folder(wxString name = wxEmptyString); std::string replaceSpace(std::string s, std::string ts, std::string ns); void on_import_file(wxCommandEvent &event); - void Reload(wxString aux_path, std::map> paths); + void Reload(wxString aux_path, std::map> paths); void update_all_panel(); void update_all_cover(); diff --git a/src/slic3r/GUI/BindDialog.cpp b/src/slic3r/GUI/BindDialog.cpp index c16bcf016d..2f1283b790 100644 --- a/src/slic3r/GUI/BindDialog.cpp +++ b/src/slic3r/GUI/BindDialog.cpp @@ -26,7 +26,7 @@ #include #include "slic3r/GUI/BBLStatusBarBind.hpp" #include "slic3r/GUI/Jobs/BindJob.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/Jobs/Worker.hpp" #include @@ -54,6 +54,8 @@ #include "DeviceCore/DevManager.h" +using json = nlohmann::json; + namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 24591ae0f8..efe7bc16ba 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -25,7 +25,7 @@ #include "slic3r/GUI/Widgets/RadioBox.hpp" #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include "slic3r/GUI/GUI_Utils.hpp" #include "slic3r/GUI/Widgets/Label.hpp" @@ -91,6 +91,8 @@ #define SELECT_ALL_OPTION_COLOUR wxColour("#009688") #define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC") +using json = nlohmann::json; + namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/DeviceCore/DevAxis.cpp b/src/slic3r/GUI/DeviceCore/DevAxis.cpp index 1274054507..5dc0245a3a 100644 --- a/src/slic3r/GUI/DeviceCore/DevAxis.cpp +++ b/src/slic3r/GUI/DeviceCore/DevAxis.cpp @@ -1,10 +1,12 @@ #include "DevAxis.h" #include "DevUtil.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceCore/DevDefs.h" +using json = nlohmann::json; + namespace Slic3r { diff --git a/src/slic3r/GUI/DeviceCore/DevAxis.h b/src/slic3r/GUI/DeviceCore/DevAxis.h index d543132e49..6e8b3ef20d 100644 --- a/src/slic3r/GUI/DeviceCore/DevAxis.h +++ b/src/slic3r/GUI/DeviceCore/DevAxis.h @@ -2,7 +2,6 @@ #include #include #include -#include "slic3r/Utils/json_diff.hpp" namespace Slic3r { @@ -22,7 +21,7 @@ public: bool IsArchCoreXY() const; public: - void ParseAxis(const json &print_json); + void ParseAxis(const nlohmann::json &print_json); int Ctrl_GoHome(); int Ctrl_Axis(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // xyz e diff --git a/src/slic3r/GUI/DeviceCore/DevAxisCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevAxisCtrl.cpp index ee9c8f00e8..6178a0e1ce 100644 --- a/src/slic3r/GUI/DeviceCore/DevAxisCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevAxisCtrl.cpp @@ -1,11 +1,13 @@ #include "DevAxis.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include #include #include +using json = nlohmann::json; + namespace Slic3r { diff --git a/src/slic3r/GUI/DeviceCore/DevBed.cpp b/src/slic3r/GUI/DeviceCore/DevBed.cpp index 134de17e30..48ab32f947 100644 --- a/src/slic3r/GUI/DeviceCore/DevBed.cpp +++ b/src/slic3r/GUI/DeviceCore/DevBed.cpp @@ -1,7 +1,9 @@ #include "DevBed.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" +using json = nlohmann::json; + namespace Slic3r { void DevBed::ParseV1_0(const json &print_json, DevBed *system) diff --git a/src/slic3r/GUI/DeviceCore/DevBed.h b/src/slic3r/GUI/DeviceCore/DevBed.h index dcdb698449..ddfd1e8902 100644 --- a/src/slic3r/GUI/DeviceCore/DevBed.h +++ b/src/slic3r/GUI/DeviceCore/DevBed.h @@ -1,6 +1,5 @@ #pragma once #include -#include "slic3r/Utils/json_diff.hpp" namespace Slic3r { @@ -16,8 +15,8 @@ public: public: - static void ParseV1_0(const json &print_json, DevBed *system); - static void ParseV2_0(const json &print_json, DevBed *system); + static void ParseV1_0(const nlohmann::json &print_json, DevBed *system); + static void ParseV2_0(const nlohmann::json &print_json, DevBed *system); private: diff --git a/src/slic3r/GUI/DeviceCore/DevCalib.cpp b/src/slic3r/GUI/DeviceCore/DevCalib.cpp index 61566c83ed..ec1e55a247 100644 --- a/src/slic3r/GUI/DeviceCore/DevCalib.cpp +++ b/src/slic3r/GUI/DeviceCore/DevCalib.cpp @@ -1,6 +1,6 @@ #include #include -#include "json_diff.hpp" +#include #include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/DeviceManager.hpp" @@ -22,6 +22,8 @@ #include "DevFilaSystem.h" #include "DevConfig.h" +using json = nlohmann::json; + namespace Slic3r { static float string_to_float(const std::string &str_value) diff --git a/src/slic3r/GUI/DeviceCore/DevCalib.h b/src/slic3r/GUI/DeviceCore/DevCalib.h index 54f5f4b053..f0600424e2 100644 --- a/src/slic3r/GUI/DeviceCore/DevCalib.h +++ b/src/slic3r/GUI/DeviceCore/DevCalib.h @@ -2,7 +2,6 @@ #include #include #include -#include "slic3r/Utils/json_diff.hpp" #include "DevDefs.h" @@ -86,11 +85,11 @@ public: std::vector GetFlowRatioResult() const {return m_flow_ratio_results; } protected: - void ExtrusionCalibSetParse(const json &jj); - void ExtrusionCalibSelectParse(const json &jj); - void ExtrusionCalibGetTableParse(const json &jj); - void ExtrusionCalibGetResultParse(const json &jj); - void FlowrateGetResultParse(const json &jj); + void ExtrusionCalibSetParse(const nlohmann::json &jj); + void ExtrusionCalibSelectParse(const nlohmann::json &jj); + void ExtrusionCalibGetTableParse(const nlohmann::json &jj); + void ExtrusionCalibGetResultParse(const nlohmann::json &jj); + void FlowrateGetResultParse(const nlohmann::json &jj); private: MachineObject* m_owner{nullptr}; @@ -119,11 +118,11 @@ private: bool m_calib_finished{false}; public: - static void ParseCalibVersion(const json& j, DevCalib* system); + static void ParseCalibVersion(const nlohmann::json& j, DevCalib* system); static void ParseSupportNewAutoCalib(int flag, DevCalib* system); - static void ParseV1_0(const json& print_json, DevCalib* system, bool key_field_only); + static void ParseV1_0(const nlohmann::json& print_json, DevCalib* system, bool key_field_only); }; } // namespace Slic3r \ No newline at end of file diff --git a/src/slic3r/GUI/DeviceCore/DevChamber.cpp b/src/slic3r/GUI/DeviceCore/DevChamber.cpp index 8cd47481f2..3c1a0c8e8b 100644 --- a/src/slic3r/GUI/DeviceCore/DevChamber.cpp +++ b/src/slic3r/GUI/DeviceCore/DevChamber.cpp @@ -3,9 +3,11 @@ #include "DevConfig.h" #include "DevUtil.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" +using json = nlohmann::json; + namespace Slic3r { bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); } diff --git a/src/slic3r/GUI/DeviceCore/DevChamber.h b/src/slic3r/GUI/DeviceCore/DevChamber.h index 6fcafabcf2..0e6464a839 100644 --- a/src/slic3r/GUI/DeviceCore/DevChamber.h +++ b/src/slic3r/GUI/DeviceCore/DevChamber.h @@ -1,7 +1,6 @@ #pragma once #include #include -#include "slic3r/Utils/json_diff.hpp" namespace Slic3r { @@ -25,10 +24,10 @@ public: // getter public: // setter - void ParseChamber(const json &print_json); + void ParseChamber(const nlohmann::json &print_json); - void ParseChamberV1_0(const json& print_json); - void ParseChamberV2_0(const json& print_json); + void ParseChamberV1_0(const nlohmann::json& print_json); + void ParseChamberV2_0(const nlohmann::json& print_json); // control int CtrlSetChamberTemp(int temp); diff --git a/src/slic3r/GUI/DeviceCore/DevChamberCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevChamberCtrl.cpp index 01201998ce..13ab7bccc9 100644 --- a/src/slic3r/GUI/DeviceCore/DevChamberCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevChamberCtrl.cpp @@ -1,8 +1,10 @@ #include "DevChamber.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include +using json = nlohmann::json; + namespace Slic3r { int DevChamber::CtrlSetChamberTemp(int temp) diff --git a/src/slic3r/GUI/DeviceCore/DevConfig.cpp b/src/slic3r/GUI/DeviceCore/DevConfig.cpp index cce5257527..9833731040 100644 --- a/src/slic3r/GUI/DeviceCore/DevConfig.cpp +++ b/src/slic3r/GUI/DeviceCore/DevConfig.cpp @@ -2,7 +2,6 @@ #include "DevConfig.h" #include "DevUtil.h" -#include "json_diff.hpp" using namespace nlohmann; diff --git a/src/slic3r/GUI/DeviceCore/DevConfig.h b/src/slic3r/GUI/DeviceCore/DevConfig.h index b0cdcb936e..9fa26d9238 100644 --- a/src/slic3r/GUI/DeviceCore/DevConfig.h +++ b/src/slic3r/GUI/DeviceCore/DevConfig.h @@ -1,7 +1,7 @@ #pragma once #include "libslic3r/CommonDefs.hpp" -#include "slic3r/Utils/json_diff.hpp" +#include #include #include @@ -47,11 +47,11 @@ public: public: /*Setters*/ - void ParseConfig(const json& print_json); + void ParseConfig(const nlohmann::json& print_json); - void ParseChamberConfig(const json& print_json); // chamber - void ParsePrintOptionsConfig(const json& print_json); // print options - void ParseCalibrationConfig(const json& print_json); //cali + 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; diff --git a/src/slic3r/GUI/DeviceCore/DevConfigUtil.cpp b/src/slic3r/GUI/DeviceCore/DevConfigUtil.cpp index e6679f4463..b0a6f2678c 100644 --- a/src/slic3r/GUI/DeviceCore/DevConfigUtil.cpp +++ b/src/slic3r/GUI/DeviceCore/DevConfigUtil.cpp @@ -1,6 +1,6 @@ #include "DevConfigUtil.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include diff --git a/src/slic3r/GUI/DeviceCore/DevCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevCtrl.cpp index 56547e2a03..011d9228a0 100644 --- a/src/slic3r/GUI/DeviceCore/DevCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevCtrl.cpp @@ -4,7 +4,6 @@ #include "DevCtrl.h" // TODO: remove this include -#include "json_diff.hpp" #include "slic3r/GUI/DeviceManager.hpp" using namespace nlohmann; diff --git a/src/slic3r/GUI/DeviceCore/DevCtrl.h b/src/slic3r/GUI/DeviceCore/DevCtrl.h index 55d0dc4c3e..6b38cc1569 100644 --- a/src/slic3r/GUI/DeviceCore/DevCtrl.h +++ b/src/slic3r/GUI/DeviceCore/DevCtrl.h @@ -1,6 +1,6 @@ #pragma once -#include "slic3r/Utils/json_diff.hpp" +#include #include #include #include @@ -15,7 +15,7 @@ class DevCtrlInfo { public: DevCtrlInfo() {}; - DevCtrlInfo(MachineObject* obj, int sequence_id, const json& req_json, int interval_max = 3, int interval_min = 0); + DevCtrlInfo(MachineObject* obj, int sequence_id, const nlohmann::json& req_json, int interval_max = 3, int interval_min = 0); public: bool CheckCanUpdateData(const nlohmann::json& jj); @@ -32,7 +32,7 @@ private: time_t m_request_time = 0; int m_request_seq = 0; - json m_request_json = json(); + nlohmann::json m_request_json = nlohmann::json(); // check int m_request_interval_max = 3; diff --git a/src/slic3r/GUI/DeviceCore/DevExtensionTool.h b/src/slic3r/GUI/DeviceCore/DevExtensionTool.h index 8ce33b6e43..0b16c95a90 100644 --- a/src/slic3r/GUI/DeviceCore/DevExtensionTool.h +++ b/src/slic3r/GUI/DeviceCore/DevExtensionTool.h @@ -3,7 +3,7 @@ #include #include "libslic3r/CommonDefs.hpp" -#include "slic3r/Utils/json_diff.hpp" +#include #include #include "DevDefs.h" diff --git a/src/slic3r/GUI/DeviceCore/DevExtruderSystem.cpp b/src/slic3r/GUI/DeviceCore/DevExtruderSystem.cpp index 20975a7ca3..5013d85228 100644 --- a/src/slic3r/GUI/DeviceCore/DevExtruderSystem.cpp +++ b/src/slic3r/GUI/DeviceCore/DevExtruderSystem.cpp @@ -15,7 +15,6 @@ #include "DevFilaSystem.h" // complete type for GetFilaSystem()->GetTrayIndexMap() in GetBackupAmsSlotInGroup // TODO: remove this include -#include "json_diff.hpp" #include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/I18N.hpp" diff --git a/src/slic3r/GUI/DeviceCore/DevExtruderSystem.h b/src/slic3r/GUI/DeviceCore/DevExtruderSystem.h index 4d9f7c9abf..e7e083050f 100644 --- a/src/slic3r/GUI/DeviceCore/DevExtruderSystem.h +++ b/src/slic3r/GUI/DeviceCore/DevExtruderSystem.h @@ -5,7 +5,7 @@ #include #include "libslic3r/CommonDefs.hpp" -#include "slic3r/Utils/json_diff.hpp" +#include #include #include diff --git a/src/slic3r/GUI/DeviceCore/DevFan.cpp b/src/slic3r/GUI/DeviceCore/DevFan.cpp index 52ac9f1d76..c4fc80116b 100644 --- a/src/slic3r/GUI/DeviceCore/DevFan.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFan.cpp @@ -6,7 +6,6 @@ #include #include #include -#include "json_diff.hpp" #include "slic3r/GUI/DeviceManager.hpp" using namespace nlohmann; diff --git a/src/slic3r/GUI/DeviceCore/DevFan.h b/src/slic3r/GUI/DeviceCore/DevFan.h index 393c8a477c..b36705a19b 100644 --- a/src/slic3r/GUI/DeviceCore/DevFan.h +++ b/src/slic3r/GUI/DeviceCore/DevFan.h @@ -2,7 +2,6 @@ #include #include #include -#include "slic3r/Utils/json_diff.hpp" #include #include @@ -13,7 +12,7 @@ namespace Slic3r { class MachineObject; enum AirDuctType { AIR_FAN_TYPE, AIR_DOOR_TYPE }; -typedef std::function CommandCallBack; +typedef std::function CommandCallBack; enum AIR_FUN : int { FAN_HEAT_BREAK_0_IDX = 0, @@ -123,14 +122,14 @@ public: AirDuctData GetAirDuctData() { return m_air_duct_data; }; void converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun); // Convert the data to duct type to make the newand old protocols consistent - int command_handle_response(const json &response); + int command_handle_response(const nlohmann::json &response); int command_control_fan(int fan_type, int val); // Old protocol int command_control_fan_new(int fan_id, int val); // New protocol int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb); - void ParseV1_0(const json &print_json); - void ParseV2_0(const json &print_json); - void ParseV3_0(const json &print_json); + void ParseV1_0(const nlohmann::json &print_json); + void ParseV2_0(const nlohmann::json &print_json); + void ParseV3_0(const nlohmann::json &print_json); public: bool GetSupportAirduct() { return is_support_airduct; }; diff --git a/src/slic3r/GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp index cc8312ce9a..f86838729c 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFilaAmsSettingCtrl.cpp @@ -1,11 +1,13 @@ #include "DevFilaAmsSetting.h" #include "DevFilaSystem.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include #include "slic3r/GUI/DeviceCore/DevCtrl.h" +using json = nlohmann::json; + namespace Slic3r { int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx) { diff --git a/src/slic3r/GUI/DeviceCore/DevFilaBlackList.cpp b/src/slic3r/GUI/DeviceCore/DevFilaBlackList.cpp index c499b89622..ef921c5620 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaBlackList.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFilaBlackList.cpp @@ -14,7 +14,6 @@ #include "slic3r/GUI/DeviceCore/DevDefs.h" #include "DevFilaBlackList.h" -#include "json_diff.hpp" #include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/GUI/DeviceManager.hpp" #include "DevFilaSystem.h" diff --git a/src/slic3r/GUI/DeviceCore/DevFilaBlackList.h b/src/slic3r/GUI/DeviceCore/DevFilaBlackList.h index 1f727396a8..43e50360b9 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaBlackList.h +++ b/src/slic3r/GUI/DeviceCore/DevFilaBlackList.h @@ -5,7 +5,7 @@ #include #include #include -#include "slic3r/Utils/json_diff.hpp" +#include namespace Slic3r { @@ -67,7 +67,7 @@ public: static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info); public: - static json filaments_blacklist; + static nlohmann::json filaments_blacklist; };// class DevFilaBlacklist }// namespace Slic3r diff --git a/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp b/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp index 14880a6ef3..8644047e64 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFilaSystem.cpp @@ -18,7 +18,6 @@ #include #include #include "DevFilaSystem.h" -#include "json_diff.hpp" #include "slic3r/Utils/NetworkAgent.hpp" #include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId diff --git a/src/slic3r/GUI/DeviceCore/DevFilaSystem.h b/src/slic3r/GUI/DeviceCore/DevFilaSystem.h index 32edc06a32..27dc238e9e 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaSystem.h +++ b/src/slic3r/GUI/DeviceCore/DevFilaSystem.h @@ -1,6 +1,6 @@ #pragma once #include "libslic3r/CommonDefs.hpp" -#include "slic3r/Utils/json_diff.hpp" +#include #include "DevDefs.h" #include "DevFilaAmsSetting.h" @@ -415,9 +415,9 @@ private: class DevFilaSystemParser { public: - static void ParseV1_0(const json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only); + static void ParseV1_0(const nlohmann::json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only); - static void ParseAgentFilament(const json& data, MachineObject* obj, DevFilaSystem* system); + static void ParseAgentFilament(const nlohmann::json& data, MachineObject* obj, DevFilaSystem* system); }; struct DevFilamentDryingPreset diff --git a/src/slic3r/GUI/DeviceCore/DevFilaSystemCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevFilaSystemCtrl.cpp index 16121f00d2..e7181580cd 100644 --- a/src/slic3r/GUI/DeviceCore/DevFilaSystemCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevFilaSystemCtrl.cpp @@ -2,7 +2,6 @@ #include #include "DevFilaSystem.h" -#include "json_diff.hpp" #include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include using namespace nlohmann; diff --git a/src/slic3r/GUI/DeviceCore/DevFirmware.h b/src/slic3r/GUI/DeviceCore/DevFirmware.h index 1b251144e5..bc0a0f0168 100644 --- a/src/slic3r/GUI/DeviceCore/DevFirmware.h +++ b/src/slic3r/GUI/DeviceCore/DevFirmware.h @@ -1,11 +1,9 @@ #pragma once #include "DevFirmware.h" -#include "slic3r/Utils/json_diff.hpp" #include #include #include -#include "slic3r/Utils/json_diff.hpp" namespace Slic3r { @@ -51,10 +49,10 @@ public: bool isCuttingModule() const { return product_name.Contains("Cutting Module"); } bool isRotary() const { return product_name.Contains("Rotary"); }// Rotary Attachment bool isExtinguishSystem() const { return product_name.Contains("Extinguishing System"); }// Auto Fire Extinguishing System - bool isWTM() const { return name.find("wtm") != string::npos; } // nozzle + bool isWTM() const { return name.find("wtm") != std::string::npos; } // nozzle bool isExhaustFan() const { return product_name.Contains("Exhaust Fan"); } - bool isHmshub() const { return product_name.find("Filament Buffer") != string::npos; } - bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != string::npos; } + bool isHmshub() const { return product_name.find("Filament Buffer") != std::string::npos; } + bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != std::string::npos; } }; diff --git a/src/slic3r/GUI/DeviceCore/DevHMS.cpp b/src/slic3r/GUI/DeviceCore/DevHMS.cpp index 456e806170..b696542658 100644 --- a/src/slic3r/GUI/DeviceCore/DevHMS.cpp +++ b/src/slic3r/GUI/DeviceCore/DevHMS.cpp @@ -2,10 +2,12 @@ #include "DevHMS.h" #include #include -#include "json_diff.hpp" +#include #include #include +using json = nlohmann::json; + namespace Slic3r { diff --git a/src/slic3r/GUI/DeviceCore/DevHMS.h b/src/slic3r/GUI/DeviceCore/DevHMS.h index 82022833cf..1e499f3aea 100644 --- a/src/slic3r/GUI/DeviceCore/DevHMS.h +++ b/src/slic3r/GUI/DeviceCore/DevHMS.h @@ -1,6 +1,6 @@ #pragma once -#include "slic3r/Utils/json_diff.hpp" +#include #include #include #include @@ -18,7 +18,7 @@ public: DevHMS(MachineObject* obj) : m_object(obj) {} public: - void ParseHMSItems(const json& hms_json); + void ParseHMSItems(const nlohmann::json& hms_json); const std::vector& GetHMSItems() const { return m_hms_list; }; private: @@ -69,7 +69,7 @@ public: bool has_read() const { return m_already_read; }; protected: - friend void DevHMS::ParseHMSItems(const json& hms_json); + friend void DevHMS::ParseHMSItems(const nlohmann::json& hms_json); bool parse_hms_info(unsigned attr, unsigned code); private: diff --git a/src/slic3r/GUI/DeviceCore/DevLampCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevLampCtrl.cpp index 5190632b5b..fefad1479f 100644 --- a/src/slic3r/GUI/DeviceCore/DevLampCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevLampCtrl.cpp @@ -3,7 +3,6 @@ #include "DevLamp.h" // TODO: remove this include -#include "json_diff.hpp" #include "slic3r/GUI/DeviceManager.hpp" using namespace nlohmann; diff --git a/src/slic3r/GUI/DeviceCore/DevManager.cpp b/src/slic3r/GUI/DeviceCore/DevManager.cpp index 0fd5ed2cc0..c04321e71f 100644 --- a/src/slic3r/GUI/DeviceCore/DevManager.cpp +++ b/src/slic3r/GUI/DeviceCore/DevManager.cpp @@ -23,7 +23,6 @@ #include "DevUtil.h" // TODO: remove this include -#include "json_diff.hpp" #include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/GUI_App.hpp" diff --git a/src/slic3r/GUI/DeviceCore/DevManager.h b/src/slic3r/GUI/DeviceCore/DevManager.h index 5ab3eed01b..1a669d0aee 100644 --- a/src/slic3r/GUI/DeviceCore/DevManager.h +++ b/src/slic3r/GUI/DeviceCore/DevManager.h @@ -3,7 +3,6 @@ #include #include "libslic3r/CommonDefs.hpp" -#include "slic3r/Utils/json_diff.hpp" #include #include #include diff --git a/src/slic3r/GUI/DeviceCore/DevMappingNozzle.cpp b/src/slic3r/GUI/DeviceCore/DevMappingNozzle.cpp index ee935a58a0..5eb0defa93 100644 --- a/src/slic3r/GUI/DeviceCore/DevMappingNozzle.cpp +++ b/src/slic3r/GUI/DeviceCore/DevMappingNozzle.cpp @@ -6,7 +6,6 @@ #include "DevUtil.h" #include "DevUtilBackend.h" -#include "json_diff.hpp" #include "libslic3r/MultiNozzleUtils.hpp" #include "slic3r/GUI/DeviceManager.hpp" diff --git a/src/slic3r/GUI/DeviceCore/DevNozzleRack.h b/src/slic3r/GUI/DeviceCore/DevNozzleRack.h index 28c7990b78..a5388eb2f2 100644 --- a/src/slic3r/GUI/DeviceCore/DevNozzleRack.h +++ b/src/slic3r/GUI/DeviceCore/DevNozzleRack.h @@ -1,7 +1,7 @@ #pragma once #include "libslic3r/CommonDefs.hpp" #include "libslic3r/MultiNozzleUtils.hpp" -#include "slic3r/Utils/json_diff.hpp" +#include #include "DevNozzleSystem.h" #include "DevFirmware.h" diff --git a/src/slic3r/GUI/DeviceCore/DevNozzleRackCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevNozzleRackCtrl.cpp index e8d720a324..484eb77098 100644 --- a/src/slic3r/GUI/DeviceCore/DevNozzleRackCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevNozzleRackCtrl.cpp @@ -1,7 +1,7 @@ #include "DevNozzleRack.h" #include "DevExtruderSystem.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/MsgDialog.hpp" #include "slic3r/GUI/I18N.hpp" @@ -14,6 +14,8 @@ #include "slic3r/GUI/DeviceCore/DevNozzleSystem.h" +using json = nlohmann::json; + namespace Slic3r { diff --git a/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp b/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp index 70eec0f795..98d5d5bd5f 100644 --- a/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp +++ b/src/slic3r/GUI/DeviceCore/DevNozzleSystem.cpp @@ -4,7 +4,7 @@ #include "DevNozzleSystem.h" #include "DevUtil.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/I18N.hpp" @@ -28,6 +28,8 @@ #include #include +using json = nlohmann::json; + namespace Slic3r { diff --git a/src/slic3r/GUI/DeviceCore/DevNozzleSystem.h b/src/slic3r/GUI/DeviceCore/DevNozzleSystem.h index f4fc97938b..040ecb58b4 100644 --- a/src/slic3r/GUI/DeviceCore/DevNozzleSystem.h +++ b/src/slic3r/GUI/DeviceCore/DevNozzleSystem.h @@ -4,7 +4,7 @@ #include "libslic3r/CommonDefs.hpp" #include "libslic3r/MultiNozzleUtils.hpp" -#include "slic3r/Utils/json_diff.hpp" +#include #include "libslic3r/PrintConfig.hpp" #include @@ -195,6 +195,6 @@ namespace Slic3r { public: static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, DevNozzleSystem* system, std::optional flag_e3d); - static void ParseV2_0(const json& device_json, DevNozzleSystem* system); + static void ParseV2_0(const nlohmann::json& device_json, DevNozzleSystem* system); }; }; diff --git a/src/slic3r/GUI/DeviceCore/DevPrintOptions.cpp b/src/slic3r/GUI/DeviceCore/DevPrintOptions.cpp index 082997e177..c80597e28b 100644 --- a/src/slic3r/GUI/DeviceCore/DevPrintOptions.cpp +++ b/src/slic3r/GUI/DeviceCore/DevPrintOptions.cpp @@ -8,9 +8,11 @@ #include #include -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" +using json = nlohmann::json; + namespace Slic3r { diff --git a/src/slic3r/GUI/DeviceCore/DevStorage.cpp b/src/slic3r/GUI/DeviceCore/DevStorage.cpp index b2bd9f06ef..04a5ff8433 100644 --- a/src/slic3r/GUI/DeviceCore/DevStorage.cpp +++ b/src/slic3r/GUI/DeviceCore/DevStorage.cpp @@ -1,8 +1,10 @@ #include "DevStorage.h" -#include "json_diff.hpp" +#include #include +using json = nlohmann::json; + namespace Slic3r { DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state) diff --git a/src/slic3r/GUI/DeviceCore/DevStorage.h b/src/slic3r/GUI/DeviceCore/DevStorage.h index 58f556499b..e436bbd9ea 100644 --- a/src/slic3r/GUI/DeviceCore/DevStorage.h +++ b/src/slic3r/GUI/DeviceCore/DevStorage.h @@ -1,7 +1,6 @@ #pragma once #include #include -#include "slic3r/Utils/json_diff.hpp" namespace Slic3r { @@ -27,7 +26,7 @@ public: SdcardState get_sdcard_state() const { return m_sdcard_state; }; SdcardState set_sdcard_state(int state); - static void ParseV1_0(const json &print_json, DevStorage *system); + static void ParseV1_0(const nlohmann::json &print_json, DevStorage *system); bool is_timelapse_storage_low(const std::string& storage) const; diff --git a/src/slic3r/GUI/DeviceCore/DevUpgrade.cpp b/src/slic3r/GUI/DeviceCore/DevUpgrade.cpp index c35ec8bfce..16ffbf21fb 100644 --- a/src/slic3r/GUI/DeviceCore/DevUpgrade.cpp +++ b/src/slic3r/GUI/DeviceCore/DevUpgrade.cpp @@ -1,7 +1,7 @@ #include "DevUpgrade.h" #include "DevUtil.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/GUI_App.hpp" @@ -13,6 +13,8 @@ #include "slic3r/GUI/DeviceCore/DevDefs.h" #include +using json = nlohmann::json; + namespace Slic3r { int DevUpgrade::GetUpgradeProgressInt() const diff --git a/src/slic3r/GUI/DeviceCore/DevUpgrade.h b/src/slic3r/GUI/DeviceCore/DevUpgrade.h index 1593f54260..7ff06b09f0 100644 --- a/src/slic3r/GUI/DeviceCore/DevUpgrade.h +++ b/src/slic3r/GUI/DeviceCore/DevUpgrade.h @@ -4,7 +4,6 @@ #include #include #include -#include "slic3r/Utils/json_diff.hpp" #include "DevDefs.h" #include "DevFirmware.h" @@ -47,8 +46,8 @@ public: int CtrlUpgradeModule(std::string url, std::string module_type, std::string version); // parser - void ParseUpgrade_V1_0(const json &print_jj); - void ParseUpgradeDisplayState(const json &upgrade_state_jj); + void ParseUpgrade_V1_0(const nlohmann::json &print_jj); + void ParseUpgradeDisplayState(const nlohmann::json &upgrade_state_jj); protected: DevUpgrade(MachineObject *owner) : m_owner(owner) {} @@ -90,7 +89,7 @@ public: public: int CtrlGetVersion(bool with_retry = true); - void ParseGetVersion(const json &print_jj); + void ParseGetVersion(const nlohmann::json &print_jj); private: MachineObject *m_owner; diff --git a/src/slic3r/GUI/DeviceCore/DevUpgradeCtrl.cpp b/src/slic3r/GUI/DeviceCore/DevUpgradeCtrl.cpp index a6d4550a2b..58aa6ce6db 100644 --- a/src/slic3r/GUI/DeviceCore/DevUpgradeCtrl.cpp +++ b/src/slic3r/GUI/DeviceCore/DevUpgradeCtrl.cpp @@ -1,10 +1,12 @@ #include "DevUpgrade.h" -#include "json_diff.hpp" +#include #include "slic3r/GUI/DeviceManager.hpp" #include #include "slic3r/GUI/DeviceCore/DevFirmware.h" +using json = nlohmann::json; + namespace Slic3r { int DevUpgrade::CtrlUpgradeConfirm() diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 392ff4587b..0eca3239b2 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1,5 +1,5 @@ #include "PrinterNetworkTypes.hpp" -#include "json_diff.hpp" +#include #include "DeviceManager.hpp" #include "HMS.hpp" #include "I18N.hpp" @@ -105,6 +105,8 @@ #include "libslic3r/PresetBundle.hpp" #include "slic3r/GUI/Jobs/SendJob.hpp" +using json = nlohmann::json; + class wxWindow; namespace fs = boost::filesystem; diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index c4a63cb588..f41a32ada7 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -63,7 +63,6 @@ #define END_SEQ_ID 30000 #define SUBSCRIBE_RETRY_COUNT 5 -using namespace nlohmann; namespace Slic3r { namespace GUI @@ -467,7 +466,7 @@ public: std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); } std::unordered_set m_command_error_code_dlgs; - void add_command_error_code_dlg(int command_err, json action_json=json{}); + void add_command_error_code_dlg(int command_err, nlohmann::json action_json=nlohmann::json{}); int curr_layer = 0; int total_layers = 0; @@ -759,9 +758,9 @@ public: int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter); int command_get_access_code(); int command_start_camera(); - int command_ack_proceed(json& proceed); + int command_ack_proceed(nlohmann::json& proceed); int command_purification_disable(); - int command_dont_remind_next_time(json& mqtt_guard_json); + int command_dont_remind_next_time(nlohmann::json& mqtt_guard_json); /* command upgrade */ int command_upgrade_confirm(); @@ -887,7 +886,7 @@ public: static bool is_in_printing_status(std::string status); void set_print_state(std::string status); - void update_print_progress(const json& value); + void update_print_progress(const nlohmann::json& value); bool is_connected(); bool is_connecting(); @@ -903,7 +902,7 @@ public: /* Msg for display MsgFn */ typedef std::function MsgFn; - int publish_json(const json& json_item, int qos = 0, int flag = 0) ; + int publish_json(const nlohmann::json& json_item, int qos = 0, int flag = 0) ; int publish_json(const std::string& json_str, int qos = 0, int flag = 0) = delete; int cloud_publish_json(std::string json_str, int qos = 0, int flag = 0); int local_publish_json(std::string json_str, int qos = 0, int flag = 0); @@ -947,16 +946,16 @@ public: * or scenarios where users want to bypass the AMS. */ std::vector vt_slot; - DevAmsTray parse_vt_tray(json vtray); + DevAmsTray parse_vt_tray(nlohmann::json vtray); /*get ams slot info*/ bool contains_tray(const std::string &ams_id, const std::string &tray_id) const; DevAmsTray get_tray(const std::string &ams_id, const std::string &tray_id) const;/*use contains_tray() check first*/ /*for parse new info*/ - bool check_enable_np(const json& print) const; - void parse_new_info(json print); - void parse_new_info2(const json& info); + bool check_enable_np(const nlohmann::json& print) const; + void parse_new_info(nlohmann::json print); + void parse_new_info2(const nlohmann::json& info); int get_flag_bits(std::string str, int start, int count = 1) const; uint32_t get_flag_bits_no_border(std::string str, int start_idx, int count = 1) const; int get_flag_bits(int num, int start, int count = 1, int base = 10) const; diff --git a/src/slic3r/GUI/ExportPresetBundleDialog.hpp b/src/slic3r/GUI/ExportPresetBundleDialog.hpp index 2038cd7677..a2a66ddbe6 100644 --- a/src/slic3r/GUI/ExportPresetBundleDialog.hpp +++ b/src/slic3r/GUI/ExportPresetBundleDialog.hpp @@ -67,7 +67,7 @@ public: void on_script_message(const nlohmann::json& payload) override; void OnRequestPresets(); - void OnExportData(const wxString& path, const wxString& name, json data); + void OnExportData(const wxString& path, const wxString& name, nlohmann::json data); protected: bool m_seq_top_layer_only_changed{false}; diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 6c56e4fa54..9c6c200050 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -2816,7 +2816,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector>>& title_columns, float extra_size = 0.0f) { + auto calculate_offsets = [max_width, window_padding](const std::vector>>& title_columns, float extra_size = 0.0f) { const ImGuiStyle& style = ImGui::GetStyle(); std::vector offsets; offsets.push_back(max_width(title_columns[0].second, title_columns[0].first, extra_size) + 3.0f * style.ItemSpacing.x + style.WindowPadding.x); @@ -2963,7 +2963,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector>> title_columns; + std::vector>> title_columns; if (displayed_columns & ColumnData::Model) { title_columns.push_back({ _u8L("Filament"), {""} }); title_columns.push_back({ _u8L("Model"), {buff} }); @@ -3184,7 +3184,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding) float ams_item_height = 0; float filament_group_item_align_width = 0; { - float three_words_width = imgui.calc_text_size("ABC"sv).x; + float three_words_width = imgui.calc_text_size(std::string_view("ABC")).x; const int line_capacity = 4; for (const auto& extruder_filaments : {m_left_extruder_filament,m_right_extruder_filament }) @@ -3195,8 +3195,8 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding) for (int j = idx; j < extruder_filaments.size() && j < idx + line_capacity; ++j) { auto text_info = imgui.calculate_filament_group_text_size(get_filament_display_type(extruder_filaments[j])); auto text_size = std::get<0>(text_info); - filament_group_item_align_width = max(filament_group_item_align_width, text_size.x); - text_line_height = max(text_line_height, text_size.y); + filament_group_item_align_width = std::max(filament_group_item_align_width, text_size.x); + text_line_height = std::max(text_line_height, text_size.y); } container_height += (three_words_width * 1.3f + text_line_height ); } @@ -3589,7 +3589,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv return ret; }; - auto calculate_offsets = [max_width, this](const std::vector>>& title_columns, float extra_size = 0.0f) { + auto calculate_offsets = [max_width, this](const std::vector>>& title_columns, float extra_size = 0.0f) { const ImGuiStyle& style = ImGui::GetStyle(); std::vector offsets; // ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size @@ -4014,7 +4014,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv total_filaments.push_back(buffer); - std::vector>> title_columns; + std::vector>> title_columns; if (displayed_columns & ColumnData::Model) { title_columns.push_back({ _u8L("Filament"), {""} }); title_columns.push_back({ _u8L("Model"), total_filaments }); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 2293a94d62..705c489863 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -311,6 +311,7 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)( using namespace std::literals; namespace pt = boost::property_tree; +using json = nlohmann::json; struct StaticBambuLib { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 2800b2b146..e807ef1d4e 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -3651,7 +3651,7 @@ void GLGizmoCut3D::perform_cut(const Selection& selection) // model_name failing reason std::vector> failed_models; auto plater = wxGetApp().plater(); - auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg, + auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const std::string &model_name, ProgressDialog &progress_dlg, std::vector &succes_models, std::vector> &failed_models) { wxString msg = _L("Repairing model object"); msg += ": " + from_u8(model_name) + "\n"; diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index a210a99656..0a5dba5a0e 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -6,7 +6,7 @@ #include "DeviceCore/DevManager.h" #include "DeviceCore/DevUtil.h" #include "Http.hpp" -#include "json_diff.hpp" +#include #include "libslic3r/AppConfig.hpp" #include @@ -26,6 +26,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; static const char* HMS_PATH = "hms"; static const char* HMS_LOCAL_IMG_PATH = "hms/local_image"; diff --git a/src/slic3r/GUI/IMSlider.cpp b/src/slic3r/GUI/IMSlider.cpp index ce2aa2ecba..c031705f14 100644 --- a/src/slic3r/GUI/IMSlider.cpp +++ b/src/slic3r/GUI/IMSlider.cpp @@ -1405,7 +1405,7 @@ void IMSlider::render_input_custom_gcode(std::string custom_gcode) } void IMSlider::do_go_to_layer(size_t layer_number) { - layer_number = clamp((int)layer_number, m_min_value, m_max_value); + layer_number = std::clamp((int)layer_number, m_min_value, m_max_value); GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number); } diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 29f2e5b403..9e5e2cc7c4 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -19,7 +19,7 @@ #include #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include "slic3r/GUI/PartPlate.hpp" #include "libslic3r/PrintConfig.hpp" @@ -39,6 +39,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 0aa0dd98c6..419b03afd3 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -1,5 +1,5 @@ #include "SendJob.hpp" -#include "json_diff.hpp" +#include #include "bambu_networking.hpp" #include "libslic3r/LifecycleEvents.hpp" #include "slic3r/GUI/I18N.hpp" @@ -23,6 +23,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 689f9eb87c..c882667d90 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -34,7 +34,7 @@ #include "slic3r/GUI/Widgets/SideMenuPopup.hpp" #include #include "libslic3r/libslic3r.h" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -155,6 +155,8 @@ #include +using json = nlohmann::json; + namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index 249db6c3d7..54ce5907fb 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -45,6 +45,8 @@ #include "../Utils/MacDarkMode.hpp" #endif +using json = nlohmann::json; + namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/ModelMall.cpp b/src/slic3r/GUI/ModelMall.cpp index 66d26f1042..e8b08f7e02 100644 --- a/src/slic3r/GUI/ModelMall.cpp +++ b/src/slic3r/GUI/ModelMall.cpp @@ -13,7 +13,7 @@ #include "slic3r/GUI/Widgets/WebView.hpp" #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -24,6 +24,8 @@ #include "GUI_App.hpp" #include "Plater.hpp" +using json = nlohmann::json; + namespace Slic3r::GUI { class Plater; } namespace Slic3r { diff --git a/src/slic3r/GUI/Monitor.cpp b/src/slic3r/GUI/Monitor.cpp index 2c800ecebb..b23c5ab468 100644 --- a/src/slic3r/GUI/Monitor.cpp +++ b/src/slic3r/GUI/Monitor.cpp @@ -15,7 +15,7 @@ #include "slic3r/GUI/StatusPanel.hpp" #include "slic3r/GUI/UpgradePanel.hpp" #include "slic3r/GUI/Widgets/SideTools.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -57,6 +57,8 @@ #include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/Widgets/Button.hpp" +using json = nlohmann::json; + namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 2613d3da9a..2fcd872390 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -631,8 +631,8 @@ private: // Aditional text after hypertext - currently not used std::string m_text2; // mark for render operation - size_t pos_start = string::npos; - size_t pos_end = string::npos; + size_t pos_start = std::string::npos; + size_t pos_end = std::string::npos; std::string error_start = ""; std::string error_end = ""; diff --git a/src/slic3r/GUI/PresetBundleDialog.cpp b/src/slic3r/GUI/PresetBundleDialog.cpp index 9c11fc67aa..c067d99c28 100644 --- a/src/slic3r/GUI/PresetBundleDialog.cpp +++ b/src/slic3r/GUI/PresetBundleDialog.cpp @@ -16,7 +16,7 @@ #include #include #include "slic3r/GUI/GUI.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -32,6 +32,9 @@ #include #include #include + +using json = nlohmann::json; + namespace Slic3r { namespace GUI { PresetBundleDialog::PresetBundleDialog( diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp index a74780660c..9ae746c6e0 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.cpp +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.cpp @@ -58,6 +58,8 @@ //#define PRINTER_FILE_SYSTEM_TEST #endif +using json = nlohmann::json; + std::string last_system_error() { return Slic3r::decode_path(std::error_code( #ifdef _WIN32 diff --git a/src/slic3r/GUI/Printer/PrinterFileSystem.h b/src/slic3r/GUI/Printer/PrinterFileSystem.h index 2748e0ae0c..337fa6931d 100644 --- a/src/slic3r/GUI/Printer/PrinterFileSystem.h +++ b/src/slic3r/GUI/Printer/PrinterFileSystem.h @@ -22,7 +22,6 @@ #include #include "nlohmann/json_fwd.hpp" -using nlohmann::json; #include #include @@ -290,17 +289,17 @@ private: static void DumpLog(void* context, int level, tchar const *msg); private: - template using Translator = std::function; + template using Translator = std::function; - typedef std::function callback_t; + typedef std::function callback_t; - typedef std::function callback_t2; + typedef std::function callback_t2; typedef std::function callback_t3; - template boost::uint32_t SendRequest(int type, json const &req, Translator const &translator, Callback const &callback, const std::string ¶m = "") + template boost::uint32_t SendRequest(int type, nlohmann::json const &req, Translator const &translator, Callback const &callback, const std::string ¶m = "") { - auto c = [translator, callback, this](int result, json const &resp, unsigned char const *data) -> int + auto c = [translator, callback, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int { T t; if (result == 0 || result == CONTINUE || result == FILE_EXIST) { @@ -323,7 +322,7 @@ private: template void InstallNotify(int type, Translator const& translator, Applier const& applier) { - auto c = [translator, applier, this](int result, json const &resp, unsigned char const *data) -> int + auto c = [translator, applier, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int { T t; if (result == 0 || result == CONTINUE) { @@ -345,7 +344,7 @@ private: InstallNotify(type, c); } - boost::uint32_t SendRequest(int type, json const &req, callback_t2 const &callback, const std::string ¶m = ""); + boost::uint32_t SendRequest(int type, nlohmann::json const &req, callback_t2 const &callback, const std::string ¶m = ""); void InstallNotify(int type, callback_t2 const &callback); diff --git a/src/slic3r/GUI/PrinterCloudAuthDialog.cpp b/src/slic3r/GUI/PrinterCloudAuthDialog.cpp index 3b1b15ea6b..4bb9824f99 100644 --- a/src/slic3r/GUI/PrinterCloudAuthDialog.cpp +++ b/src/slic3r/GUI/PrinterCloudAuthDialog.cpp @@ -6,7 +6,6 @@ #include #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include "slic3r/GUI/GUI.hpp" #include #include @@ -30,6 +29,9 @@ #include #include + +using json = nlohmann::json; + //------------------------------------------ // PrinterCloundAuthDialog //------------------------------------------ diff --git a/src/slic3r/GUI/Project.cpp b/src/slic3r/GUI/Project.cpp index 2ce0da582c..a0ed54cfe2 100644 --- a/src/slic3r/GUI/Project.cpp +++ b/src/slic3r/GUI/Project.cpp @@ -16,7 +16,7 @@ #include #include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/Auxiliary.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -54,7 +54,8 @@ #include #include "slic3r/GUI/Jobs/SendJob.hpp" #include "slic3r/GUI/Plater.hpp" -#include "slic3r/Utils/json_diff.hpp" + +using json = nlohmann::json; class wxWindow; diff --git a/src/slic3r/GUI/Project.hpp b/src/slic3r/GUI/Project.hpp index 13d234a697..3a8460e42b 100644 --- a/src/slic3r/GUI/Project.hpp +++ b/src/slic3r/GUI/Project.hpp @@ -30,7 +30,6 @@ #include #include "nlohmann/json.hpp" -#include "slic3r/Utils/json_diff.hpp" #include #include @@ -109,7 +108,7 @@ public: void OnScriptMessage(wxWebViewEvent& evt); void RunScript(std::string content); - std::map> Reload(wxString aux_path); + std::map> Reload(wxString aux_path); std::string formatBytes(unsigned long bytes); wxString to_base64(std::string path); }; diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index 67dc80ca6d..11b62728f2 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -74,6 +74,8 @@ #include "slic3r/Utils/NetworkAgent.hpp" #include +using json = nlohmann::json; + namespace Slic3r::GUI { class Plater; } namespace fs = boost::filesystem; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 5d51e5429f..3a23889c6c 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -62,7 +62,7 @@ #include #include #include "libslic3r/Config.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -133,6 +133,8 @@ #include "slic3r/Utils/NetworkAgent.hpp" #include +using json = nlohmann::json; + namespace Slic3r { class PrintBase; } namespace fs = boost::filesystem; diff --git a/src/slic3r/GUI/SendMultiMachinePage.cpp b/src/slic3r/GUI/SendMultiMachinePage.cpp index c66a0f6055..acf4fe11b5 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.cpp +++ b/src/slic3r/GUI/SendMultiMachinePage.cpp @@ -26,7 +26,7 @@ #include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/PartPlate.hpp" #include "libslic3r/PrintConfig.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include "slic3r/GUI/MsgDialog.hpp" #include "slic3r/GUI/Widgets/Label.hpp" #include "slic3r/GUI/Widgets/TextInput.hpp" @@ -77,6 +77,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 4a17aff571..af908c0c80 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -23,7 +23,7 @@ #include #include "slic3r/GUI/wxMediaCtrl3.h" #include "slic3r/GUI/Widgets/StaticBox.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include "libslic3r/calib.hpp" @@ -689,7 +689,7 @@ protected: int m_last_vcamera = -1; int m_model_mall_request_count = 0; bool m_is_load_with_temp = false; - json m_rating_result; + nlohmann::json m_rating_result; wxWebRequest web_request; bool bed_temp_input = false; diff --git a/src/slic3r/GUI/SyncAmsInfoDialog.cpp b/src/slic3r/GUI/SyncAmsInfoDialog.cpp index f4c59088bd..a9dba84871 100644 --- a/src/slic3r/GUI/SyncAmsInfoDialog.cpp +++ b/src/slic3r/GUI/SyncAmsInfoDialog.cpp @@ -15,7 +15,7 @@ #include "libslic3r/Utils.hpp" #include #include "slic3r/GUI/BBLStatusBarPrint.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include "libslic3r/PrintConfig.hpp" #include @@ -85,6 +85,7 @@ #include "slic3r/Utils/NetworkAgent.hpp" namespace fs = boost::filesystem; +using json = nlohmann::json; using namespace Slic3r; using namespace Slic3r::GUI; diff --git a/src/slic3r/GUI/TaskManager.cpp b/src/slic3r/GUI/TaskManager.cpp index 8170da5a34..712bfea67e 100644 --- a/src/slic3r/GUI/TaskManager.cpp +++ b/src/slic3r/GUI/TaskManager.cpp @@ -20,7 +20,6 @@ #include #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" using namespace nlohmann; diff --git a/src/slic3r/GUI/UserManager.cpp b/src/slic3r/GUI/UserManager.cpp index cdc2bfcaf5..44e21223a8 100644 --- a/src/slic3r/GUI/UserManager.cpp +++ b/src/slic3r/GUI/UserManager.cpp @@ -1,4 +1,4 @@ -#include "json_diff.hpp" +#include #include "UserManager.hpp" #include "BindDialog.hpp" #include "GUI_App.hpp" @@ -10,6 +10,8 @@ #include +using json = nlohmann::json; + namespace Slic3r { UserManager::UserManager(NetworkAgent* agent) diff --git a/src/slic3r/GUI/UserManager.hpp b/src/slic3r/GUI/UserManager.hpp index a7f402cbac..9e80e23bbe 100644 --- a/src/slic3r/GUI/UserManager.hpp +++ b/src/slic3r/GUI/UserManager.hpp @@ -9,12 +9,9 @@ #include #include #include "nlohmann/json.hpp" -#include "slic3r/Utils/json_diff.hpp" #include "slic3r/Utils/NetworkAgent.hpp" -using namespace nlohmann; - namespace Slic3r { class NetworkAgent; diff --git a/src/slic3r/GUI/WebDownPluginDlg.cpp b/src/slic3r/GUI/WebDownPluginDlg.cpp index 93c8c77d46..0bb93ef55b 100644 --- a/src/slic3r/GUI/WebDownPluginDlg.cpp +++ b/src/slic3r/GUI/WebDownPluginDlg.cpp @@ -4,7 +4,7 @@ #include "slic3r/GUI/GUI.hpp" #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include "I18N.hpp" diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 665280aca9..8ca85d4119 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -36,7 +36,7 @@ #include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetCacheFormat.hpp" #include "slic3r/GUI/GUI_App.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include "libslic3r_version.h" #include @@ -78,7 +78,6 @@ #include "libslic3r/PrintConfig.hpp" #include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/PresetUpdater.hpp" -#include "slic3r/Utils/json_diff.hpp" class wxWindow; diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index bf7c7d9365..0f35a90a09 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -5,7 +5,6 @@ #include "slic3r/GUI/HttpServer.hpp" #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include "slic3r/GUI/GUI.hpp" #include #include diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index d46615328b..f73eec6abd 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -24,7 +24,7 @@ #include #include #include -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include #include #include @@ -44,6 +44,7 @@ #include namespace pt = boost::property_tree; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/Widgets/FanControl.cpp b/src/slic3r/GUI/Widgets/FanControl.cpp index adb440d876..a6352ebd1d 100644 --- a/src/slic3r/GUI/Widgets/FanControl.cpp +++ b/src/slic3r/GUI/Widgets/FanControl.cpp @@ -3,7 +3,7 @@ #include "../I18N.hpp" #include "../GUI_App.hpp" #include "../MsgDialog.hpp" -#include "json_diff.hpp" +#include #include #include @@ -28,6 +28,8 @@ #include #include +using json = nlohmann::json; + namespace Slic3r { namespace GUI { wxDEFINE_EVENT(EVT_FAN_SWITCH_ON, wxCommandEvent); diff --git a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp index 2fe66de8de..de863bd06d 100644 --- a/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp +++ b/src/slic3r/GUI/Widgets/MultiNozzleSync.cpp @@ -12,7 +12,7 @@ #include "Label.hpp" #include "ComboBox.hpp" #include "StaticBox.hpp" -#include "json_diff.hpp" +#include #include "libslic3r/PresetBundle.hpp" #include "libslic3r/Utils.hpp" @@ -55,6 +55,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/GUI/WipeTowerDialog.cpp b/src/slic3r/GUI/WipeTowerDialog.cpp index 8e2b0fcb9c..3aaee6b849 100644 --- a/src/slic3r/GUI/WipeTowerDialog.cpp +++ b/src/slic3r/GUI/WipeTowerDialog.cpp @@ -38,11 +38,12 @@ #include "Widgets/Label.hpp" #include "MainFrame.hpp" #include "libslic3r/PresetBundle.hpp" -#include "slic3r/GUI/Printer/PrinterFileSystem.h" +#include #include "slic3r/GUI/Jobs/SendJob.hpp" -#include "slic3r/Utils/json_diff.hpp" #include +using json = nlohmann::json; + class wxWindow; namespace fs = boost::filesystem; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 5babf843bc..56b58b5c57 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -453,7 +453,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in, const bool menu_bitmap/* = false*/, const bool resize/* = false*/, const bool bitmap2/* = false*/, - const vector& array_new_color/* = vector*/)//used for semi transparent material) + const std::vector& array_new_color/* = vector*/)//used for semi transparent material) { static Slic3r::GUI::BitmapCache cache; @@ -501,7 +501,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in, wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::BitmapCache& cache, wxWindow* win/* = nullptr*/ , const int px_cnt/* = 16*/, const bool grayscale/* = false*/ , const bool resize/* = false*/ , - const vector& array_new_color/* = vector()*/) // color witch will used instead of orange + const std::vector& array_new_color/* = vector()*/) // color witch will used instead of orange { unsigned int width = 0; // win may be nullptr; see create_scaled_bitmap() above. diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index f0fcdd53e6..2a4ca8c05a 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -6,7 +6,7 @@ #include "NetworkAgent.hpp" #include "../GUI/Jobs/ProgressIndicator.hpp" #include "../GUI/PartPlate.hpp" -#include "json_diff.hpp" +#include #include "libslic3r/CutUtils.hpp" #include "libslic3r/ClipperUtils.hpp" #include "libslic3r/Utils.hpp" @@ -61,6 +61,7 @@ #include namespace fs = boost::filesystem; +using json = nlohmann::json; namespace Slic3r { namespace GUI { diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 90807eb723..ee67950b20 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -38,7 +38,7 @@ #include #include -#include "json_diff.hpp" +#include #include "libslic3r/format.hpp" #include "libslic3r/Utils.hpp" #include "libslic3r/PresetBundle.hpp" @@ -58,6 +58,8 @@ #include "slic3r/GUI/MarkdownTip.hpp" #include "libslic3r/miniz_extension.hpp" +using json = nlohmann::json; + namespace Slic3r::GUI::Config { class Snapshot; } namespace Slic3r::GUI::Config { class SnapshotDB; } diff --git a/src/slic3r/Utils/json_diff.hpp b/src/slic3r/Utils/json_diff.hpp index 6ba5a1b8e4..bb88e78c7f 100644 --- a/src/slic3r/Utils/json_diff.hpp +++ b/src/slic3r/Utils/json_diff.hpp @@ -8,7 +8,6 @@ #include "nlohmann/json.hpp" -using json = nlohmann::json; using namespace std; class json_diff @@ -16,25 +15,25 @@ class json_diff private: std::string printer_type; std::string printer_version = "00.00.00.00"; - json settings_base; - json full_message; + nlohmann::json settings_base; + nlohmann::json full_message; - json diff2all_base; - json all2diff_base; + nlohmann::json diff2all_base; + nlohmann::json all2diff_base; int decode_error_count = 0; - int diff_objects(json const &in, json &out, json const &base); - int restore_objects(json const &in, json &out, json const &base); - int restore_append_objects(json const &in, json &out); - void merge_objects(json const &in, json &out); + int diff_objects(nlohmann::json const &in, nlohmann::json &out, nlohmann::json const &base); + int restore_objects(nlohmann::json const &in, nlohmann::json &out, nlohmann::json const &base); + int restore_append_objects(nlohmann::json const &in, nlohmann::json &out); + void merge_objects(nlohmann::json const &in, nlohmann::json &out); public: bool load_compatible_settings(std::string const &type, std::string const &version); - int all2diff(json const &in, json &out); - int diff2all(json const &in, json &out); - int all2diff_base_reset(json const &base); - int diff2all_base_reset(json &base); - void compare_print(json &a, json &b); + int all2diff(nlohmann::json const &in, nlohmann::json &out); + int diff2all(nlohmann::json const &in, nlohmann::json &out); + int all2diff_base_reset(nlohmann::json const &base); + int diff2all_base_reset(nlohmann::json &base); + void compare_print(nlohmann::json &a, nlohmann::json &b); bool is_need_request(); };