mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-02 18:08:51 +03:00
update slic3r
This commit is contained in:
@@ -11,8 +11,12 @@
|
||||
#include "slic3r/Utils/Http.hpp"
|
||||
#include "libslic3r/Thread.hpp"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include <mutex>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class MachineObject;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
#define HMS_INFO_FILE "hms.json"
|
||||
@@ -20,26 +24,55 @@ namespace GUI {
|
||||
#define QUERY_HMS_ACTION "query_hms_action"
|
||||
|
||||
class HMSQuery {
|
||||
protected:
|
||||
json m_hms_info_json;
|
||||
json m_hms_action_json;
|
||||
int download_hms_related(std::string hms_type,json* receive_json);
|
||||
int load_from_local(std::string& version_info, std::string hms_type, json* load_json);
|
||||
int save_to_local(std::string lang, std::string hms_type,json save_json);
|
||||
std::string get_hms_file(std::string hms_type, std::string lang = std::string("en"));
|
||||
wxString _query_hms_msg(std::string long_error_code, std::string lang_code = std::string("en"));
|
||||
bool _query_error_msg(wxString &error_msg, std::string long_error_code, std::string lang_code = std::string("en"));
|
||||
wxString _query_error_url_action(std::string long_error_code, std::string dev_id, std::vector<int>& button_action);
|
||||
public:
|
||||
HMSQuery() {}
|
||||
int check_hms_info();
|
||||
wxString query_hms_msg(std::string long_error_code);
|
||||
bool query_print_error_msg(int print_error, wxString &error_msg);
|
||||
wxString query_print_error_url_action(int print_error, std::string dev_id, std::vector<int>& button_action);
|
||||
static std::string hms_language_code();
|
||||
static std::string build_query_params(std::string& lang);
|
||||
|
||||
bool save_local = false;
|
||||
protected:
|
||||
std::unordered_map<string, json> m_hms_info_jsons; // key-> device id type, the first three digits of SN number
|
||||
std::unordered_map<string, json> m_hms_action_jsons;// key-> device id type
|
||||
std::unordered_map<wxString, wxImage> m_hms_local_images; // key-> image name
|
||||
mutable std::mutex m_hms_mutex;
|
||||
|
||||
std::unordered_map<string, time_t> m_cloud_hms_last_update_time;
|
||||
|
||||
public:
|
||||
HMSQuery() { }
|
||||
~HMSQuery() { clear_hms_info(); };
|
||||
|
||||
public:
|
||||
// clear hms
|
||||
void clear_hms_info();
|
||||
|
||||
// query
|
||||
wxString query_hms_msg(const MachineObject* obj, const std::string& long_error_code);
|
||||
wxString query_hms_msg(const std::string& dev_id, const std::string& long_error_code);
|
||||
|
||||
bool is_internal_error(const MachineObject *obj, int print_error);
|
||||
wxString query_print_error_msg(const MachineObject* obj, int print_error);
|
||||
wxString query_print_error_msg(const std::string& dev_id, int print_error);
|
||||
wxString query_print_image_action(const MachineObject* obj, int print_error, std::vector<int>& button_action);
|
||||
|
||||
// query local images
|
||||
wxImage query_image_from_local(const wxString& image_name);
|
||||
|
||||
public:
|
||||
static std::string hms_language_code();
|
||||
static std::string build_query_params(std::string& lang);
|
||||
|
||||
private:
|
||||
// load hms
|
||||
void init_hms_info(const std::string& dev_type_id);
|
||||
void copy_from_data_dir_to_local();
|
||||
int download_hms_related(const std::string& hms_type, const std::string& dev_id_type, json* receive_json);
|
||||
int load_from_local(const std::string& hms_type, const std::string& dev_id_type, json* receive_json, std::string& version_info);
|
||||
int save_to_local(std::string lang, std::string hms_type, std::string dev_id_type, json save_json);
|
||||
std::string get_hms_file(std::string hms_type, std::string lang = std::string("en"), std::string dev_id_type = "");
|
||||
|
||||
// internal query
|
||||
string get_dev_id_type(const MachineObject* obj) const;
|
||||
wxString _query_hms_msg(const string& dev_id_type, const string& long_error_code, const string& lang_code = std::string("en"));
|
||||
|
||||
bool _is_internal_error(const string &dev_id_type, const string &long_error_code, const string &lang_code = std::string("en"));
|
||||
wxString _query_error_msg(const string& dev_id_type, const std::string& long_error_code, const std::string& lang_code = std::string("en"));
|
||||
wxString _query_error_image_action(const string& dev_id_type, const std::string& long_error_code, std::vector<int>& button_action);
|
||||
};
|
||||
|
||||
int get_hms_info_version(std::string &version);
|
||||
|
||||
Reference in New Issue
Block a user