Various improvements to SimplyPrint integration (#4831)

* Allow using BBL's device tab when 3rd party print host is used

* Add option to open SimplyPrint panel in device tab after uploading

* Fix default print host for prusa connect

* Do not set api key in device view when SimplyPrint is used

* Sending 3mf file to SimplyPrint when using BBL printers

* Fix file extension when uploading 3mf

* Prepare for large file uploading

* Implement chunk upload

* Fix file uploading exceeding content size

* Fix wrong field type

* Add `temp=true` to all chunk upload calls

* Add macro to enable test api

* Merge branch 'main' into dev/simplyprint-improve

* Fix another missing `temp=true`

* Add delete token

* Try fixing build error on *nix systems

* Merge branch 'main' into dev/simplyprint-improve

* Merge branch 'main' into dev/simplyprint-improve

* Merge remote-tracking branch 'remote/main' into dev/simplyprint-improve

# Conflicts:
#	src/slic3r/GUI/BackgroundSlicingProcess.cpp

* Move the `bbl_use_print_host_webui` option to print host dialog. Also make it a derived option of `print_host_webui` instead.

* Merge branch 'main' into dev/simplyprint-improve

# Conflicts:
#	src/slic3r/GUI/MainFrame.cpp
#	src/slic3r/GUI/Plater.cpp

* Merge branch 'main' into dev/simplyprint-improve

# Conflicts:
#	src/slic3r/GUI/Plater.cpp

* Use a more generic option instead of SimplyPrint specific

* Merge branch 'main' into dev/simplyprint-improve

* Merge branch 'main' into dev/simplyprint-improve
This commit is contained in:
Noisyfox
2024-06-21 19:48:00 +08:00
committed by GitHub
parent b7a0b30578
commit cd6cd0786f
17 changed files with 505 additions and 110 deletions

View File

@@ -15,10 +15,37 @@ class SimplyPrint : public PrintHost
void load_oauth_credential();
/**
* \brief Call the given SimplyPrint API, and if the token expired do a token refresh then retry
* \param build_request the http request builder
* \param on_complete
* \param on_error
* \return whether the API call succeeded
*/
bool do_api_call(std::function<Http(bool /*is_retry*/)> build_request,
std::function<bool(std::string /* body */, unsigned /* http_status */)> on_complete,
std::function<bool(std::string /* body */, std::string /* error */, unsigned /* http_status */)> on_error) const;
/**
* \brief Upload a temp file and open SimplyPrint panel for file importing
* \param file_path for file smaller than 100MB, this is the file path, otherwise must left empty
* \param chunk_id for file greater than 100MB, this is the chunk id returned by the ChunkReceive API, otherwise must left empty
* \param filename the target file name
* \param prorgess_fn
* \param error_fn
* \return whether upload succeeded
*/
bool do_temp_upload(const boost::filesystem::path& file_path,
const std::string& chunk_id,
const std::string& filename,
ProgressFn prorgess_fn,
ErrorFn error_fn) const;
bool do_chunk_upload(const boost::filesystem::path& file_path,
const std::string& filename,
ProgressFn prorgess_fn,
ErrorFn error_fn) const;
public:
SimplyPrint(DynamicPrintConfig* config);
~SimplyPrint() override = default;