mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-18 00:12:09 +00:00
NetworkAgent::use_legacy_network is only meant to be an intention of whether user wants to use legacy plugin or not, anything that actually interact with the plugin should use the loaded plugin version instead.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "I18N.hpp"
|
||||
#include "MsgDialog.hpp"
|
||||
#include "DownloadProgressDialog.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include "slic3r/Utils/BBLNetworkPlugin.hpp"
|
||||
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
@@ -161,7 +161,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
m_device_busy = obj->is_camera_busy_off();
|
||||
m_tutk_state = obj->tutk_state;
|
||||
|
||||
if (DevPrinterConfigUtil::get_printer_series_str(obj->printer_type) == "series_o" && NetworkAgent::use_legacy_network) {
|
||||
if (DevPrinterConfigUtil::get_printer_series_str(obj->printer_type) == "series_o" && BBLNetworkPlugin::instance().use_legacy_network()) {
|
||||
// Legacy plugin cannot support remote play for H2D, force using local mode
|
||||
m_remote_proto = MachineObject::LVR_None;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version)
|
||||
|
||||
// Auto-migration: If loading legacy version and versioned library doesn't exist,
|
||||
// but unversioned legacy library does exist, copy it to versioned format
|
||||
if (version == BAMBU_NETWORK_AGENT_VERSION_LEGACY) {
|
||||
if (is_legacy_version(version)) {
|
||||
boost::filesystem::path versioned_path;
|
||||
boost::filesystem::path legacy_path;
|
||||
#if defined(_MSC_VER) || defined(_WIN32)
|
||||
@@ -162,12 +162,15 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version)
|
||||
// Load all function pointers
|
||||
load_all_function_pointers();
|
||||
|
||||
// Sync legacy network flag from NetworkAgent (set during GUI_App initialization)
|
||||
m_use_legacy_network = NetworkAgent::use_legacy_network;
|
||||
// Sync legacy network flag from loaded plugin
|
||||
m_use_legacy_network = is_legacy_version(version);
|
||||
|
||||
std::string loaded_version;
|
||||
if (m_get_version) {
|
||||
loaded_version = m_get_version();
|
||||
if (!loaded_version.empty()) {
|
||||
m_use_legacy_network = is_legacy_version(loaded_version);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "BBLNetworkPlugin::initialize: legacy_mode="
|
||||
@@ -208,6 +211,8 @@ int BBLNetworkPlugin::unload()
|
||||
|
||||
clear_all_function_pointers();
|
||||
|
||||
m_use_legacy_network = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -377,7 +382,7 @@ bool BBLNetworkPlugin::versioned_library_exists(const std::string& version)
|
||||
|
||||
if (boost::filesystem::exists(path)) return true;
|
||||
|
||||
if (version == BAMBU_NETWORK_AGENT_VERSION_LEGACY) {
|
||||
if (is_legacy_version(version)) {
|
||||
return legacy_library_exists();
|
||||
}
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ public:
|
||||
// Legacy Network Flag
|
||||
// ========================================================================
|
||||
|
||||
static bool is_legacy_version(const std::string& version) { return version == BAMBU_NETWORK_AGENT_VERSION_LEGACY; }
|
||||
bool use_legacy_network() const { return m_use_legacy_network; }
|
||||
void set_use_legacy_network(bool legacy) { m_use_legacy_network = legacy; }
|
||||
|
||||
@@ -404,7 +405,7 @@ private:
|
||||
NetworkLibraryLoadError m_load_error;
|
||||
|
||||
// Legacy network compatibility flag
|
||||
bool m_use_legacy_network{true};
|
||||
bool m_use_legacy_network{false};
|
||||
|
||||
// Function pointers
|
||||
func_check_debug_consistent m_check_debug_consistent{nullptr};
|
||||
|
||||
Reference in New Issue
Block a user