From f16071f083ef17bcbb70f23b58460f70cf52d715 Mon Sep 17 00:00:00 2001 From: Ian Chua Date: Tue, 25 Aug 2026 13:54:40 +0800 Subject: [PATCH] fix: remove heavy includes from IPrinterAgent --- src/slic3r/GUI/DeviceManager.hpp | 28 +-------- src/slic3r/Utils/IPrinterAgent.hpp | 3 +- src/slic3r/Utils/NetworkAgent.hpp | 46 +------------- src/slic3r/Utils/PrinterNetworkTypes.hpp | 78 ++++++++++++++++++++++++ src/slic3r/plugin/PythonPluginBridge.cpp | 13 ---- 5 files changed, 81 insertions(+), 87 deletions(-) create mode 100644 src/slic3r/Utils/PrinterNetworkTypes.hpp diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index f920433652..62de0e87b8 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -18,6 +18,7 @@ #include "boost/bimap/bimap.hpp" #include "libslic3r/calib.hpp" #include "libslic3r/Utils.hpp" +#include "slic3r/Utils/PrinterNetworkTypes.hpp" #include "DeviceCore/DevDefs.h" #include "DeviceCore/DevConfigUtil.h" @@ -100,33 +101,6 @@ struct DevPrintTaskRatingInfo; // given nozzle diameter (mm), bucketed per nozzle size to mirror the printer firmware. bool is_stringing_prone_filament(const std::string& filament_id, float nozzle_diameter); -enum LiveviewLocal { - LVL_None, - LVL_Disable, - LVL_Local, - LVL_Rtsps, - LVL_Rtsp -}; - -enum LiveviewRemote { - LVR_None, - LVR_Tutk, - LVR_Agora, - LVR_TutkAgora -}; - -enum FileLocal { - FL_None, - FL_Local -}; - -enum FileRemote { - FR_None, - FR_Tutk, - FR_Agora, - FR_TutkAgora -}; - class MachineObject { private: diff --git a/src/slic3r/Utils/IPrinterAgent.hpp b/src/slic3r/Utils/IPrinterAgent.hpp index 0938066970..b5db97403b 100644 --- a/src/slic3r/Utils/IPrinterAgent.hpp +++ b/src/slic3r/Utils/IPrinterAgent.hpp @@ -2,7 +2,6 @@ #define __I_PRINTER_AGENT_HPP__ #include "bambu_networking.hpp" -#include // why: these extend the BAMBU_NETWORK_* return space rather than opening a new one - the value // flows through the same int domain callers already compare against BAMBU_NETWORK_SUCCESS. // They live here and not in bambu_networking.hpp because that file is a vendor header replaced @@ -16,7 +15,7 @@ #include #include -#include "NetworkAgent.hpp" +#include "PrinterNetworkTypes.hpp" namespace Slic3r { diff --git a/src/slic3r/Utils/NetworkAgent.hpp b/src/slic3r/Utils/NetworkAgent.hpp index 75cca1e314..4a2e69ecad 100644 --- a/src/slic3r/Utils/NetworkAgent.hpp +++ b/src/slic3r/Utils/NetworkAgent.hpp @@ -5,7 +5,7 @@ #include "libslic3r/ProjectTask.hpp" #include "ICloudServiceAgent.hpp" -#include "slic3r/GUI/DeviceManager.hpp" +#include "PrinterNetworkTypes.hpp" #include #include @@ -17,50 +17,6 @@ namespace Slic3r { class IPrinterAgent; enum class FilamentSyncMode; -enum URL_STATE { - URL_TCP, - URL_TUTK, -}; - -struct CameraURLParams { - std::string ip_address; - std::string user; - std::string password; - LiveviewLocal protocol; - std::string device; - std::string network_version; - std::string device_version; - std::string refresh_url; - std::string client_id; - std::string client_version; - bool apply_meta{false}; -}; - -struct FileTransferURLParams { - URL_STATE url_state{URL_TCP}; - std::string ip_address; - std::string username; - std::string password; - std::string device_id; - std::string network_version; - std::string device_version; - std::string refresh_url; - std::string client_id; - std::string client_version; -}; - -struct FileTransferURLResult { - bool is_success{false}; - std::string url; - int error_code{-1}; -}; - -struct CameraURLResult { - bool is_success{false}; - std::string url; - int error_code{-1}; -}; - // Forward declaration class BBLNetworkPlugin; diff --git a/src/slic3r/Utils/PrinterNetworkTypes.hpp b/src/slic3r/Utils/PrinterNetworkTypes.hpp new file mode 100644 index 0000000000..aa3809f768 --- /dev/null +++ b/src/slic3r/Utils/PrinterNetworkTypes.hpp @@ -0,0 +1,78 @@ +#pragma once + +#include + +namespace Slic3r { + +enum LiveviewLocal { + LVL_None, + LVL_Disable, + LVL_Local, + LVL_Rtsps, + LVL_Rtsp +}; + +enum LiveviewRemote { + LVR_None, + LVR_Tutk, + LVR_Agora, + LVR_TutkAgora +}; + +enum FileLocal { + FL_None, + FL_Local +}; + +enum FileRemote { + FR_None, + FR_Tutk, + FR_Agora, + FR_TutkAgora +}; + +enum URL_STATE { + URL_TCP, + URL_TUTK, +}; + +struct CameraURLParams { + std::string ip_address; + std::string user; + std::string password; + LiveviewLocal protocol; + std::string device; + std::string network_version; + std::string device_version; + std::string refresh_url; + std::string client_id; + std::string client_version; + bool apply_meta{false}; +}; + +struct CameraURLResult { + bool is_success{false}; + std::string url; + int error_code{-1}; +}; + +struct FileTransferURLParams { + URL_STATE url_state{URL_TCP}; + std::string ip_address; + std::string username; + std::string password; + std::string device_id; + std::string network_version; + std::string device_version; + std::string refresh_url; + std::string client_id; + std::string client_version; +}; + +struct FileTransferURLResult { + bool is_success{false}; + std::string url; + int error_code{-1}; +}; + +} // namespace Slic3r diff --git a/src/slic3r/plugin/PythonPluginBridge.cpp b/src/slic3r/plugin/PythonPluginBridge.cpp index 4dd4c5ea93..5cf44e2f95 100644 --- a/src/slic3r/plugin/PythonPluginBridge.cpp +++ b/src/slic3r/plugin/PythonPluginBridge.cpp @@ -1,15 +1,3 @@ -#ifdef ORCA_PYTHON_STUBGEN_MODULE - #ifdef _WIN32 - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - #ifndef NOMINMAX - #define NOMINMAX - #endif - #include - #endif -#endif - #include "PythonPluginBridge.hpp" #include @@ -25,7 +13,6 @@ #include #include "PythonInterpreter.hpp" -#include "PluginFsUtils.hpp" #include "PluginConfig.hpp" #include "host/PluginHost.hpp" #include "PyPluginPackage.hpp"