Skip to content

Commit

Permalink
A *lot* of import fixes for flatpak (#3909)
Browse files Browse the repository at this point in the history
* A *lot* of import fixes for flatpak

Aside, thank you @hadess for the majority of these fixes. You are the
base point for a lot of issues fixed during the creation of this
flatpak.

* Use slic3r::load_string_file

Boost 1.84 removed `boost::fs::load_string_file` so use the func located
in Utils.hpp
  • Loading branch information
powpingdone authored Jan 31, 2024
1 parent 4110ecc commit 951fc8e
Show file tree
Hide file tree
Showing 114 changed files with 214 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/libslic3r/Arrange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define BOOST_NO_CXX17_HDR_STRING_VIEW
#endif

#include <boost/log/trivial.hpp>
#include <boost/multiprecision/integer.hpp>
#include <boost/rational.hpp>

Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/Color.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef slic3r_Color_hpp_
#define slic3r_Color_hpp_

#include <vector>
#include <string>
#include <array>
#include <algorithm>

Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Format/bbs_3mf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Slic3r {
class Model;
class ModelObject;
struct ConfigSubstitutionContext;
class DynamicPrintConfig;
class Preset;
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/GCodeReader.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "GCodeReader.hpp"
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/nowide/cstdio.hpp>
#include <fstream>
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Orient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <numeric>
#include <ClipperUtils.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/log/trivial.hpp>
#include <tbb/parallel_for.h>

#if defined(_MSC_VER) && defined(__clang__)
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PNGReadWrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstdio>
#include <png.h>

#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>

Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PNGReadWrite.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef PNGREAD_HPP
#define PNGREAD_HPP

#include <cstdint>
#include <vector>
#include <string>
#include <istream>
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <cmath>
#include <cassert>
#include <unordered_set>

static const int overhang_sampling_number = 6;
static const double narrow_loop_length_threshold = 10;
Expand Down
11 changes: 8 additions & 3 deletions src/libslic3r/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "Utils.hpp"
#include "PrintConfig.hpp"
#include "Model.hpp"
#include "format.hpp"
#include <float.h>

#include <algorithm>
Expand All @@ -49,6 +50,10 @@
#include <boost/format.hpp>
#include <boost/log/trivial.hpp>
#include <boost/regex.hpp>
#include <boost/nowide/fstream.hpp>

#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>

//BBS: add json support
#include "nlohmann/json.hpp"
Expand Down Expand Up @@ -1117,8 +1122,8 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
return
// Test whether the last slicing plane is below or above the print volume.
{ 0.5 * (layers[layers.size() - 2] + layers.back()) > this->config().printable_height + EPSILON ?
format(_u8L("The object %1% exceeds the maximum build volume height."), print_object.model_object()->name) :
format(_u8L("While the object %1% itself fits the build volume, its last layer exceeds the maximum build volume height."), print_object.model_object()->name) +
Slic3r::format(_u8L("The object %1% exceeds the maximum build volume height."), print_object.model_object()->name) :
Slic3r::format(_u8L("While the object %1% itself fits the build volume, its last layer exceeds the maximum build volume height."), print_object.model_object()->name) +
" " + _u8L("You might want to reduce the size of your model or change current print settings and retry.") };
}
}
Expand Down Expand Up @@ -1401,7 +1406,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
}

StringObjectException except;
except.string = format(L("Plate %d: %s does not support filament %s"), this->get_plate_index() + 1, L(bed_type_name), extruder_id + 1);
except.string = Slic3r::format(L("Plate %d: %s does not support filament %s"), this->get_plate_index() + 1, L(bed_type_name), extruder_id + 1);
except.string += "\n";
except.type = STRING_EXCEPT_FILAMENT_NOT_MATCH_BED_TYPE;
except.params.push_back(std::to_string(this->get_plate_index() + 1));
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintApply.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Model.hpp"
#include "Print.hpp"

#include <boost/log/trivial.hpp>
#include <cfloat>

