mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 22:24:01 -06:00
Printables.com support (associate prusaslicer:// link explicitly) (#5416)
* 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 * register prusaslicer:// on user request only * fix build error * fix single instance problem * format * add orcalicer:// handler for Mac Attempt to add Linux support but seems not working --------- Co-authored-by: Ocraftyone <Ocraftyone@users.noreply.github.com>
This commit is contained in:
parent
a764d836e1
commit
7725fbeb90
13 changed files with 111 additions and 60 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "GUI_App.hpp"
|
||||
#include "InstanceCheck.hpp"
|
||||
#include "Plater.hpp"
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "MainFrame.hpp"
|
||||
|
@ -370,6 +371,7 @@ bool instance_check(int argc, char** argv, bool app_config_single_instance)
|
|||
namespace GUI {
|
||||
|
||||
wxDEFINE_EVENT(EVT_LOAD_MODEL_OTHER_INSTANCE, LoadFromOtherInstanceEvent);
|
||||
wxDEFINE_EVENT(EVT_START_DOWNLOAD_OTHER_INSTANCE, StartDownloadOtherInstanceEvent);
|
||||
wxDEFINE_EVENT(EVT_INSTANCE_GO_TO_FRONT, InstanceGoToFrontEvent);
|
||||
|
||||
void OtherInstanceMessageHandler::init(wxEvtHandler* callback_evt_handler)
|
||||
|
@ -498,12 +500,18 @@ void OtherInstanceMessageHandler::handle_message(const std::string& message)
|
|||
}
|
||||
|
||||
std::vector<boost::filesystem::path> paths;
|
||||
std::vector<std::string> downloads;
|
||||
boost::regex re(R"(^(orcaslicer|prusaslicer):\/\/open[\/]?\?file=)", boost::regbase::icase);
|
||||
boost::smatch results;
|
||||
|
||||
// Skip the first argument, it is the path to the slicer executable.
|
||||
auto it = args.begin();
|
||||
for (++ it; it != args.end(); ++ it) {
|
||||
boost::filesystem::path p = MessageHandlerInternal::get_path(*it);
|
||||
if (! p.string().empty())
|
||||
paths.emplace_back(p);
|
||||
else if (boost::regex_search(*it, results, re))
|
||||
downloads.emplace_back(*it);
|
||||
}
|
||||
if (! paths.empty()) {
|
||||
//wxEvtHandler* evt_handler = wxGetApp().plater(); //assert here?
|
||||
|
@ -511,6 +519,10 @@ void OtherInstanceMessageHandler::handle_message(const std::string& message)
|
|||
wxPostEvent(m_callback_evt_handler, LoadFromOtherInstanceEvent(GUI::EVT_LOAD_MODEL_OTHER_INSTANCE, std::vector<boost::filesystem::path>(std::move(paths))));
|
||||
//}
|
||||
}
|
||||
if (!downloads.empty())
|
||||
{
|
||||
wxPostEvent(m_callback_evt_handler, StartDownloadOtherInstanceEvent(GUI::EVT_START_DOWNLOAD_OTHER_INSTANCE, std::vector<std::string>(std::move(downloads))));
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue