diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index c55edd897f..f9ad7eaf95 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -973,7 +973,7 @@ static void generic_exception_handle() //#endif } -static vector split_str(const string& src, const string& separator) +static std::vector split_str(const std::string& src, const std::string& separator) { size_t pos; size_t start_pos = 0; @@ -5500,6 +5500,27 @@ void GUI_App::OSXStoreOpenFiles(const wxArrayString &fileNames) }*/ wxApp::OSXStoreOpenFiles(fileNames); } + +void GUI_App::MacOpenURL(const wxString& url) +{ + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "get mac url " << url; + + if (!url.empty() && boost::starts_with(url, "bambustudioopen://")) { + auto input_str_arr = split_str(url.ToStdString(), "bambustudioopen://"); + + std::string download_origin_url; + for (auto input_str : input_str_arr) { + if (!input_str.empty()) download_origin_url = input_str; + } + + std::string download_file_url = url_decode(download_origin_url); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << download_file_url; + if (!download_file_url.empty() && (boost::starts_with(download_file_url, "http://") || boost::starts_with(download_file_url, "https://"))) { + request_model_download(download_file_url); + } + } +} + // wxWidgets override to get an event on open files. void GUI_App::MacOpenFiles(const wxArrayString &fileNames) { @@ -5565,6 +5586,7 @@ void GUI_App::MacOpenFiles(const wxArrayString &fileNames) start_new_gcodeviewer(&filename);*/ } } + #endif /* __APPLE */ Sidebar& GUI_App::sidebar() diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index af9d1c45d8..51b85bd0b0 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -496,6 +496,7 @@ public: void OSXStoreOpenFiles(const wxArrayString &files); // wxWidgets override to get an event on open files. void MacOpenFiles(const wxArrayString &fileNames) override; + void MacOpenURL(const wxString& url) override; #endif /* __APPLE */ Sidebar& sidebar();