namespace Slic3r {
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp>

#include "I18N.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
#include "PrintConfig.hpp"
#include "ClipperUtils.hpp"
#include "Config.hpp"
#include "I18N.hpp"

Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Fill/FillLightning.hpp"
#include "Format/STL.hpp"
#include "TreeSupport.hpp"
#include "format.hpp"

#include <float.h>
#include <oneapi/tbb/blocked_range.h>
Expand Down Expand Up @@ -659,7 +660,7 @@ void PrintObject::generate_support_material()
{SharpTail,L("floating regions")},
{Cantilever,L("floating cantilever")},
{LargeOverhang,L("large overhangs")} };
std::string warning_message = format(L("It seems object %s has %s. Please re-orient the object or enable support generation."),
std::string warning_message = Slic3r::format(L("It seems object %s has %s. Please re-orient the object or enable support generation."),
this->model_object()->name, reasons[sntype]);
this->active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL, warning_message, PrintStateBase::SlicingNeedSupportOn);
}
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/ProjectTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <codecvt>

#include <boost/random.hpp>
#include <boost/log/trivial.hpp>
#include <boost/generator_iterator.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/SVG.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "SVG.hpp"
#include <iostream>

#include <boost/filesystem.hpp>
#include <boost/nowide/cstdio.hpp>

