Fixing Clang warnings 1

This commit is contained in:
Lukas Matena 2021-01-29 16:16:23 +01:00
parent cd1322ce3f
commit 0ff0444dcc
23 changed files with 90 additions and 88 deletions

View file

@ -266,14 +266,14 @@ void AppConfig::save()
else
c << "# " << Slic3r::header_gcodeviewer_generated() << std::endl;
// Make sure the "no" category is written first.
for (const std::pair<std::string, std::string> &kvp : m_storage[""])
for (const auto& kvp : m_storage[""])
c << kvp.first << " = " << kvp.second << std::endl;
// Write the other categories.
for (const auto category : m_storage) {
for (const auto& category : m_storage) {
if (category.first.empty())
continue;
c << std::endl << "[" << category.first << "]" << std::endl;
for (const std::pair<std::string, std::string> &kvp : category.second)
for (const auto& kvp : category.second)
c << kvp.first << " = " << kvp.second << std::endl;
}
// Write vendor sections

View file

@ -1344,7 +1344,7 @@ public:
static bool has(T value)
{
for (const std::pair<std::string, int> &kvp : ConfigOptionEnum<T>::get_enum_values())
for (const auto &kvp : ConfigOptionEnum<T>::get_enum_values())
if (kvp.second == value)
return true;
return false;

View file

@ -405,7 +405,7 @@ public:
WipeTowerWriter& append(const std::string& text) { m_gcode += text; return *this; }
std::vector<Vec2f> wipe_path() const
const std::vector<Vec2f>& wipe_path() const
{
return m_wipe_path;
}

View file

@ -290,7 +290,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
surfaces_append(bottom, union_ex(grown, true), bridges[idx_last]);
}
fill_boundaries = std::move(to_polygons(fill_boundaries_ex));
fill_boundaries = to_polygons(fill_boundaries_ex);
BOOST_LOG_TRIVIAL(trace) << "Processing external surface, detecting bridges - done";
}
@ -327,7 +327,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly
surfaces_append(
new_surfaces,
// Don't use a safety offset as fill_boundaries were already united using the safety offset.
std::move(intersection_ex(polys, fill_boundaries, false)),
intersection_ex(polys, fill_boundaries, false),
s1);
}
}
@ -424,7 +424,7 @@ void LayerRegion::elephant_foot_compensation_step(const float elephant_foot_comp
Polygons slices_polygons = to_polygons(slices_expolygons);
Polygons tmp = intersection(slices_polygons, trimming_polygons, false);
append(tmp, diff(slices_polygons, offset(offset_ex(slices_expolygons, -elephant_foot_compensation_perimeter_step), elephant_foot_compensation_perimeter_step)));
this->slices.set(std::move(union_ex(tmp)), stInternal);
this->slices.set(union_ex(tmp), stInternal);
}
void LayerRegion::export_region_slices_to_svg(const char *path) const

View file

