Files
OrcaSlicer/src/slic3r/GUI/NetworkPluginDialog.hpp
SoftFever 2804e06cf2 Sort network plug-in versions newest first and mark only the loaded build
Discovered builds were inserted positionally behind the whitelist entry they
anchored to, so an OTA-installed 02.08.01.53 listed below 02.08.01.52. The list
is now built by appending and sorting once, which also drops the per-entry
insertion scans.

"(installed)" tested whether the library was present on disk, so it marked every
version ever selected - switching leaves the previous library in place. The flag
is now is_loaded, resolved against the plug-in actually loaded, and the two
combo populators share one label helper.
2026-07-18 16:23:50 +08:00

83 lines
2.3 KiB
C++

#ifndef slic3r_GUI_NetworkPluginDialog_hpp_
#define slic3r_GUI_NetworkPluginDialog_hpp_
#include "GUI_Utils.hpp"
#include "MsgDialog.hpp"
#include "Widgets/ComboBox.hpp"
#include "Widgets/Button.hpp"
#include "slic3r/Utils/bambu_networking.hpp"
#include <wx/collpane.h>
namespace Slic3r {
namespace GUI {
// Dropdown label for one network plug-in version: tree glyph for a dev build, then
// "(Latest)" for the highest listed version and "(installed)" for the build currently
// loaded. Shared by the Preferences selector and the download dialog so both stay
// consistent.
wxString network_version_label(const NetworkLibraryVersionInfo& ver);
class NetworkPluginDownloadDialog : public DPIDialog
{
public:
enum class Mode {
MissingPlugin,
UpdateAvailable,
CorruptedPlugin
};
NetworkPluginDownloadDialog(wxWindow* parent, Mode mode,
const std::string& current_version = "",
const std::string& error_message = "",
const std::string& error_details = "");
std::string get_selected_version() const;
enum ResultCode {
RESULT_DOWNLOAD = wxID_OK,
RESULT_SKIP = wxID_CANCEL,
RESULT_REMIND_LATER = wxID_APPLY,
RESULT_SKIP_VERSION = wxID_IGNORE,
RESULT_DONT_ASK = wxID_ABORT
};
protected:
void on_dpi_changed(const wxRect& suggested_rect) override;
private:
void create_missing_plugin_ui();
void create_update_available_ui(const std::string& current_version);
void setup_version_selector();
void on_download(wxCommandEvent& evt);
void on_skip(wxCommandEvent& evt);
void on_remind_later(wxCommandEvent& evt);
void on_skip_version(wxCommandEvent& evt);
void on_dont_ask(wxCommandEvent& evt);
Mode m_mode;
ComboBox* m_version_combo{nullptr};
wxCollapsiblePane* m_details_pane{nullptr};
std::string m_error_message;
std::string m_error_details;
std::vector<NetworkLibraryVersionInfo> m_available_versions;
};
class NetworkPluginRestartDialog : public DPIDialog
{
public:
NetworkPluginRestartDialog(wxWindow* parent);
bool should_restart_now() const { return m_restart_now; }
protected:
void on_dpi_changed(const wxRect& suggested_rect) override;
private:
bool m_restart_now{false};
};
} // namespace GUI
} // namespace Slic3r
#endif // slic3r_GUI_NetworkPluginDialog_hpp_