namespace Slic3r {
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/Shape/TextShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include "BRepPrimAPI_MakePrism.hxx"
#include "Font_FontMgr.hxx"

#include <boost/log/trivial.hpp>

namespace Slic3r {

static std::map<std::string, std::string> g_occt_fonts_maps; //map<font_name, font_path>
Expand Down
4 changes: 3 additions & 1 deletion src/libslic3r/Shape/TextShape.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef slic3r_Text_Shape_hpp_
#define slic3r_Text_Shape_hpp_

#include "libslic3r/TriangleMesh.hpp"

namespace Slic3r {
class TriangleMesh;

Expand All @@ -17,4 +19,4 @@ std::map<std::string, std::string> get_occt_fonts_maps();

}; // namespace Slic3r

#endif // slic3r_Text_Shape_hpp_
#endif // slic3r_Text_Shape_hpp_
2 changes: 2 additions & 0 deletions src/libslic3r/Support/SupportCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
#include "../MutablePolygon.hpp"
#include "../Geometry.hpp"
#include "../Point.hpp"
#include "clipper/clipper_z.hpp"

#include <cmath>
#include <boost/container/static_vector.hpp>
#include <boost/log/trivial.hpp>

#include <tbb/parallel_for.h>

Expand Down
4 changes: 4 additions & 0 deletions src/libslic3r/TreeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "I18N.hpp"
#include <libnest2d/backends/libslic3r/geometries.hpp>

#include <boost/log/trivial.hpp>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>

#define _L(s) Slic3r::I18N::translate(s)

#define USE_PLAN_LAYER_HEIGHTS 1
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/TriangleSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "Model.hpp"

#include <boost/container/small_vector.hpp>
#include <boost/log/trivial.hpp>

#ifndef NDEBUG
// #define EXPENSIVE_DEBUG_CHECKS
Expand Down
5 changes: 3 additions & 2 deletions src/libslic3r/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cstdarg>
#include <stdio.h>

#include "format.hpp"
#include "Platform.hpp"
#include "Time.hpp"
#include "libslic3r.h"
Expand Down Expand Up @@ -1510,7 +1511,7 @@ bool bbl_calc_md5(std::string &filename, std::string &md5_out)
// SoftFever: copy directory recursively
void copy_directory_recursively(const boost::filesystem::path &source, const boost::filesystem::path &target)
{
BOOST_LOG_TRIVIAL(info) << format("copy_directory_recursively %1% -> %2%", source, target);
BOOST_LOG_TRIVIAL(info) << Slic3r::format("copy_directory_recursively %1% -> %2%", source, target);
std::string error_message;

if (boost::filesystem::exists(target))
Expand All @@ -1530,7 +1531,7 @@ void copy_directory_recursively(const boost::filesystem::path &source, const boo
CopyFileResult cfr = copy_file(source_file, target_file, error_message, false);
if (cfr != CopyFileResult::SUCCESS) {
BOOST_LOG_TRIVIAL(error) << "Copying failed(" << cfr << "): " << error_message;
throw Slic3r::CriticalException(format(
throw Slic3r::CriticalException(Slic3r::format(
("Copying directory %1% to %2% failed: %3%"),
source, target, error_message));
}
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/GUI/AMSMaterialsSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "GUI_App.hpp"
#include "libslic3r/Preset.hpp"
#include "I18N.hpp"
#include <boost/log/trivial.hpp>
#include <wx/colordlg.h>
#include <wx/dcgraph.h>
#include "CalibUtils.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/AMSMaterialsSetting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "wxExtensions.hpp"
#include "GUI_Utils.hpp"
#include "DeviceManager.hpp"
#include "wx/colourdata.h"
#include "wx/clrpicker.h"
#include "Widgets/RadioBox.hpp"
#include "Widgets/Button.hpp"
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/GUI/Auxiliary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <wx/arrstr.h>
#include <wx/tglbtn.h>

#include <boost/log/trivial.hpp>

#include "wxExtensions.hpp"
#include "GUI_App.hpp"
#include "GUI_ObjectList.hpp"
Expand Down
5 changes: 5 additions & 0 deletions src/slic3r/GUI/AuxiliaryDataViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
#include "libslic3r/Model.hpp"
#include "libslic3r/Format/bbs_3mf.hpp"


#include <boost/log/trivial.hpp>

#include <wx/log.h>

const static std::array<wxString, 4> s_default_folders = {
_L("Model Pictures"),
_L("Bill of Materials"),
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/AuxiliaryDataViewModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "I18N.hpp"

#include <filesystem>
#include <boost/filesystem.hpp>

class AuxiliaryModelNode;
WX_DEFINE_ARRAY_PTR(AuxiliaryModelNode*, AuxiliaryModelNodePtrArray);
Expand Down
4 changes: 3 additions & 1 deletion src/slic3r/GUI/AuxiliaryDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "libslic3r/Utils.hpp"

#include <boost/property_tree/ptree.hpp>

namespace pt = boost::property_tree;
typedef pt::ptree JSON;

Expand Down Expand Up @@ -33,4 +35,4 @@ void AuxiliaryDialog::on_dpi_changed(const wxRect& suggested_rect)
}

} // namespace GUI
} // namespace Slic3r
} // namespace Slic3r
1 change: 1 addition & 0 deletions src/slic3r/GUI/BBLStatusBar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define BBLSTATUSBAR_HPP

#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/stattext.h>

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/BBLStatusBarSend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "I18N.hpp"

#include <iostream>

#include <regex>

namespace Slic3r {

Expand Down
3 changes: 3 additions & 0 deletions src/slic3r/GUI/BBLTopbar.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "BBLTopbar.hpp"
#include "wx/artprov.h"
#include "wx/aui/framemanager.h"
#include "wx/display.h"
#include "I18N.hpp"
#include "GUI_App.hpp"
#include "GUI.hpp"
Expand All @@ -10,6 +11,8 @@
#include "WebViewDialog.hpp"
#include "PartPlate.hpp"

#include <boost/log/trivial.hpp>

#define TOPBAR_ICON_SIZE 18
#define TOPBAR_TITLE_WIDTH 300

Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/BindDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <wx/sizer.h>
#include <wx/statbox.h>
#include "wx/evtloop.h"
#include <wx/mstream.h>
#include <wx/tokenzr.h>
#include <wx/richmsgdlg.h>
#include <wx/richtext/richtextctrl.h>
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/BitmapCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "GUI.hpp"
#include "GUI_Utils.hpp"

#include <boost/nowide/cstdio.hpp>
#include <boost/filesystem.hpp>

#ifdef __WXGTK2__
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/CameraPopup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/timer.h>
#include <wx/sizer.h>
#include <wx/gbsizer.h>
#include <wx/webrequest.h>
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/GUI/CreatePresetsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <openssl/md5.h>
#include <openssl/evp.h>
#include <wx/dcgraph.h>
#include <wx/tooltip.h>
#include <boost/nowide/cstdio.hpp>
#include "libslic3r/PresetBundle.hpp"
#include "I18N.hpp"
#include "GUI_App.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/DeviceManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <string>
#include <memory>
#include <chrono>
#include <mutex>
#include <boost/thread.hpp>
#include <boost/nowide/fstream.hpp>
#include "nlohmann/json.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/ExtrusionCalibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "MsgDialog.hpp"
#include "libslic3r/Preset.hpp"
#include "I18N.hpp"
#include <boost/log/trivial.hpp>
#include <wx/dcgraph.h>

namespace Slic3r { namespace GUI {
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/GCodeViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "GCodeViewer.hpp"

#include "libslic3r/BuildVolume.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/Geometry.hpp"
#include "libslic3r/Model.hpp"
Expand Down
Loading

0 comments on commit 951fc8e

Please sign in to comment.