@ -103,7 +103,7 @@ enum FacetEdgeType {
class IntersectionReference
{
public:
IntersectionReference() : point_id(-1), edge_id(-1) {};
IntersectionReference() : point_id(-1), edge_id(-1) {}
IntersectionReference(int point_id, int edge_id) : point_id(point_id), edge_id(edge_id) {}
// Where is this intersection point located? On mesh vertex or mesh edge?
// Only one of the following will be set, the other will remain set to -1.
@ -116,7 +116,7 @@ public:
class IntersectionPoint : public Point, public IntersectionReference
{
public:
IntersectionPoint() {};
IntersectionPoint() {}
IntersectionPoint(int point_id, int edge_id, const Point &pt) : IntersectionReference(point_id, edge_id), Point(pt) {}
IntersectionPoint(const IntersectionReference &ir, const Point &pt) : IntersectionReference(ir), Point(pt) {}
// Inherits coord_t x, y

View file

@ -251,7 +251,7 @@ bool Snapshot::equal_to_active(const AppConfig &app_config) const
return false;
matched.insert(vc.name);
}
for (const std::pair<std::string, std::map<std::string, std::set<std::string>>> &v : app_config.vendors())
for (const auto &v : app_config.vendors())
if (matched.find(v.first) == matched.end() && ! v.second.empty())
// There are more vendors currently installed than enabled in the snapshot.
return false;
@ -402,7 +402,7 @@ const Snapshot& SnapshotDB::take_snapshot(const AppConfig &app_config, Snapshot:
snapshot.filaments.emplace_back(app_config.get("presets", name));
}
// Vendor specific config bundles and installed printers.
for (const std::pair<std::string, std::map<std::string, std::set<std::string>>> &vendor : app_config.vendors()) {
for (const auto &vendor : app_config.vendors()) {
Snapshot::VendorConfig cfg;
cfg.name = vendor.first;
cfg.models_variants_installed = vendor.second;

View file

@ -119,7 +119,7 @@ bool BonjourDialog::show_and_lookup()
// Note: More can be done here when we support discovery of hosts other than Octoprint and SL1
Bonjour::TxtKeys txt_keys { "version", "model" };
bonjour = std::move(Bonjour("octoprint")
bonjour = Bonjour("octoprint")
.set_txt_keys(std::move(txt_keys))
.set_retries(3)
.set_timeout(4)
@ -139,8 +139,7 @@ bool BonjourDialog::show_and_lookup()
wxQueueEvent(dialog, evt);
}
})
.lookup()
);
.lookup();
bool res = ShowModal() == wxID_OK && list->GetFirstSelected() >= 0;
{

View file

@ -68,7 +68,7 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve
if (vc.version.max_slic3r_version != Semver::inf())
text += ", " + _(L("max PrusaSlicer version")) + ": " + vc.version.max_slic3r_version.to_string();
text += "<br>";
for (const std::pair<std::string, std::set<std::string>> &model : vc.models_variants_installed) {
for (const auto& model : vc.models_variants_installed) {
text += _(L("model")) + ": " + model.first + ", " + _(L("variants")) + ": ";
for (const std::string &variant : model.second) {
if (&variant != &*model.second.begin())

View file

@ -1872,7 +1872,7 @@ void ConfigWizard::priv::load_vendors()
std::map<std::string, std::string> section_new;
if (app_config->has_section(section_name)) {
const std::map<std::string, std::string> &section_old = app_config->get_section(section_name);
for (const std::pair<std::string, std::string> &material_name_and_installed : section_old)
for (const auto& material_name_and_installed : section_old)
if (material_name_and_installed.second == "1") {
// Material is installed. Resolve it in bundles.
size_t num_found = 0;
@ -2248,7 +2248,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
if ((only_for_model_id.empty() || only_for_model_id == printer_model->id) &&
printer_models_without_material.find(printer_model) == printer_models_without_material.end()) {
bool has_material = false;
for (const std::pair<std::string, std::string> &preset : appconfig_presets) {
for (const auto& preset : appconfig_presets) {
if (preset.second == "1") {
const Preset *material = materials.find_preset(preset.first, false);
if (material != nullptr && is_compatible_with_printer(PresetWithVendorProfile(*material, nullptr), PresetWithVendorProfile(printer, nullptr))) {

View file

@ -648,7 +648,7 @@ void FirmwareDialog::priv::perform_upload()
}
}
})
.on_message(std::move([q, extra_verbose](const char *msg, unsigned /* size */) {
.on_message([q, extra_verbose](const char *msg, unsigned /* size */) {
if (extra_verbose) {
BOOST_LOG_TRIVIAL(debug) << "avrdude: " << msg;
}
@ -665,19 +665,19 @@ void FirmwareDialog::priv::perform_upload()
evt->SetExtraLong(AE_MESSAGE);
evt->SetString(std::move(wxmsg));
wxQueueEvent(q, evt);
}))
.on_progress(std::move([q](const char * /* task */, unsigned progress) {
})
.on_progress([q](const char * /* task */, unsigned progress) {
auto evt = new wxCommandEvent(EVT_AVRDUDE, q->GetId());
evt->SetExtraLong(AE_PROGRESS);
evt->SetInt(progress);
wxQueueEvent(q, evt);
}))
.on_complete(std::move([this]() {
})
.on_complete([this]() {
auto evt = new wxCommandEvent(EVT_AVRDUDE, this->q->GetId());
evt->SetExtraLong(AE_EXIT);
evt->SetInt(this->avrdude->exit_code());
wxQueueEvent(this->q, evt);
}))
})
.run();
}

View file

@ -117,7 +117,9 @@ ObjectList::ObjectList(wxWindow* parent) :
// detect the current mouse position here, to pass it to list_manipulation() method
// if we detect it later, the user may have moved the mouse pointer while calculations are performed, and this would mess-up the HitTest() call performed into list_manipulation()
// see: https://github.com/prusa3d/PrusaSlicer/issues/3802
#ifndef __WXOSX__
const wxPoint mouse_pos = this->get_mouse_position_in_control();
#endif
#ifndef __APPLE__
// On Windows and Linux, forces a kill focus emulation on the object manipulator fields because this event handler is called
@ -752,7 +754,7 @@ void ObjectList::copy_layers_to_clipboard()
return;
}
for (const auto layer_item : sel_layers)
for (const auto& layer_item : sel_layers)
if (m_objects_model->GetItemType(layer_item) & itLayer) {
auto range = m_objects_model->GetLayerRangeByItem(layer_item);
auto it = ranges.find(range);
@ -778,7 +780,7 @@ void ObjectList::paste_layers_into_list()
t_layer_config_ranges& ranges = object(obj_idx)->layer_config_ranges;
// and create Layer item(s) according to the layer_config_ranges
for (const auto range : cache_ranges)
for (const auto& range : cache_ranges)
ranges.emplace(range);
layers_item = add_layer_root_item(object_item);
@ -1842,7 +1844,7 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const
void ObjectList::append_menu_item_reload_from_disk(wxMenu* menu) const
{
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")),
[this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu,
[](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu,
[]() { return wxGetApp().plater()->can_reload_from_disk(); }, wxGetApp().plater());
}
@ -2063,9 +2065,9 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu)
for (auto cat : settings_menu) {
append_menu_item(menu, wxID_ANY, _(cat.first), "",
[menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); },
[this, menu](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); },
CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu,
[this]() { return true; }, wxGetApp().plater());
[]() { return true; }, wxGetApp().plater());
}
return menu;
@ -2084,9 +2086,9 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje
continue;
append_menu_item(menu, wxID_ANY, _(it.first), "",
[menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
[this, menu](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu,
[this]() { return true; }, wxGetApp().plater());
[]() { return true; }, wxGetApp().plater());
}
#if 0
// Add "Quick" settings bundles
@ -4600,7 +4602,7 @@ void ObjectList::show_multi_selection_menu()
append_menu_item_change_extruder(menu);
append_menu_item(menu, wxID_ANY, _(L("Reload from disk")), _(L("Reload the selected volumes from disk")),
[this](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() {
[](wxCommandEvent&) { wxGetApp().plater()->reload_from_disk(); }, "", menu, []() {
return wxGetApp().plater()->can_reload_from_disk();
}, wxGetApp().plater());

View file

@ -64,10 +64,10 @@ public:
// Only allow opening a new PrusaSlicer instance on OSX if "single_instance" is disabled,
// as starting new instances would interfere with the locking mechanism of "single_instance" support.
append_menu_item(menu, wxID_ANY, _L("Open new instance"), _L("Open a new PrusaSlicer instance"),
[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr);
}
append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open G-code viewer"),
[this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
[](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
return menu;
}
};
@ -78,9 +78,9 @@ public:
wxMenu *CreatePopupMenu() override {
wxMenu *menu = new wxMenu;
append_menu_item(menu, wxID_ANY, _L("Open PrusaSlicer"), _L("Open a new PrusaSlicer instance"),
[this](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr);
[](wxCommandEvent&) { start_new_slicer(nullptr, true); }, "", nullptr);
append_menu_item(menu, wxID_ANY, _L("G-code preview") + dots, _L("Open new G-code viewer"),
[this](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
[](wxCommandEvent&) { start_new_gcodeviewer_open_file(); }, "", nullptr);
return menu;
}
};
@ -231,7 +231,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
// So, redraw explicitly canvas, when application is moved
//FIXME maybe this is useful for __WXGTK3__ as well?
#if __APPLE__
Bind(wxEVT_MOVE, [this](wxMoveEvent& event) {
Bind(wxEVT_MOVE, [](wxMoveEvent& event) {
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
event.Skip();
@ -1190,7 +1190,7 @@ void MainFrame::init_menubar_as_editor()
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Open new instance") + "\tCtrl+Shift+I", _L("Open a new PrusaSlicer instance"),
[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr, [this]() {return m_plater != nullptr && wxGetApp().app_config->get("single_instance") != "1"; }, this);
windowMenu->AppendSeparator();
append_menu_item(windowMenu, wxID_ANY, _L("Compare presets")/* + "\tCtrl+F"*/, _L("Compare presets"),
@ -1263,8 +1263,8 @@ void MainFrame::init_menubar_as_gcodeviewer()
[this](wxCommandEvent&) { if (m_plater != nullptr) m_plater->export_toolpaths_to_obj(); }, "export_plater", nullptr,
[this]() {return can_export_toolpaths(); }, this);
append_menu_item(fileMenu, wxID_ANY, _L("Open &PrusaSlicer") + dots, _L("Open PrusaSlicer"),
[this](wxCommandEvent&) { start_new_slicer(); }, "", nullptr,
[this]() {return true; }, this);
[](wxCommandEvent&) { start_new_slicer(); }, "", nullptr,
[]() {return true; }, this);
fileMenu->AppendSeparator();
append_menu_item(fileMenu, wxID_EXIT, _L("&Quit"), wxString::Format(_L("Quit %s"), SLIC3R_APP_NAME),
[this](wxCommandEvent&) { Close(false); });

View file

@ -397,7 +397,7 @@ void Mouse3DController::save_config(AppConfig &appconfig) const
// We do not synchronize m_params_by_device with the background thread explicitely
// as there should be a full memory barrier executed once the background thread is stopped.
for (const std::pair<std::string, Params> &key_value_pair : m_params_by_device) {
for (const auto &key_value_pair : m_params_by_device) {
const std::string &device_name = key_value_pair.first;
const Params &params = key_value_pair.second;
// Store current device parameters into the config

View file

@ -1362,7 +1362,7 @@ void ObjectDataViewModel::GetAllChildren(const wxDataViewItem &parent, wxDataVie
}
wxDataViewItemArray new_array = array;
for (const auto item : new_array)
for (const auto& item : new_array)
{
wxDataViewItemArray children;
GetAllChildren(item, children);

View file

@ -27,20 +27,20 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
// is the normal type.
if (opt.gui_type == "select") {
} else if (opt.gui_type == "select_open") {
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "color") {
m_fields.emplace(id, std::move(ColourPicker::Create<ColourPicker>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, ColourPicker::Create<ColourPicker>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "f_enum_open" ||
opt.gui_type == "i_enum_open" ||
opt.gui_type == "i_enum_closed") {
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "slider") {
m_fields.emplace(id, std::move(SliderCtrl::Create<SliderCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, SliderCtrl::Create<SliderCtrl>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "i_spin") { // Spinctrl
} else if (opt.gui_type == "legend") { // StaticText
m_fields.emplace(id, std::move(StaticText::Create<StaticText>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, StaticText::Create<StaticText>(this->ctrl_parent(), opt, id));
} else if (opt.gui_type == "one_string") {
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id));
} else {
switch (opt.type) {
case coFloatOrPercent:
@ -50,18 +50,18 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co
case coPercents:
case coString:
case coStrings:
m_fields.emplace(id, std::move(TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, TextCtrl::Create<TextCtrl>(this->ctrl_parent(), opt, id));
break;
case coBool:
case coBools:
m_fields.emplace(id, std::move(CheckBox::Create<CheckBox>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, CheckBox::Create<CheckBox>(this->ctrl_parent(), opt, id));
break;
case coInt:
case coInts:
m_fields.emplace(id, std::move(SpinCtrl::Create<SpinCtrl>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, SpinCtrl::Create<SpinCtrl>(this->ctrl_parent(), opt, id));
break;
case coEnum:
m_fields.emplace(id, std::move(Choice::Create<Choice>(this->ctrl_parent(), opt, id)));
m_fields.emplace(id, Choice::Create<Choice>(this->ctrl_parent(), opt, id));
break;
case coPoints:
m_fields.emplace(id, std::move(PointCtrl::Create<PointCtrl>(this->ctrl_parent(), opt, id)));

View file

@ -275,7 +275,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_optgroup->append_single_option_line("host_type");
auto create_sizer_with_btn = [this](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) {
auto create_sizer_with_btn = [](wxWindow* parent, ScalableButton** btn, const std::string& icon_name, const wxString& label) {
*btn = new ScalableButton(parent, wxID_ANY, icon_name, label, wxDefaultSize, wxDefaultPosition, wxBU_LEFT | wxBU_EXACTFIT);
(*btn)->SetFont(wxGetApp().normal_font());
@ -290,7 +290,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
m_printhost_browse_btn->Bind(wxEVT_BUTTON, [=](wxCommandEvent& e) {
BonjourDialog dialog(this, Preset::printer_technology(m_printer.config));
if (dialog.show_and_lookup()) {
m_optgroup->set_value("print_host", std::move(dialog.get_selected()), true);
m_optgroup->set_value("print_host", dialog.get_selected(), true);
m_optgroup->get_field("print_host")->field_changed();
}
});
@ -366,7 +366,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
static const auto filemasks = _L("Certificate files (*.crt, *.pem)|*.crt;*.pem|All files|*.*");
wxFileDialog openFileDialog(this, _L("Open CA certificate file"), "", "", filemasks, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (openFileDialog.ShowModal() != wxID_CANCEL) {
m_optgroup->set_value("printhost_cafile", std::move(openFileDialog.GetPath()), true);
m_optgroup->set_value("printhost_cafile", openFileDialog.GetPath(), true);
m_optgroup->get_field("printhost_cafile")->field_changed();
}
});
@ -379,7 +379,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
Line cafile_hint{ "", "" };
cafile_hint.full_width = 1;
cafile_hint.widget = [this, ca_file_hint](wxWindow* parent) {
cafile_hint.widget = [ca_file_hint](wxWindow* parent) {
auto txt = new wxStaticText(parent, wxID_ANY, ca_file_hint);
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(txt);
@ -420,7 +420,7 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
{
wxTextCtrl* temp = dynamic_cast<wxTextCtrl*>(printhost_field->getWindow());
if (temp)
temp->Bind(wxEVT_TEXT, ([this, printhost_field, temp](wxEvent& e)
temp->Bind(wxEVT_TEXT, ([printhost_field, temp](wxEvent& e)
{
#ifndef __WXGTK__
e.Skip();

View file

@ -274,7 +274,7 @@ public:
wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; }
wxSizer* get_sizer() override;
ConfigOptionsGroup* get_og(const bool is_fff);
void Show(const bool is_fff);
void Show(const bool is_fff) override;
void msw_rescale();
};
@ -2065,7 +2065,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
// Preview events:
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [this](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_QUESTION_MARK, [](SimpleEvent&) { wxGetApp().keyboard_shortcuts(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [q](SimpleEvent&) { q->set_bed_shape(); });
if (wxGetApp().is_editor()) {
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
@ -2127,8 +2127,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
if (wxGetApp().is_editor()) {
this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); });
this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); });
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this, q](RemovableDriveEjectEvent &evt) {
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this](RemovableDriveEjectEvent &evt) {
if (evt.data.second) {
this->show_action_buttons(this->ready_to_slice);
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
@ -2143,7 +2143,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
);
}
});
this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this, q](RemovableDrivesChangedEvent &) {
this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this](RemovableDrivesChangedEvent &) {
this->show_action_buttons(this->ready_to_slice);
// Close notification ExportingFinished but only if last export was to removable
notification_manager->device_ejected();
@ -4963,7 +4963,7 @@ ProjectDropDialog::ProjectDropDialog(const std::string& filename)
wxBoxSizer* bottom_sizer = new wxBoxSizer(wxHORIZONTAL);
wxCheckBox* check = new wxCheckBox(this, wxID_ANY, _L("Don't show again"));
check->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& evt) {
check->Bind(wxEVT_CHECKBOX, [](wxCommandEvent& evt) {
wxGetApp().app_config->set("show_drop_project_dialog", evt.IsChecked() ? "0" : "1");
});

View file

@ -738,7 +738,7 @@ void PlaterPresetComboBox::show_add_menu()
wxMenu* menu = new wxMenu();
append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "",
[this](wxCommandEvent&) {
[](wxCommandEvent&) {
wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); });
}, "edit_uni", menu, []() { return true; }, wxGetApp().plater());
@ -768,7 +768,7 @@ void PlaterPresetComboBox::show_edit_menu()
}
else
append_menu_item(menu, wxID_ANY, _L("Add/Remove presets"), "",
[this](wxCommandEvent&) {
[](wxCommandEvent&) {
wxTheApp->CallAfter([]() { wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS); });
}, "edit_uni", menu, []() { return true; }, wxGetApp().plater());
@ -893,7 +893,7 @@ void PlaterPresetComboBox::update()
const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers;
for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) {
for (const std::string preset_name : it->get_preset_names()) {
for (const std::string& preset_name : it->get_preset_names()) {
Preset* preset = m_collection->find_preset(preset_name);
if (!preset)
continue;
@ -1078,7 +1078,7 @@ void TabPresetComboBox::update()
const PhysicalPrinterCollection& ph_printers = m_preset_bundle->physical_printers;
for (PhysicalPrinterCollection::ConstIterator it = ph_printers.begin(); it != ph_printers.end(); ++it) {
for (const std::string preset_name : it->get_preset_names()) {
for (const std::string& preset_name : it->get_preset_names()) {
Preset* preset = m_collection->find_preset(preset_name);
if (!preset)
continue;

View file

@ -121,7 +121,7 @@ Tab::Tab(wxNotebook* parent, const wxString& title, Preset::Type type) :
m_config_manipulation = get_config_manipulation();
Bind(wxEVT_SIZE, ([this](wxSizeEvent &evt) {
Bind(wxEVT_SIZE, ([](wxSizeEvent &evt) {
//for (auto page : m_pages)
// if (! page.get()->IsShown())
// page->layout_valid = false;
@ -242,7 +242,7 @@ void Tab::create_preset_tab()
if (dlg.ShowModal() == wxID_OK)
wxGetApp().update_label_colours();
});
m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().plater()->search(false); });
m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); });
// Colors for ui "decoration"
m_sys_label_clr = wxGetApp().get_label_clr_sys();
@ -491,7 +491,7 @@ void Tab::update_label_colours()
m_modified_label_clr = wxGetApp().get_label_clr_modified();
//update options "decoration"
for (const auto opt : m_options_list)
for (const auto& opt : m_options_list)
{
const wxColour *color = &m_sys_label_clr;
@ -541,7 +541,7 @@ void Tab::update_label_colours()
void Tab::decorate()
{
for (const auto opt : m_options_list)
for (const auto& opt : m_options_list)
{
Field* field = nullptr;
wxColour* colored_label_clr = nullptr;
@ -639,7 +639,7 @@ void Tab::init_options_list()
if (!m_options_list.empty())
m_options_list.clear();
for (const auto opt_key : m_config->keys())
for (const std::string& opt_key : m_config->keys())
m_options_list.emplace(opt_key, m_opt_status_value);
}
@ -656,7 +656,7 @@ void TabPrinter::init_options_list()
if (!m_options_list.empty())
m_options_list.clear();
for (const auto opt_key : m_config->keys())
for (const std::string& opt_key : m_config->keys())
{
if (opt_key == "bed_shape" || opt_key == "thumbnails") {
m_options_list.emplace(opt_key, m_opt_status_value);
@ -709,7 +709,7 @@ void TabSLAMaterial::init_options_list()
if (!m_options_list.empty())
m_options_list.clear();
for (const auto opt_key : m_config->keys())
for (const std::string& opt_key : m_config->keys())
{
if (opt_key == "compatible_prints" || opt_key == "compatible_printers") {
m_options_list.emplace(opt_key, m_opt_status_value);
@ -1728,7 +1728,7 @@ void TabFilament::add_filament_overrides_page()
line.near_label_widget = [this, optgroup, opt_key, opt_index](wxWindow* parent) {
wxCheckBox* check_box = new wxCheckBox(parent, wxID_ANY, "");
check_box->Bind(wxEVT_CHECKBOX, [this, optgroup, opt_key, opt_index](wxCommandEvent& evt) {
check_box->Bind(wxEVT_CHECKBOX, [optgroup, opt_key, opt_index](wxCommandEvent& evt) {
const bool is_checked = evt.IsChecked();
Field* field = optgroup->get_fieldc(opt_key, opt_index);
if (field != nullptr) {
@ -3352,7 +3352,9 @@ bool Tab::tree_sel_change_delayed()
wxCheckForInterrupt(m_treectrl);
if (m_page_switch_planned)
throw UIBuildCanceled();
#endif // WIN32
#else // WIN32
(void)this; // silence warning
#endif
});
try {
@ -3924,7 +3926,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
#else
auto tab = parent()->GetParent();// GetParent();
#endif
optgroup->m_on_change = [this, tab](t_config_option_key opt_key, boost::any value) {
optgroup->m_on_change = [tab](t_config_option_key opt_key, boost::any value) {
//! This function will be called from OptionGroup.
//! Using of CallAfter is redundant.
//! And in some cases it causes update() function to be recalled again
@ -3934,21 +3936,21 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
//! });
};
optgroup->m_get_initial_config = [this, tab]() {
optgroup->m_get_initial_config = [tab]() {
DynamicPrintConfig config = static_cast<Tab*>(tab)->m_presets->get_selected_preset().config;
return config;
};
optgroup->m_get_sys_config = [this, tab]() {
optgroup->m_get_sys_config = [tab]() {
DynamicPrintConfig config = static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent()->config;
return config;
};
optgroup->have_sys_config = [this, tab]() {
optgroup->have_sys_config = [tab]() {
return static_cast<Tab*>(tab)->m_presets->get_selected_preset_parent() != nullptr;
};
optgroup->rescale_extra_column_item = [this](wxWindow* win) {
optgroup->rescale_extra_column_item = [](wxWindow* win) {
auto *ctrl = dynamic_cast<wxStaticBitmap*>(win);
if (ctrl == nullptr)
return;

View file

@ -383,7 +383,6 @@ public:
private:
ogStaticText* m_recommended_thin_wall_thickness_description_line = nullptr;
ogStaticText* m_top_bottom_shell_thickness_explanation = nullptr;
bool m_support_material_overhangs_queried = false;
};
class TabFilament : public Tab

View file

@ -226,7 +226,7 @@ struct DnsResource
}
dataoffset = offset;
res.data = std::move(std::vector<char>(buffer.begin() + offset, buffer.begin() + offset + rdlength));
res.data = std::vector<char>(buffer.begin() + offset, buffer.begin() + offset + rdlength);
offset += rdlength;
return std::move(res);

View file

@ -553,7 +553,7 @@ void Http::cancel()
Http Http::get(std::string url)
{
return std::move(Http{std::move(url)});
return Http{std::move(url)};
}
Http Http::post(std::string url)

View file

@ -206,7 +206,7 @@ bool PresetUpdater::priv::get_file(const std::string &url, const fs::path &targe
tmp_path.string());
Http::get(url)
.on_progress([this](Http::Progress, bool &cancel) {
.on_progress([](Http::Progress, bool &cancel) {
if (cancel) { cancel = true; }
})
.on_error([&](std::string body, std::string error, unsigned http_status) {
@ -406,7 +406,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
BOOST_LOG_TRIVIAL(info) << "Checking for cached configuration updates...";
// Over all indices from the cache directory:
for (const auto idx : index_db) {
for (const Index& idx : index_db) {
auto bundle_path = vendor_path / (idx.vendor() + ".ini");
auto bundle_path_idx = vendor_path / idx.path().filename();
@ -679,11 +679,11 @@ void PresetUpdater::sync(PresetBundle *preset_bundle)
// into the closure (but perhaps the compiler can elide this).
VendorMap vendors = preset_bundle->vendors;
p->thread = std::move(std::thread([this, vendors]() {
p->thread = std::thread([this, vendors]() {
this->p->prune_tmps();
this->p->sync_version();
this->p->sync_config(std::move(vendors));
}));
});
}
void PresetUpdater::slic3r_update_notify()