Code cleanup

This commit is contained in:
Lam Wei Lun
2026-08-21 18:36:30 +08:00
parent a5033afaf8
commit 95e392e206
10 changed files with 67 additions and 59 deletions
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef slic3r_ConfigValueFormatter_hpp_
#define slic3r_ConfigValueFormatter_hpp_
#pragma once
#include <string>
@@ -25,5 +24,3 @@ wxString get_string_from_enum(const std::string& opt_key, const DynamicPrintConf
} // namespace GUI
} // namespace Slic3r
#endif // slic3r_ConfigValueFormatter_hpp_
+2 -2
View File
@@ -16851,7 +16851,7 @@ void publish(Model &model, SaveStrategy strategy) {
}
// BBS: backup
int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy strategy, int export_plate_idx, Export3mfProgressFn proFn, const DynamicPrintConfig* override_config)
int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy strategy, int export_plate_idx, Export3mfProgressFn proFn)
{
int ret = 0;
//if (p->model.objects.empty()) {
@@ -16873,7 +16873,7 @@ int Plater::export_3mf(const boost::filesystem::path& output_path, SaveStrategy
// modify model
publish(p->model, strategy);
DynamicPrintConfig cfg = override_config ? *override_config : wxGetApp().preset_bundle->full_config_secure();
DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure();
const std::string path_u8 = into_u8(path);
wxBusyCursor wait;
+1 -1
View File
@@ -504,7 +504,7 @@ public:
//void export_amf();
//BBS add extra param for exporting 3mf silence
// BBS: backup
int export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path(), SaveStrategy strategy = SaveStrategy::Default, int export_plate_idx = -1, Export3mfProgressFn proFn = nullptr, const DynamicPrintConfig* override_config = nullptr);
int export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path(), SaveStrategy strategy = SaveStrategy::Default, int export_plate_idx = -1, Export3mfProgressFn proFn = nullptr);
//BBS
void publish_project();
+5 -7
View File
@@ -332,7 +332,7 @@ void PublishSettingsDialog::build_option_model()
for (const auto& opt : optgroup->opt_map()) {
// Row keys are base keys; the load side applies them positionally.
const std::string& opt_id = opt.first;
std::string base = opt_id.substr(0, opt_id.find('#'));
std::string base = publish_base_key(opt_id);
if (!material_added.insert(base).second)
continue;
// Show the value of this slot; fall back to slot 0 if out of range.
@@ -388,15 +388,13 @@ void PublishSettingsDialog::build_option_model()
// Pre-check the dirty (modified) settings and mark them bold (base-key match, across all
// sections; collect_dirty_settings_keys unions the prints, printers and filaments).
std::set<std::string> dirty_base;
for (const std::string& key : collect_dirty_settings_keys(*wxGetApp().preset_bundle)) {
auto n = key.find('#');
dirty_base.insert(n == std::string::npos ? key : key.substr(0, n));
}
for (const std::string& key : collect_dirty_settings_keys(*wxGetApp().preset_bundle))
dirty_base.insert(publish_base_key(key));
for (Row& row : m_rows) {
// The Color/Type requirement rows are not "dirty overrides": never auto-checked.
if (row.kind != RowKind::Setting)
continue;
std::string base = row.key.substr(0, row.key.find('#'));
std::string base = publish_base_key(row.key);
row.dirty = dirty_base.count(base) > 0;
if (row.dirty) {
row.check->SetValue(true);
@@ -919,7 +917,7 @@ std::vector<std::string> PublishSettingsDialog::GetPublishedKeys() const
// build). Publish every extruder element so the load side can apply per-extruder
// values even when the receiver has a different extruder count; a scalar printer
// key is published as-is.
const std::string base_key = row.key.substr(0, row.key.find('#'));
const std::string base_key = publish_base_key(row.key);
if (const ConfigOption* opt = full.option(base_key)) {
if (const auto* vec = dynamic_cast<const ConfigOptionVectorBase*>(opt)) {
for (size_t i = 0; i < vec->size(); ++i)
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef slic3r_GUI_PublishSettingsDialog_hpp_
#define slic3r_GUI_PublishSettingsDialog_hpp_
#pragma once
#include "GUI_Utils.hpp"
#include "wxExtensions.hpp"
@@ -200,5 +199,3 @@ private:
};
}} // namespace Slic3r::GUI
#endif // slic3r_GUI_PublishSettingsDialog_hpp_