diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index 5737484960..8878d1f3ad 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -7,7 +7,7 @@ #include "I18N.hpp" #include "MsgDialog.hpp" #include "DownloadProgressDialog.hpp" -#include "slic3r/Utils/NetworkAgent.hpp" +#include "slic3r/Utils/BBLNetworkPlugin.hpp" #include @@ -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; } diff --git a/src/slic3r/Utils/BBLNetworkPlugin.cpp b/src/slic3r/Utils/BBLNetworkPlugin.cpp index 0f74808c44..142b2a41cc 100644 --- a/src/slic3r/Utils/BBLNetworkPlugin.cpp +++ b/src/slic3r/Utils/BBLNetworkPlugin.cpp @@ -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(); } diff --git a/src/slic3r/Utils/BBLNetworkPlugin.hpp b/src/slic3r/Utils/BBLNetworkPlugin.hpp index 812a2c91c5..ddbc0ac67c 100644 --- a/src/slic3r/Utils/BBLNetworkPlugin.hpp +++ b/src/slic3r/Utils/BBLNetworkPlugin.hpp @@ -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};