Merge: Snapmaker Orca 2.1.2

This commit is contained in:
xiaoyeliu
2025-11-17 10:04:25 +08:00
parent 737948be1f
commit e89263e51a
1147 changed files with 668188 additions and 15290 deletions

View File

@@ -334,40 +334,39 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin
combobox->GetDropDown().Bind(wxEVT_COMBOBOX, [this, combobox, current_region, local_regions](wxCommandEvent &e) {
auto region_index = e.GetSelection();
auto region = local_regions[region_index];
/*auto area = "";
if (region == "CHN" || region == "China")
area = "CN";
else if (region == "USA")
area = "US";
else if (region == "Asia-Pacific")
area = "Others";
else if (region == "Europe")
area = "US";
else if (region == "North America")
area = "US";
else
area = "Others";*/
combobox->SetSelection(region_index);
NetworkAgent* agent = wxGetApp().getAgent();
// snapmaker
AppConfig* config = GUI::wxGetApp().app_config;
if (agent) {
MessageDialog msg_wingow(this, _L("Changing the region will log out your account.\n") + "\n" + _L("Do you want to continue?"), L("Region selection"),
wxICON_QUESTION | wxOK | wxCANCEL);
combobox->SetSelection(region_index);
auto info = wxGetApp().sm_get_userinfo();
if (info && info->is_user_login()) {
MessageDialog msg_wingow(this, _L("Changing the region will log out your account and restart.\n") + "\n" + _L("Do you want to continue?"),
L("Region selection"), wxICON_QUESTION | wxOK | wxCANCEL);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
combobox->SetSelection(current_region);
return;
} else {
wxGetApp().request_user_logout();
wxGetApp().sm_request_user_logout();
config->set("region", region.ToStdString());
auto area = config->get_country_code();
if (agent) {
agent->set_country_code(area);
}
EndModal(wxID_CANCEL);
}
Close();
GetParent()->RemoveChild(this);
wxGetApp().recreate_GUI(_L("Change Region"));
} else {
MessageDialog msg_wingow(nullptr,
_L("Switching the region requires application restart.\n") + "\n" + _L("Do you want to continue?"),
L("Region selection"), wxICON_QUESTION | wxOK | wxCANCEL);
if (msg_wingow.ShowModal() == wxID_CANCEL) {
combobox->SetSelection(current_region);
return;
}
config->set("region", region.ToStdString());
Close();
GetParent()->RemoveChild(this);
wxGetApp().recreate_GUI(_L("Change Region"));
}
wxGetApp().update_publish_status();
@@ -943,7 +942,7 @@ wxWindow *PreferencesDialog ::create_item_radiobox(wxString title, wxWindow *par
wxBoxSizer* PreferencesDialog::create_item_link_association(wxWindow* parent, wxString url_prefix, wxString website_name)
{
wxString title = _L("Associate") + (boost::format(" %1%://") % url_prefix.c_str()).str();
wxString tooltip = _L("Associate") + " " + url_prefix + ":// " + _L("with OrcaSlicer so that Orca can open models from") + " " + website_name;
wxString tooltip = _L("Associate") + " " + url_prefix + ":// " + _L("with Snapmaker Orca so that Orca can open models from") + " " + website_name;
std::wstring registered_bin; // not used, just here to provide a ref to check fn
bool reg_to_current_instance = wxGetApp().check_url_association(url_prefix.ToStdWstring(), registered_bin);
@@ -1046,6 +1045,9 @@ void PreferencesDialog::create()
app_config = get_app_config();
m_backup_interval_time = app_config->get("backup_interval");
// set icon for dialog
std::string icon_path = (boost::format("%1%/images/Snapmaker_OrcaTitle.ico") % resources_dir()).str();
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
SetSizeHints(wxDefaultSize, wxDefaultSize);
auto main_sizer = new wxBoxSizer(wxVERTICAL);
@@ -1176,19 +1178,27 @@ wxWindow* PreferencesDialog::create_general_page()
std::vector<wxString> Regions = {_L("Asia-Pacific"), _L("China"), _L("Europe"), _L("North America"), _L("Others")};
auto item_region= create_item_region_combobox(_L("Login Region"), page, _L("Login Region"), Regions);
auto item_stealth_mode = create_item_checkbox(_L("Stealth Mode"), page, _L("This stops the transmission of data to Bambu's cloud services. Users who don't use BBL machines or use LAN mode only can safely turn on this function."), 50, "stealth_mode");
// SM Beta: temporarily open the item_stealth_mode and close the network plugin
/*auto item_stealth_mode = create_item_checkbox(_L("Stealth Mode"), page, _L("This stops the transmission of data to Bambu's cloud services. Users who don't use BBL machines or use LAN mode only can safely turn on this function."), 50, "stealth_mode");
auto item_enable_plugin = create_item_checkbox(_L("Enable network plugin"), page, _L("Enable network plugin"), 50, "installed_networking");
auto item_legacy_network_plugin = create_item_checkbox(_L("Use legacy network plugin (Takes effect after restarting Orca)"), page, _L("Disable to use latest network plugin that supports new BambuLab firmwares."), 50, "legacy_networking");
*/
app_config->set_bool("stealth_mode", true);
app_config->set_bool("installed_networking", false);
app_config->save();
auto item_check_stable_version_only = create_item_checkbox(_L("Check for stable updates only"), page, _L("Check for stable updates only"), 50, "check_stable_update_only");
std::vector<wxString> Units = {_L("Metric") + " (mm, g)", _L("Imperial") + " (in, oz)"};
auto item_currency = create_item_combobox(_L("Units"), page, _L("Units"), "use_inches", Units);
auto item_single_instance = create_item_checkbox(_L("Allow only one OrcaSlicer instance"), page,
auto item_single_instance = create_item_checkbox(_L("Allow only one Snapmaker Orca instance"), page,
#if __APPLE__
_L("On OSX there is always only one instance of app running by default. However it is allowed to run multiple instances "
"of same app from the command line. In such case this settings will allow only one instance."),
#else
_L("If this is enabled, when starting OrcaSlicer and another instance of the same OrcaSlicer is already running, that instance will be reactivated instead."),
_L("If this is enabled, when starting Snapmaker Orca and another instance of the same Snapmaker Orca is already running, that instance will be reactivated instead."),
#endif
50, "single_instance");
@@ -1222,17 +1232,17 @@ wxWindow* PreferencesDialog::create_general_page()
});
#ifdef _WIN32
auto title_associate_file = create_item_title(_L("Associate files to OrcaSlicer"), page, _L("Associate files to OrcaSlicer"));
auto title_associate_file = create_item_title(_L("Associate files to Snapmaker Orca"), page, _L("Associate files to Snapmaker Orca"));
// associate file
auto item_associate_3mf = create_item_checkbox(_L("Associate .3mf files to OrcaSlicer"), page,
_L("If enabled, sets OrcaSlicer as default application to open .3mf files"), 50, "associate_3mf");
auto item_associate_stl = create_item_checkbox(_L("Associate .stl files to OrcaSlicer"), page,
_L("If enabled, sets OrcaSlicer as default application to open .stl files"), 50, "associate_stl");
auto item_associate_step = create_item_checkbox(_L("Associate .step/.stp files to OrcaSlicer"), page,
_L("If enabled, sets OrcaSlicer as default application to open .step files"), 50, "associate_step");
auto item_associate_3mf = create_item_checkbox(_L("Associate .3mf files to Snapmaker Orca"), page,
_L("If enabled, sets Snapmaker Orca as default application to open .3mf files"), 50, "associate_3mf");
auto item_associate_stl = create_item_checkbox(_L("Associate .stl files to Snapmaker Orca"), page,
_L("If enabled, sets Snapmaker Orca as default application to open .stl files"), 50, "associate_stl");
auto item_associate_step = create_item_checkbox(_L("Associate .step/.stp files to Snapmaker Orca"), page,
_L("If enabled, sets Snapmaker Orca as default application to open .step files"), 50, "associate_step");
auto title_associate_url = create_item_title(_L("Associate web links to OrcaSlicer"), page, _L("Associate URLs to OrcaSlicer"));
auto title_associate_url = create_item_title(_L("Associate web links to Snapmaker Orca"), page, _L("Associate URLs to Snapmaker Orca"));
auto associate_url_prusaslicer = create_item_link_association(page, L"prusaslicer", "Printables.com");
auto associate_url_bambustudio = create_item_link_association(page, L"bambustudio", "Makerworld.com");
@@ -1305,9 +1315,13 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_save_presets, 0, wxTOP, FromDIP(3));
sizer_page->Add(title_network, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_check_stable_version_only, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_stealth_mode, 0, wxTOP, FromDIP(3));
// SM Beta: temporarily open the item_stealth_mode and close the network plugin
/*sizer_page->Add(item_stealth_mode, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_enable_plugin, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_legacy_network_plugin, 0, wxTOP, FromDIP(3));
*/
#ifdef _WIN32
sizer_page->Add(title_associate_file, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_associate_3mf, 0, wxTOP, FromDIP(3));