OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::Bundle Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/ConfigWizard_private.hpp>

Collaboration diagram for Slic3r::GUI::Bundle:

Public Member Functions

 Bundle ()=default
 Bundle (Bundle &&other)
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

Public Attributes

std::unique_ptr< PresetBundle > preset_bundle
VendorProfile * vendor_profile { nullptr }
bool is_in_resources { false }
bool is_bbl_bundle { false }

Detailed Description

Constructor & Destructor Documentation

◆ Bundle() [1/2]

Slic3r::GUI::Bundle::Bundle ( )
default

References Bundle(), is_bbl_bundle, and is_in_resources.

Referenced by Bundle(), and Bundle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bundle() [2/2]

Slic3r::GUI::Bundle::Bundle ( Bundle && other)
144 : preset_bundle(std::move(other.preset_bundle))
145 , vendor_profile(other.vendor_profile)
146 , is_in_resources(other.is_in_resources)
147 , is_bbl_bundle(other.is_bbl_bundle)
148{
149 other.vendor_profile = nullptr;
150}
bool is_bbl_bundle
Definition ConfigWizard_private.hpp:80
bool is_in_resources
Definition ConfigWizard_private.hpp:78
std::unique_ptr< PresetBundle > preset_bundle
Definition ConfigWizard_private.hpp:76
VendorProfile * vendor_profile
Definition ConfigWizard_private.hpp:77

References Bundle(), is_bbl_bundle, is_in_resources, preset_bundle, and vendor_profile.

Here is the call graph for this function:

Member Function Documentation

◆ load()

bool Slic3r::GUI::Bundle::load ( boost::filesystem::path dir,
const std::string & vendor_name,
bool is_in_resources,
bool is_bbl_bundle = false )
104{
105 this->preset_bundle = std::make_unique<PresetBundle>();
106 this->is_in_resources = ais_in_resources;
107 this->is_bbl_bundle = ais_bbl_bundle;
108
109 //BBS: add json logic for vendor bundles
110 // Orca: served from the vendor's preset cache where one covers it — which is
111 // how a shipped build carries its vendors — and parsed from the JSONs otherwise.
112 // A vendor that can be neither read nor parsed — a cache the build cannot use
113 // with the preset JSONs behind it pruned, say — is one the wizard cannot offer.
114 // Every other vendor still can be, so it is left out rather than thrown over.
115 size_t presets_loaded = 0;
116 try {
117 auto [config_substitutions, loaded] = preset_bundle->load_vendor_configs_from_json(
119 UNUSED(config_substitutions);
120 // No substitutions shall be reported when loading a system config bundle, no substitutions are allowed.
121 assert(config_substitutions.empty());
122 presets_loaded = loaded;
123 } catch (const std::exception &e) {
124 BOOST_LOG_TRIVIAL(fatal) << boost::format("Vendor bundle: `%1%`: cannot be loaded, leaving it out: %2%") % vendor_name % e.what();
125 return false;
126 }
127 auto first_vendor = preset_bundle->vendors.begin();
128 if (first_vendor == preset_bundle->vendors.end()) {
129 BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: No vendor information defined, cannot install.") % vendor_name;
130 return false;
131 }
132 if (presets_loaded == 0) {
133 BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: No profile loaded.") % vendor_name;
134 return false;
135 }
136
137 BOOST_LOG_TRIVIAL(trace) << boost::format("Vendor bundle: `%1%`: %2% profiles loaded.") % vendor_name % presets_loaded;
138 this->vendor_profile = &first_vendor->second;
139 return true;
140}
@ LoadSystem
Definition PresetBundle.hpp:605
#define UNUSED(x)
Definition libslic3r.h:112
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
@ Disable
Definition Config.hpp:243

References Slic3r::Disable, is_bbl_bundle, is_in_resources, Slic3r::PresetBundle::LoadSystem, preset_bundle, Slic3r::trace(), UNUSED, and vendor_profile.

Referenced by Slic3r::GUI::BundleMap::load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vendor_id()

const std::string & Slic3r::GUI::Bundle::vendor_id ( ) const
inline
91{ return vendor_profile->id; }

References vendor_profile.

Member Data Documentation

◆ is_bbl_bundle

bool Slic3r::GUI::Bundle::is_bbl_bundle { false }
80{ false };

Referenced by Bundle(), Bundle(), and load().

◆ is_in_resources

bool Slic3r::GUI::Bundle::is_in_resources { false }
78{ false };

Referenced by Bundle(), Bundle(), and load().

◆ preset_bundle

std::unique_ptr<PresetBundle> Slic3r::GUI::Bundle::preset_bundle

Referenced by Bundle(), and load().

◆ vendor_profile

VendorProfile* Slic3r::GUI::Bundle::vendor_profile { nullptr }
77{ nullptr };

Referenced by Bundle(), load(), and vendor_id().


The documentation for this struct was generated from the following files: