* 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:
SoftFever
2026-05-01 18:01:29 +08:00
committed by GitHub
parent e54e7a61c0
commit c04be9ab37
113 changed files with 8691 additions and 3467 deletions

View File

@@ -1133,16 +1133,21 @@ void PlaterPresetComboBox::update()
std::map<wxString, wxBitmap*> nonsys_presets;
//BBS: add project embedded presets logic
std::map<wxString, wxBitmap*> project_embedded_presets;
// ORCA: add bundle presets
std::map<wxString, wxBitmap*> bundle_presets;
std::map<wxString, wxBitmap *> system_presets;
std::map<wxString, wxBitmap *> uncompatible_presets;
std::unordered_set<std::string> system_printer_models;
std::map<wxString, wxString> preset_descriptions;
std::map<wxString, std::string> preset_filament_vendors;
std::map<wxString, std::string> preset_filament_types;
std::map<wxString, std::string> preset_filament_names; // ORCA
std::map<wxString, std::string> preset_aliases; // ORCA
std::map<wxString, std::string> preset_bundle_ids;
std::map<wxString, std::string> preset_bundle_names;
//BBS: move system to the end
wxString selected_system_preset;
wxString selected_user_preset;
wxString selected_bundle_preset;
wxString tooltip;
const std::deque<Preset>& presets = m_collection->get_presets();
@@ -1170,7 +1175,21 @@ void PlaterPresetComboBox::update()
}
bool single_bar = false;
wxString name = get_preset_name(preset);
wxString name = preset.name;
preset_aliases[name] = get_preset_name(preset).ToStdString(); // ORCA
// Track bundle names for bundled presets
if (preset.is_from_bundle()) {
m_preset_bundle->bundles.ReadLock();
auto bundle_it = m_preset_bundle->bundles.m_bundles.find(preset.bundle_id);
if (bundle_it != m_preset_bundle->bundles.m_bundles.end()) {
preset_bundle_ids[name] = bundle_it->second.id;
preset_bundle_names[name] = bundle_it->second.name;
}
m_preset_bundle->bundles.ReadUnlock();
}
if (m_type == Preset::TYPE_FILAMENT)
{
#if 0
@@ -1192,7 +1211,6 @@ void PlaterPresetComboBox::update()
if (preset_filament_vendors[name] == "Bambu Lab")
preset_filament_vendors[name] = "Bambu";
preset_filament_types[name] = preset.config.option<ConfigOptionStrings>("filament_type")->values.at(0);
preset_filament_names[name] = name.ToStdString(); // ORCA
//}
}
wxBitmap* bmp = get_bmp(preset);
@@ -1214,6 +1232,7 @@ void PlaterPresetComboBox::update()
name = from_u8(is_selected && preset.is_dirty ? Preset::suffix_modified() + printer_model : printer_model);
if (system_printer_models.count(printer_model) == 0) {
preset_aliases[name] = name.ToStdString(); // ORCA
system_presets.emplace(name, bmp);
system_printer_models.insert(printer_model);
}
@@ -1246,6 +1265,15 @@ void PlaterPresetComboBox::update()
tooltip = wxString::FromUTF8(preset.name.c_str());
}
}
// ORCA: add bundle presets
else if (preset.is_from_bundle())
{
bundle_presets.emplace(name, bmp);
if (is_selected) {
selected_bundle_preset = name;
tooltip = get_tooltip(preset);
}
}
else
{
nonsys_presets.emplace(name, bmp);
@@ -1271,11 +1299,11 @@ void PlaterPresetComboBox::update()
"Bambu PLA Galaxy", "Bambu PLA Metal", "Bambu PLA Marble", "Bambu PETG-CF", "Bambu PETG Translucent", "Bambu ABS-GF"};
std::vector<std::string> first_vendors = {"", "Bambu", "Generic"}; // Empty vendor for non-system presets
std::vector<std::string> first_types = {"PLA", "PETG", "ABS", "TPU"};
auto add_presets = [this, &preset_descriptions, &filament_orders, &preset_filament_vendors, &first_vendors, &preset_filament_types, &preset_filament_names, &first_types, &selected_in_ams]
auto add_presets = [this, &preset_descriptions, &filament_orders, &preset_filament_vendors, &first_vendors, &preset_filament_types, &preset_aliases, &preset_bundle_ids, &preset_bundle_names, &first_types, &selected_in_ams]
(std::map<wxString, wxBitmap *> const &presets, wxString const &selected, std::string const &group, wxString const &groupName) {
if (!presets.empty()) {
set_label_marker(Append(_L(group), wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM));
if (m_type == Preset::TYPE_FILAMENT) {
if (m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_PRINTER) {
std::vector<std::map<wxString, wxBitmap *>::value_type const*> list(presets.size(), nullptr);
std::transform(presets.begin(), presets.end(), list.begin(), [](auto & pair) { return &pair; });
bool groupByGroup = group != "System presets";
@@ -1283,7 +1311,7 @@ void PlaterPresetComboBox::update()
// if (GetCount() == 1) Clear();
// else SetString(GetCount() - 1, "");
//}
if (group == "System presets" || group == "Unsupported presets")
if (m_type == Preset::TYPE_FILAMENT && (group == "System presets" || group == "Unsupported presets"))
std::sort(list.begin(), list.end(), [&filament_orders, &preset_filament_vendors, &first_vendors, &preset_filament_types, &first_types](auto *l, auto *r) {
{ // Compare order
auto iter1 = std::find(filament_orders.begin(), filament_orders.end(), l->first);
@@ -1306,10 +1334,11 @@ void PlaterPresetComboBox::update()
return l->first < r->first;
});
// ORCA add sorting support for vendor / type for user presets. also non grouped items
if (groupName == "by_vendor" || groupName == "by_type" || groupName == ""){
auto by = groupName == "by_vendor" ? preset_filament_vendors
if (groupName == "by_bundle" || groupName == "by_vendor" || groupName == "by_type" || groupName == ""){
auto by = groupName == "by_bundle" ? preset_bundle_names
: groupName == "by_vendor" ? preset_filament_vendors
: groupName == "by_type" ? preset_filament_types
: preset_filament_names;
: preset_aliases;
std::sort(list.begin(), list.end(), [&by](auto *l, auto *r) {
auto get_key = [&](auto* item) -> std::pair<bool, std::string> {
std::string str = by.count(item->first) ? by.at(item->first) : "";
@@ -1319,20 +1348,29 @@ void PlaterPresetComboBox::update()
auto [l_valid, l_lower] = get_key(l);
auto [r_valid, r_lower] = get_key(r);
return (l_valid != r_valid) ? l_valid > r_valid
: (l_lower != r_lower) ? l_lower < r_lower
: (l_lower != r_lower) ? l_lower < r_lower
: l->first < r->first;
});
}
bool unsupported = group == "Unsupported presets";
for (auto it : list) {
// ORCA add sorting support for vendor / type for user presets
auto groupName2 = groupName == "by_type" ? (preset_filament_types[it->first].empty() ? _L("Unspecified") : preset_filament_types[it->first])
: groupName == "by_vendor" ? (preset_filament_vendors[it->first].empty() ? _L("Unspecified") : preset_filament_vendors[it->first])
: groupByGroup ? groupName
auto groupName2 = groupName == "by_bundle" ? (preset_bundle_names[it->first].empty() ? _L("Unspecified") : preset_bundle_names[it->first])
: groupName == "by_type" ? (preset_filament_types[it->first].empty() ? _L("Unspecified") : preset_filament_types[it->first])
: groupName == "by_vendor" ? (preset_filament_vendors[it->first].empty() ? _L("Unspecified") : preset_filament_vendors[it->first])
: groupByGroup ? groupName
: preset_filament_vendors[it->first];
int index = Append(it->first, *it->second, groupName2, nullptr, unsupported ? DD_ITEM_STYLE_DISABLED : 0);
int index = groupName == "by_bundle"
? Append(preset_aliases[it->first], *it->second,
from_u8(preset_bundle_ids[it->first]), groupName2, nullptr,
unsupported ? DD_ITEM_STYLE_DISABLED : 0)
: Append(preset_aliases[it->first], *it->second, groupName2, nullptr,
unsupported ? DD_ITEM_STYLE_DISABLED : 0);
SetItemAlias(index, it->first);
if (unsupported)
set_label_marker(index, LABEL_ITEM_DISABLED);
else if (m_type == Preset::TYPE_PRINTER && group == "System presets" )
set_label_marker(index, LABEL_ITEM_PRINTER_MODELS);
SetItemTooltip(index, preset_descriptions[it->first]);
bool is_selected = it->first == selected;
validate_selection(is_selected);
@@ -1342,7 +1380,9 @@ void PlaterPresetComboBox::update()
}
} else {
for (std::map<wxString, wxBitmap *>::const_iterator it = presets.begin(); it != presets.end(); ++it) {
SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
int index = Append(preset_aliases[it->first], *it->second);
SetItemAlias(index, it->first);
SetItemTooltip(index, preset_descriptions[it->first]);
if (group == "System presets")
set_label_marker(GetCount() - 1, LABEL_ITEM_PRINTER_MODELS);
validate_selection(it->first == selected);
@@ -1360,6 +1400,9 @@ void PlaterPresetComboBox::update()
: group_filament_presets == "3" ? "by_vendor" // Create sub menus with filament vendor
: ""; // Use without sub menu
add_presets(nonsys_presets, selected_user_preset, L("User presets"), group_filament_presets_by);
// ORCA: add bundle presets with sub-dropdown grouping for filament and printer
auto bundle_group_name = (m_type == Preset::TYPE_FILAMENT || m_type == Preset::TYPE_PRINTER) ? "by_bundle" : "";
add_presets(bundle_presets, selected_bundle_preset, L("Bundle presets"), bundle_group_name);
// BBS: move system to the end
add_presets(system_presets, selected_system_preset, L("System presets"), _L("System"));
add_presets(uncompatible_presets, {}, L("Unsupported presets"), _L("Unsupported") + " ");
@@ -1579,7 +1622,10 @@ void TabPresetComboBox::OnSelect(wxCommandEvent &evt)
wxString TabPresetComboBox::get_preset_name(const Preset& preset)
{
return from_u8(preset.label(true));
if (preset.is_from_bundle())
return from_u8(preset.label(false));
else
return from_u8(preset.label(true));
}
// Update the choice UI from the list of presets.
@@ -1598,7 +1644,12 @@ void TabPresetComboBox::update()
std::map<wxString, std::pair<wxBitmap*, bool>> project_embedded_presets;
//BBS: move system to the end
std::map<wxString, std::pair<wxBitmap*, bool>> system_presets;
// ORCA: add bundle presets
std::map<wxString, std::pair<wxBitmap*, bool>> bundle_presets;
std::map<wxString, wxString> preset_descriptions;
std::map<wxString, std::string> preset_aliases; // ORCA
std::map<wxString, std::string> preset_bundle_ids;
std::map<wxString, std::string> preset_bundle_names;
wxString selected = "";
//BBS: move system to the end
@@ -1625,10 +1676,23 @@ void TabPresetComboBox::update()
wxBitmap* bmp = get_bmp(preset);
assert(bmp);
const wxString name = get_preset_name(preset);
const wxString name = preset.name;
preset_aliases[name] = get_preset_name(preset).ToStdString();
if (preset.is_system)
preset_descriptions.emplace(name, from_u8(preset.description));
// ORCA: Track bundle names for bundled presets
if (preset.is_from_bundle()) {
m_preset_bundle->bundles.ReadLock();
auto bundle_it = m_preset_bundle->bundles.m_bundles.find(preset.bundle_id);
if (bundle_it != m_preset_bundle->bundles.m_bundles.end()) {
preset_bundle_ids[name] = bundle_it->second.id;
preset_bundle_names[name] = bundle_it->second.name;
}
m_preset_bundle->bundles.ReadUnlock();
}
if (preset.is_default || preset.is_system) {
//BBS: move system to the end
system_presets.emplace(name, std::pair<wxBitmap *, bool>(bmp, is_enabled));
@@ -1647,6 +1711,13 @@ void TabPresetComboBox::update()
if (i == idx_selected)
selected = name;
}
// ORCA: add bundle presets
else if (preset.is_from_bundle())
{
bundle_presets.emplace(name, std::pair<wxBitmap*, bool>(bmp, is_enabled));
if (i == idx_selected)
selected = name;
}
else
{
std::pair<wxBitmap*, bool> pair(bmp, is_enabled);
@@ -1680,6 +1751,27 @@ void TabPresetComboBox::update()
set_label_marker(Append(_L("User presets"), wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM));
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
int item_id = Append(it->first, *it->second.first);
SetItemAlias(item_id, it->first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second;
if (!is_enabled)
set_label_marker(item_id, LABEL_ITEM_DISABLED);
validate_selection(it->first == selected);
}
}
// ORCA: add bundle presets with sub-dropdown grouping
if (!bundle_presets.empty())
{
set_label_marker(Append(_L("Bundle presets"), wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM));
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = bundle_presets.begin(); it != bundle_presets.end(); ++it) {
// Get bundle name for grouping
wxString bundle_name = _L("Unspecified");
if (preset_bundle_names.count(it->first) > 0 && !preset_bundle_names[it->first].empty()) {
bundle_name = preset_bundle_names[it->first];
}
// Use Append with group parameter for sub-dropdown grouping
int item_id = Append(preset_aliases[it->first], *it->second.first, from_u8(preset_bundle_ids[it->first]), bundle_name);
SetItemAlias(item_id, it->first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second;
if (!is_enabled)
@@ -1693,6 +1785,7 @@ void TabPresetComboBox::update()
set_label_marker(Append(_L("System presets"), wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM));
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = system_presets.begin(); it != system_presets.end(); ++it) {
int item_id = Append(it->first, *it->second.first);
SetItemAlias(item_id, it->first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second;
if (!is_enabled)