Compare commits

..
Author SHA1 Message Date
Ian Chua 15aa9fe6c3 fix: avoid substring denies in audit path keywords 2026-10-07 15:11:55 +08:00
Ian Chua e5324ae319 Fix Orca Cloud API requests to use HTTPS (#15391)
# Description

The default Orca Cloud API URL omits its scheme, so libcurl interprets
it as HTTP and follows the server redirect to HTTPS. Recent libcurl
versions intentionally do not forward the `Authorization` header across
protocol/port-changing redirects, causing Orca Cloud profile sync to
receive HTTP 401 `missing_authorization` responses and eventually log
the user out.

Use the HTTPS API URL directly. Besides restoring sync with current
libcurl versions, this improves security by preventing the bearer access
token from being sent in the initial unencrypted HTTP request.

# Screenshots/Recordings/Graphs

N/A — no UI changes.

## Tests

- `git diff --check`
- Confirmed with current libcurl that the scheme-less URL redirects and
loses the authorization header, while the direct HTTPS URL retains it
2026-10-07 14:30:07 +08:00
HanifKoh 559ad3e2b7 Flag Global Usings in Headers with clang-tidy (#16225)
A using-directive or using-declaration in the global namespace of a
header reaches every file that includes it, and a using-declaration also
makes the include checker treat that header as the one to include for
the name. google-global-names-in-headers reports both, on changed lines
like the existing check, so headers that still have one are not held to
it until the line is touched.

The check does not see a using inside a namespace.

clang_tidy_diff.py's closing message assumed every finding was a missing
include; it now says other findings need a manual fix.
2026-10-07 14:23:11 +08:00
HanifKoh de6b0b9f2d Remove Header Usings and Aliases Nothing Depends On (#16224)
- ClipperUtils.hpp imported jtMiter, jtRound and jtSquare into the
  global namespace for every includer. No code names them there.
- BBLStatusBar.hpp, BBLStatusBarBind.hpp, BBLStatusBarPrint.hpp,
  BBLStatusBarSend.hpp and ProgressStatusBar.hpp re-exported their class
  into Slic3r::GUI. Nothing refers to the class through that namespace.
- Jobs/SendJob.hpp, Jobs/BindJob.hpp, Jobs/UpgradeNetworkJob.hpp and
  AuxiliaryDataViewModel.hpp declared "namespace fs = boost::filesystem;"
  at global scope without using it.
2026-10-07 14:23:00 +08:00
HanifKoh f02292f163 Stop Exporting Names Through Usings in GUI and Voronoi Headers (#16223)
Each of these headers put a using or namespace alias at global or
namespace scope, which every includer inherited:

- BBLTopbar.hpp: "using namespace Slic3r::GUI;" at global scope, reached
  through MainFrame.hpp. Seven source files used GUI names unqualified
  outside the namespace because of it, one of them as "::RadioBox".
- IMSlider.hpp and TickCode.hpp: "using namespace CustomGCode;" inside
  Slic3r.
- ProjectTask.hpp, Jobs/PrintJob.hpp and ConfigWizard_private.hpp:
  "namespace fs = boost::filesystem;". PresetBundle.cpp and GUI_App.cpp
  had no alias of their own.
- VoronoiUtils.hpp: "using VD = Slic3r::Geometry::VoronoiDiagram;" at
  global scope.

The headers now spell the names out. Source files that used them get
the qualifier, or a using of their own where there are many uses.
2026-10-07 14:22:45 +08:00
HanifKoh 23546e71ce Remove Unused Usings and the Includes Kept Only for Them (#16220)
151 using-directives, using-declarations, type aliases and namespace
aliases in source and test files that nothing refers to: the name is
never used, it duplicates a using already in scope, or the code sits
inside the namespace it names. Each one was removed on its own and the
file still compiled, both as it is and with every header-level using
taken away, so none of them was only redundant because a header leaks
the same name.

With the using gone, 28 #include lines and one forward declaration had
no other reference left in their file (boost/optional.hpp without any
optional, property_tree headers without any ptree) and go with it.

No header is touched.
2026-10-07 14:22:32 +08:00
AveryanAlex 67ff6bd34b Fix Orca Cloud API URL scheme 2026-08-26 19:52:16 +03:00
112 changed files with 139 additions and 354 deletions
+9 -4
View File
@@ -1,10 +1,15 @@
# clang-tidy configuration, enforced by the clang-tidy CI job on the lines a pull
# request changes (scripts/clang_tidy_diff.py). Only missing includes are reported
# for now: a file should include the header for every symbol it uses, not rely on
# the precompiled header or another header's includes. Run with --fix to add them.
# request changes (scripts/clang_tidy_diff.py). Two things are reported.
# Missing includes: a file should include the header for every symbol it uses, not
# rely on the precompiled header or another header's includes. Run with --fix to
# add them.
# Using-directives and using-declarations in the global namespace of a header:
# they reach every file that includes the header, and a using-declaration also
# makes the header look like the one to include for that name. Qualify the name
# in the header, and put the using in the source files that want it.
# Every check listed here gates pull requests, so enable a new one only once the
# code it flags on touched lines is reasonable to fix in passing.
Checks: '-*,misc-include-cleaner'
Checks: '-*,misc-include-cleaner,google-global-names-in-headers'
WarningsAsErrors: '*'
CheckOptions:
# Missing includes only. Builds without the precompiled header break on these.
+3 -2
View File
@@ -311,11 +311,12 @@ def main():
for path in fixed:
print(f" {path}")
if failed and fixed:
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not add.")
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not fix.")
return 1
if failed:
print(f"\nclang-tidy failed on {len(failed)} file(s). Add the includes it names, or apply its "
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows).")
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows). "
"Other findings need a manual fix.")
return 1
print("clang-tidy passed.")
return 0
@@ -466,8 +466,6 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys)
edge.from->incident_edge = &edge;
}
using NodeSet = SkeletalTrapezoidation::NodeSet;
void SkeletalTrapezoidation::separatePointyQuadEndNodes()
{
NodeSet visited_nodes;
-1
View File
@@ -93,7 +93,6 @@ using namespace libnest2d;
using Item = _Item<ExPolygon>;
using Box = _Box<Point>;
using Circle = _Circle<Point>;
using Segment = _Segment<Point>;
using MultiPolygon = ExPolygons;
// Summon the spatial indexing facilities from boost
-5
View File
@@ -23,11 +23,6 @@ enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
} // namespace Slic3r
// import these wherever we're included
using Slic3r::jtMiter;
using Slic3r::jtRound;
using Slic3r::jtSquare;
namespace Slic3r {
static constexpr const float ClipperSafetyOffset = 10.f;
-1
View File
@@ -2851,7 +2851,6 @@ bool is_patch_inside_of_model(const SurfacePatch &patch,
/// <returns>shape point index</returns>
uint32_t get_shape_point_index(const CutAOI &cut, const CutMesh &model);
using PatchNumber = CutMesh::Property_map<FI, size_t>;
/// <summary>
/// Separate triangles singned with number n
/// </summary>
@@ -32,8 +32,6 @@
// #define DEBUG_FUZZY
using namespace Slic3r;
namespace Slic3r::Feature::FuzzySkin {
// Produces a random value between 0 and 1. Thread-safe.
-2
View File
@@ -122,8 +122,6 @@ Polylines get_polylines(const ScalarField& sf, const double tolerance = SCALED_E
namespace Slic3r {
using namespace std;
void FillTpmsFK::_fill_surface_single(const FillParams& params,
unsigned int thickness_layers,
const std::pair<float, Point>& direction,
-1
View File
@@ -25,7 +25,6 @@
#include <boost/property_tree/xml_parser.hpp>
#include <vector>
#include <utility>
namespace pt = boost::property_tree;
#include <boost/filesystem/operations.hpp>
#include <boost/algorithm/string.hpp>
-1
View File
@@ -1135,7 +1135,6 @@ void SeamPlacer::gather_seam_candidates(const PrintObject *po, const SeamPlacerI
void SeamPlacer::calculate_candidates_visibility(const PrintObject *po,
const SeamPlacerImpl::GlobalModelInfo &global_model_info) {
using namespace SeamPlacerImpl;
std::vector<PrintObjectSeamData::LayerSeams> &layers = m_seam_per_object[po].layers;
tbb::parallel_for(tbb::blocked_range<size_t>(0, layers.size()),
-2
View File
@@ -1482,7 +1482,6 @@ static FilamentGroupContext build_filament_group_context(
FilamentMapMode mode,
const std::unordered_map<int, int>& nozzle_status)
{
using namespace MultiNozzleUtils;
using namespace FilamentGroupUtils;
FilamentGroupContext context;
@@ -1691,7 +1690,6 @@ static std::vector<int> apply_master_extruder_preference(const FilamentGroupCont
// multi-nozzle (H2C/A2L) resolves to a nozzle-granular result.
MultiNozzleUtils::LayeredNozzleGroupResult ToolOrdering::get_recommended_filament_maps(const std::vector<std::vector<unsigned int>>& layer_filaments, const Print* print, const FilamentMapMode mode, const std::vector<std::set<int>>& physical_unprintables, const std::vector<std::set<int>>& geometric_unprintables, const std::map<int, std::set<NozzleVolumeType>>& unprintable_volumes, const std::unordered_map<int, int>& nozzle_status)
{
using namespace FilamentGroupUtils;
using namespace MultiNozzleUtils;
if (!print || layer_filaments.empty())
+1
View File
@@ -16,6 +16,7 @@
namespace Slic3r::Geometry {
using VD = VoronoiDiagram;
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
using LinesIt = Lines::iterator;
using ColoredLinesConstIt = ColoredLines::const_iterator;
+1
View File
@@ -20,6 +20,7 @@
namespace Slic3r::Geometry {
using VD = VoronoiDiagram;
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
using LinesIt = Lines::iterator;
using ColoredLinesIt = ColoredLines::iterator;
+14 -16
View File
@@ -10,8 +10,6 @@
#include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h"
using VD = Slic3r::Geometry::VoronoiDiagram;
namespace Slic3r::Geometry {
// Represent trapezoid Voronoi cell around segment.
@@ -19,8 +17,8 @@ template<typename PT> struct SegmentCellRange
{
const PT source_segment_start_point; // The start point of the source segment of this cell.
const PT source_segment_end_point; // The end point of the source segment of this cell.
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
SegmentCellRange() = delete;
explicit SegmentCellRange(const PT &source_segment_start_point, const PT &source_segment_end_point)
@@ -34,8 +32,8 @@ template<typename PT> struct SegmentCellRange
template<typename PT> struct PointCellRange
{
const PT source_point; // The source point of this cell.
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
PointCellRange() = delete;
explicit PointCellRange(const PT &source_point) : source_point(source_point) {}
@@ -46,20 +44,20 @@ template<typename PT> struct PointCellRange
class VoronoiUtils
{
public:
static Vec2i64 to_point(const VD::vertex_type *vertex);
static Vec2i64 to_point(const VoronoiDiagram::vertex_type *vertex);
static Vec2i64 to_point(const VD::vertex_type &vertex);
static Vec2i64 to_point(const VoronoiDiagram::vertex_type &vertex);
static bool is_finite(const VD::vertex_type &vertex);
static bool is_finite(const VoronoiDiagram::vertex_type &vertex);
static VD::vertex_type make_rotated_vertex(VD::vertex_type &vertex, double angle);
static VoronoiDiagram::vertex_type make_rotated_vertex(VoronoiDiagram::vertex_type &vertex, double angle);
template<typename SegmentIterator>
static typename boost::polygon::enable_if<
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
typename std::iterator_traits<SegmentIterator>::reference>::type
get_source_segment(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
get_source_segment(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
template<typename SegmentIterator>
static typename boost::polygon::enable_if<
@@ -73,7 +71,7 @@ public:
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
Arachne::PolygonsPointIndex>::type
get_source_point_index(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
get_source_point_index(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
/**
* Discretize a parabola based on (approximate) step size.
@@ -113,7 +111,7 @@ public:
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
Geometry::SegmentCellRange<
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
compute_segment_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
compute_segment_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
/**
* Compute the range of line segments that surround a cell of the skeletal
@@ -140,19 +138,19 @@ public:
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
Geometry::PointCellRange<
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
compute_point_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
compute_point_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
template<typename T> static bool is_in_range(double value)
{
return double(std::numeric_limits<T>::lowest()) <= value && value <= double(std::numeric_limits<T>::max());
}
template<typename T> static bool is_in_range(const VD::vertex_type &vertex)
template<typename T> static bool is_in_range(const VoronoiDiagram::vertex_type &vertex)
{
return VoronoiUtils::is_finite(vertex) && is_in_range<T>(vertex.x()) && is_in_range<T>(vertex.y());
}
template<typename T> static bool is_in_range(const VD::edge_type &edge)
template<typename T> static bool is_in_range(const VoronoiDiagram::edge_type &edge)
{
if (edge.vertex0() == nullptr || edge.vertex1() == nullptr)
return false;
-2
View File
@@ -230,7 +230,6 @@ std::vector<Bridge> get_grouped_bridges(
{
result.reserve(bridge_expansions.size());
uint32_t group_id = 0;
using std::move_iterator;
for (ExPolygon& expolygon : bridge_expolygons)
result.push_back({ std::move(expolygon), group_id ++, bridge_expansions.end() });
}
@@ -432,7 +431,6 @@ Surfaces expand_bridges_detect_orientations(
const float closing_radius
)
{
using namespace Slic3r::Algorithm;
double thickness;
ExPolygons bridge_expolygons = fill_surfaces_extract_expolygons(surfaces, {stBottomBridge}, thickness);
-1
View File
@@ -660,7 +660,6 @@ bool empty(const CGALMesh &mesh)
bool repair(TriangleMesh& mesh, RepairedMeshErrors* repaired_errors, std::string* error)
{
using namespace CGAL;
namespace PMP = CGAL::Polygon_mesh_processing;
if (mesh.empty())
@@ -63,6 +63,7 @@ namespace Slic3r { enum class EnforcerBlockerType : int8_t; }
namespace Slic3r {
using boost::polygon::voronoi_diagram;
using VD = Geometry::VoronoiDiagram;
static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; }
-1
View File
@@ -263,7 +263,6 @@ size_t get_shapes_count(const NSVGimage &image)
} // namespace Slic3r
namespace {
using namespace Slic3r; // Polygon + Vec2f
Point::coord_type to_coor(float val, double scale) { return static_cast<Point::coord_type>(std::round(val * scale)); }
-1
View File
@@ -2175,7 +2175,6 @@ namespace client
{
macro_processor() : macro_processor::base_type(start)
{
using namespace qi::labels;
qi::alpha_type alpha;
qi::alnum_type alnum;
qi::eps_type eps;
+2 -1
View File
@@ -80,6 +80,8 @@
#include <vector>
#include <utility>
namespace fs = boost::filesystem;
// Mark string for localization and translate.
#define L(s) Slic3r::I18N::translate(s)
@@ -1529,7 +1531,6 @@ bool PresetBundle::apply_vendor_config(
const std::string& preferred_printer_variant,
const std::string& preferred_filament)
{
namespace fs = boost::filesystem;
// Get current configuration from AppConfig
const auto old_vendors = app_config->vendors();
+2 -4
View File
@@ -11,8 +11,6 @@
#include <boost/filesystem/path.hpp>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
namespace Slic3r {
class BBLProject;
@@ -208,7 +206,7 @@ public:
std::string task_profile_id; /* profile id*/
std::string task_name; /* task name, generally filename as task name */
std::string task_file; /* local full file path of 3mf or gcode */
fs::path task_path; /* local path of 3mf or gcode */
boost::filesystem::path task_path; /* local path of 3mf or gcode */
std::string task_gcode_in_3mf; /* gcode in 3mf */
std::string task_create_time; /* time created by cloud */
std::string task_thumbnail_url; /* url of task thumbnail */
@@ -326,7 +324,7 @@ public:
std::string project_url_md5; /* md5 of project url file */
std::string project_name;
std::string project_3mf_file;
fs::path project_path;
boost::filesystem::path project_path;
std::string project_content;
std::string project_country_code;
-2
View File
@@ -404,7 +404,6 @@ std::string debug_out_path(const char *name, ...)
}
namespace logging = boost::log;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
namespace keywords = boost::log::keywords;
namespace attrs = boost::log::attributes;
@@ -892,7 +891,6 @@ int copy_file_linux_read_write(int infile, int outfile, uintmax_t file_size)
// and only features supported by Linux 3.10 (on our build server with CentOS 7) are kept, namely sendfile with ranges and statx() are not supported.
bool copy_file_linux(const boost::filesystem::path &from, const boost::filesystem::path &to, boost::system::error_code &ec)
{
using namespace boost::filesystem;
struct fd_wrapper
{
@@ -18,8 +18,6 @@
class AuxiliaryModelNode;
WX_DEFINE_ARRAY_PTR(AuxiliaryModelNode*, AuxiliaryModelNodePtrArray);
namespace fs = boost::filesystem;
class AuxiliaryModelNode
{
public:
-4
View File
@@ -73,10 +73,6 @@ private:
CancelFn m_cancel_cb;
};
namespace GUI {
using Slic3r::BBLStatusBar;
}
}
#endif // BBLSTATUSBAR_HPP
-4
View File
@@ -80,10 +80,6 @@ private:
CancelFn m_cancel_cb_fina;
};
namespace GUI {
using Slic3r::BBLStatusBarBind;
}
} // namespace Slic3r
#endif // BBLSTATUSBAR_HPP
-4
View File
@@ -97,10 +97,6 @@ private:
CancelFn m_cancel_cb_fina;
};
namespace GUI {
using Slic3r::BBLStatusBarPrint;
}
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO, wxCommandEvent);
} // namespace Slic3r
-4
View File
@@ -99,10 +99,6 @@ private:
CancelFn m_cancel_cb_fina;
};
namespace GUI {
using Slic3r::BBLStatusBarSend;
}
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO_SEND, wxCommandEvent);
wxDECLARE_EVENT(EVT_SHOW_ERROR_FAIL_SEND, wxCommandEvent);
} // namespace Slic3r
+1
View File
@@ -41,6 +41,7 @@
#define TOPBAR_TITLE_WIDTH 300
using namespace Slic3r;
using namespace Slic3r::GUI;
enum CUSTOM_ID
{
-2
View File
@@ -18,8 +18,6 @@ class wxMouseCaptureLostEvent;
class wxMouseEvent;
class wxWindow;
using namespace Slic3r::GUI;
class CenteredTitle : public wxControl
{
public:
+2 -2
View File
@@ -218,7 +218,7 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f
void BackgroundSlicingProcess::process_fff()
{
assert(m_print == m_fff_print);
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
PresetBundle& preset_bundle = *GUI::wxGetApp().preset_bundle;
m_fff_print->is_BBL_printer() = preset_bundle.is_bbl_vendor();
// BBS: add the logic to process from an existed gcode file
if (m_print->finished()) {
@@ -727,7 +727,7 @@ StringObjectException BackgroundSlicingProcess::validate(std::vector<StringObjec
assert(m_print != nullptr);
assert(m_print == m_fff_print);
m_fff_print->is_BBL_printer() = wxGetApp().preset_bundle->is_bbl_vendor();
m_fff_print->is_BBL_printer() = GUI::wxGetApp().preset_bundle->is_bbl_vendor();
return m_print->validate(warnings, collison_polygons, height_polygons);
}
@@ -22,8 +22,6 @@
#include "CapsuleButton.hpp"
namespace Slic3r::GUI { struct IntEvent; }
using namespace Slic3r;
using namespace Slic3r::GUI;
namespace Slic3r { namespace GUI {
#define ANIMATION_REFRESH_INTERVAL 20
-2
View File
@@ -45,8 +45,6 @@
#include <gtk/gtk.h>
#endif
using Slic3r::GUI::format_wxstr;
#define BORDER_W 10
// ---------------------------------
-1
View File
@@ -95,7 +95,6 @@ namespace GUI {
using Config::Snapshot;
using Config::SnapshotDB;
// Configuration data structures extensions needed for the wizard
+1 -3
View File
@@ -43,8 +43,6 @@
#include <wx/types.h>
namespace fs = boost::filesystem;
namespace Slic3r {
namespace GUI {
@@ -88,7 +86,7 @@ struct Bundle
// cache or its profile JSONs, whichever is usable.
// Returns false if not loaded. Reason for that is logged as boost::log error.
//BBS: set BBL as default
bool load(fs::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
bool load(boost::filesystem::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
const std::string& vendor_id() const { return vendor_profile->id; }
};
@@ -5,8 +5,6 @@
#include <map>
#include <nlohmann/json.hpp>
using namespace nlohmann;
namespace Slic3r
{
@@ -1,11 +1,8 @@
#include <nlohmann/json.hpp>
#include "DevExtruderSystem.h"
#include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann;
namespace Slic3r
{
int DevExtderSystem::CtrlRetrySwitching()
-3
View File
@@ -6,7 +6,6 @@
#include <limits>
#include <map>
#include <nlohmann/json.hpp>
#include <vector>
#include <string>
#include <utility>
@@ -21,8 +20,6 @@
#include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/GuiColor.hpp"
using namespace nlohmann;
namespace Slic3r
{
bool DevMappingUtil::is_valid_mapping_result(const MachineObject* obj, std::vector<FilamentInfo>& result, bool check_empty_slot)
-2
View File
@@ -117,8 +117,6 @@ namespace fs = boost::filesystem;
#define ORCA_NETWORK_DEBUG
namespace pt = boost::property_tree;
float string_to_float(const std::string& str_value) {
float value = 0.0;
fast_float::from_chars(str_value.c_str(), str_value.c_str() + str_value.size(), value);
-3
View File
@@ -38,9 +38,6 @@
#include "wx/private/markupparser.h"
#endif // wxUSE_ACCESSIBILITY
using Slic3r::GUI::from_u8;
using Slic3r::GUI::into_u8;
//-----------------------------------------------------------------------------
// DataViewBitmapText
+5 -5
View File
@@ -3622,7 +3622,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
if (extruder_id + 1 != static_cast<unsigned char>(item.extruder))
continue;
if (item.type != ColorChange)
if (item.type != CustomGCode::ColorChange)
continue;
if (!zs_built) {
@@ -4789,10 +4789,10 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGui::SameLine();
switch (custom_gcode.type) {
case PausePrint: imgui.text(cgcode_pause_str); break;
case Template: imgui.text(cgcode_template_str); break;
case ToolChange: imgui.text(cgcode_toolchange_str); break;
case Custom: imgui.text(cgcode_custom_str); break;
case CustomGCode::PausePrint: imgui.text(cgcode_pause_str); break;
case CustomGCode::Template: imgui.text(cgcode_template_str); break;
case CustomGCode::ToolChange: imgui.text(cgcode_toolchange_str); break;
case CustomGCode::Custom: imgui.text(cgcode_custom_str); break;
default: imgui.text(cgcode_unknown_str); break;
}
ImGui::SameLine(max_len);
+2 -2
View File
@@ -184,12 +184,12 @@ static Slic3r::ColorRGBA DEFAULT_BG_LIGHT_COLOR_DARK = { 0.329f, 0.329f, 0.353f,
static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR = { 0.753f, 0.192f, 0.039f, 1.0f };
static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR_DARK = { 0.753f, 0.192f, 0.039f, 1.0f };
void GLCanvas3D::update_render_colors()
void Slic3r::GUI::GLCanvas3D::update_render_colors()
{
DEFAULT_BG_LIGHT_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_3D_Background]);
}
void GLCanvas3D::load_render_colors()
void Slic3r::GUI::GLCanvas3D::load_render_colors()
{
RenderColor::colors[RenderCol_3D_Background] = ImGuiWrapper::to_ImVec4(DEFAULT_BG_LIGHT_COLOR);
}
+1
View File
@@ -309,6 +309,7 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)(
#include <gtk/gtk.h>
#endif
namespace fs = boost::filesystem;
using namespace std::literals;
namespace pt = boost::property_tree;
using json = nlohmann::json;
+1 -1
View File
@@ -396,7 +396,7 @@ void Preview::sys_color_changed()
// m_layers_slider->sys_color_changed();
}
void Preview::on_tick_changed(Type type)
void Preview::on_tick_changed(CustomGCode::Type type)
{
//if (type == Type::PausePrint) {
// m_schedule_background_process();
-2
View File
@@ -4098,8 +4098,6 @@ void GLGizmoCut3D::apply_cut_connectors(ModelObject* mo, const std::string& conn
if (mo->cut_connectors.empty())
return;
using namespace Geometry;
size_t connector_id = mo->cut_id.connectors_cnt();
for (const CutConnector& connector : mo->cut_connectors) {
TriangleMesh mesh = TriangleMesh(get_connector_mesh(connector.attribs));
-1
View File
@@ -77,7 +77,6 @@
#include <fstream>
using namespace Slic3r;
using namespace Slic3r::Emboss;
using namespace Slic3r::GUI;
using namespace Slic3r::GUI::Emboss;
+2
View File
@@ -46,6 +46,8 @@
namespace Slic3r {
using namespace CustomGCode;
namespace GUI {
// equal to 25 mm2
+12 -13
View File
@@ -20,7 +20,6 @@ struct IMGUI_API ImRect;
namespace Slic3r {
using namespace CustomGCode;
class PrintObject;
class Layer;
@@ -89,8 +88,8 @@ public:
void SetSliderValues(const std::vector<double> &values);
void SetSliderAlternateValues(const std::vector<double> &values) { m_alternate_values = values; }
Info GetTicksValues() const;
void SetTicksValues(const Info &custom_gcode_per_print_z);
CustomGCode::Info GetTicksValues() const;
void SetTicksValues(const CustomGCode::Info &custom_gcode_per_print_z);
void SetLayersTimes(const std::vector<float> &layers_times, float total_time);
void SetLayersTimes(const std::vector<double> &layers_times);
@@ -98,8 +97,8 @@ public:
void SetDrawMode(DrawMode mode) { m_draw_mode = mode; }
//BBS
void SetExtraStyle(long style) { m_extra_style = style; }
void SetManipulationMode(Mode mode) { m_mode = mode; }
Mode GetManipulationMode() const { return m_mode; }
void SetManipulationMode(CustomGCode::Mode mode) { m_mode = mode; }
CustomGCode::Mode GetManipulationMode() const { return m_mode; }
void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder, bool can_change_color);
void SetExtruderColors(const std::vector<std::string> &extruder_colors);
@@ -117,8 +116,8 @@ public:
void UseDefaultColors(bool def_colors_on) { m_ticks.set_default_colors(def_colors_on); }
void on_mouse_wheel(wxMouseEvent& evt);
void post_ticks_changed_event(Type type = Unknown);
bool check_ticks_changed_event(Type type);
void post_ticks_changed_event(CustomGCode::Type type = CustomGCode::Unknown);
bool check_ticks_changed_event(CustomGCode::Type type);
bool switch_one_layer_mode();
void show_go_to_layer(bool show) { m_show_go_to_layer_dialog = show; }
@@ -130,9 +129,9 @@ public:
bool is_need_post_tick_event() { return m_is_need_post_tick_changed_event; }
void reset_post_tick_event(bool val = false) {
m_is_need_post_tick_changed_event = val;
m_tick_change_event_type = Type::Unknown;
m_tick_change_event_type = CustomGCode::Type::Unknown;
}
Type get_post_tick_event_type() { return m_tick_change_event_type; }
CustomGCode::Type get_post_tick_event_type() { return m_tick_change_event_type; }
float m_scale = 1.0;
void set_scale(float scale = 1.0);
@@ -143,7 +142,7 @@ public:
protected:
void add_custom_gcode(std::string custom_gcode);
void add_code_as_tick(Type type, int selected_extruder = -1);
void add_code_as_tick(CustomGCode::Type type, int selected_extruder = -1);
void delete_tick(const TickCode& tick);
void do_go_to_layer(size_t layer_number); //menu
void correct_lower_value();
@@ -156,7 +155,7 @@ protected:
void render_edit_menu(const TickCode& tick); //menu
void draw_background_and_groove(const ImRect& bg_rect, const ImRect& groove);
void draw_colored_band(const ImRect& groove, const ImRect& slideable_region);
void draw_custom_label_block(const ImVec2 anchor, Type type);
void draw_custom_label_block(const ImVec2 anchor, CustomGCode::Type type);
void draw_ticks(const ImRect& slideable_region);
void draw_tick_on_mouse_position(const ImRect& slideable_region);
void show_tooltip(const TickCode& tick); //menu
@@ -217,7 +216,7 @@ private:
void *m_delete_icon_id;
DrawMode m_draw_mode = dmRegular;
Mode m_mode = SingleExtruder;
CustomGCode::Mode m_mode = CustomGCode::SingleExtruder;
int m_only_extruder = -1;
long m_style;
@@ -232,7 +231,7 @@ private:
bool m_can_change_color;
std::string m_print_obj_idxs;
bool m_is_need_post_tick_changed_event { false };
Type m_tick_change_event_type;
CustomGCode::Type m_tick_change_event_type;
std::vector<double> m_alternate_values;
-3
View File
@@ -19,9 +19,6 @@
#include <wx/window.h>
#include "wxExtensions.hpp"
using namespace Slic3r;
using namespace Slic3r::GUI;
namespace Slic3r { namespace GUI {
#define ANIMATION_REFRESH_INTERVAL 20
ImageDPIFrame::ImageDPIFrame()
-2
View File
@@ -11,8 +11,6 @@
class wxWindow;
namespace fs = boost::filesystem;
namespace Slic3r {
namespace GUI {
@@ -30,7 +30,6 @@
#include "libslic3r/libslic3r.h"
#include <exception>
using namespace Slic3r;
using namespace Slic3r::GUI;
const std::string CreateFontImageJob::default_text = "AaBbCc 123";
@@ -23,9 +23,6 @@
#include <exception>
#include <cstdint>
using namespace Slic3r;
using namespace Slic3r::Emboss;
using namespace Slic3r::GUI;
using namespace Slic3r::GUI::Emboss;
+3 -5
View File
@@ -12,8 +12,6 @@
#include "Job.hpp"
#include "slic3r/GUI/DeviceCore/DevStorage.h"
namespace fs = boost::filesystem;
namespace Slic3r {
namespace GUI {
@@ -26,9 +24,9 @@ class PrintPrepareData
public:
bool is_from_plater = true;
int plate_idx;
fs::path _3mf_path;
fs::path _3mf_config_path;
fs::path _temp_path;
boost::filesystem::path _3mf_path;
boost::filesystem::path _3mf_config_path;
boost::filesystem::path _temp_path;
PrintPrepareData() {
plate_idx = 0;
}
-2
View File
@@ -11,8 +11,6 @@
#include "Job.hpp"
#include "PrintJob.hpp"
namespace fs = boost::filesystem;
namespace Slic3r {
namespace GUI {
@@ -12,8 +12,6 @@
class wxWindow;
namespace fs = boost::filesystem;
namespace Slic3r {
namespace GUI {
-1
View File
@@ -293,7 +293,6 @@ VideoMonitoringBasePanel::~VideoMonitoringBasePanel()
///////////////////////////////////////////////////////////////////////////
using namespace Slic3r::GUI;
TaskListBasePanel::TaskListBasePanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) : wxPanel(parent, id, pos, size, style, name)
{
-5
View File
@@ -1,4 +1,3 @@
#include <boost/optional/optional.hpp>
#include <array>
#include <cassert>
#include <cmath>
@@ -60,7 +59,6 @@
#include <future>
#include <glad/gl.h>
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/log/trivial.hpp>
@@ -113,9 +111,6 @@
#include "slic3r/GUI/GLModel.hpp"
class wxFont;
namespace boost { template <class T> class optional; }
using boost::optional;
namespace fs = boost::filesystem;
static const float GROUND_Z = -0.03f;
static const float GROUND_Z_GRIDLINE = -0.26f;
+3 -7
View File
@@ -296,11 +296,7 @@
#include "DeviceCore/DevConfigUtil.h"
#include "DeviceCore/DevDefs.h"
using boost::optional;
namespace fs = boost::filesystem;
using Slic3r::_3DScene;
using Slic3r::Preset;
using Slic3r::GUI::format_wxstr;
using namespace nlohmann;
static const std::pair<unsigned int, unsigned int> THUMBNAIL_SIZE_3MF = { 512, 512 };
@@ -8111,13 +8107,13 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); });
preview->get_wxglcanvas()->Bind(EVT_CUSTOMEVT_TICKSCHANGED, [this](wxCommandEvent& event) {
Type tick_event_type = (Type)event.GetInt();
CustomGCode::Type tick_event_type = (CustomGCode::Type)event.GetInt();
Model& model = wxGetApp().plater()->model();
//BBS: replace model custom gcode with current plate custom gcode
model.plates_custom_gcodes[model.curr_plate_index] = preview->get_canvas3d()->get_gcode_viewer().get_layers_slider()->GetTicksValues();
// BBS set to invalid state only
if (tick_event_type == Type::ToolChange || tick_event_type == Type::Custom || tick_event_type == Type::Template || tick_event_type == Type::PausePrint) {
if (tick_event_type == CustomGCode::Type::ToolChange || tick_event_type == CustomGCode::Type::Custom || tick_event_type == CustomGCode::Type::Template || tick_event_type == CustomGCode::Type::PausePrint) {
PartPlate *plate = this->q->get_partplate_list().get_curr_plate();
if (plate) {
plate->update_slice_result_valid_state(false);
@@ -20544,7 +20540,7 @@ void Plater::on_filaments_delete(size_t num_filaments, size_t filament_id, int r
// update customize gcode
for (auto item = p->model.plates_custom_gcodes.begin(); item != p->model.plates_custom_gcodes.end(); ++item) {
auto iter = std::remove_if(item->second.gcodes.begin(), item->second.gcodes.end(), [filament_id](const Item& gcode_item) {
auto iter = std::remove_if(item->second.gcodes.begin(), item->second.gcodes.end(), [filament_id](const CustomGCode::Item& gcode_item) {
return (gcode_item.type == CustomGCode::Type::ToolChange && gcode_item.extruder == filament_id + 1);
});
if (replace_filament_id == -1)
+1 -3
View File
@@ -81,8 +81,6 @@
#include <gtk/gtk.h>
#endif
using Slic3r::GUI::format_wxstr;
namespace Slic3r {
namespace GUI {
@@ -2177,7 +2175,7 @@ void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt)
wxPostEvent(m_parent, e);
}
void PlaterPresetComboBox::sys_color_changed()
void GUI::PlaterPresetComboBox::sys_color_changed()
{
PresetComboBox::sys_color_changed();
if (clr_picker) {
+2 -2
View File
@@ -1752,8 +1752,8 @@ void ElegooPrintHostSendDialog::init() {
}
{
auto radioBoxA = new ::RadioBox(this);
auto radioBoxB = new ::RadioBox(this);
auto radioBoxA = new RadioBox(this);
auto radioBoxB = new RadioBox(this);
if (m_BedType == BedType::btPC)
radioBoxB->SetValue(true);
else
-4
View File
@@ -68,10 +68,6 @@ private:
CancelFn m_cancel_cb;
};
namespace GUI {
using Slic3r::ProgressStatusBar;
}
}
#endif // PROGRESSSTATUSBAR_HPP
-2
View File
@@ -78,8 +78,6 @@ using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; }
namespace fs = boost::filesystem;
namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_SECONDARY_CHECK_CONFIRM, wxCommandEvent);
-2
View File
@@ -42,8 +42,6 @@
#include "Widgets/DialogButtons.hpp"
using Slic3r::GUI::format_wxstr;
namespace Slic3r { namespace GUI {
#define BORDER_W 10
-4
View File
@@ -1,6 +1,5 @@
#include "Search.hpp"
#include <boost/optional/optional.hpp>
#include "slic3r/GUI/GUI.hpp"
#include "libslic3r/Preset.hpp"
#include "libslic3r/Config.hpp"
@@ -22,7 +21,6 @@
#include <cstddef>
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp>
#include <boost/nowide/convert.hpp>
#include <wx/event.h>
#include <wx/gdicmn.h>
@@ -56,8 +54,6 @@
#include "LinuxDisplayBackend.hpp"
#endif
using boost::optional;
namespace Slic3r {
wxDEFINE_EVENT(wxCUSTOMEVT_JUMP_TO_OPTION, wxCommandEvent);
-3
View File
@@ -87,9 +87,6 @@
namespace fs = boost::filesystem;
using json = nlohmann::json;
using namespace Slic3r;
using namespace Slic3r::GUI;
#define OK_BUTTON_SIZE wxSize(FromDIP(90), FromDIP(24))
#define CANCEL_BUTTON_SIZE wxSize(FromDIP(58), FromDIP(24))
#define SyncAmsInfoDialogWidth FromDIP(675)
+3
View File
@@ -6,6 +6,9 @@
#include <set>
namespace Slic3r {
using namespace CustomGCode;
namespace GUI {
std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int extruder)
{
+8 -9
View File
@@ -7,7 +7,6 @@
#include <vector>
namespace Slic3r {
using namespace CustomGCode;
namespace GUI {
struct TickCode
@@ -16,7 +15,7 @@ struct TickCode
bool operator>(const TickCode& other) const { return other.tick < this->tick; }
int tick = 0;
Type type = ColorChange;
CustomGCode::Type type = CustomGCode::ColorChange;
int extruder = 0;
std::string color;
std::string extra;
@@ -31,22 +30,22 @@ class TickCodeInfo
std::vector<std::string>* m_colors{ nullptr };// reference to IMSlider::m_extruder_colors
std::string get_color_for_tick(TickCode tick, Type type, const int extruder);
std::string get_color_for_tick(TickCode tick, CustomGCode::Type type, const int extruder);
public:
std::set<TickCode> ticks{};
Mode mode = Undef;
CustomGCode::Mode mode = CustomGCode::Undef;
bool empty() const { return ticks.empty(); }
void set_pause_print_msg(const std::string& message) { pause_print_msg = message; }
bool add_tick(const int tick, Type type, int extruder, double print_z);
bool add_tick(const int tick, CustomGCode::Type type, int extruder, double print_z);
bool edit_tick(std::set<TickCode>::iterator it, double print_z);
void switch_code(Type type_from, Type type_to);
bool switch_code_for_tick(std::set<TickCode>::iterator it, Type type_to, const int extruder);
void erase_all_ticks_with_code(Type type);
void switch_code(CustomGCode::Type type_from, CustomGCode::Type type_to);
bool switch_code_for_tick(std::set<TickCode>::iterator it, CustomGCode::Type type_to, const int extruder);
void erase_all_ticks_with_code(CustomGCode::Type type);
bool has_tick_with_code(Type type);
bool has_tick_with_code(CustomGCode::Type type);
bool has_tick(int tick);
void suppress_plus(bool suppress) { m_suppress_plus = suppress; }
-4
View File
@@ -1,6 +1,5 @@
#include "UnsavedChangesDialog.hpp"
#include <boost/optional/optional.hpp>
#include <cmath>
#include <boost/algorithm/string/replace.hpp>
#include <cassert>
@@ -26,7 +25,6 @@
#include <string>
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/optional.hpp>
#include <wx/colour.h>
#include <wx/dataview.h>
@@ -66,8 +64,6 @@
#include "Widgets/DialogButtons.hpp"
#include "Widgets/HyperLink.hpp"
using boost::optional;
#ifdef __linux__
#define wxLinux true
#else
-2
View File
@@ -81,8 +81,6 @@
class wxWindow;
namespace fs = boost::filesystem;
using namespace nlohmann;
namespace Slic3r { namespace GUI {
-1
View File
@@ -52,7 +52,6 @@
#include <sstream>
#include <slic3r/GUI/Widgets/WebView.hpp>
#include <slic3r/GUI/Widgets/HyperLink.hpp> // ORCA
using namespace std;
using namespace nlohmann;
-3
View File
@@ -43,9 +43,6 @@
#include <wx/utils.h>
using json = nlohmann::json;
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace {
-1
View File
@@ -21,7 +21,6 @@
#include "Http.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
@@ -18,8 +18,6 @@
#include <vector>
#include "libslic3r/AppConfig.hpp"
using json = nlohmann::json;
namespace Slic3r {
-6
View File
@@ -22,8 +22,6 @@
#include <boost/format.hpp>
#include <boost/foreach.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string/split.hpp>
@@ -55,7 +53,6 @@
#include <nlohmann/json.hpp>
#include <wx/string.h>
using json = nlohmann::json;
using std::to_string;
namespace beast = boost::beast;
namespace http = beast::http;
@@ -63,9 +60,6 @@ namespace websocket = beast::websocket;
namespace net = boost::asio;
using tcp = boost::asio::ip::tcp;
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
CrealityPrint::CrealityPrint(DynamicPrintConfig* config) :
-1
View File
@@ -214,7 +214,6 @@ bool CrealityPrintAgent::parse_cfs_response(const std::string& response,
int& box_count,
std::string& error)
{
using nlohmann::json;
slots.clear();
box_count = 0;
-6
View File
@@ -3,11 +3,8 @@
#include <algorithm>
#include <cassert>
#include <ctime>
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <utility>
#include <wx/frame.h>
@@ -25,9 +22,6 @@
#include "slic3r/GUI/I18N.hpp"
#include "Http.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
Duet::Duet(DynamicPrintConfig *config) :
-5
View File
@@ -7,8 +7,6 @@
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
@@ -28,9 +26,6 @@
#include "slic3r/GUI/I18N.hpp"
#include "Http.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
ESP3D::ESP3D(DynamicPrintConfig* config) : m_host(config->opt_string("print_host")), m_console_port("8888") {}
-1
View File
@@ -50,7 +50,6 @@
#include "slic3r/GUI/BonjourDialog.hpp"
#include <boost/asio/ip/address.hpp>
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
#define MAX_UPLOAD_PACKAGE_LENGTH 1048576 //(1024*1024)
-1
View File
@@ -561,7 +561,6 @@ bool StyleManager::set_wx_font(const wxFont &wx_font, std::unique_ptr<FontFile>
// StylesSerializable
namespace {
using namespace Slic3r;
using namespace Slic3r::GUI;
using Section = std::map<std::string,std::string>;
-4
View File
@@ -2,7 +2,6 @@
#include <algorithm>
#include <ctime>
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/algorithm/string/predicate.hpp>
@@ -23,9 +22,6 @@
#include "slic3r/GUI/I18N.hpp"
#include "Http.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
FlashAir::FlashAir(DynamicPrintConfig *config) :
-3
View File
@@ -25,8 +25,6 @@
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
@@ -55,7 +53,6 @@
#include "SerialMessageType.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
using json = nlohmann::json;
namespace Slic3r {
-2
View File
@@ -13,8 +13,6 @@
#include <fontconfig/fontconfig.h>
#include "libslic3r/Utils.hpp"
using namespace Slic3r::GUI;
// @Vojta suggest to make static variable global
// Guard for finalize Font Config
-6
View File
@@ -4,11 +4,8 @@
#include <ctime>
#include <chrono>
#include <thread>
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
@@ -31,9 +28,6 @@
#include "SerialMessage.hpp"
#include "SerialMessageType.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
MKS::MKS(DynamicPrintConfig* config) :
-1
View File
@@ -30,7 +30,6 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/BonjourDialog.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
-1
View File
@@ -37,7 +37,6 @@
#include <boost/asio/ip/address.hpp>
#include <cstddef>
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
+1 -1
View File
@@ -82,7 +82,7 @@ using json = nlohmann::json;
namespace Slic3r {
namespace {
constexpr const char* ORCA_DEFAULT_API_URL = "api.orcaslicer.com";
constexpr const char* ORCA_DEFAULT_API_URL = "https://api.orcaslicer.com";
constexpr const char* ORCA_DEFAULT_AUTH_URL = "https://auth.orcaslicer.com";
constexpr const char* ORCA_DEFAULT_CLOUD_URL = "https://cloud.orcaslicer.com";
// Orca: This is a public key with no secret, used to identify the client application to the backend.
-2
View File
@@ -66,8 +66,6 @@ namespace Slic3r::GUI::Config { class SnapshotDB; }
namespace fs = boost::filesystem;
using Slic3r::GUI::Config::Index;
using Slic3r::GUI::Config::Version;
using Slic3r::GUI::Config::Snapshot;
using Slic3r::GUI::Config::SnapshotDB;
// FIXME: Incompat bundle resolution doesn't deal with inherited user presets
-3
View File
@@ -1,6 +1,5 @@
#include "PrintHost.hpp"
#include <boost/optional/optional.hpp>
#include "libslic3r/Config.hpp"
#include <string>
#include <boost/algorithm/string/predicate.hpp>
@@ -16,7 +15,6 @@
#include <thread>
#include <exception>
#include <sstream>
#include <boost/optional.hpp>
#include <boost/log/trivial.hpp>
#include <boost/filesystem.hpp>
#include <nlohmann/json.hpp>
@@ -50,7 +48,6 @@
#include "Moonraker.hpp"
namespace fs = boost::filesystem;
using boost::optional;
using Slic3r::GUI::PrintHostQueueDialog;
namespace Slic3r {
-2
View File
@@ -18,8 +18,6 @@
#include <utility>
#include <vector>
using json = nlohmann::json;
namespace Slic3r {
namespace {
-1
View File
@@ -27,7 +27,6 @@
#include "Http.hpp"
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
-1
View File
@@ -288,7 +288,6 @@ std::vector<std::string> scan_serial_ports()
// Class Serial
namespace asio = boost::asio;
using boost::system::error_code;
Serial::Serial(asio::io_service& io_service) :
asio::serial_port(io_service)
+1 -1
View File
@@ -115,7 +115,7 @@ static void set_auth(Http& http, const std::string& access_token) { http.header(
static bool should_open_in_external_browser()
{
const auto& app = wxGetApp();
const auto& app = GUI::wxGetApp();
if (app.preset_bundle->use_bbl_device_tab()) {
// When using bbl device tab, we always need to open external browser
@@ -13,8 +13,6 @@
#include <cstddef>
#include <utility>
using json = nlohmann::json;
namespace Slic3r {
namespace {
-5
View File
@@ -3,9 +3,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/read_until.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/write.hpp>
#include <boost/bind/bind.hpp>
#include <boost/bind/placeholders.hpp>
@@ -24,9 +22,6 @@
#include "SerialMessage.hpp"
#include "SerialMessageType.hpp"
using boost::asio::steady_timer;
using boost::asio::ip::tcp;
namespace Slic3r {
namespace Utils {
-3
View File
@@ -6,7 +6,6 @@
#include <cstdio>
#include <cassert>
#include <ctime>
#include <boost/filesystem/path.hpp>
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ptree.hpp>
@@ -34,8 +33,6 @@
#include <iostream>
#include <stdio.h>
#include <string>
namespace fs = boost::filesystem;
namespace pt = boost::property_tree;
namespace Slic3r {
-1
View File
@@ -16,7 +16,6 @@
#include <boost/nowide/iostream.hpp>
#include <boost/nowide/fstream.hpp>
using namespace std;
using json = nlohmann::json;
int json_diff::diff_objects(json const &in, json &out, json const &base)
+25 -6
View File
@@ -346,8 +346,20 @@ std::vector<std::string> PluginAuditManager::default_denied_path_keywords()
// must never be able to reach a secret, a certificate, or a configuration file just because
// it happens to live inside an otherwise-allowed root (e.g. the bundled TLS client cert at
// resources_dir()/cert/..., which would become reachable the moment resources_dir() is
// granted as a read-only allowed root).
return {"secret", "cert", "conf"};
// granted as a read-only allowed root). Match as whole path components, not substrings, so
// imports such as numpy/__config__.py and stdlib configparser.py remain usable.
return {"secret", "secrets", "cert", "certs", "certificate", "certificates", "conf", "config"};
}
static bool has_denied_config_extension(std::string name)
{
const size_t stream_pos = name.find(':');
if (stream_pos != std::string::npos)
name.erase(stream_pos);
const boost::filesystem::path path(name);
const std::string extension = path.extension().string();
return extension == ".conf" || extension == ".ini";
}
bool PluginAuditManager::is_denied_path_keyword(const boost::filesystem::path& candidate) const
@@ -372,7 +384,7 @@ bool PluginAuditManager::is_denied_path_keyword(const boost::filesystem::path& c
continue;
std::transform(name.begin(), name.end(), name.begin(), [](unsigned char c) { return std::tolower(c); });
for (const auto& keyword : m_denied_path_keywords) {
if (name.find(keyword) != std::string::npos)
if (name == keyword || (keyword == "conf" && has_denied_config_extension(name)))
return true;
}
}
@@ -796,7 +808,8 @@ bool persist_permission(const std::string& plugin_key,
int report_denied(PluginAuditManager& mgr,
const std::string& event_name,
const AuditDecision& decision)
const AuditDecision& decision,
const std::string& target = {})
{
AuditViolation violation;
violation.plugin_key = mgr.current_plugin();
@@ -804,7 +817,13 @@ int report_denied(PluginAuditManager& mgr,
violation.reason = decision.reason;
mgr.report_violation(violation);
PyErr_SetString(PyExc_PermissionError, "Plugin attempted an audited operation without permission");
std::string message = "Plugin attempted audited operation \"" + event_name + "\" without permission";
if (!decision.reason.empty())
message += ": " + decision.reason;
if (!target.empty())
message += ": " + target;
PyErr_SetString(PyExc_PermissionError, message.c_str());
return -1;
}
@@ -916,7 +935,7 @@ int PluginAuditManager::audit_hook(const char* event, PyObject* args, void* user
if (fs_category) {
for (const auto& target : targets) {
if (mgr->is_denied_path(boost::filesystem::path(target)))
return PluginAuditDetail::report_denied(*mgr, event_name, {false, "denied path"});
return PluginAuditDetail::report_denied(*mgr, event_name, {false, "denied path"}, target);
}
}
+8 -11
View File
@@ -4,7 +4,6 @@
// Via pybind11 so this file requests the same python3xx.lib as everything else.
#include <boost/filesystem/path.hpp>
#include <pybind11/conduit/wrap_include_python_h.h>
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
@@ -103,22 +102,20 @@ public:
bool is_denied_filename(const boost::filesystem::path& candidate) const;
// --- denied-path-keyword registry ---
// Keywords that categorically deny a path if ANY of its components (directory or file
// name), not just the base name, contains one case-insensitively -- e.g. a "secrets"
// subfolder, a "certificates" folder, or a "conf"/"config" file anywhere the plugin can
// otherwise reach, including inside an allowed root. This is intentionally broader and
// fuzzier than the exact-name is_denied_filename registry: it exists to categorically rule
// out whole classes of sensitive paths (secrets, certificates, config) rather than name
// specific known files, at the cost of over-blocking an unrelated name that happens to
// contain the keyword -- the fail-safe direction, same rationale as is_denied_filename.
// Keywords that categorically deny a path if ANY component matches one case-insensitively --
// e.g. a "secrets" subfolder, a "certificates" folder, a "conf"/"config" directory, or a
// .conf/.ini file anywhere the plugin can otherwise reach, including inside an allowed root.
// This is broader than the exact-name is_denied_filename registry, but it is not a substring
// match: importable modules such as numpy/__config__.py, configparser.py, sysconfig.py, or
// user folders such as "Conference" and "Concert" are unrelated names and must stay promptable.
void add_denied_path_keyword(const std::string& keyword);
// The list install_hook() seeds into the keyword registry. Exposed so tests seed the exact
// same set without a live interpreter.
static std::vector<std::string> default_denied_path_keywords();
// True when any component of candidate's (canonicalized) path contains a registered
// keyword, case-insensitively.
// True when any component of candidate's (canonicalized) path matches a registered keyword,
// case-insensitively. A registered "conf" keyword also blocks .conf/.ini file components.
bool is_denied_path_keyword(const boost::filesystem::path& candidate) const;
// is_denied_filename(candidate) || is_denied_path_keyword(candidate). Convenience for
+12 -12
View File
@@ -565,7 +565,7 @@ void progress_close(int id)
});
}
void plater_notification(NotificationManager::NotificationLevel notification_level, const std::string& text,
void plater_notification(GUI::NotificationManager::NotificationLevel notification_level, const std::string& text,
const std::string& hypertext, py::object on_click)
{
const std::string plugin_key = PluginAuditManager::instance().current_plugin();
@@ -600,7 +600,7 @@ void plater_notification(NotificationManager::NotificationLevel notification_lev
}
run_on_ui_blocking([notification_level, text, hypertext, callback = std::move(callback)]() mutable {
wxGetApp().plater()->get_notification_manager()->push_notification(NotificationType::CustomNotification, notification_level, text,
GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::CustomNotification, notification_level, text,
hypertext, std::move(callback));
});
}
@@ -713,16 +713,16 @@ void PluginHostUi::RegisterBindings(pybind11::module_& host)
py::arg("maximum") = 100, py::arg("style") = wxPD_APP_MODAL | wxPD_AUTO_HIDE,
"Create a native progress dialog and return a ProgressDialog handle.");
py::enum_<NotificationManager::NotificationLevel>(ui, "NotificationLevel")
.value("ProgressBarNotificationLevel", NotificationManager::NotificationLevel::ProgressBarNotificationLevel)
.value("HintNotificationLevel", NotificationManager::NotificationLevel::HintNotificationLevel)
.value("RegularNotificationLevel", NotificationManager::NotificationLevel::RegularNotificationLevel)
.value("PrintInfoNotificationLevel", NotificationManager::NotificationLevel::PrintInfoNotificationLevel)
.value("PrintInfoShortNotificationLevel", NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel)
.value("ImportantNotificationLevel", NotificationManager::NotificationLevel::ImportantNotificationLevel)
.value("WarningNotificationLevel", NotificationManager::NotificationLevel::WarningNotificationLevel)
.value("SeriousWarningNotificationLevel", NotificationManager::NotificationLevel::SeriousWarningNotificationLevel)
.value("ErrorNotificationLevel", NotificationManager::NotificationLevel::ErrorNotificationLevel)
py::enum_<GUI::NotificationManager::NotificationLevel>(ui, "NotificationLevel")
.value("ProgressBarNotificationLevel", GUI::NotificationManager::NotificationLevel::ProgressBarNotificationLevel)
.value("HintNotificationLevel", GUI::NotificationManager::NotificationLevel::HintNotificationLevel)
.value("RegularNotificationLevel", GUI::NotificationManager::NotificationLevel::RegularNotificationLevel)
.value("PrintInfoNotificationLevel", GUI::NotificationManager::NotificationLevel::PrintInfoNotificationLevel)
.value("PrintInfoShortNotificationLevel", GUI::NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel)
.value("ImportantNotificationLevel", GUI::NotificationManager::NotificationLevel::ImportantNotificationLevel)
.value("WarningNotificationLevel", GUI::NotificationManager::NotificationLevel::WarningNotificationLevel)
.value("SeriousWarningNotificationLevel", GUI::NotificationManager::NotificationLevel::SeriousWarningNotificationLevel)
.value("ErrorNotificationLevel", GUI::NotificationManager::NotificationLevel::ErrorNotificationLevel)
.export_values();
ui.def("push_notification", &plater_notification, py::arg("notification_level"), py::arg("text"),
-1
View File
@@ -12,7 +12,6 @@
#include "libslic3r/Flow.hpp"
#include "libslic3r/libslic3r.h"
using namespace Slic3r::Test;
using namespace Slic3r;
/// Test the expected behavior for auto-width,
-2
View File
@@ -27,8 +27,6 @@
#include "test_utils.hpp"
using namespace std;
namespace Slic3r { namespace Test {
const std::unordered_map<TestMesh, const char*, TestMeshHash> mesh_names {

Some files were not shown because too many files have changed in this diff Show More