From ff64f7167d6f6d2edc34de38fd9c2292db945c74 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Fri, 5 Jan 2024 10:33:42 +0100 Subject: [PATCH] Fixes and icons. Sla printer icons with Connect status. Fix of non-static variable and missing includes update of priter_type table missing include --- deps/+wxWidgets/wxWidgets.cmake | 2 +- resources/icons/sla_printer_available.svg | 16 ++++++++++++++++ resources/icons/sla_printer_busy.svg | 16 ++++++++++++++++ resources/icons/sla_printer_offline.svg | 16 ++++++++++++++++ src/CMakeLists.txt | 2 +- src/slic3r/GUI/ConfigWizard.cpp | 8 ++++++-- src/slic3r/GUI/ConfigWizard.hpp | 5 +---- src/slic3r/GUI/FrequentlyChangedParameters.hpp | 2 ++ src/slic3r/GUI/GUI_App.cpp | 4 ++-- src/slic3r/GUI/Plater.cpp | 2 +- src/slic3r/GUI/Preferences.cpp | 2 +- src/slic3r/GUI/Sidebar.hpp | 1 + src/slic3r/GUI/UserAccount.cpp | 1 + src/slic3r/GUI/UserAccount.hpp | 17 ++++++++++++++--- 14 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 resources/icons/sla_printer_available.svg create mode 100644 resources/icons/sla_printer_busy.svg create mode 100644 resources/icons/sla_printer_offline.svg diff --git a/deps/+wxWidgets/wxWidgets.cmake b/deps/+wxWidgets/wxWidgets.cmake index f0745d115e..b621bb4973 100644 --- a/deps/+wxWidgets/wxWidgets.cmake +++ b/deps/+wxWidgets/wxWidgets.cmake @@ -33,7 +33,7 @@ add_cmake_project(wxWidgets "-DCMAKE_DEBUG_POSTFIX:STRING=" -DwxBUILD_PRECOMP=ON ${_wx_toolkit} - -DwxUSE_MEDIACTRL=ON + -DwxUSE_MEDIACTRL=OFF -DwxUSE_DETECT_SM=OFF -DwxUSE_UNICODE=ON -DwxUSE_UNICODE_UTF8=${_unicode_utf8} diff --git a/resources/icons/sla_printer_available.svg b/resources/icons/sla_printer_available.svg new file mode 100644 index 0000000000..47db35e290 --- /dev/null +++ b/resources/icons/sla_printer_available.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/resources/icons/sla_printer_busy.svg b/resources/icons/sla_printer_busy.svg new file mode 100644 index 0000000000..fc4dcf3bc6 --- /dev/null +++ b/resources/icons/sla_printer_busy.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/resources/icons/sla_printer_offline.svg b/resources/icons/sla_printer_offline.svg new file mode 100644 index 0000000000..eb91f6fe5c --- /dev/null +++ b/resources/icons/sla_printer_offline.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 31e14c3f0f..dd5b70c5a5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,7 @@ if (SLIC3R_GUI) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set (wxWidgets_CONFIG_OPTIONS "--toolkit=gtk${SLIC3R_GTK}") endif () - find_package(wxWidgets 3.2 MODULE REQUIRED COMPONENTS base core adv html gl webview media) + find_package(wxWidgets 3.2 MODULE REQUIRED COMPONENTS base core adv html gl webview) include(${wxWidgets_USE_FILE}) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 5971c4f97d..c3c555ba7b 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1536,6 +1536,10 @@ bool PageDownloader::on_finish_downloader() const return m_downloader->on_finish(); } +#ifdef __linux__ +bool DownloaderUtils::Worker::perform_registration_linux = false; +#endif // __linux__ + bool DownloaderUtils::Worker::perform_register(const std::string& path) { boost::filesystem::path aux_dest (path); @@ -3063,10 +3067,10 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese #ifdef __linux__ // Desktop integration on Linux - BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << page_downloader->m_downloader->get_perform_registration_linux(); + BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << DownloaderUtils::Worker::perform_registration_linux; if (page_welcome->integrate_desktop()) DesktopIntegrationDialog::perform_desktop_integration(); - if (page_downloader->m_downloader->get_perform_registration_linux()) + if (DownloaderUtils::Worker::perform_registration_linux) DesktopIntegrationDialog::perform_downloader_desktop_integration(); #endif diff --git a/src/slic3r/GUI/ConfigWizard.hpp b/src/slic3r/GUI/ConfigWizard.hpp index 59b98c8f6f..1425b7cfa4 100644 --- a/src/slic3r/GUI/ConfigWizard.hpp +++ b/src/slic3r/GUI/ConfigWizard.hpp @@ -31,9 +31,6 @@ namespace DownloaderUtils { wxWindow* m_parent{ nullptr }; wxTextCtrl* m_input_path{ nullptr }; bool downloader_checked{ false }; -#ifdef __linux__ - bool perform_registration_linux{ false }; -#endif // __linux__ void deregister(); @@ -51,7 +48,7 @@ namespace DownloaderUtils { bool on_finish(); static bool perform_register(const std::string& path); #ifdef __linux__ - bool get_perform_registration_linux() { return perform_registration_linux; } + static bool perform_registration_linux; #endif // __linux__ }; } diff --git a/src/slic3r/GUI/FrequentlyChangedParameters.hpp b/src/slic3r/GUI/FrequentlyChangedParameters.hpp index 08d07afa05..0be8fb0415 100644 --- a/src/slic3r/GUI/FrequentlyChangedParameters.hpp +++ b/src/slic3r/GUI/FrequentlyChangedParameters.hpp @@ -17,6 +17,8 @@ #ifndef slic3r_FreqChangedParams_hpp_ #define slic3r_FreqChangedParams_hpp_ +#include + #include "Event.hpp" class wxButton; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 663ebf3ea7..7d21b5e8ff 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2640,7 +2640,7 @@ wxMenu* GUI_App::get_config_menu() break; case ConfigMenuMediaDialog: //MediaDialog(nullptr).ShowModal(); - wxMediaPlayerDialog("Media").ShowModal(); + //wxMediaPlayerDialog("Media").ShowModal(); break; case ConfigMenuConnectDialog: //WebViewDialog(plater()).ShowModal(); @@ -3194,7 +3194,7 @@ void GUI_App::show_downloader_registration_dialog() auto downloader_worker = new DownloaderUtils::Worker(nullptr); downloader_worker->perform_register(app_config->get("url_downloader_dest")); #ifdef __linux__ - if (downloader_worker->get_perform_registration_linux()) + if (DownloaderUtils::Worker::perform_registration_linux) DesktopIntegrationDialog::perform_downloader_desktop_integration(); #endif // __linux__ } else { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 990fd9d169..c75f1a86dc 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -876,7 +876,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) //auto downloader_worker = new DownloaderUtils::Worker(nullptr); DownloaderUtils::Worker::perform_register(wxGetApp().app_config->get("url_downloader_dest")); #ifdef __linux__ - if (downloader_worker->get_perform_registration_linux()) + if (DownloaderUtils::Worker::perform_registration_linux) DesktopIntegrationDialog::perform_downloader_desktop_integration(); #endif // __linux__ // than open url diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index ee4c06f4a1..04c3f04da6 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -761,7 +761,7 @@ void PreferencesDialog::accept(wxEvent&) if (!downloader->on_finish()) return; #ifdef __linux__ - if( downloader->get_perform_registration_linux()) + if(DownloaderUtils::Worker::perform_registration_linux) DesktopIntegrationDialog::perform_downloader_desktop_integration(); #endif // __linux__ } diff --git a/src/slic3r/GUI/Sidebar.hpp b/src/slic3r/GUI/Sidebar.hpp index 498fc65d87..20cfb049f4 100644 --- a/src/slic3r/GUI/Sidebar.hpp +++ b/src/slic3r/GUI/Sidebar.hpp @@ -21,6 +21,7 @@ #include #include +#include #include "libslic3r/Preset.hpp" #include "GUI.hpp" diff --git a/src/slic3r/GUI/UserAccount.cpp b/src/slic3r/GUI/UserAccount.cpp index f799608375..1868d35805 100644 --- a/src/slic3r/GUI/UserAccount.cpp +++ b/src/slic3r/GUI/UserAccount.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace pt = boost::property_tree; diff --git a/src/slic3r/GUI/UserAccount.hpp b/src/slic3r/GUI/UserAccount.hpp index ba80f44e50..fa792afb2f 100644 --- a/src/slic3r/GUI/UserAccount.hpp +++ b/src/slic3r/GUI/UserAccount.hpp @@ -70,25 +70,36 @@ private: std::map m_user_data; std::string m_username; + // first string is "printer_type" code from Connect edpoints const std::map printer_type_and_name_table = { + {"1.2.5", "MK2.5" }, + {"1.2.6", "MK2.5S" }, {"1.3.0", "MK3" }, {"1.3.1", "MK3S" }, + {"1.3.5", "MK3.5" }, + {"1.3.9", "MK3.9" }, {"1.4.0", "MK4" }, {"2.1.0", "MINI" }, {"3.1.0", "XL" }, + {"5.1.0", "SL1" }, // ysFIXME : needs to add Connect ids for next printers {"0.0.0", "MK4IS" }, {"0.0.0", "MK3SMMU2S" }, {"0.0.0", "MK3MMU2" }, - {"0.0.0", "MK2.5S" }, - {"0.0.0", "MK2.5" }, {"0.0.0", "MK2.5SMMU2S" }, {"0.0.0", "MK2.5MMU2" }, {"0.0.0", "MK2S" }, {"0.0.0", "MK2SMM" }, - {"0.0.0", "SL1" }, {"0.0.0", "SL1S" }, }; + /* TODO: + 4 1 0 iXL + 6 2 0 Trilab DeltiQ 2 + 6 2 1 Trilab DelriQ 2 Plus + 7 1 0 Trilab AzteQ + 7 2 0 Trilab AzteQ Industrial + 7 2 1 Trilab AzteQ Industrial Plus + */ const std::map printer_state_table = { {"OFFLINE" , ConnectPrinterState::CONNECT_PRINTER_OFFLINE},