Optimize Device

This commit is contained in:
QIDI TECH
2024-09-20 18:07:25 +08:00
parent 007578e041
commit 18a0c7bd80
6 changed files with 20 additions and 11 deletions

View File

@@ -282,7 +282,6 @@ void PrinterWebView::CreatThread() {
break;
BOOST_LOG_TRIVIAL(error) << "machine IP: " << (button->getIPLabel());
std::unique_ptr<PrintHost> printhost(
PrintHost::get_print_host_url((button->getIPLabel()).ToStdString(), (button->getIPLabel()).ToStdString()));
if (!printhost) {
@@ -482,13 +481,6 @@ void PrinterWebView::SetLoginStatus(bool status) {
//y5
std::string head_name = wxGetApp().app_config->get("user_head_name");
wxString head_savePath = (boost::filesystem::path(Slic3r::data_dir()) / "user" / head_name).make_preferred().string();
std::ifstream file(head_savePath);
if (file.good()) {
file.close();
remove(head_savePath.c_str());
}
wxGetApp().app_config->set("user_head_url", "");
wxGetApp().app_config->set("user_head_name", "");
m_user_head_name = "";
SetPresetChanged(true);
UpdateState();

View File

@@ -45,6 +45,9 @@
#include <boost/thread.hpp>
#include "./Widgets/SwitchButton.hpp"
#include "./Widgets/DeviceButton.hpp"
#include "../Utils/Moonraker.hpp"
namespace Slic3r {
namespace GUI {
@@ -106,9 +109,12 @@ public:
void StopStatusThread()
{
m_stopThread = true;
//y6
Moonraker::m_isStop = true;
if (m_statusThread.joinable()) {
m_statusThread.join();
}
Moonraker::m_isStop = false;
};
void SetPauseThread(bool status) { m_pauseThread = status; };
void SetPresetChanged(bool status);

View File

@@ -22,6 +22,7 @@
#include <libslic3r/Utils.hpp>
#include <slic3r/GUI/I18N.hpp>
#include <slic3r/GUI/format.hpp>
#include "Moonraker.hpp"
namespace fs = boost::filesystem;
@@ -225,6 +226,9 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o
{
auto self = static_cast<priv*>(userp);
bool cb_cancel = false;
//y6
if (Moonraker::GetStop())
cb_cancel = true;
if (self->progressfn) {
Progress progress(dltotal, dlnow, ultotal, ulnow, self->buffer);

View File

@@ -21,6 +21,9 @@ namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
//y6
bool Moonraker::m_isStop = false;
namespace {
#ifdef WIN32
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
@@ -165,8 +168,8 @@ std::string Moonraker::get_status(wxString &msg) const
auto http = Http::get(std::move(url));
set_auth(http);
//B64
http.timeout_connect(2)
//B64 //y6
http.timeout_connect(4)
.on_error([&](std::string body, std::string error, unsigned status) {
// y1
if(status == 404)

View File

@@ -42,6 +42,10 @@ public:
std::string get_host() const override { return m_show_ip != "" ? m_show_ip : m_host; }
const std::string& get_apikey() const { return m_apikey; }
const std::string& get_cafile() const { return m_cafile; }
//y6
static void SetStop(bool isStop) { m_isStop = isStop; };
static bool GetStop() { return m_isStop; };
static bool m_isStop;
protected:
/*