diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in index 1f435674cf..66c30a6ffe 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/cmake/modules/MacOSXBundleInfo.plist.in @@ -36,6 +36,7 @@ CFBundleURLSchemes orcasliceropen + orcaslicer diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 1121a785c5..49a7228f1f 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -333,11 +333,6 @@ void AppConfig::set_defaults() set("download_path", ""); } - // Orca - if (get("ps_url_registered").empty()) { - set_bool("ps_url_registered", false); - } - if (get("mouse_wheel").empty()) { set("mouse_wheel", "0"); } diff --git a/src/platform/osx/Info.plist.in b/src/platform/osx/Info.plist.in index f5846c023a..a2621d2521 100644 --- a/src/platform/osx/Info.plist.in +++ b/src/platform/osx/Info.plist.in @@ -32,6 +32,7 @@ CFBundleURLSchemes orcasliceropen + orcaslicer diff --git a/src/slic3r/GUI/DesktopIntegrationDialog.cpp b/src/slic3r/GUI/DesktopIntegrationDialog.cpp index a9d8708462..672504ebd2 100644 --- a/src/slic3r/GUI/DesktopIntegrationDialog.cpp +++ b/src/slic3r/GUI/DesktopIntegrationDialog.cpp @@ -531,7 +531,7 @@ void DesktopIntegrationDialog::perform_downloader_desktop_integration() std::string desktop_file_downloader = GUI::format( "[Desktop Entry]\n" - "Name=PrusaSlicer URL Protocol%1%\n" + "Name=OrcaSlicer URL Protocol%1%\n" "Exec=\"%2%\" %%u\n" "Terminal=false\n" "Type=Application\n" @@ -541,12 +541,12 @@ void DesktopIntegrationDialog::perform_downloader_desktop_integration() , name_suffix, excutable_path); // desktop file for downloader as part of main app - std::string desktop_path = GUI::format("%1%/applications/PrusaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); + std::string desktop_path = GUI::format("%1%/applications/OrcaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); if (create_desktop_file(desktop_path, desktop_file_downloader)) { // save path to desktop file app_config->set("desktop_integration_URL_path", desktop_path); // finish registration on mime type - std::string command = GUI::format("xdg-mime default PrusaSlicerURLProtocol%1%.desktop x-scheme-handler/prusaslicer", version_suffix); + std::string command = GUI::format("xdg-mime default OrcaSlicerURLProtocol%1%.desktop x-scheme-handler/prusaslicer", version_suffix); BOOST_LOG_TRIVIAL(debug) << "system command: " << command; int r = system(command.c_str()); BOOST_LOG_TRIVIAL(debug) << "system result: " << r; @@ -558,16 +558,16 @@ void DesktopIntegrationDialog::perform_downloader_desktop_integration() if (contains_path_dir(target_candidates[i], "applications")) { target_dir_desktop = target_candidates[i]; // Write slicer desktop file - std::string path = GUI::format("%1%/applications/PrusaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); + std::string path = GUI::format("%1%/applications/OrcaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); if (create_desktop_file(path, desktop_file_downloader)) { app_config->set("desktop_integration_URL_path", path); candidate_found = true; - BOOST_LOG_TRIVIAL(debug) << "PrusaSlicerURLProtocol.desktop file installation success."; + BOOST_LOG_TRIVIAL(debug) << "OrcaSlicerURLProtocol.desktop file installation success."; break; } else { // write failed - try another path - BOOST_LOG_TRIVIAL(debug) << "Attempt to PrusaSlicerURLProtocol.desktop file installation failed. failed path: " << target_candidates[i]; + BOOST_LOG_TRIVIAL(debug) << "Attempt to OrcaSlicerURLProtocol.desktop file installation failed. failed path: " << target_candidates[i]; target_dir_desktop.clear(); } } @@ -578,7 +578,7 @@ void DesktopIntegrationDialog::perform_downloader_desktop_integration() create_path(boost::nowide::narrow(wxFileName::GetHomeDir()), ".local/share/applications"); // create desktop file target_dir_desktop = GUI::format("%1%/.local/share", wxFileName::GetHomeDir()); - std::string path = GUI::format("%1%/applications/PrusaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); + std::string path = GUI::format("%1%/applications/OrcaSlicerURLProtocol%2%.desktop", target_dir_desktop, version_suffix); if (contains_path_dir(target_dir_desktop, "applications")) { if (!create_desktop_file(path, desktop_file_downloader)) { // Desktop file not written - end desktop integration @@ -602,7 +602,7 @@ void DesktopIntegrationDialog::perform_downloader_desktop_integration() } // finish registration on mime type - std::string command = GUI::format("xdg-mime default PrusaSlicerURLProtocol%1%.desktop x-scheme-handler/prusaslicer", version_suffix); + std::string command = GUI::format("xdg-mime default OrcaSlicerURLProtocol%1%.desktop x-scheme-handler/prusaslicer", version_suffix); BOOST_LOG_TRIVIAL(debug) << "system command: " << command; int r = system(command.c_str()); BOOST_LOG_TRIVIAL(debug) << "system result: " << r; diff --git a/src/slic3r/GUI/Downloader.cpp b/src/slic3r/GUI/Downloader.cpp index 229936160f..10b3b6cbe5 100644 --- a/src/slic3r/GUI/Downloader.cpp +++ b/src/slic3r/GUI/Downloader.cpp @@ -135,13 +135,6 @@ void Downloader::start_download(const std::string& full_url) { assert(m_initialized); - // Orca: check if url is registered - if (!wxGetApp().app_config->has("ps_url_registered") || !wxGetApp().app_config->get_bool("ps_url_registered")) { - BOOST_LOG_TRIVIAL(error) << "PrusaSlicer links are not enabled. Download aborted: " << full_url; - show_error(nullptr, "PrusaSlicer links are not enabled in preferences. Download aborted."); - return; - } - // Orca: Move to the 3D view MainFrame* mainframe = wxGetApp().mainframe; Plater* plater = wxGetApp().plater(); @@ -155,7 +148,7 @@ void Downloader::start_download(const std::string& full_url) // Orca: Replace PS workaround for "mysterious slash" with a more dynamic approach // Windows seems to have fixed the issue and this provides backwards compatability for those it still affects - boost::regex re(R"(^prusaslicer:\/\/open[\/]?\?file=)", boost::regbase::icase); + boost::regex re(R"(^(orcaslicer|prusaslicer):\/\/open[\/]?\?file=)", boost::regbase::icase); boost::smatch results; if (!boost::regex_search(full_url, results, re)) { @@ -168,14 +161,16 @@ void Downloader::start_download(const std::string& full_url) } size_t id = get_next_id(); std::string escaped_url = FileGet::escape_url(full_url.substr(results.length())); - if (!boost::starts_with(escaped_url, "https://") || !FileGet::is_subdomain(escaped_url, "printables.com")) { - std::string msg = format(_L("Download won't start. Download URL doesn't point to https://printables.com : %1%"), escaped_url); - BOOST_LOG_TRIVIAL(error) << msg; - NotificationManager* ntf_mngr = wxGetApp().notification_manager(); - ntf_mngr->push_notification(NotificationType::CustomNotification, NotificationManager::NotificationLevel::ErrorNotificationLevel, - "Download failed. Download URL doesn't point to https://printables.com."); - return; - } + // Orca:: any website that supports orcaslicer://open/?file= can be downloaded + + // if (!boost::starts_with(escaped_url, "https://") || !FileGet::is_subdomain(escaped_url, "printables.com")) { + // std::string msg = format(_L("Download won't start. Download URL doesn't point to https://printables.com : %1%"), escaped_url); + // BOOST_LOG_TRIVIAL(error) << msg; + // NotificationManager* ntf_mngr = wxGetApp().notification_manager(); + // ntf_mngr->push_notification(NotificationType::CustomNotification, NotificationManager::NotificationLevel::ErrorNotificationLevel, + // "Download failed. Download URL doesn't point to https://printables.com."); + // return; + // } std::string text(escaped_url); m_downloads.emplace_back(std::make_unique(id, std::move(escaped_url), this, m_dest_folder)); diff --git a/src/slic3r/GUI/DownloaderFileGet.cpp b/src/slic3r/GUI/DownloaderFileGet.cpp index 137a7e9bc1..2389d379db 100644 --- a/src/slic3r/GUI/DownloaderFileGet.cpp +++ b/src/slic3r/GUI/DownloaderFileGet.cpp @@ -201,12 +201,12 @@ void FileGet::priv::get_perform() return; } - std:: string range_string = std::to_string(m_written) + "-"; + std:: string range_string = std::to_string(m_written) + "-"; - size_t written_previously = m_written; - size_t written_this_session = 0; - Http::get(m_url) - .size_limit(DOWNLOAD_SIZE_LIMIT) //more? + size_t written_previously = m_written; + size_t written_this_session = 0; + Http::get(m_url) + .size_limit(DOWNLOAD_SIZE_LIMIT) //more? .set_range(range_string) .on_progress([&](Http::Progress progress, bool& cancel) { // to prevent multiple calls into following ifs (m_cancel / m_pause) @@ -244,7 +244,7 @@ void FileGet::priv::get_perform() } if (progress.dlnow != 0) { - if (progress.dlnow - written_this_session > DOWNLOAD_MAX_CHUNK_SIZE || progress.dlnow == progress.dltotal) { + if (progress.dlnow - written_this_session > DOWNLOAD_MAX_CHUNK_SIZE || progress.dlnow == progress.dltotal) { try { std::string part_for_write = progress.buffer.substr(written_this_session, progress.dlnow); @@ -264,7 +264,7 @@ void FileGet::priv::get_perform() m_written = written_previously + written_this_session; } wxCommandEvent* evt = new wxCommandEvent(EVT_DWNLDR_FILE_PROGRESS); - int percent_total = (written_previously + progress.dlnow) * 100 / m_absolute_size; + int percent_total = m_absolute_size == 0 ? 0 : (written_previously + progress.dlnow) * 100 / m_absolute_size; evt->SetString(std::to_string(percent_total)); evt->SetInt(m_id); m_evt_handler->QueueEvent(evt); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 46b0c4bc23..52bfa21508 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -821,7 +821,8 @@ void GUI_App::post_init() (boost::starts_with(this->init_params->input_files.front(), "orcaslicer://open") || boost::starts_with(this->init_params->input_files.front(), "prusaslicer://open"))) { - if (boost::starts_with(this->init_params->input_files.front(), "prusaslicer://open")) { + if (boost::starts_with(this->init_params->input_files.front(), "orcaslicer://open")|| + boost::starts_with(this->init_params->input_files.front(), "prusaslicer://open")) { switch_to_3d = true; start_download(this->init_params->input_files.front()); } else if (vector input_str_arr = split_str(this->init_params->input_files.front(), "orcaslicer://open/?file="); input_str_arr.size() > 1) { @@ -1098,7 +1099,7 @@ GUI_App::GUI_App() , m_em_unit(10) , m_imgui(new ImGuiWrapper()) , m_removable_drive_manager(std::make_unique()) - , m_downloader(std::make_unique()) + , m_downloader(std::make_unique()) , m_other_instance_message_handler(std::make_unique()) { //app config initializes early becasuse it is used in instance checking in OrcaSlicer.cpp @@ -2371,10 +2372,8 @@ bool GUI_App::on_init_inner() associate_files(L"step"); associate_files(L"stp"); } - // Orca: add PS url functionality - if (app_config->get_bool("ps_url_registered")) { - associate_url(L"prusaslicer"); - } + associate_url(L"orcaslicer"); + if (app_config->get("associate_gcode") == "true") associate_files(L"gcode"); #endif // __WXMSW__ @@ -5533,10 +5532,7 @@ void GUI_App::open_preferences(size_t open_on_tab, const std::string& highlight_ associate_files(L"step"); associate_files(L"stp"); } - // Orca: add PS url functionality - if (app_config->get_bool("ps_url_registered")) { - associate_url(L"prusaslicer"); - } + associate_url(L"orcaslicer"); } else { if (app_config->get("associate_gcode") == "true") @@ -6577,9 +6573,11 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t return false; } +#endif // __WXMSW__ void GUI_App::associate_files(std::wstring extend) { +#ifdef WIN32 wchar_t app_path[MAX_PATH]; ::GetModuleFileNameW(nullptr, app_path, sizeof(app_path)); @@ -6599,10 +6597,12 @@ void GUI_App::associate_files(std::wstring extend) if (is_new) // notify Windows only when any of the values gets changed ::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr); +#endif // WIN32 } void GUI_App::disassociate_files(std::wstring extend) { +#ifdef WIN32 wchar_t app_path[MAX_PATH]; ::GetModuleFileNameW(nullptr, app_path, sizeof(app_path)); @@ -6629,12 +6629,33 @@ void GUI_App::disassociate_files(std::wstring extend) if (is_new) ::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr); +#endif // WIN32 +} + +bool GUI_App::check_url_association(std::wstring url_prefix, std::wstring& reg_bin) +{ + reg_bin = L""; +#ifdef WIN32 + wxRegKey key_full(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix + "\\shell\\open\\command"); + if (!key_full.Exists()) { + return false; + } + reg_bin = key_full.QueryDefaultValue().ToStdWstring(); + + boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location())); + // wxString wbinary = wxString::FromUTF8(binary_path.string()); + // std::string binary_string = (boost::format("%1%") % wbinary).str(); + std::wstring key_string = L"\"" + binary_path.wstring() + L"\" L\"%1\""; + // return boost::iequals(key_string,(boost::format("%1%") % reg_bin).str()); + return key_string == reg_bin; +#else + return false; +#endif // WIN32 } void GUI_App::associate_url(std::wstring url_prefix) { - // Registry key creation for "prusaslicer://" URL - +#ifdef WIN32 boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location())); // the path to binary needs to be correctly saved in string with respect to localized characters wxString wbinary = wxString::FromUTF8(binary_path.string()); @@ -6654,18 +6675,22 @@ void GUI_App::associate_url(std::wstring url_prefix) key_full.Create(false); } key_full = key_string; +#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) + DesktopIntegrationDialog::perform_downloader_desktop_integration(); +#endif // WIN32 } void GUI_App::disassociate_url(std::wstring url_prefix) { +#ifdef WIN32 wxRegKey key_full(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix + "\\shell\\open\\command"); if (!key_full.Exists()) { return; } key_full = ""; +#endif // WIN32 } -#endif // __WXMSW__ void GUI_App::start_download(std::string url) { diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index dc0b8e4ff3..7def51e40b 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -646,13 +646,12 @@ private: bool is_glsl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { return m_opengl_mgr.get_gl_info().is_glsl_version_greater_or_equal_to(major, minor); } int GetSingleChoiceIndex(const wxString& message, const wxString& caption, const wxArrayString& choices, int initialSelection); -#ifdef __WXMSW__ // extend is stl/3mf/gcode/step etc void associate_files(std::wstring extend); void disassociate_files(std::wstring extend); + bool check_url_association(std::wstring url_prefix, std::wstring& reg_bin); void associate_url(std::wstring url_prefix); void disassociate_url(std::wstring url_prefix); -#endif // __WXMSW__ // URL download - PrusaSlicer gets system call to open prusaslicer:// URL which should contain address of download void start_download(std::string url); diff --git a/src/slic3r/GUI/InstanceCheck.cpp b/src/slic3r/GUI/InstanceCheck.cpp index bc5eb4d8cd..a2f38d8e8f 100644 --- a/src/slic3r/GUI/InstanceCheck.cpp +++ b/src/slic3r/GUI/InstanceCheck.cpp @@ -1,6 +1,7 @@ #include "GUI_App.hpp" #include "InstanceCheck.hpp" #include "Plater.hpp" +#include #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 paths; + std::vector 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(std::move(paths)))); //} } + if (!downloads.empty()) + { + wxPostEvent(m_callback_evt_handler, StartDownloadOtherInstanceEvent(GUI::EVT_START_DOWNLOAD_OTHER_INSTANCE, std::vector(std::move(downloads)))); + } } #ifdef __APPLE__ diff --git a/src/slic3r/GUI/InstanceCheck.hpp b/src/slic3r/GUI/InstanceCheck.hpp index 10ccf7b925..5f26f1e48f 100644 --- a/src/slic3r/GUI/InstanceCheck.hpp +++ b/src/slic3r/GUI/InstanceCheck.hpp @@ -43,7 +43,9 @@ class MainFrame; #endif // __linux__ using LoadFromOtherInstanceEvent = Event>; +using StartDownloadOtherInstanceEvent = Event>; wxDECLARE_EVENT(EVT_LOAD_MODEL_OTHER_INSTANCE, LoadFromOtherInstanceEvent); +wxDECLARE_EVENT(EVT_START_DOWNLOAD_OTHER_INSTANCE, StartDownloadOtherInstanceEvent); using InstanceGoToFrontEvent = SimpleEvent; wxDECLARE_EVENT(EVT_INSTANCE_GO_TO_FRONT, InstanceGoToFrontEvent); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index abb5f33ddf..a7b9b51fc8 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3175,6 +3175,15 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) wxGetApp().mainframe->Raise(); this->q->load_files(input_files); }); + + this->q->Bind(EVT_START_DOWNLOAD_OTHER_INSTANCE, [](StartDownloadOtherInstanceEvent& evt) { + BOOST_LOG_TRIVIAL(trace) << "Received url from other instance event."; + wxGetApp().mainframe->Raise(); + for (size_t i = 0; i < evt.data.size(); ++i) { + wxGetApp().start_download(evt.data[i]); + } + + }); this->q->Bind(EVT_INSTANCE_GO_TO_FRONT, [this](InstanceGoToFrontEvent &) { bring_instance_forward(); }); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 42ec0a49c7..f6b7996557 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -745,16 +745,18 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa return m_sizer_checkbox; } -wxBoxSizer *PreferencesDialog::create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::function onclick) +wxBoxSizer* PreferencesDialog::create_item_button( + wxString title, wxString title2, wxWindow* parent, wxString tooltip, wxString tooltip2, std::function onclick) { wxBoxSizer *m_sizer_checkbox = new wxBoxSizer(wxHORIZONTAL); m_sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, 23); auto m_staticTextPath = new wxStaticText(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END); - // m_staticTextPath->SetMaxSize(wxSize(FromDIP(440), -1)); + m_staticTextPath->SetMaxSize(wxSize(FromDIP(240), -1)); m_staticTextPath->SetForegroundColour(DESIGN_GRAY900_COLOR); m_staticTextPath->SetFont(::Label::Body_13); m_staticTextPath->Wrap(-1); + m_staticTextPath->SetToolTip(tooltip); auto m_button_download = new Button(parent, title2); @@ -770,7 +772,7 @@ wxBoxSizer *PreferencesDialog::create_item_button(wxString title, wxString title m_button_download->SetMinSize(wxSize(FromDIP(58), FromDIP(22))); m_button_download->SetSize(wxSize(FromDIP(58), FromDIP(22))); m_button_download->SetCornerRadius(FromDIP(12)); - m_button_download->SetToolTip(tooltip); + m_button_download->SetToolTip(tooltip2); m_button_download->Bind(wxEVT_BUTTON, [this, onclick](auto &e) { onclick(); }); @@ -1051,7 +1053,7 @@ wxWindow* PreferencesDialog::create_general_page() auto title_network = create_item_title(_L("Network"), page, _L("Network")); auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset"); auto item_system_sync = create_item_checkbox(_L("Update built-in Presets automatically."), page, _L("System Sync"), 50, "sync_system_preset"); - auto item_save_presets = create_item_button(_L("Clear my choice on the unsaved presets."), _L("Clear"), page, _L("Clear my choice on the unsaved presets."), []() { + auto item_save_presets = create_item_button(_L("Clear my choice on the unsaved presets."), _L("Clear"), page, L"", _L("Clear my choice on the unsaved presets."), []() { wxGetApp().app_config->set("save_preset_choise", ""); }); @@ -1066,6 +1068,16 @@ wxWindow* PreferencesDialog::create_general_page() auto item_associate_step = create_item_checkbox(_L("Associate .step/.stp files to OrcaSlicer"), page, _L("If enabled, sets OrcaSlicer as default application to open .step files"), 50, "associate_step"); #endif // _WIN32 +#if !defined(__APPLE__) + + + std::wstring reg_bin; + wxGetApp().check_url_association(L"prusaslicer", reg_bin); + auto associate_url_prusaslicer = create_item_button(_L("Current association: ") + reg_bin, _L("Associate prusaslicer://"), page, + reg_bin.empty() ? _L("Not associated to any application") : reg_bin, + _L("Associate OrcaSlicer with prusaslicer:// links so that Orca can open PrusaSlicer links from Printable.com"), + []() { wxGetApp().associate_url(L"prusaslicer"); }); +#endif // auto title_modelmall = create_item_title(_L("Online Models"), page, _L("Online Models")); // auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units"); @@ -1077,7 +1089,7 @@ wxWindow* PreferencesDialog::create_general_page() if (value.ToLong(&max)) wxGetApp().mainframe->set_max_recent_count(max); }); - auto item_save_choise = create_item_button(_L("Clear my choice on the unsaved projects."), _L("Clear"), page, _L("Clear my choice on the unsaved projects."), []() { + auto item_save_choise = create_item_button(_L("Clear my choice on the unsaved projects."), _L("Clear"), page, L"", _L("Clear my choice on the unsaved projects."), []() { wxGetApp().app_config->set("save_project_choise", ""); }); // auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units"); @@ -1088,8 +1100,6 @@ wxWindow* PreferencesDialog::create_general_page() //downloads auto title_downloads = create_item_title(_L("Downloads"), page, _L("Downloads")); auto item_downloads = create_item_downloads(page,50,"download_path"); - auto ps_download_url_registered = create_item_checkbox(_L("Allow downloads from Printables.com"), page, - _L("Allow downloads from Printables.com"), 50, "ps_url_registered"); //dark mode #ifdef _WIN32 @@ -1131,6 +1141,9 @@ wxWindow* PreferencesDialog::create_general_page() sizer_page->Add(item_associate_stl, 0, wxTOP, FromDIP(3)); sizer_page->Add(item_associate_step, 0, wxTOP, FromDIP(3)); #endif // _WIN32 +#if !defined(__APPLE__) + sizer_page->Add(associate_url_prusaslicer, 0, wxTOP | wxEXPAND, FromDIP(20)); +#endif // auto item_title_modelmall = sizer_page->Add(title_modelmall, 0, wxTOP | wxEXPAND, FromDIP(20)); // auto item_item_modelmall = sizer_page->Add(item_modelmall, 0, wxTOP, FromDIP(3)); // auto update_modelmall = [this, item_title_modelmall, item_item_modelmall] (wxEvent & e) { @@ -1152,7 +1165,6 @@ wxWindow* PreferencesDialog::create_general_page() sizer_page->Add(title_downloads, 0, wxTOP| wxEXPAND, FromDIP(20)); sizer_page->Add(item_downloads, 0, wxEXPAND, FromDIP(3)); - sizer_page->Add(ps_download_url_registered, 0, wxTOP | wxEXPAND, FromDIP(20)); #ifdef _WIN32 sizer_page->Add(title_darkmode, 0, wxTOP | wxEXPAND, FromDIP(20)); diff --git a/src/slic3r/GUI/Preferences.hpp b/src/slic3r/GUI/Preferences.hpp index a417d47de9..6335196186 100644 --- a/src/slic3r/GUI/Preferences.hpp +++ b/src/slic3r/GUI/Preferences.hpp @@ -111,7 +111,7 @@ public: wxBoxSizer *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param); wxBoxSizer *create_item_darkmode_checkbox(wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string param); void set_dark_mode(); - wxBoxSizer *create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::function onclick); + wxBoxSizer *create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, wxString tooltip2, std::function onclick); wxWindow* create_item_downloads(wxWindow* parent, int padding_left, std::string param); wxBoxSizer *create_item_input(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::string param, std::function onchange = {}); wxBoxSizer *create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param);