mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 18:27:00 +00:00
ENH: [STUDIO-4135] only sync user preset that need update
Change-Id: I9a1c0f9c34a5f5950beffa1c5e8f63c4cf7be6c6
This commit is contained in:
@@ -79,6 +79,7 @@ func_get_user_presets NetworkAgent::get_user_presets_ptr = nullptr
|
||||
func_request_setting_id NetworkAgent::request_setting_id_ptr = nullptr;
|
||||
func_put_setting NetworkAgent::put_setting_ptr = nullptr;
|
||||
func_get_setting_list NetworkAgent::get_setting_list_ptr = nullptr;
|
||||
func_get_setting_list2 NetworkAgent::get_setting_list2_ptr = nullptr;
|
||||
func_delete_setting NetworkAgent::delete_setting_ptr = nullptr;
|
||||
func_get_studio_info_url NetworkAgent::get_studio_info_url_ptr = nullptr;
|
||||
func_set_extra_http_header NetworkAgent::set_extra_http_header_ptr = nullptr;
|
||||
@@ -233,7 +234,8 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||
get_user_presets_ptr = reinterpret_cast<func_get_user_presets>(get_network_function("bambu_network_get_user_presets"));
|
||||
request_setting_id_ptr = reinterpret_cast<func_request_setting_id>(get_network_function("bambu_network_request_setting_id"));
|
||||
put_setting_ptr = reinterpret_cast<func_put_setting>(get_network_function("bambu_network_put_setting"));
|
||||
get_setting_list_ptr = reinterpret_cast<func_get_setting_list>(get_network_function("bambu_network_get_setting_list"));
|
||||
get_setting_list_ptr = reinterpret_cast<func_get_setting_list>(get_network_function("bambu_network_get_setting_list"));
|
||||
get_setting_list2_ptr = reinterpret_cast<func_get_setting_list2>(get_network_function("bambu_network_get_setting_list2"));
|
||||
delete_setting_ptr = reinterpret_cast<func_delete_setting>(get_network_function("bambu_network_delete_setting"));
|
||||
get_studio_info_url_ptr = reinterpret_cast<func_get_studio_info_url>(get_network_function("bambu_network_get_studio_info_url"));
|
||||
set_extra_http_header_ptr = reinterpret_cast<func_set_extra_http_header>(get_network_function("bambu_network_set_extra_http_header"));
|
||||
@@ -343,6 +345,7 @@ int NetworkAgent::unload_network_module()
|
||||
request_setting_id_ptr = nullptr;
|
||||
put_setting_ptr = nullptr;
|
||||
get_setting_list_ptr = nullptr;
|
||||
get_setting_list2_ptr = nullptr;
|
||||
delete_setting_ptr = nullptr;
|
||||
get_studio_info_url_ptr = nullptr;
|
||||
set_extra_http_header_ptr = nullptr;
|
||||
@@ -967,8 +970,19 @@ int NetworkAgent::get_setting_list(std::string bundle_version, ProgressFn pro_fn
|
||||
int ret = 0;
|
||||
if (network_agent && get_setting_list_ptr) {
|
||||
ret = get_setting_list_ptr(network_agent, bundle_version, pro_fn, cancel_fn);
|
||||
if (ret)
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%, bundle_version=%3%")%network_agent %ret %bundle_version ;
|
||||
if (ret) BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%, bundle_version=%3%") % network_agent % ret % bundle_version;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetworkAgent::get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn, WasCancelledFn cancel_fn)
|
||||
{
|
||||
int ret = 0;
|
||||
if (network_agent && get_setting_list2_ptr) {
|
||||
ret = get_setting_list2_ptr(network_agent, bundle_version, chk_fn, pro_fn, cancel_fn);
|
||||
if (ret) BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%, bundle_version=%3%") % network_agent % ret % bundle_version;
|
||||
} else {
|
||||
ret = get_setting_list(bundle_version, pro_fn, cancel_fn);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ typedef int (*func_get_user_presets)(void *agent, std::map<std::string, std::map
|
||||
typedef std::string (*func_request_setting_id)(void *agent, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||
typedef int (*func_put_setting)(void *agent, std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||
typedef int (*func_get_setting_list)(void *agent, std::string bundle_version, ProgressFn pro_fn, WasCancelledFn cancel_fn);
|
||||
typedef int (*func_get_setting_list2)(void *agent, std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn, WasCancelledFn cancel_fn);
|
||||
typedef int (*func_delete_setting)(void *agent, std::string setting_id);
|
||||
typedef std::string (*func_get_studio_info_url)(void *agent);
|
||||
typedef int (*func_set_extra_http_header)(void *agent, std::map<std::string, std::string> extra_headers);
|
||||
@@ -158,6 +159,7 @@ public:
|
||||
std::string request_setting_id(std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||
int put_setting(std::string setting_id, std::string name, std::map<std::string, std::string>* values_map, unsigned int* http_code);
|
||||
int get_setting_list(std::string bundle_version, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr);
|
||||
int get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn = nullptr, WasCancelledFn cancel_fn = nullptr);
|
||||
int delete_setting(std::string setting_id);
|
||||
std::string get_studio_info_url();
|
||||
int set_extra_http_header(std::map<std::string, std::string> extra_headers);
|
||||
@@ -245,6 +247,7 @@ private:
|
||||
static func_request_setting_id request_setting_id_ptr;
|
||||
static func_put_setting put_setting_ptr;
|
||||
static func_get_setting_list get_setting_list_ptr;
|
||||
static func_get_setting_list2 get_setting_list2_ptr;
|
||||
static func_delete_setting delete_setting_ptr;
|
||||
static func_get_studio_info_url get_studio_info_url_ptr;
|
||||
static func_set_extra_http_header set_extra_http_header_ptr;
|
||||
|
||||
@@ -128,6 +128,7 @@ typedef std::function<void(int progress)> ProgressFn;
|
||||
typedef std::function<void(int retcode, std::string info)> LoginFn;
|
||||
typedef std::function<void(int result, std::string info)> ResultFn;
|
||||
typedef std::function<bool()> CancelFn;
|
||||
typedef std::function<bool(std::map<std::string, std::string> info)> CheckFn;
|
||||
|
||||
enum SendingPrintJobStage {
|
||||
PrintingStageCreate = 0,
|
||||
|
||||
Reference in New Issue
Block a user