A *lot* of import fixes for flatpak (#3909)

* 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
This commit is contained in:
Aidan 2024-01-31 05:23:29 -06:00 committed by GitHub
parent 4110ecc968
commit 951fc8e98a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
114 changed files with 214 additions and 45 deletions

View file

@ -1,6 +1,7 @@
#include "ColorSpaceConvert.hpp"
#include <algorithm>
#include <cmath>
const static float param_13 = 1.0f / 3.0f;
const static float param_16116 = 16.0f / 116.0f;

View file

@ -1,6 +1,8 @@
#ifndef slic3r_Utils_ColorSpaceConvert_hpp_
#define slic3r_Utils_ColorSpaceConvert_hpp_
#include <tuple>
std::tuple<int, int, int> rgb_to_yuv(float r, float g, float b);
double PivotRGB(double n);
double PivotXYZ(double n);

View file

@ -1,5 +1,6 @@
#include "FileHelp.hpp"
#include <boost/filesystem.hpp>
#include <boost/log/trivial.hpp>
#include <regex>
namespace Slic3r {
namespace Utils {
@ -23,4 +24,4 @@ void slash_to_back_slash(std::string &file_path) {
file_path = std::regex_replace(file_path, regex, "/");
}
}} // namespace Slic3r::Utils
}} // namespace Slic3r::Utils

View file

@ -1,11 +1,15 @@
#ifndef __Http_hpp__
#define __Http_hpp__
#include <map>
#include <memory>
#include <string>
#include <functional>
#include <boost/filesystem/path.hpp>
#include "libslic3r/Exception.hpp"
#include "libslic3r_version.h"
#define MAX_SIZE_TO_FILE 3*1024
namespace Slic3r {

View file

@ -818,9 +818,9 @@ void PresetUpdater::priv::sync_tooltip(std::string http_url, std::string languag
fs::path cache_root = fs::path(data_dir()) / "resources/tooltip";
try {
auto vf = cache_root / "common" / "version";
if (fs::exists(vf)) load_string_file(vf, common_version);
if (fs::exists(vf)) Slic3r::load_string_file(vf, common_version);
vf = cache_root / language / "version";
if (fs::exists(vf)) load_string_file(vf, language_version);
if (fs::exists(vf)) Slic3r::load_string_file(vf, language_version);
} catch (...) {}
std::map<std::string, Resource> resources
{
@ -996,11 +996,11 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
auto cache_folder = data_dir_path / "ota" / "printers";
try {
load_string_file(config_folder / "version.txt", curr_version);
Slic3r::load_string_file(config_folder / "version.txt", curr_version);
boost::algorithm::trim(curr_version);
} catch (...) {}
try {
load_string_file(cache_folder / "version.txt", cached_version);
Slic3r::load_string_file(cache_folder / "version.txt", cached_version);
boost::algorithm::trim(cached_version);
} catch (...) {}
if (!cached_version.empty()) {
@ -1034,7 +1034,7 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
bool result = false;
try {
load_string_file(cache_folder / "version.txt", cached_version);
Slic3r::load_string_file(cache_folder / "version.txt", cached_version);
boost::algorithm::trim(cached_version);
result = true;
} catch (...) {}
@ -1137,11 +1137,11 @@ Updates PresetUpdater::priv::get_printer_config_updates(bool update) const
std::string curr_version;
std::string resc_version;
try {
load_string_file(resc_folder / "version.txt", resc_version);
Slic3r::load_string_file(resc_folder / "version.txt", resc_version);
boost::algorithm::trim(resc_version);
} catch (...) {}
try {
load_string_file(config_folder / "version.txt", curr_version);
Slic3r::load_string_file(config_folder / "version.txt", curr_version);
boost::algorithm::trim(curr_version);
} catch (...) {}

View file

@ -12,6 +12,10 @@
#include <libslic3r/Utils.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/iostream.hpp>
#include <boost/nowide/fstream.hpp>
using namespace std;
using json = nlohmann::json;