Compare commits

..
Author SHA1 Message Date
Hanif Koh 7412dab76a Flag Global Usings in Headers with clang-tidy
A using-directive or using-declaration in the global namespace of a
header reaches every file that includes it, and a using-declaration also
makes the include checker treat that header as the one to include for
the name. google-global-names-in-headers reports both, on changed lines
like the existing check, so headers that still have one are not held to
it until the line is touched.

The check does not see a using inside a namespace.

clang_tidy_diff.py's closing message assumed every finding was a missing
include; it now says other findings need a manual fix.
2026-10-07 01:38:53 +08:00
94 changed files with 187 additions and 221 deletions
+9 -4
View File
@@ -1,10 +1,15 @@
# clang-tidy configuration, enforced by the clang-tidy CI job on the lines a pull
# request changes (scripts/clang_tidy_diff.py). Only missing includes are reported
# for now: a file should include the header for every symbol it uses, not rely on
# the precompiled header or another header's includes. Run with --fix to add them.
# request changes (scripts/clang_tidy_diff.py). Two things are reported.
# Missing includes: a file should include the header for every symbol it uses, not
# rely on the precompiled header or another header's includes. Run with --fix to
# add them.
# Using-directives and using-declarations in the global namespace of a header:
# they reach every file that includes the header, and a using-declaration also
# makes the header look like the one to include for that name. Qualify the name
# in the header, and put the using in the source files that want it.
# Every check listed here gates pull requests, so enable a new one only once the
# code it flags on touched lines is reasonable to fix in passing.
Checks: '-*,misc-include-cleaner'
Checks: '-*,misc-include-cleaner,google-global-names-in-headers'
WarningsAsErrors: '*'
CheckOptions:
# Missing includes only. Builds without the precompiled header break on these.
+3 -2
View File
@@ -311,11 +311,12 @@ def main():
for path in fixed:
print(f" {path}")
if failed and fixed:
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not add.")
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not fix.")
return 1
if failed:
print(f"\nclang-tidy failed on {len(failed)} file(s). Add the includes it names, or apply its "
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows).")
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows). "
"Other findings need a manual fix.")
return 1
print("clang-tidy passed.")
return 0
+7 -5
View File
@@ -23,6 +23,7 @@
#include <map>
#include <vector>
#include "libslic3r/PrintBase.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <cerrno>
#include <utility>
@@ -77,10 +78,12 @@
#include <condition_variable>
#include <mutex>
#include <boost/thread.hpp>
#endif
//add json logic
#include "nlohmann/json.hpp"
using namespace nlohmann;
#endif
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <boost/nowide/args.hpp>
@@ -154,7 +157,6 @@
#include <stdio.h>
namespace fs = boost::filesystem;
using json = nlohmann::json;
#ifdef __WXGTK__
#if __has_include(<X11/Xlib.h>)
@@ -3522,7 +3524,7 @@ int CLI::run(int argc, char **argv)
ConfigOptionStrings *curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant");
if (!curr_variant_opt) {
curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant", true);
std::vector<std::string>& filament_variants = curr_variant_opt->values;
std::vector<string>& filament_variants = curr_variant_opt->values;
filament_variants.resize(filament_count, get_extruder_variant_string(etDirectDrive, nvtStandard));
}
const ConfigOptionStrings *new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_extruder_variant", true));
@@ -6552,7 +6554,7 @@ int CLI::run(int argc, char **argv)
std::vector<int> 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(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin()));
conflict_filament_vector = result_filaments;
}
}
+2
View File
@@ -15,6 +15,8 @@
#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"
-1
View File
@@ -87,7 +87,6 @@
#include "libslic3r/GCode/Thumbnails.hpp"
namespace fs = boost::filesystem;
using json = nlohmann::json;
using boost::property_tree::ptree;
-2
View File
@@ -87,8 +87,6 @@
// 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
+1 -1
View File
@@ -1580,7 +1580,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
{
std::vector<int> 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(), std::insert_iterator<std::vector<int>>(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(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin()));
conflict_filament_vector = result_filaments;
}
}
-1
View File
@@ -69,7 +69,6 @@
#include <wx/dcmemory.h>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
+2 -2
View File
@@ -11,7 +11,7 @@
#include "slic3r/GUI/Widgets/Button.hpp"
#include "slic3r/GUI/Widgets/ComboBox.hpp"
#include <string>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/notebook.h>
#include <wx/scrolwin.h>
#include <wx/sizer.h>
@@ -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<std::string, std::vector<nlohmann::json>> paths);
void Reload(wxString aux_path, std::map<std::string, std::vector<json>> paths);
void update_all_panel();
void update_all_cover();
+1 -3
View File
@@ -26,7 +26,7 @@
#include <memory>
#include "slic3r/GUI/BBLStatusBarBind.hpp"
#include "slic3r/GUI/Jobs/BindJob.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "slic3r/GUI/Jobs/Worker.hpp"
#include <utility>
@@ -54,8 +54,6 @@
#include "DeviceCore/DevManager.h"
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -25,7 +25,7 @@
#include "slic3r/GUI/Widgets/RadioBox.hpp"
#include <cstdio>
#include <map>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <cstdlib>
#include "slic3r/GUI/GUI_Utils.hpp"
#include "slic3r/GUI/Widgets/Label.hpp"
@@ -91,8 +91,6 @@
#define SELECT_ALL_OPTION_COLOUR wxColour("#009688")
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -1,12 +1,10 @@
#include "DevAxis.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/DeviceCore/DevDefs.h"
using json = nlohmann::json;
namespace Slic3r
{
+2 -1
View File
@@ -2,6 +2,7 @@
#include <memory>
#include <nlohmann/json.hpp>
#include <string>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -21,7 +22,7 @@ public:
bool IsArchCoreXY() const;
public:
void ParseAxis(const nlohmann::json &print_json);
void ParseAxis(const 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
+1 -3
View File
@@ -1,13 +1,11 @@
#include "DevAxis.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
#include <cstdlib>
#include <cstdio>
using json = nlohmann::json;
namespace Slic3r
{
+1 -3
View File
@@ -1,9 +1,7 @@
#include "DevBed.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r {
void DevBed::ParseV1_0(const json &print_json, DevBed *system)
+3 -2
View File
@@ -1,5 +1,6 @@
#pragma once
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -15,8 +16,8 @@ public:
public:
static void ParseV1_0(const nlohmann::json &print_json, DevBed *system);
static void ParseV2_0(const nlohmann::json &print_json, DevBed *system);
static void ParseV1_0(const json &print_json, DevBed *system);
static void ParseV2_0(const json &print_json, DevBed *system);
private:
+1 -3
View File
@@ -1,6 +1,6 @@
#include <algorithm>
#include <boost/log/trivial.hpp>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
@@ -22,8 +22,6 @@
#include "DevFilaSystem.h"
#include "DevConfig.h"
using json = nlohmann::json;
namespace Slic3r {
static float string_to_float(const std::string &str_value)
+8 -7
View File
@@ -2,6 +2,7 @@
#include <nlohmann/json.hpp>
#include <optional>
#include <vector>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h"
@@ -85,11 +86,11 @@ public:
std::vector<FlowRatioCalibResult> GetFlowRatioResult() const {return m_flow_ratio_results; }
protected:
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);
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);
private:
MachineObject* m_owner{nullptr};
@@ -118,11 +119,11 @@ private:
bool m_calib_finished{false};
public:
static void ParseCalibVersion(const nlohmann::json& j, DevCalib* system);
static void ParseCalibVersion(const json& j, DevCalib* system);
static void ParseSupportNewAutoCalib(int flag, DevCalib* system);
static void ParseV1_0(const nlohmann::json& print_json, DevCalib* system, bool key_field_only);
static void ParseV1_0(const json& print_json, DevCalib* system, bool key_field_only);
};
} // namespace Slic3r
+1 -3
View File
@@ -3,11 +3,9 @@
#include "DevConfig.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r {
bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); }
+4 -3
View File
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -24,10 +25,10 @@ public: // getter
public:
// setter
void ParseChamber(const nlohmann::json &print_json);
void ParseChamber(const json &print_json);
void ParseChamberV1_0(const nlohmann::json& print_json);
void ParseChamberV2_0(const nlohmann::json& print_json);
void ParseChamberV1_0(const json& print_json);
void ParseChamberV2_0(const json& print_json);
// control
int CtrlSetChamberTemp(int temp);
+1 -3
View File
@@ -1,10 +1,8 @@
#include "DevChamber.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
using json = nlohmann::json;
namespace Slic3r {
int DevChamber::CtrlSetChamberTemp(int temp)
+1
View File
@@ -2,6 +2,7 @@
#include "DevConfig.h"
#include "DevUtil.h"
#include "json_diff.hpp"
using namespace nlohmann;
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <wx/string.h>
#include <limits>
@@ -47,11 +47,11 @@ public:
public:
/*Setters*/
void ParseConfig(const nlohmann::json& print_json);
void ParseConfig(const 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
void ParseChamberConfig(const json& print_json); // chamber
void ParsePrintOptionsConfig(const json& print_json); // print options
void ParseCalibrationConfig(const json& print_json); //cali
private:
[[maybe_unused]] MachineObject* m_obj;
+1 -1
View File
@@ -1,6 +1,6 @@
#include "DevConfigUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
+1
View File
@@ -4,6 +4,7 @@
#include "DevCtrl.h"
// TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <string>
#include <ctime>
#include <wx/string.h>
@@ -15,7 +15,7 @@ class DevCtrlInfo
{
public:
DevCtrlInfo() {};
DevCtrlInfo(MachineObject* obj, int sequence_id, const nlohmann::json& req_json, int interval_max = 3, int interval_min = 0);
DevCtrlInfo(MachineObject* obj, int sequence_id, const 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;
nlohmann::json m_request_json = nlohmann::json();
json m_request_json = json();
// check
int m_request_interval_max = 3;
+1 -1
View File
@@ -3,7 +3,7 @@
#include <optional>
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <wx/string.h>
#include "DevDefs.h"
@@ -15,6 +15,7 @@
#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"
@@ -5,7 +5,7 @@
#include <unordered_map>
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <vector>
#include <wx/string.h>
+1
View File
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include <wx/app.h>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
+6 -5
View File
@@ -2,6 +2,7 @@
#include <functional>
#include <cstdint>
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <map>
#include <vector>
@@ -12,7 +13,7 @@ namespace Slic3r {
class MachineObject;
enum AirDuctType { AIR_FAN_TYPE, AIR_DOOR_TYPE };
typedef std::function<void(const nlohmann::json &)> CommandCallBack;
typedef std::function<void(const json &)> CommandCallBack;
enum AIR_FUN : int {
FAN_HEAT_BREAK_0_IDX = 0,
@@ -122,14 +123,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 nlohmann::json &response);
int command_handle_response(const 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 nlohmann::json &print_json);
void ParseV2_0(const nlohmann::json &print_json);
void ParseV3_0(const nlohmann::json &print_json);
void ParseV1_0(const json &print_json);
void ParseV2_0(const json &print_json);
void ParseV3_0(const json &print_json);
public:
bool GetSupportAirduct() { return is_support_airduct; };
@@ -1,13 +1,11 @@
#include "DevFilaAmsSetting.h"
#include "DevFilaSystem.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
#include "slic3r/GUI/DeviceCore/DevCtrl.h"
using json = nlohmann::json;
namespace Slic3r {
int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx)
{
@@ -14,6 +14,7 @@
#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"
+2 -2
View File
@@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include <wx/string.h>
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r
{
@@ -67,7 +67,7 @@ public:
static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info);
public:
static nlohmann::json filaments_blacklist;
static json filaments_blacklist;
};// class DevFilaBlacklist
}// namespace Slic3r
@@ -18,6 +18,7 @@
#include <set>
#include <utility>
#include "DevFilaSystem.h"
#include "json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
#include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include "libslic3r/CommonDefs.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h"
#include "DevFilaAmsSetting.h"
@@ -415,9 +415,9 @@ private:
class DevFilaSystemParser
{
public:
static void ParseV1_0(const nlohmann::json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
static void ParseV1_0(const json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
static void ParseAgentFilament(const nlohmann::json& data, MachineObject* obj, DevFilaSystem* system);
static void ParseAgentFilament(const json& data, MachineObject* obj, DevFilaSystem* system);
};
struct DevFilamentDryingPreset
@@ -2,6 +2,7 @@
#include <string>
#include "DevFilaSystem.h"
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include
using namespace nlohmann;
+5 -3
View File
@@ -1,9 +1,11 @@
#pragma once
#include "DevFirmware.h"
#include "slic3r/Utils/json_diff.hpp"
#include <nlohmann/json.hpp>
#include <string>
#include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -49,10 +51,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") != std::string::npos; } // nozzle
bool isWTM() const { return name.find("wtm") != string::npos; } // nozzle
bool isExhaustFan() const { return product_name.Contains("Exhaust Fan"); }
bool isHmshub() const { return product_name.find("Filament Buffer") != std::string::npos; }
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != std::string::npos; }
bool isHmshub() const { return product_name.find("Filament Buffer") != string::npos; }
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != string::npos; }
};
+1 -3
View File
@@ -2,12 +2,10 @@
#include "DevHMS.h"
#include <string>
#include <cstdio>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include <exception>
#include <cassert>
using json = nlohmann::json;
namespace Slic3r
{
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <vector>
#include <string>
#include <wx/string.h>
@@ -18,7 +18,7 @@ public:
DevHMS(MachineObject* obj) : m_object(obj) {}
public:
void ParseHMSItems(const nlohmann::json& hms_json);
void ParseHMSItems(const json& hms_json);
const std::vector<DevHMSItem>& 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 nlohmann::json& hms_json);
friend void DevHMS::ParseHMSItems(const json& hms_json);
bool parse_hms_info(unsigned attr, unsigned code);
private:
@@ -3,6 +3,7 @@
#include "DevLamp.h"
// TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
+1
View File
@@ -23,6 +23,7 @@
#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"
+1
View File
@@ -3,6 +3,7 @@
#include <mutex>
#include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <string>
#include <vector>
#include <wx/object.h>
@@ -6,6 +6,7 @@
#include "DevUtil.h"
#include "DevUtilBackend.h"
#include "json_diff.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once
#include "libslic3r/CommonDefs.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include "DevNozzleSystem.h"
#include "DevFirmware.h"
@@ -1,7 +1,7 @@
#include "DevNozzleRack.h"
#include "DevExtruderSystem.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/MsgDialog.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -14,8 +14,6 @@
#include "slic3r/GUI/DeviceCore/DevNozzleSystem.h"
using json = nlohmann::json;
namespace Slic3r
{
@@ -4,7 +4,7 @@
#include "DevNozzleSystem.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -28,8 +28,6 @@
#include <optional>
#include <cmath>
using json = nlohmann::json;
namespace Slic3r
{
+2 -2
View File
@@ -4,7 +4,7 @@
#include "libslic3r/CommonDefs.hpp"
#include "libslic3r/MultiNozzleUtils.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <string>
@@ -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<int> flag_e3d);
static void ParseV2_0(const nlohmann::json& device_json, DevNozzleSystem* system);
static void ParseV2_0(const json& device_json, DevNozzleSystem* system);
};
};
@@ -8,11 +8,9 @@
#include <ctime>
#include <exception>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r
{
+1 -3
View File
@@ -1,10 +1,8 @@
#include "DevStorage.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include <string>
using json = nlohmann::json;
namespace Slic3r {
DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state)
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <nlohmann/json.hpp>
#include <string>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r {
@@ -26,7 +27,7 @@ public:
SdcardState get_sdcard_state() const { return m_sdcard_state; };
SdcardState set_sdcard_state(int state);
static void ParseV1_0(const nlohmann::json &print_json, DevStorage *system);
static void ParseV1_0(const json &print_json, DevStorage *system);
bool is_timelapse_storage_low(const std::string& storage) const;
+1 -3
View File
@@ -1,7 +1,7 @@
#include "DevUpgrade.h"
#include "DevUtil.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/GUI_App.hpp"
@@ -13,8 +13,6 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include <wx/string.h>
using json = nlohmann::json;
namespace Slic3r {
int DevUpgrade::GetUpgradeProgressInt() const
+4 -3
View File
@@ -4,6 +4,7 @@
#include <nlohmann/json.hpp>
#include <string>
#include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h"
#include "DevFirmware.h"
@@ -46,8 +47,8 @@ public:
int CtrlUpgradeModule(std::string url, std::string module_type, std::string version);
// parser
void ParseUpgrade_V1_0(const nlohmann::json &print_jj);
void ParseUpgradeDisplayState(const nlohmann::json &upgrade_state_jj);
void ParseUpgrade_V1_0(const json &print_jj);
void ParseUpgradeDisplayState(const json &upgrade_state_jj);
protected:
DevUpgrade(MachineObject *owner) : m_owner(owner) {}
@@ -89,7 +90,7 @@ public:
public:
int CtrlGetVersion(bool with_retry = true);
void ParseGetVersion(const nlohmann::json &print_jj);
void ParseGetVersion(const json &print_jj);
private:
MachineObject *m_owner;
+1 -3
View File
@@ -1,12 +1,10 @@
#include "DevUpgrade.h"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"
#include <string>
#include "slic3r/GUI/DeviceCore/DevFirmware.h"
using json = nlohmann::json;
namespace Slic3r {
int DevUpgrade::CtrlUpgradeConfirm()
+1 -3
View File
@@ -1,5 +1,5 @@
#include "PrinterNetworkTypes.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "DeviceManager.hpp"
#include "HMS.hpp"
#include "I18N.hpp"
@@ -105,8 +105,6 @@
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/Jobs/SendJob.hpp"
using json = nlohmann::json;
class wxWindow;
namespace fs = boost::filesystem;
+10 -9
View File
@@ -63,6 +63,7 @@
#define END_SEQ_ID 30000
#define SUBSCRIBE_RETRY_COUNT 5
using namespace nlohmann;
namespace Slic3r {
namespace GUI
@@ -466,7 +467,7 @@ public:
std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); }
std::unordered_set<GUI::DeviceErrorDialog*> m_command_error_code_dlgs;
void add_command_error_code_dlg(int command_err, nlohmann::json action_json=nlohmann::json{});
void add_command_error_code_dlg(int command_err, json action_json=json{});
int curr_layer = 0;
int total_layers = 0;
@@ -758,9 +759,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(nlohmann::json& proceed);
int command_ack_proceed(json& proceed);
int command_purification_disable();
int command_dont_remind_next_time(nlohmann::json& mqtt_guard_json);
int command_dont_remind_next_time(json& mqtt_guard_json);
/* command upgrade */
int command_upgrade_confirm();
@@ -886,7 +887,7 @@ public:
static bool is_in_printing_status(std::string status);
void set_print_state(std::string status);
void update_print_progress(const nlohmann::json& value);
void update_print_progress(const json& value);
bool is_connected();
bool is_connecting();
@@ -902,7 +903,7 @@ public:
/* Msg for display MsgFn */
typedef std::function<void(std::string topic, std::string payload)> MsgFn;
int publish_json(const nlohmann::json& json_item, int qos = 0, int flag = 0) ;
int publish_json(const 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);
@@ -946,16 +947,16 @@ public:
* or scenarios where users want to bypass the AMS.
*/
std::vector<DevAmsTray> vt_slot;
DevAmsTray parse_vt_tray(nlohmann::json vtray);
DevAmsTray parse_vt_tray(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 nlohmann::json& print) const;
void parse_new_info(nlohmann::json print);
void parse_new_info2(const nlohmann::json& info);
bool check_enable_np(const json& print) const;
void parse_new_info(json print);
void parse_new_info2(const 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;
+1 -1
View File
@@ -67,7 +67,7 @@ public:
void on_script_message(const nlohmann::json& payload) override;
void OnRequestPresets();
void OnExportData(const wxString& path, const wxString& name, nlohmann::json data);
void OnExportData(const wxString& path, const wxString& name, json data);
protected:
bool m_seq_top_layer_only_changed{false};
+7 -7
View File
@@ -2816,7 +2816,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
}
return ret;
};
auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<std::string>>>& title_columns, float extra_size = 0.0f) {
auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
const ImGuiStyle& style = ImGui::GetStyle();
std::vector<float> 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<const GCodeProcessor
}
::sprintf(buff, "%.2f", longest_str);
std::vector<std::pair<std::string, std::vector<std::string>>> title_columns;
std::vector<std::pair<std::string, std::vector<::string>>> 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(std::string_view("ABC")).x;
float three_words_width = imgui.calc_text_size("ABC"sv).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 = std::max(filament_group_item_align_width, text_size.x);
text_line_height = std::max(text_line_height, text_size.y);
filament_group_item_align_width = max(filament_group_item_align_width, text_size.x);
text_line_height = 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<std::pair<std::string, std::vector<std::string>>>& title_columns, float extra_size = 0.0f) {
auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
const ImGuiStyle& style = ImGui::GetStyle();
std::vector<float> 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<std::pair<std::string, std::vector<std::string>>> title_columns;
std::vector<std::pair<std::string, std::vector<::string>>> title_columns;
if (displayed_columns & ColumnData::Model) {
title_columns.push_back({ _u8L("Filament"), {""} });
title_columns.push_back({ _u8L("Model"), total_filaments });
-1
View File
@@ -311,7 +311,6 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)(
using namespace std::literals;
namespace pt = boost::property_tree;
using json = nlohmann::json;
struct StaticBambuLib
{
+1 -1
View File
@@ -3651,7 +3651,7 @@ void GLGizmoCut3D::perform_cut(const Selection& selection)
// model_name failing reason
std::vector<std::pair<std::string, std::string>> failed_models;
auto plater = wxGetApp().plater();
auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const std::string &model_name, ProgressDialog &progress_dlg,
auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg,
std::vector<std::string> &succes_models, std::vector<std::pair<std::string, std::string>> &failed_models) {
wxString msg = _L("Repairing model object");
msg += ": " + from_u8(model_name) + "\n";
+1 -2
View File
@@ -6,7 +6,7 @@
#include "DeviceCore/DevManager.h"
#include "DeviceCore/DevUtil.h"
#include "Http.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "libslic3r/AppConfig.hpp"
#include <boost/filesystem/operations.hpp>
@@ -26,7 +26,6 @@
#include <ctime>
namespace fs = boost::filesystem;
using json = nlohmann::json;
static const char* HMS_PATH = "hms";
static const char* HMS_LOCAL_IMG_PATH = "hms/local_image";
+1 -1
View File
@@ -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 = std::clamp((int)layer_number, m_min_value, m_max_value);
layer_number = clamp((int)layer_number, m_min_value, m_max_value);
GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number);
}
+1 -2
View File
@@ -19,7 +19,7 @@
#include <boost/log/trivial.hpp>
#include <functional>
#include <cstddef>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/string.h>
#include "slic3r/GUI/PartPlate.hpp"
#include "libslic3r/PrintConfig.hpp"
@@ -39,7 +39,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -2
View File
@@ -1,5 +1,5 @@
#include "SendJob.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "bambu_networking.hpp"
#include "libslic3r/LifecycleEvents.hpp"
#include "slic3r/GUI/I18N.hpp"
@@ -23,7 +23,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -34,7 +34,7 @@
#include "slic3r/GUI/Widgets/SideMenuPopup.hpp"
#include <utility>
#include "libslic3r/libslic3r.h"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <algorithm>
#include <wx/dirdlg.h>
#include <exception>
@@ -155,8 +155,6 @@
#include <wx/window.h>
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
-2
View File
@@ -45,8 +45,6 @@
#include "../Utils/MacDarkMode.hpp"
#endif
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -13,7 +13,7 @@
#include "slic3r/GUI/Widgets/WebView.hpp"
#include <wx/log.h>
#include <wx/webview.h>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <exception>
#include <wx/wx.h>
#include <wx/sizer.h>
@@ -24,8 +24,6 @@
#include "GUI_App.hpp"
#include "Plater.hpp"
using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; }
namespace Slic3r {
+1 -3
View File
@@ -15,7 +15,7 @@
#include "slic3r/GUI/StatusPanel.hpp"
#include "slic3r/GUI/UpgradePanel.hpp"
#include "slic3r/GUI/Widgets/SideTools.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/app.h>
#include <wx/bookctrl.h>
#include <wx/button.h>
@@ -57,8 +57,6 @@
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/Widgets/Button.hpp"
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+2 -2
View File
@@ -631,8 +631,8 @@ private:
// Aditional text after hypertext - currently not used
std::string m_text2;
// mark for render operation
size_t pos_start = std::string::npos;
size_t pos_end = std::string::npos;
size_t pos_start = string::npos;
size_t pos_end = string::npos;
std::string error_start = "<Error>";
std::string error_end = "</Error>";
+1 -4
View File
@@ -16,7 +16,7 @@
#include <vector>
#include <utility>
#include "slic3r/GUI/GUI.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <wx/app.h>
#include <wx/event.h>
#include <wx/filename.h>
@@ -32,9 +32,6 @@
#include <OrcaCloudServiceAgent.hpp>
#include <wx/event.h>
#include <wx/utils.h>
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
PresetBundleDialog::PresetBundleDialog(
@@ -58,8 +58,6 @@
//#define PRINTER_FILE_SYSTEM_TEST
#endif
using json = nlohmann::json;
std::string last_system_error() {
return Slic3r::decode_path(std::error_code(
#ifdef _WIN32
+8 -7
View File
@@ -22,6 +22,7 @@
#include <boost/enable_shared_from_this.hpp>
#include "nlohmann/json_fwd.hpp"
using nlohmann::json;
#include <functional>
#include <deque>
@@ -289,17 +290,17 @@ private:
static void DumpLog(void* context, int level, tchar const *msg);
private:
template<typename T> using Translator = std::function<int(nlohmann::json const &, T &, unsigned char const *)>;
template<typename T> using Translator = std::function<int(json const &, T &, unsigned char const *)>;
typedef std::function<void(int, nlohmann::json const & resp)> callback_t;
typedef std::function<void(int, json const & resp)> callback_t;
typedef std::function<int(int, nlohmann::json const &resp, unsigned char const *data)> callback_t2;
typedef std::function<int(int, json const &resp, unsigned char const *data)> callback_t2;
typedef std::function<int(std::string &msg)> callback_t3;
template<typename T> boost::uint32_t SendRequest(int type, nlohmann::json const &req, Translator<T> const &translator, Callback<T> const &callback, const std::string &param = "")
template<typename T> boost::uint32_t SendRequest(int type, json const &req, Translator<T> const &translator, Callback<T> const &callback, const std::string &param = "")
{
auto c = [translator, callback, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int
auto c = [translator, callback, this](int result, json const &resp, unsigned char const *data) -> int
{
T t;
if (result == 0 || result == CONTINUE || result == FILE_EXIST) {
@@ -322,7 +323,7 @@ private:
template<typename T>
void InstallNotify(int type, Translator<T> const& translator, Applier<T> const& applier)
{
auto c = [translator, applier, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int
auto c = [translator, applier, this](int result, json const &resp, unsigned char const *data) -> int
{
T t;
if (result == 0 || result == CONTINUE) {
@@ -344,7 +345,7 @@ private:
InstallNotify(type, c);
}
boost::uint32_t SendRequest(int type, nlohmann::json const &req, callback_t2 const &callback, const std::string &param = "");
boost::uint32_t SendRequest(int type, json const &req, callback_t2 const &callback, const std::string &param = "");
void InstallNotify(int type, callback_t2 const &callback);
+1 -3
View File
@@ -6,6 +6,7 @@
#include <wx/gdicmn.h>
#include <wx/settings.h>
#include <cstddef>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/GUI.hpp"
#include <exception>
#include <wx/msgdlg.h>
@@ -29,9 +30,6 @@
#include <sstream>
#include <slic3r/GUI/Widgets/WebView.hpp>
using json = nlohmann::json;
//------------------------------------------
// PrinterCloundAuthDialog
//------------------------------------------
+2 -3
View File
@@ -16,7 +16,7 @@
#include <string>
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/Auxiliary.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <cstddef>
#include <memory>
#include <map>
@@ -54,8 +54,7 @@
#include <slic3r/GUI/Widgets/WebView.hpp>
#include "slic3r/GUI/Jobs/SendJob.hpp"
#include "slic3r/GUI/Plater.hpp"
using json = nlohmann::json;
#include "slic3r/Utils/json_diff.hpp"
class wxWindow;
+2 -1
View File
@@ -30,6 +30,7 @@
#include <wx/timer.h>
#include "nlohmann/json.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <atomic>
#include <map>
@@ -108,7 +109,7 @@ public:
void OnScriptMessage(wxWebViewEvent& evt);
void RunScript(std::string content);
std::map<std::string, std::vector<nlohmann::json>> Reload(wxString aux_path);
std::map<std::string, std::vector<json>> Reload(wxString aux_path);
std::string formatBytes(unsigned long bytes);
wxString to_base64(std::string path);
};
-2
View File
@@ -74,8 +74,6 @@
#include "slic3r/Utils/NetworkAgent.hpp"
#include <boost/filesystem.hpp>
using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; }
namespace fs = boost::filesystem;
+1 -3
View File
@@ -62,7 +62,7 @@
#include <cstdio>
#include <cstddef>
#include "libslic3r/Config.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <exception>
#include <cstdlib>
#include <map>
@@ -133,8 +133,6 @@
#include "slic3r/Utils/NetworkAgent.hpp"
#include <boost/filesystem.hpp>
using json = nlohmann::json;
namespace Slic3r { class PrintBase; }
namespace fs = boost::filesystem;
+1 -2
View File
@@ -26,7 +26,7 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "slic3r/GUI/PartPlate.hpp"
#include "libslic3r/PrintConfig.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/MsgDialog.hpp"
#include "slic3r/GUI/Widgets/Label.hpp"
#include "slic3r/GUI/Widgets/TextInput.hpp"
@@ -77,7 +77,6 @@
#include <wx/dcgraph.h>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+2 -2
View File
@@ -23,7 +23,7 @@
#include <unordered_set>
#include "slic3r/GUI/wxMediaCtrl3.h"
#include "slic3r/GUI/Widgets/StaticBox.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <boost/date_time/posix_time/ptime.hpp>
#include <map>
#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;
nlohmann::json m_rating_result;
json m_rating_result;
wxWebRequest web_request;
bool bed_temp_input = false;
+1 -2
View File
@@ -15,7 +15,7 @@
#include "libslic3r/Utils.hpp"
#include <string>
#include "slic3r/GUI/BBLStatusBarPrint.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <cassert>
#include "libslic3r/PrintConfig.hpp"
#include <cstdlib>
@@ -85,7 +85,6 @@
#include "slic3r/Utils/NetworkAgent.hpp"
namespace fs = boost::filesystem;
using json = nlohmann::json;
using namespace Slic3r;
using namespace Slic3r::GUI;
+1
View File
@@ -20,6 +20,7 @@
#include <vector>
#include <map>
#include <utility>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
using namespace nlohmann;
+1 -3
View File
@@ -1,4 +1,4 @@
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "UserManager.hpp"
#include "BindDialog.hpp"
#include "GUI_App.hpp"
@@ -10,8 +10,6 @@
#include <wx/string.h>
using json = nlohmann::json;
namespace Slic3r {
UserManager::UserManager(NetworkAgent* agent)
+3
View File
@@ -9,9 +9,12 @@
#include <chrono>
#include <boost/thread.hpp>
#include "nlohmann/json.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
using namespace nlohmann;
namespace Slic3r {
class NetworkAgent;
+1 -1
View File
@@ -4,7 +4,7 @@
#include "slic3r/GUI/GUI.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/log/trivial.hpp>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <exception>
#include <string.h>
#include "I18N.hpp"
+2 -1
View File
@@ -36,7 +36,7 @@
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/PresetCacheFormat.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "libslic3r_version.h"
#include <string>
@@ -78,6 +78,7 @@
#include "libslic3r/PrintConfig.hpp"
#include "slic3r/Utils/NetworkAgent.hpp"
#include "slic3r/Utils/PresetUpdater.hpp"
#include "slic3r/Utils/json_diff.hpp"
class wxWindow;
+1
View File
@@ -5,6 +5,7 @@
#include "slic3r/GUI/HttpServer.hpp"
#include <memory>
#include <boost/log/trivial.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/GUI.hpp"
#include <exception>
#include <boost/filesystem/path.hpp>
+1 -2
View File
@@ -24,7 +24,7 @@
#include <wx/filename.h>
#include <sstream>
#include <string>
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include <functional>
#include <cstddef>
#include <wx/dialog.h>
@@ -44,7 +44,6 @@
#include <wx/infobar.h>
namespace pt = boost::property_tree;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -3,7 +3,7 @@
#include "../I18N.hpp"
#include "../GUI_App.hpp"
#include "../MsgDialog.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include <wx/anybutton.h>
#include <wx/event.h>
@@ -28,8 +28,6 @@
#include <wx/stattext.h>
#include <wx/sizer.h>
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_FAN_SWITCH_ON, wxCommandEvent);
+1 -2
View File
@@ -12,7 +12,7 @@
#include "Label.hpp"
#include "ComboBox.hpp"
#include "StaticBox.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Utils.hpp"
@@ -55,7 +55,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace GUI {
+2 -3
View File
@@ -38,12 +38,11 @@
#include "Widgets/Label.hpp"
#include "MainFrame.hpp"
#include "libslic3r/PresetBundle.hpp"
#include <nlohmann/json.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/Jobs/SendJob.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/filesystem.hpp>
using json = nlohmann::json;
class wxWindow;
namespace fs = boost::filesystem;
+2 -2
View File
@@ -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 std::vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material)
const vector<std::string>& array_new_color/* = vector<std::string>*/)//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 std::vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange
const vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange
{
unsigned int width = 0;
// win may be nullptr; see create_scaled_bitmap() above.
+1 -2
View File
@@ -6,7 +6,7 @@
#include "NetworkAgent.hpp"
#include "../GUI/Jobs/ProgressIndicator.hpp"
#include "../GUI/PartPlate.hpp"
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "libslic3r/CutUtils.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/Utils.hpp"
@@ -61,7 +61,6 @@
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r {
namespace GUI {
+1 -3
View File
@@ -38,7 +38,7 @@
#include <wx/event.h>
#include <wx/msgdlg.h>
#include <nlohmann/json.hpp>
#include "json_diff.hpp"
#include "libslic3r/format.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/PresetBundle.hpp"
@@ -58,8 +58,6 @@
#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; }
+14 -13
View File
@@ -8,6 +8,7 @@
#include "nlohmann/json.hpp"
using json = nlohmann::json;
using namespace std;
class json_diff
@@ -15,25 +16,25 @@ class json_diff
private:
std::string printer_type;
std::string printer_version = "00.00.00.00";
nlohmann::json settings_base;
nlohmann::json full_message;
json settings_base;
json full_message;
nlohmann::json diff2all_base;
nlohmann::json all2diff_base;
json diff2all_base;
json all2diff_base;
int decode_error_count = 0;
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);
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);
public:
bool load_compatible_settings(std::string const &type, std::string const &version);
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);
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);
bool is_need_request();
};