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:
Ocraftyone 2024-05-21 22:52:34 -04:00 committed by GitHub
parent 0dbf610226
commit a764d836e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 3109 additions and 41 deletions

View file

@ -138,6 +138,7 @@ struct Http::priv
void set_post_body(const std::string &body);
void set_put_body(const fs::path &path);
void set_del_body(const std::string& body);
void set_range(const std::string &range);
std::string curl_error(CURLcode curlcode);
std::string body_size_error();
@ -237,7 +238,7 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o
curl_easy_getinfo(self->curl, CURLINFO_SPEED_UPLOAD, &speed);
if (speed > 0.01)
speed = speed;
Progress progress(dltotal, dlnow, ultotal, ulnow, speed);
Progress progress(dltotal, dlnow, ultotal, ulnow, self->buffer, speed);
self->progressfn(progress, cb_cancel);
}
@ -370,6 +371,11 @@ void Http::priv::set_del_body(const std::string& body)
postfields = body;
}
void Http::priv::set_range(const std::string& range)
{
::curl_easy_setopt(curl, CURLOPT_RANGE, range.c_str());
}
std::string Http::priv::curl_error(CURLcode curlcode)
{
return (boost::format("curl:%1%:\n%2%\n[Error %3%]")
@ -434,7 +440,7 @@ void Http::priv::http_perform()
if (res == CURLE_ABORTED_BY_CALLBACK) {
if (cancel) {
// The abort comes from the request being cancelled programatically
Progress dummyprogress(0, 0, 0, 0);
Progress dummyprogress(0, 0, 0, 0, std::string());
bool cancel = true;
if (progressfn) { progressfn(dummyprogress, cancel); }
} else {
@ -510,6 +516,12 @@ Http& Http::size_limit(size_t sizeLimit)
return *this;
}
Http& Http::set_range(const std::string& range)
{
if (p) { p->set_range(range); }
return *this;
}
Http& Http::header(std::string name, const std::string &value)
{
if (!p) { return * this; }