mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 22:43:04 +00:00
Introducing Orca Cloud: https://cloud.orcaslicer.com (#13414)
* Add OrcaCloud sync platform and preset bundle sharing system Introduce OrcaCloud, a cloud sync platform for user presets, alongside a preset bundle system that enables sharing printer/filament/process profiles as local exportable bundles or subscribed cloud bundles. OrcaCloud platform: - Auth to Orca Cloud - Encrypted token storage (file-based or system keychain) - User preset sync with - Profile migration from default/bambu folders on first login - Homepage integration with entrance to cloud.orcaslicer.com Preset bundles: - Local bundle import/export with bundle_structure.json metadata - Subscribed cloud bundles with version-based update checking - Thread-safe concurrent bundle access with read-write mutex - Canonical bundle preset naming (_local/<id>/... and _subscribed/<id>/...) - Bundle presets are read-only; grouped under subheaders in combo boxes - PresetBundleDialog with auto-sync toggle, refresh, update notifications - Hyperlinked bundle names to cloud bundle pages Co-authored-by: Sabriel Koh <sabrielkcr@gmail.com> Co-authored-by: Derrick <derrick992110@gmail.com> Co-authored-by: Mykola Nahirnyi <mnahirnyi@amcbridge.com> Co-authored-by: Ian Chua <iancrb00@gmail.com> Co-authored-by: Draginraptor <draginraptor@gmail.com> Co-authored-by: ExPikaPaka <112851715+ExPikaPaka@users.noreply.github.com> Co-authored-by: Ian Bassi <ian.bassi@outlook.com> Co-authored-by: Ocraftyone <Ocraftyone@users.noreply.github.com> Co-authored-by: yw4z <ywsyildiz@gmail.com> Co-authored-by: peterm-m <101202951+peterm-m@users.noreply.github.com> * Fixed an issue on Windows it failed to login Orca Cloud with Google account
This commit is contained in:
@@ -509,7 +509,6 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
||||
SaveProfile();
|
||||
|
||||
std::string oldregion = m_ProfileJson["region"];
|
||||
bool bLogin = false;
|
||||
if (m_Region != oldregion) {
|
||||
AppConfig* config = GUI::wxGetApp().app_config;
|
||||
std::string country_code = config->get_country_code();
|
||||
@@ -517,7 +516,6 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
||||
if (agent) {
|
||||
agent->set_country_code(country_code);
|
||||
if (wxGetApp().is_user_login()) {
|
||||
bLogin = true;
|
||||
agent->user_logout();
|
||||
}
|
||||
}
|
||||
@@ -526,10 +524,7 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
|
||||
this->EndModal(wxID_OK);
|
||||
|
||||
if (InstallNetplugin)
|
||||
GUI::wxGetApp().CallAfter([this] { GUI::wxGetApp().ShowDownNetPluginDlg(); });
|
||||
|
||||
if (bLogin)
|
||||
GUI::wxGetApp().CallAfter([this] { login(); });
|
||||
GUI::wxGetApp().CallAfter([] { GUI::wxGetApp().ShowDownNetPluginDlg(); });
|
||||
}
|
||||
else if (strCmd == "user_guide_cancel") {
|
||||
this->EndModal(wxID_CANCEL);
|
||||
@@ -790,11 +785,9 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
|
||||
!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes))
|
||||
return false;
|
||||
|
||||
if (install_bundles.size() > 0) {
|
||||
// Install bundles from resources.
|
||||
// Don't create snapshot - we've already done that above if applicable.
|
||||
if (! updater->install_bundles_rsrc(std::move(install_bundles), false))
|
||||
return false;
|
||||
// If there are bundles to install, they will be installed by apply_vendor_config
|
||||
if (!install_bundles.empty()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Will install " << install_bundles.size() << " vendor bundles from resources";
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "No bundles need to be installed from resource directory";
|
||||
}
|
||||
@@ -884,32 +877,82 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
|
||||
// Not switch filament
|
||||
//get_first_added_material_preset(AppConfig::SECTION_FILAMENTS, first_added_filament);
|
||||
|
||||
//update the app_config
|
||||
app_config->set_section(AppConfig::SECTION_FILAMENTS, enabled_filaments);
|
||||
app_config->set_vendors(m_appconfig_new);
|
||||
// ORCA: functionality moved to PresetBundle::apply_vendor_config; keeping for future reference
|
||||
// // For each @System filament, check if a vendor-specific override exists
|
||||
// // in the loaded profiles. If so, replace the @System variant with the
|
||||
// // override (e.g. replace "Generic ABS @System" with BBL "Generic ABS").
|
||||
// // When printers from the default bundle are also selected, keep @System
|
||||
// // too since those printers need it.
|
||||
// static const std::string system_suffix = " @System";
|
||||
// auto it_default = enabled_vendors.find(PresetBundle::ORCA_DEFAULT_BUNDLE);
|
||||
// bool has_default_bundle_printer = it_default != enabled_vendors.end() && !it_default->second.empty();
|
||||
// bool has_filament_profiles = m_ProfileJson.contains("filament");
|
||||
|
||||
if (check_unsaved_preset_changes)
|
||||
preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::Enable,
|
||||
{preferred_model, preferred_variant, first_added_filament, std::string()});
|
||||
// // Check if any non-default vendor has selected printers
|
||||
// bool has_vendor_printer = false;
|
||||
// for (const auto& [vendor, models] : enabled_vendors) {
|
||||
// if (vendor != PresetBundle::ORCA_DEFAULT_BUNDLE && !models.empty()) {
|
||||
// has_vendor_printer = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// If the active filament is not in the wizard-selected filaments, switch to the first
|
||||
// compatible wizard-selected filament. This handles the first-run case where load_presets
|
||||
// falls back to "Generic PLA" even though the user selected a different filament.
|
||||
bool active_filament_selected = enabled_filaments.empty()
|
||||
|| enabled_filaments.count(preset_bundle->filament_presets.front()) > 0;
|
||||
if (!active_filament_selected) {
|
||||
for (const auto& [filament_name, _] : enabled_filaments) {
|
||||
const Preset* preset = preset_bundle->filaments.find_preset(filament_name);
|
||||
if (preset && preset->is_visible && preset->is_compatible) {
|
||||
preset_bundle->filaments.select_preset_by_name(filament_name, true);
|
||||
preset_bundle->filament_presets.front() = preset_bundle->filaments.get_selected_preset_name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// std::map<std::string, std::string> supplemented_filaments;
|
||||
// for (const auto& [name, value] : enabled_filaments) {
|
||||
// if (name.size() > system_suffix.size() &&
|
||||
// name.compare(name.size() - system_suffix.size(), system_suffix.size(), system_suffix) == 0) {
|
||||
// std::string short_name = name.substr(0, name.size() - system_suffix.size());
|
||||
// if (has_vendor_printer && has_filament_profiles && m_ProfileJson["filament"].contains(short_name)) {
|
||||
// supplemented_filaments[short_name] = value;
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " Replacing @System filament: '" << name << "' -> '" << short_name << "'";
|
||||
// if (has_default_bundle_printer) {
|
||||
// supplemented_filaments[name] = value;
|
||||
// BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " Also keeping '" << name << "' for default bundle printers";
|
||||
// }
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// supplemented_filaments[name] = value;
|
||||
// }
|
||||
|
||||
// Update the selections from the compatibilty.
|
||||
preset_bundle->export_selections(*app_config);
|
||||
// //update the app_config
|
||||
// app_config->set_section(AppConfig::SECTION_FILAMENTS, supplemented_filaments);
|
||||
// app_config->set_vendors(m_appconfig_new);
|
||||
|
||||
// if (check_unsaved_preset_changes)
|
||||
// preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::Enable,
|
||||
// {preferred_model, preferred_variant, first_added_filament, std::string()});
|
||||
|
||||
// // If the active filament is not in the wizard-selected filaments, switch to the first
|
||||
// // compatible wizard-selected filament. This handles the first-run case where load_presets
|
||||
// // falls back to "Generic PLA" even though the user selected a different filament.
|
||||
// bool active_filament_selected = supplemented_filaments.empty()
|
||||
// || supplemented_filaments.count(preset_bundle->filament_presets.front()) > 0;
|
||||
// if (!active_filament_selected) {
|
||||
// for (const auto& [filament_name, _] : supplemented_filaments) {
|
||||
// const Preset* preset = preset_bundle->filaments.find_preset(filament_name);
|
||||
// if (preset && preset->is_visible && preset->is_compatible) {
|
||||
// preset_bundle->filaments.select_preset_by_name(filament_name, true);
|
||||
// preset_bundle->filament_presets.front() = preset_bundle->filaments.get_selected_preset_name();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Update the selections from the compatibilty.
|
||||
// preset_bundle->export_selections(*app_config);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "calling apply_vendor_config from WebGuideDialog";
|
||||
// Call the Core library function to apply vendor configuration
|
||||
// This handles bundle installation, filament @System substitution, AppConfig updates, and preset loading
|
||||
if (!preset_bundle->apply_vendor_config(
|
||||
enabled_vendors,
|
||||
enabled_filaments,
|
||||
app_config,
|
||||
true,
|
||||
preferred_model,
|
||||
preferred_variant))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user