mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 18:56:13 +00:00
ENH: Open Prinables.com Links and Zip Archives (#3823)
* Enable ability to open `prusaslicer://` links * Add needed function to miniz * Import Zip Functionality Allows zip file to be drag and dropped or imported via the menu option Based on prusa3d/PrusaSlicer@ce38e57 and current master branch files * Update dialog style to match Orca * Ensure link is from printables * add toggle option in preferences doesn't actually control anything yet * Add Downloader classes As-is from PS master * Create Orca Styled Variant of Icons * Add Icons to ImGui * Use PS's Downloader impl for `prusaslicer://` links * Implement URL Registering on Windows * Implement prusaslicer:// link on macOS * Remove unnecessary class name qualifier in Plater.hpp * Add downloader desktop integration registration and undo * Revert Info.plist --------- Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
58
src/libslic3r/Format/ZipperArchiveImport.hpp
Normal file
58
src/libslic3r/Format/ZipperArchiveImport.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
///|/ Copyright (c) Prusa Research 2022 Tomáš Mészáros @tamasmeszaros
|
||||
///|/
|
||||
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||
///|/
|
||||
#ifndef ZIPPERARCHIVEIMPORT_HPP
|
||||
#define ZIPPERARCHIVEIMPORT_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// Buffer for arbitraryfiles inside a zipper archive.
|
||||
struct EntryBuffer
|
||||
{
|
||||
std::vector<uint8_t> buf;
|
||||
std::string fname;
|
||||
};
|
||||
|
||||
// Structure holding the data read from a zipper archive.
|
||||
struct ZipperArchive
|
||||
{
|
||||
boost::property_tree::ptree profile, config;
|
||||
std::vector<EntryBuffer> entries;
|
||||
};
|
||||
|
||||
// Names of the files containing metadata inside the archive.
|
||||
const constexpr char *CONFIG_FNAME = "config.ini";
|
||||
const constexpr char *PROFILE_FNAME = "prusaslicer.ini";
|
||||
|
||||
// Read an archive that was written using the Zipper class.
|
||||
// The includes parameter is a set of file name substrings that the entries
|
||||
// must contain to be included in ZipperArchive.
|
||||
// The excludes parameter may contain substrings that filenames must not
|
||||
// contain.
|
||||
// Every file in the archive is read into ZipperArchive::entries
|
||||
// except the files CONFIG_FNAME, and PROFILE_FNAME which are read into
|
||||
// ZipperArchive::config and ZipperArchive::profile structures.
|
||||
ZipperArchive read_zipper_archive(const std::string &zipfname,
|
||||
const std::vector<std::string> &includes,
|
||||
const std::vector<std::string> &excludes);
|
||||
|
||||
// Extract the print profile form the archive into 'out'.
|
||||
// Returns a profile that has correct parameters to use for model reconstruction
|
||||
// even if the needed parameters were not fully found in the archive's metadata.
|
||||
// The inout argument shall be a usable fallback profile if the archive
|
||||
// has totally corrupted metadata.
|
||||
std::pair<DynamicPrintConfig, ConfigSubstitutions> extract_profile(
|
||||
const ZipperArchive &arch, DynamicPrintConfig &inout);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // ZIPPERARCHIVEIMPORT_HPP
|
||||
Reference in New Issue
Block a user