some misc changes (#1848)

* some misc changes
* stealth_mode: disable hms
* fix bbl camera  #1091 #1830
* fix anker
This commit is contained in:
SoftFever 2023-08-20 20:02:54 +08:00 committed by GitHub
parent a202fde769
commit 6e1bdaf9d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 360 additions and 296 deletions

View file

@ -1141,6 +1141,9 @@ void GUI_App::post_init()
}
#endif
if (app_config->get("stealth_mode") == "false")
hms_query = new HMSQuery();
m_show_gcode_window = app_config->get("show_gcode_window") == "true";
if (m_networking_need_update) {
//updating networking
@ -1165,17 +1168,17 @@ void GUI_App::post_init()
CallAfter([this] {
bool cw_showed = this->config_wizard_startup();
std::string http_url = get_http_url(app_config->get_country_code());
std::string language = GUI::into_u8(current_language_code());
std::string network_ver = Slic3r::NetworkAgent::get_version();
bool sys_preset = app_config->get("sync_system_preset") == "true";
this->preset_updater->sync(http_url, language, network_ver, sys_preset ? preset_bundle : nullptr);
// std::string http_url = get_http_url(app_config->get_country_code());
// std::string language = GUI::into_u8(current_language_code());
// std::string network_ver = Slic3r::NetworkAgent::get_version();
// bool sys_preset = app_config->get("sync_system_preset") == "true";
// this->preset_updater->sync(http_url, language, network_ver, sys_preset ? preset_bundle : nullptr);
//BBS: check new version
this->check_new_version_sf();
//BBS: check privacy version
if (is_user_login())
this->check_privacy_version(0);
// if (is_user_login())
// this->check_privacy_version(0);
});
}
@ -1269,7 +1272,6 @@ GUI_App::GUI_App()
, m_app_mode(EAppMode::Editor)
, m_em_unit(10)
, m_imgui(new ImGuiWrapper())
, hms_query(new HMSQuery())
, m_removable_drive_manager(std::make_unique<RemovableDriveManager>())
//, m_other_instance_message_handler(std::make_unique<OtherInstanceMessageHandler>())
{

View file

@ -925,6 +925,8 @@ 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("Stealth Mode"), 50, "stealth_mode");
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);
@ -984,6 +986,7 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_gcode_window, 0, wxTOP, FromDIP(3));
sizer_page->Add(title_presets, 0, wxTOP | wxEXPAND, FromDIP(20));
sizer_page->Add(item_stealth_mode, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_system_sync, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_save_presets, 0, wxTOP, FromDIP(3));

View file

@ -1,6 +1,9 @@
#include "wxMediaCtrl2.h"
#include "libslic3r/Time.hpp"
#include "I18N.hpp"
#include "GUI_App.hpp"
#include <boost/filesystem/operations.hpp>
#include <winuser.h>
#ifdef __WIN32__
#include <versionhelpers.h>
#include <wx/msw/registry.h>
@ -72,14 +75,34 @@ void wxMediaCtrl2::Load(wxURI url)
std::string data_dir_str = Slic3r::data_dir();
boost::filesystem::path data_dir_path(data_dir_str);
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
if (boost::filesystem::exists(dll_path)) {
CallAfter(
[dll_path] {
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO);
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it. You will be promoted twice"), _L("Error"), wxYES_NO);
if (res == wxYES) {
wstring quoted_dll_path = L"\"" + dll_path.wstring() + "\"";
std::string regContent = R"(Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\bambu]
"Source Filter"="{233E64FB-2041-4A6C-AFAB-FF9BCF83E7AA}"
)";
auto reg_path = (fs::temp_directory_path() / fs::unique_path()).replace_extension(".reg");
std::ofstream temp_reg_file(reg_path.c_str());
if (!temp_reg_file) {
return false;
}
temp_reg_file << regContent;
temp_reg_file.close();
auto sei_params = L"/q /s " + reg_path.wstring();
SHELLEXECUTEINFO sei{sizeof(sei), SEE_MASK_NOCLOSEPROCESS, NULL, L"open",
L"regedit", sei_params.c_str(),SW_HIDE,SW_HIDE};
::ShellExecuteEx(&sei);
wstring quoted_dll_path = L"\"" + dll_path.wstring() + L"\"";
SHELLEXECUTEINFO info{sizeof(info), 0, NULL, L"runas", L"regsvr32", quoted_dll_path.c_str(), SW_HIDE };
::ShellExecuteEx(&info);
fs::remove(reg_path);
}
});
} else {