Resolve printer agent first before getting cloud printer agent

This commit is contained in:
Lam Wei Lun
2026-09-15 18:02:02 +08:00
parent cf3f36a1c6
commit ae1752fbf2
2 changed files with 9 additions and 16 deletions
+8 -12
View File
@@ -24,7 +24,6 @@
#include <boost/locale/encoding_utf.hpp> #include <boost/locale/encoding_utf.hpp>
#include <boost/log/detail/native_typeof.hpp> #include <boost/log/detail/native_typeof.hpp>
#include <libslic3r/Config.hpp> #include <libslic3r/Config.hpp>
#include <mutex>
#include <slic3r/plugin/PythonPluginInterface.hpp> #include <slic3r/plugin/PythonPluginInterface.hpp>
#include <wx/event.h> #include <wx/event.h>
@@ -41,9 +40,11 @@
#include <iterator> #include <iterator>
#include <exception> #include <exception>
#include <cstdlib> #include <cstdlib>
#include <mutex>
#include <regex> #include <regex>
#include <thread> #include <thread>
#include <string_view> #include <string_view>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
@@ -88,7 +89,6 @@
#include "libslic3r/Thread.hpp" #include "libslic3r/Thread.hpp"
#include "libslic3r/miniz_extension.hpp" #include "libslic3r/miniz_extension.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
#include "libslic3r/Color.hpp"
#include "slic3r/plugin/PluginManager.hpp" #include "slic3r/plugin/PluginManager.hpp"
#include "slic3r/plugin/host/PluginHostUi.hpp" #include "slic3r/plugin/host/PluginHostUi.hpp"
#include "slic3r/plugin/PythonInterpreter.hpp" #include "slic3r/plugin/PythonInterpreter.hpp"
@@ -108,14 +108,12 @@
#include "../Utils/PrintHost.hpp" #include "../Utils/PrintHost.hpp"
#include "../Utils/Process.hpp" #include "../Utils/Process.hpp"
#include "../Utils/wxInspectorPlugins/Registration.hpp" #include "../Utils/wxInspectorPlugins/Registration.hpp"
#include "../Utils/MacDarkMode.hpp"
#include "../Utils/Http.hpp" #include "../Utils/Http.hpp"
#include "../Utils/InstanceID.hpp" #include "../Utils/InstanceID.hpp"
#include "../Utils/UndoRedo.hpp" #include "../Utils/UndoRedo.hpp"
#include "slic3r/Config/Snapshot.hpp" #include "slic3r/Config/Snapshot.hpp"
#include "Preferences.hpp" #include "Preferences.hpp"
#include "Tab.hpp" #include "Tab.hpp"
#include "SysInfoDialog.hpp"
#include "UpdateDialogs.hpp" #include "UpdateDialogs.hpp"
#include "Mouse3DController.hpp" #include "Mouse3DController.hpp"
#include "RemovableDriveManager.hpp" #include "RemovableDriveManager.hpp"
@@ -129,8 +127,6 @@
#include "PrintHostDialogs.hpp" #include "PrintHostDialogs.hpp"
#include "NetworkPluginDialog.hpp" #include "NetworkPluginDialog.hpp"
#include "DesktopIntegrationDialog.hpp" #include "DesktopIntegrationDialog.hpp"
#include "SendSystemInfoDialog.hpp"
#include "ParamsDialog.hpp"
#include "KBShortcutsDialog.hpp" #include "KBShortcutsDialog.hpp"
#include "DownloadProgressDialog.hpp" #include "DownloadProgressDialog.hpp"
#include "TroubleshootDialog.hpp" #include "TroubleshootDialog.hpp"
@@ -141,7 +137,6 @@
#include "Widgets/ProgressDialog.hpp" #include "Widgets/ProgressDialog.hpp"
//BBS: DailyTip and UserGuide Dialog //BBS: DailyTip and UserGuide Dialog
#include "WebDownPluginDlg.hpp"
#include "WebGuideDialog.hpp" #include "WebGuideDialog.hpp"
#include "ReleaseNote.hpp" #include "ReleaseNote.hpp"
#include "PrivacyUpdateDialog.hpp" #include "PrivacyUpdateDialog.hpp"
@@ -3976,7 +3971,7 @@ void GUI_App::set_live_printer_agent(std::shared_ptr<IPrinterAgent> agent)
sidebar().update_all_preset_comboboxes(); sidebar().update_all_preset_comboboxes();
} }
std::string GUI_App::resolve_printer_agent_id(const std::string& stored_id) std::string GUI_App::resolve_printer_agent_id(const std::string& stored_id) const
{ {
if (!stored_id.empty()) if (!stored_id.empty())
return stored_id; return stored_id;
@@ -4990,13 +4985,14 @@ bool GUI_App::is_user_login(const std::string& provider/* = ORCA_CLOUD_PROVIDER*
std::string GUI_App::get_printer_cloud_provider() const std::string GUI_App::get_printer_cloud_provider() const
{ {
std::string provider = preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent"); const std::string agent_id = resolve_printer_agent_id(
if (provider.empty()) preset_bundle ? preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent")
provider = ORCA_CLOUD_PROVIDER; : std::string());
return provider; return agent_id == BBL_PRINTER_AGENT_ID ? BBL_CLOUD_PROVIDER : ORCA_CLOUD_PROVIDER;
} }
bool GUI_App::check_login(const std::string& provider/* = ORCA_CLOUD_PROVIDER*/) bool GUI_App::check_login(const std::string& provider/* = ORCA_CLOUD_PROVIDER*/)
{ {
bool result = false; bool result = false;
+1 -4
View File
@@ -23,9 +23,6 @@
#include <wx/snglinst.h> #include <wx/snglinst.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include <mutex>
#include <stack>
//#define BBL_HAS_FIRST_PAGE 1 //#define BBL_HAS_FIRST_PAGE 1
#define STUDIO_INACTIVE_TIMEOUT 15*60*1000 #define STUDIO_INACTIVE_TIMEOUT 15*60*1000
#define LOG_FILES_MAX_NUM 30 #define LOG_FILES_MAX_NUM 30
@@ -369,7 +366,7 @@ public:
// Reconcile the live printer agent with the stored preset selection. // Reconcile the live printer agent with the stored preset selection.
void switch_printer_agent(); void switch_printer_agent();
std::string resolve_printer_agent_id(const std::string& stored_id); std::string resolve_printer_agent_id(const std::string& stored_id) const;
// ORCA TODO: in the future, bbl presets should specify "bbl" printer agent id // ORCA TODO: in the future, bbl presets should specify "bbl" printer agent id
// then, all resolve and canonical would just be ORCA<->"" // then, all resolve and canonical would just be ORCA<->""
std::string canonical_printer_agent_id(const std::string& picked_id); std::string canonical_printer_agent_id(const std::string& picked_id);