FIX: remove some warnings

jira: [none]
Change-Id: I0e74b7316d0efe38c65e1f695b2a09eb09103552
(cherry picked from commit 766c6e004145325bcc7a6addfce27842ee9504de)
This commit is contained in:
xin.zhang
2025-10-26 11:51:19 +08:00
committed by Noisyfox
parent 786ce70a29
commit bad631d389
16 changed files with 36 additions and 32 deletions
+2 -1
View File
@@ -33,8 +33,9 @@ struct ExtrusionLayer
enum class ExtrusionLayersType { INFILL, PERIMETERS, SUPPORT, WIPE_TOWER }; enum class ExtrusionLayersType { INFILL, PERIMETERS, SUPPORT, WIPE_TOWER };
struct ExtrusionLayers : public std::vector<ExtrusionLayer> class ExtrusionLayers : public std::vector<ExtrusionLayer>
{ {
public:
ExtrusionLayersType type; ExtrusionLayersType type;
}; };
+5 -5
View File
@@ -2186,7 +2186,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::vector<std::string> ne
} }
void PresetBundle::set_num_filaments(unsigned int n, std::string new_color) void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
{ {
int old_filament_count = this->filament_presets.size(); unsigned old_filament_count = this->filament_presets.size();
if (n > old_filament_count && old_filament_count != 0) if (n > old_filament_count && old_filament_count != 0)
filament_presets.resize(n, filament_presets.back()); filament_presets.resize(n, filament_presets.back());
else { else {
@@ -2205,7 +2205,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
//BBS set new filament color to new_color //BBS set new filament color to new_color
if (old_filament_count < n) { if (old_filament_count < n) {
if (!new_color.empty()) { if (!new_color.empty()) {
for (int i = old_filament_count; i < n; i++) { for (unsigned i = old_filament_count; i < n; i++) {
filament_color->values[i] = new_color; filament_color->values[i] = new_color;
filament_multi_color->values[i] = new_color; filament_multi_color->values[i] = new_color;
filament_color_type->values[i] = "1"; // default color type filament_color_type->values[i] = "1"; // default color type
@@ -2218,7 +2218,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
void PresetBundle::update_num_filaments(unsigned int to_del_flament_id) void PresetBundle::update_num_filaments(unsigned int to_del_flament_id)
{ {
int old_filament_count = this->filament_presets.size(); unsigned old_filament_count = this->filament_presets.size();
assert(to_del_flament_id < old_filament_count); assert(to_del_flament_id < old_filament_count);
filament_presets.erase(filament_presets.begin() + to_del_flament_id); filament_presets.erase(filament_presets.begin() + to_del_flament_id);
@@ -2778,7 +2778,7 @@ Preset *PresetBundle::get_similar_printer_preset(std::string printer_model, std:
//BBS: check whether this is the only edited filament //BBS: check whether this is the only edited filament
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index) bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
{ {
int n = this->filament_presets.size(); unsigned n = this->filament_presets.size();
if (filament_index >= n) if (filament_index >= n)
return false; return false;
@@ -2787,7 +2787,7 @@ bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
if (edited_preset.name != name) if (edited_preset.name != name)
return false; return false;
int index = 0; unsigned index = 0;
while (index < n) while (index < n)
{ {
if (index == filament_index) { if (index == filament_index) {
+4 -4
View File
@@ -4123,7 +4123,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":error parsing thin_fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(":error parsing thin_fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing thin_fills at layer %zd, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); ::sprintf(error_buf, "Error while parsing thin_fills at layer %zu, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
@@ -4178,7 +4178,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing perimeters found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing perimeters found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing perimeters at layer %zd, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); ::sprintf(error_buf, "Error while parsing perimeters at layer %zu, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
@@ -4193,7 +4193,7 @@ static void convert_layer_region_from_json(const json& j, LayerRegion& layer_reg
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at layer %1%, print_z %2%") %layer_region.layer()->id() %layer_region.layer()->print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing fills at layer %zd, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z); ::sprintf(error_buf, "Error while parsing fills at layer %zu, print_z %f", layer_region.layer()->id(), layer_region.layer()->print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
@@ -4274,7 +4274,7 @@ void extract_support_layer(const json& support_layer_json, SupportLayer& support
if (!ret) { if (!ret) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at support_layer %1%, print_z %2%")%support_layer.id() %support_layer.print_z; BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": error parsing fills found at support_layer %1%, print_z %2%")%support_layer.id() %support_layer.print_z;
char error_buf[1024]; char error_buf[1024];
::sprintf(error_buf, "Error while parsing fills at support_layer %zd, print_z %f", support_layer.id(), support_layer.print_z); ::sprintf(error_buf, "Error while parsing fills at support_layer %zu, print_z %f", support_layer.id(), support_layer.print_z);
throw Slic3r::FileIOError(error_buf); throw Slic3r::FileIOError(error_buf);
} }
} }
+1 -1
View File
@@ -8718,7 +8718,7 @@ void DynamicPrintConfig::update_values_to_printer_extruders(DynamicPrintConfig&
auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type")); auto opt_nozzle_volume_type = dynamic_cast<const ConfigOptionEnumsGeneric*>(printer_config.option("nozzle_volume_type"));
std::vector<int> variant_index; std::vector<int> variant_index;
if (extruder_id > 0 && extruder_id <= extruder_count) { if (extruder_id > 0 && extruder_id <= static_cast<unsigned> (extruder_count)) {
variant_index.resize(1); variant_index.resize(1);
ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(extruder_id - 1)); ExtruderType extruder_type = (ExtruderType)(opt_extruder_type->get_at(extruder_id - 1));
NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(extruder_id - 1)); NozzleVolumeType nozzle_volume_type = (NozzleVolumeType)(opt_nozzle_volume_type->get_at(extruder_id - 1));
+2 -2
View File
@@ -58,7 +58,7 @@ void BindJob::process(Ctl &ctl)
wxDateTime::TimeZone tz(wxDateTime::Local); wxDateTime::TimeZone tz(wxDateTime::Local);
long offset = tz.GetOffset(); long offset = tz.GetOffset();
std::string timezone = get_timezone_utc_hm(offset); std::string timezone = get_timezone_utc_hm(offset);
m_agent->track_update_property("ssdp_version", m_ssdp_version, "string"); m_agent->track_update_property("ssdp_version", m_ssdp_version, "string");
int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone, m_improved, int result = m_agent->bind(m_dev_ip, m_dev_id, m_sec_link, timezone, m_improved,
[this, &ctl, &curr_percent, &msg, &result_code, &result_info](int stage, int code, std::string info) { [this, &ctl, &curr_percent, &msg, &result_code, &result_info](int stage, int code, std::string info) {
@@ -114,7 +114,7 @@ void BindJob::process(Ctl &ctl)
; ;
} }
} }
post_fail_event(result_code, result_info); post_fail_event(result_code, result_info);
return; return;
} }
+1 -1
View File
@@ -57,7 +57,7 @@ void UpgradeNetworkJob::process(Ctl &ctl)
return ctl.was_canceled(); return ctl.was_canceled();
}; };
int curr_percent = 0; int curr_percent = 0;
result = wxGetApp().download_plugin(name, package_name, result = wxGetApp().download_plugin(name, package_name,
[this, &ctl, &curr_percent](int state, int percent, bool &cancel) { [this, &ctl, &curr_percent](int state, int percent, bool &cancel) {
if (state == InstallStatusNormal) { if (state == InstallStatusNormal) {
update_status(ctl, percent, _u8L("Downloading")); update_status(ctl, percent, _u8L("Downloading"));
+5 -5
View File
@@ -71,14 +71,14 @@ namespace GUI {
m_control_back->SetToolTip(_L("Click to return") + "(" + _L("Alt+") + _L("Left Arrow") + ")"); m_control_back->SetToolTip(_L("Click to return") + "(" + _L("Alt+") + _L("Left Arrow") + ")");
m_control_forward->SetToolTip(_L("Click to continue") + "(" + _L("Alt+") + _L("Right Arrow") + ")"); m_control_forward->SetToolTip(_L("Click to continue") + "(" + _L("Alt+") + _L("Right Arrow") + ")");
#endif #endif
m_control_refresh->SetToolTip(_L("Refresh")); m_control_refresh->SetToolTip(_L("Refresh"));
/* auto m_textCtrl1 = new wxTextCtrl(m_web_control_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(600, 30), 0); /* auto m_textCtrl1 = new wxTextCtrl(m_web_control_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(600, 30), 0);
auto m_button1 = new wxButton(m_web_control_panel, wxID_ANY, wxT("GO"), wxDefaultPosition, wxDefaultSize, 0); auto m_button1 = new wxButton(m_web_control_panel, wxID_ANY, wxT("GO"), wxDefaultPosition, wxDefaultSize, 0);
m_button1->Bind(wxEVT_BUTTON, [this,m_textCtrl1](auto& e) { m_button1->Bind(wxEVT_BUTTON, [this,m_textCtrl1](auto& e) {
go_to_url(m_textCtrl1->GetValue()); go_to_url(m_textCtrl1->GetValue());
});*/ });*/
m_sizer_web_control->Add( m_control_back, 0, wxALIGN_CENTER | wxLEFT, FromDIP(26) ); m_sizer_web_control->Add( m_control_back, 0, wxALIGN_CENTER | wxLEFT, FromDIP(26) );
m_sizer_web_control->Add(m_control_forward, 0, wxALIGN_CENTER | wxLEFT, FromDIP(26)); m_sizer_web_control->Add(m_control_forward, 0, wxALIGN_CENTER | wxLEFT, FromDIP(26));
m_sizer_web_control->Add(m_control_refresh, 0, wxALIGN_CENTER | wxLEFT, FromDIP(26)); m_sizer_web_control->Add(m_control_refresh, 0, wxALIGN_CENTER | wxLEFT, FromDIP(26));
@@ -125,11 +125,11 @@ namespace GUI {
json j = json::parse(strInput.utf8_string()); json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"]; wxString strCmd = j["command"];
if(strCmd == "request_close_publish_window") { if(strCmd == "request_close_publish_window") {
this->Hide(); this->Hide();
} }
} }
catch (std::exception&) { catch (std::exception&) {
// wxMessageBox(e.what(), "json Exception", MB_OK); // wxMessageBox(e.what(), "json Exception", MB_OK);
@@ -179,7 +179,7 @@ namespace GUI {
WebView::LoadUrl(m_browser, url); WebView::LoadUrl(m_browser, url);
} }
void ModelMallDialog::show_control(bool show) void ModelMallDialog::show_control(bool show)
{ {
m_web_control_panel->Show(show); m_web_control_panel->Show(show);
Layout(); Layout();
+2 -2
View File
@@ -160,7 +160,7 @@ void MonitorPanel::init_timer()
m_refresh_timer = new wxTimer(); m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL); m_refresh_timer->Start(REFRESH_INTERVAL);
wxPostEvent(this, wxTimerEvent()); if (update_flag) { update_all();}
} }
void MonitorPanel::init_tabpanel() void MonitorPanel::init_tabpanel()
@@ -411,7 +411,7 @@ bool MonitorPanel::Show(bool show)
m_refresh_timer->Stop(); m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL); m_refresh_timer->Start(REFRESH_INTERVAL);
wxPostEvent(this, wxTimerEvent()); if (update_flag) { update_all(); }
if (dev) { if (dev) {
//set a default machine when obj is null //set a default machine when obj is null
-1
View File
@@ -21,7 +21,6 @@ MonitorBasePanel::MonitorBasePanel(wxWindow* parent, wxWindowID id, const wxPoin
m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_BORDER); m_splitter = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_BORDER);
m_splitter->SetSashGravity(0); m_splitter->SetSashGravity(0);
m_splitter->SetSashSize(0);
m_splitter->Connect(wxEVT_IDLE, wxIdleEventHandler(MonitorBasePanel::m_splitterOnIdle), NULL, this); m_splitter->Connect(wxEVT_IDLE, wxIdleEventHandler(MonitorBasePanel::m_splitterOnIdle), NULL, this);
m_splitter->SetMinimumPaneSize(182); m_splitter->SetMinimumPaneSize(182);
+7 -1
View File
@@ -410,7 +410,13 @@ void SelectMachinePopup::Popup(wxWindow *WXUNUSED(focus))
} }
} }
wxPostEvent(this, wxTimerEvent()); {
wxGetApp().reset_to_active();
wxCommandEvent user_event(EVT_UPDATE_USER_MACHINE_LIST);
user_event.SetEventObject(this);
wxPostEvent(this, user_event);
}
PopupWindow::Popup(); PopupWindow::Popup();
} }
+1 -1
View File
@@ -443,7 +443,7 @@ static std::string generate_system_info_json()
pt::ptree hw_node; pt::ptree hw_node;
{ {
hw_node.put("ArchName", wxPlatformInfo::Get().GetArchName()); hw_node.put("ArchName", wxPlatformInfo::Get().GetBitnessName());
size_t num = std::round(Slic3r::total_physical_memory()/107374100.); size_t num = std::round(Slic3r::total_physical_memory()/107374100.);
hw_node.put("RAM_GiB", std::to_string(num / 10) + "." + std::to_string(num % 10)); hw_node.put("RAM_GiB", std::to_string(num / 10) + "." + std::to_string(num % 10));
} }
+3 -3
View File
@@ -218,11 +218,11 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
wxGetApp().restart_networking(); wxGetApp().restart_networking();
this->EndModal(wxID_OK); this->EndModal(wxID_OK);
this->Close(); this->Close();
} }
else if (strCmd == "close_download_dialog") { else if (strCmd == "close_download_dialog") {
this->EndModal(wxID_OK); this->EndModal(wxID_OK);
this->Close(); this->Close();
} }
else if (strCmd == "open_plugin_folder") { else if (strCmd == "open_plugin_folder") {
auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string(); auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string();
desktop_open_any_folder(plugin_folder); desktop_open_any_folder(plugin_folder);
@@ -322,7 +322,7 @@ int DownPluginFrame::InstallPlugin()
int DownPluginFrame::ShowPluginStatus(int status, int percent, bool &cancel) int DownPluginFrame::ShowPluginStatus(int status, int percent, bool &cancel)
{ {
static int nPercent = 0; static int nPercent = 0;
if (nPercent == percent) if (nPercent == percent)
return 0; return 0;
nPercent = percent; nPercent = percent;
+1 -1
View File
@@ -364,11 +364,11 @@ void AMSrefresh::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, con
m_playing_timer = new wxTimer(); m_playing_timer = new wxTimer();
m_playing_timer->SetOwner(this); m_playing_timer->SetOwner(this);
wxPostEvent(this, wxTimerEvent());
SetSize(AMS_REFRESH_SIZE); SetSize(AMS_REFRESH_SIZE);
SetMinSize(AMS_REFRESH_SIZE); SetMinSize(AMS_REFRESH_SIZE);
SetMaxSize(AMS_REFRESH_SIZE); SetMaxSize(AMS_REFRESH_SIZE);
Refresh();
} }
void AMSrefresh::on_timer(wxTimerEvent &event) void AMSrefresh::on_timer(wxTimerEvent &event)
+1 -1
View File
@@ -423,7 +423,7 @@ int DropDown::hoverIndex()
return hover_item; return hover_item;
int index = -1; int index = -1;
std::set<wxString> groups; std::set<wxString> groups;
for (size_t i = 0; i < items.size(); ++i) { for (int i = 0; i < items.size(); ++i) {
auto &item = items[i]; auto &item = items[i];
// Skip by group // Skip by group
if (group.IsEmpty()) { if (group.IsEmpty()) {
-2
View File
@@ -190,7 +190,6 @@ inline wxColour darkModeColorFor2(wxColour const &color)
if (!gDarkMode) if (!gDarkMode)
return color; return color;
auto iter = gDarkColors.find(color); auto iter = gDarkColors.find(color);
wxASSERT(iter != gDarkColors.end());
if (iter != gDarkColors.end()) return iter->second; if (iter != gDarkColors.end()) return iter->second;
return color; return color;
} }
@@ -206,7 +205,6 @@ wxColour StateColor::lightModeColorFor(wxColour const &color)
{ {
static std::map<wxColour, wxColour> gLightColors = revert(gDarkColors); static std::map<wxColour, wxColour> gLightColors = revert(gDarkColors);
auto iter = gLightColors.find(color); auto iter = gLightColors.find(color);
wxASSERT(iter != gLightColors.end());
if (iter != gLightColors.end()) return iter->second; if (iter != gLightColors.end()) return iter->second;
return color; return color;
} }
+1 -1
View File
@@ -35,7 +35,7 @@ void StateHandler::attach_child(wxWindow *child)
void StateHandler::remove_child(wxWindow *child) void StateHandler::remove_child(wxWindow *child)
{ {
children_.erase(std::remove_if(children_.begin(), children_.end(), children_.erase(std::remove_if(children_.begin(), children_.end(),
[child](auto &c) { return c->owner_ == child; }), children_.end()); [child](auto &c) { return c->owner_ == child; }), children_.end());
states2_ = 0; states2_ = 0;
for (auto & c : children_) states2_ |= c->states(); for (auto & c : children_) states2_ |= c->states();