2022-08-05 09:57:07 +00:00
|
|
|
#ifndef slic3r_HMS_hpp_
|
|
|
|
#define slic3r_HMS_hpp_
|
|
|
|
|
|
|
|
#include "GUI_App.hpp"
|
|
|
|
#include "GUI.hpp"
|
|
|
|
#include "I18N.hpp"
|
|
|
|
#include "Widgets/Label.hpp"
|
|
|
|
#include "Widgets/Button.hpp"
|
|
|
|
#include "Widgets/StepCtrl.hpp"
|
|
|
|
#include "BitmapCache.hpp"
|
|
|
|
#include "slic3r/Utils/Http.hpp"
|
|
|
|
#include "libslic3r/Thread.hpp"
|
|
|
|
#include "nlohmann/json.hpp"
|
2024-12-26 07:08:07 +00:00
|
|
|
#include <mutex>
|
2022-08-05 09:57:07 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
#define HMS_INFO_FILE "hms.json"
|
2024-04-18 13:16:54 +00:00
|
|
|
#define QUERY_HMS_INFO "query_hms_info"
|
|
|
|
#define QUERY_HMS_ACTION "query_hms_action"
|
2022-08-05 09:57:07 +00:00
|
|
|
|
|
|
|
class HMSQuery {
|
2024-12-26 07:08:07 +00:00
|
|
|
|
2022-08-05 09:57:07 +00:00
|
|
|
protected:
|
2024-04-18 13:16:54 +00:00
|
|
|
json m_hms_info_json;
|
|
|
|
json m_hms_action_json;
|
2024-12-26 07:08:07 +00:00
|
|
|
mutable std::mutex m_hms_mutex;
|
|
|
|
|
2024-12-12 13:16:19 +00:00
|
|
|
int download_hms_related(std::string hms_type, json *receive_json, std::string dev_type);
|
|
|
|
int load_from_local(std::string &version_info, std::string hms_type, json *load_json, std::string dev_type);
|
|
|
|
int save_to_local(std::string lang, std::string hms_type, std::string dev_type, json save_json);
|
|
|
|
std::string get_hms_file(std::string hms_type, std::string lang = std::string("en"), std::string dev_type = "");
|
2024-12-25 02:49:45 +00:00
|
|
|
wxString _query_hms_msg(std::string long_error_code, std::string lang_code = std::string("en")) const;
|
2024-09-04 10:21:00 +00:00
|
|
|
bool _query_error_msg(wxString &error_msg, std::string long_error_code, std::string lang_code = std::string("en"));
|
2024-04-18 13:16:54 +00:00
|
|
|
wxString _query_error_url_action(std::string long_error_code, std::string dev_id, std::vector<int>& button_action);
|
2024-12-26 07:08:07 +00:00
|
|
|
|
2022-08-05 09:57:07 +00:00
|
|
|
public:
|
|
|
|
HMSQuery() {}
|
2024-12-12 13:16:19 +00:00
|
|
|
int check_hms_info(std::string dev_type = "00M");
|
2024-12-25 02:49:45 +00:00
|
|
|
wxString query_hms_msg(std::string long_error_code) const;
|
2024-09-04 10:21:00 +00:00
|
|
|
bool query_print_error_msg(int print_error, wxString &error_msg);
|
2024-04-18 13:16:54 +00:00
|
|
|
wxString query_print_error_url_action(int print_error, std::string dev_id, std::vector<int>& button_action);
|
2022-11-18 02:24:04 +00:00
|
|
|
static std::string hms_language_code();
|
2024-01-05 08:09:26 +00:00
|
|
|
static std::string build_query_params(std::string& lang);
|
2024-12-12 13:16:19 +00:00
|
|
|
bool check_local_file(std::string dev_type);
|
2024-04-18 13:16:54 +00:00
|
|
|
bool save_local = false;
|
2022-08-05 09:57:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int get_hms_info_version(std::string &version);
|
|
|
|
|
2022-08-11 11:01:56 +00:00
|
|
|
std::string get_hms_wiki_url(std::string code);
|
2022-08-05 09:57:07 +00:00
|
|
|
|
|
|
|
std::string get_error_message(int error_code);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|