Files
OrcaSlicer/src/slic3r/GUI/UpgradePanel.hpp
T
HanifKoh 84657ff11e Add Missing Includes Across the Remaining Sources and Tests (#16071)
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
2026-10-03 13:45:21 +08:00

334 lines
12 KiB
C++

#ifndef slic3r_UpgradePanel_hpp_
#define slic3r_UpgradePanel_hpp_
#include "slic3r/GUI/wxExtensions.hpp"
#include <wx/anybutton.h>
#include <wx/event.h>
#include <wx/gdicmn.h>
#include <wx/dynarray.h>
#include <vector>
#include <string>
#include "slic3r/GUI/DeviceCore/DevFirmware.h"
#include "slic3r/GUI/DeviceCore/DevDefs.h"
#include <wx/panel.h>
#include <slic3r/GUI/Widgets/Button.hpp>
#include "Widgets/ProgressBar.hpp"
#include <slic3r/GUI/DeviceManager.hpp>
#include <slic3r/GUI/Widgets/ScrolledWindow.hpp>
#include <slic3r/GUI/StatusPanel.hpp>
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/scrolwin.h>
#include "ReleaseNote.hpp"
namespace Slic3r {
namespace GUI {
// Previous definitions
class uiDeviceUpdateVersion;
class ExtensionPanel : public wxPanel
{
public:
wxStaticText* m_staticText_ext;
wxStaticText* m_staticText_ext_val;
wxStaticText* m_staticText_ext_ver;
wxStaticText* m_staticText_ext_ver_val;
wxStaticText* m_staticText_ext_sn_val;
ScalableBitmap upgrade_green_icon;
wxStaticBitmap* m_ext_new_version_img;
ExtensionPanel(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
~ExtensionPanel();
void msw_rescale();
};
class AmsPanel : public wxPanel
{
public:
wxStaticText *m_staticText_ams_model_id;
wxStaticText *m_staticText_ams;
wxStaticText *m_staticText_ams_sn_val;
wxStaticText *m_staticText_ams_ver_val;
wxStaticText *m_staticText_beta_version;
wxStaticBitmap *m_ams_new_version_img;
ScalableBitmap upgrade_green_icon;
AmsPanel(wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString &name = wxEmptyString);
~AmsPanel();
void msw_rescale();
};
class ExtraAmsPanel : public AmsPanel
{
public:
ExtraAmsPanel(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString& name = wxEmptyString);
};
WX_DEFINE_ARRAY(AmsPanel*, AmsPanelHash);
class MachineInfoPanel : public wxPanel
{
protected:
wxPanel * m_panel_caption;
wxStaticBitmap *m_upgrade_status_img;
wxStaticText * m_caption_text;
wxStaticBitmap *m_printer_img;
wxStaticText * m_staticText_model_id;
wxStaticText * m_staticText_model_id_val;
wxStaticText * m_staticText_sn;
wxStaticText * m_staticText_sn_val;
wxStaticBitmap *m_ota_new_version_img;
wxStaticText * m_staticText_ver;
wxStaticText * m_staticText_ver_val;
wxStaticText * m_staticText_beta_version;
wxStaticLine * m_staticline;
wxStaticBitmap *m_ams_img;
AmsPanel* m_ahb_panel;
wxStaticLine* m_staticline2;
ExtraAmsPanel* m_extra_ams_panel;
wxStaticBitmap* m_extra_ams_img;
wxStaticBitmap* m_ext_img;
ExtensionPanel* m_ext_panel;
wxFlexGridSizer* m_ams_info_sizer;
/* ams info */
bool m_last_ams_show = true;
wxBoxSizer* m_ams_sizer;
/* extension info */
bool m_last_ext_show = true;
wxBoxSizer* m_ext_sizer;
/* extra_ams info */
bool m_last_extra_ams_show = true;
wxBoxSizer* m_extra_ams_sizer;
/* air_pump info*/
wxBoxSizer* m_air_pump_sizer = nullptr;
wxStaticBitmap* m_air_pump_img = nullptr;
wxStaticLine* m_air_pump_line_above = nullptr;;
uiDeviceUpdateVersion* m_air_pump_version = nullptr;
/* cutting module info*/
wxBoxSizer* m_cutting_sizer = nullptr;
wxStaticBitmap* m_cutting_img = nullptr;
wxStaticLine* m_cutting_line_above = nullptr;;
uiDeviceUpdateVersion* m_cutting_version = nullptr;
/* laser info*/
wxBoxSizer* m_laser_sizer = nullptr;
wxStaticBitmap* m_lazer_img = nullptr;
wxStaticLine* m_laser_line_above = nullptr;;
uiDeviceUpdateVersion* m_laser_version = nullptr;
/* fire extinguish*/
wxBoxSizer* m_extinguish_sizer = nullptr;
wxStaticBitmap* m_extinguish_img = nullptr;
wxStaticLine* m_extinguish_line_above = nullptr;;
uiDeviceUpdateVersion* m_extinguish_version = nullptr;
/* filament track switch info*/
wxBoxSizer* m_filatrack_sizer = nullptr;
wxStaticBitmap* m_filatrack_img = nullptr;
wxStaticLine* m_filatrack_line_above = nullptr;
uiDeviceUpdateVersion* m_filatrack_version = nullptr;
/* rotary attachment info (Orca: accessory firmware version display) */
wxBoxSizer* m_rotary_sizer = nullptr;
wxStaticBitmap* m_rotary_img = nullptr;
wxStaticLine* m_rotary_line_above = nullptr;
uiDeviceUpdateVersion* m_rotary_version = nullptr;
/* exhaust fan info (Orca: accessory firmware version display) */
wxBoxSizer* m_exhaustfan_sizer = nullptr;
wxStaticBitmap* m_exhaustfan_img = nullptr;
wxStaticLine* m_exhaustfan_line_above = nullptr;
uiDeviceUpdateVersion* m_exhaustfan_version = nullptr;
/* AMS hub / filament buffer info (Orca: accessory firmware version display for the amshub_version_info path) */
wxBoxSizer* m_amshub_sizer = nullptr;
wxStaticBitmap* m_amshub_img = nullptr;
wxStaticLine* m_amshub_line_above = nullptr;
uiDeviceUpdateVersion* m_amshub_version = nullptr;
/* nozzle rack (H2C induction hotend rack) — opens wgtDeviceNozzleRackUpgradeDlg */
wxBoxSizer* m_nozzle_rack_sizer = nullptr;
wxStaticBitmap* m_nozzle_rack_img = nullptr;
wxStaticLine* m_nozzle_rack_line_above = nullptr;
wxStaticText* m_nozzle_rack_text = nullptr;
Button* m_nozzle_rack_update_btn = nullptr;
/* upgrade widgets */
wxBoxSizer* m_upgrading_sizer;
wxStaticText * m_staticText_upgrading_info;
ProgressBar * m_upgrade_progress;
wxStaticText * m_staticText_upgrading_percent;
wxStaticBitmap *m_upgrade_retry_img;
wxStaticText * m_staticText_release_note;
Button * m_button_upgrade_firmware;
wxPanel* create_caption_panel(wxWindow *parent);
AmsPanelHash m_amspanel_list;
std::vector<ExtraAmsPanel*> m_extra_ams_panel_list;
ScalableBitmap m_img_ext;
ScalableBitmap m_img_monitor_ams;
ScalableBitmap m_img_extra_ams;
ScalableBitmap m_img_printer;
ScalableBitmap m_img_air_pump;
ScalableBitmap m_img_cutting;
ScalableBitmap m_img_laser;
ScalableBitmap m_img_extinguish;
ScalableBitmap m_img_filatrack;
ScalableBitmap m_img_nozzle_rack;
ScalableBitmap upgrade_gray_icon;
ScalableBitmap upgrade_green_icon;
ScalableBitmap upgrade_yellow_icon;
int last_status = -1;
std::string last_status_str = "";
std::string m_last_laser_product_name = "";
SecondaryCheckDialog* confirm_dlg = nullptr;
void upgrade_firmware_internal();
void on_show_release_note(wxMouseEvent &event);
void confirm_upgrade(MachineObject* obj = nullptr);
public:
MachineInfoPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString);
~MachineInfoPanel();
void on_sys_color_changed();
void update_printer_imgs(MachineObject* obj);
void init_bitmaps();
void rescale_bitmaps();
Button* get_btn() {
return m_button_upgrade_firmware;
}
void msw_rescale();
void update(MachineObject *obj);
void update_version_text(MachineObject *obj);
void update_ams_ext(MachineObject *obj);
void show_status(int status, std::string upgrade_status_str = "");
void show_ams(bool show = false, bool force_update = false);
void show_ext(bool show = false, bool force_update = false);
void show_extra_ams(bool show = false, bool force_update = false);
void on_upgrade_firmware(wxCommandEvent &event);
void on_consisitency_upgrade_firmware(wxCommandEvent &event);
MachineObject *m_obj{nullptr};
FirmwareInfo m_ota_info;
FirmwareInfo m_ams_info;
bool is_upgrading = false;
enum PanelType {
ptUndef,
ptPushPanel,
ptOtaPanel,
ptAmsPanel,
}panel_type;
private:
void createAirPumpWidgets(wxBoxSizer* main_left_sizer);
void createCuttingWidgets(wxBoxSizer* main_left_sizer);
void createLaserWidgets(wxBoxSizer* main_left_sizer);
void createExtinguishWidgets(wxBoxSizer* main_left_sizer);
void createFilaTrackSwitchWidgets(wxBoxSizer* main_left_sizer);
void createRotaryWidgets(wxBoxSizer* main_left_sizer); // Orca: accessory firmware version display
void createExhaustFan(wxBoxSizer* main_left_sizer); // Orca: accessory firmware version display
void createAmshubWidgets(wxBoxSizer* main_left_sizer); // Orca: accessory firmware version display
void createNozzleRackWidgets(wxBoxSizer* main_left_sizer);
void update_air_pump(MachineObject* obj);
void update_cut(MachineObject* obj);
void update_laszer(MachineObject* obj);
void update_extinguish(MachineObject* obj);
void update_filatrack(MachineObject* obj);
void update_rotary(MachineObject* obj); // Orca: accessory firmware version display
void update_exhaustfan(MachineObject* obj); // Orca: accessory firmware version display
void update_amshub(MachineObject* obj); // Orca: accessory firmware version display
void update_nozzle_rack(MachineObject* obj);
void show_air_pump(bool show = true);
void show_cut(bool show = true);
void show_laszer(bool show = true);
void show_extinguish(bool show = true);
void show_filatrack(bool show = true);
void show_rotary(bool show = true); // Orca: accessory firmware version display
void show_exhaustfan(bool show = true); // Orca: accessory firmware version display
void show_amshub(bool show = true); // Orca: accessory firmware version display
void show_nozzle_rack(bool show = true);
void on_nozzle_rack_update(wxCommandEvent& event);
};
//enum UpgradeMode {
// umPushUpgrading,
// umSelectOtaVerUpgrading,
// umSelectAmsVerUpgrading,
//};
//static UpgradeMode upgrade_mode;
class UpgradePanel : public wxPanel
{
protected:
wxScrolledWindow* m_scrolledWindow;
wxBoxSizer* m_machine_list_sizer;
MachineInfoPanel *m_push_upgrade_panel{nullptr};
//enable_select_firmware only in debug mode
bool enable_select_firmware = false;
bool m_need_update = false;
//hint of force upgrade or consistency upgrade
DevFirmwareUpgradingState last_forced_hint_status = DevFirmwareUpgradingState::DC;
DevFirmwareUpgradingState last_consistency_hint_status = DevFirmwareUpgradingState::DC;
int last_status;
bool m_show_forced_hint = true;
bool m_show_consistency_hint = true;
SecondaryCheckDialog* force_dlg{ nullptr };
SecondaryCheckDialog* consistency_dlg{ nullptr };
public:
UpgradePanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
~UpgradePanel();
void clean_push_upgrade_panel();
void msw_rescale();
bool Show(bool show = true) override;
void refresh_version_and_firmware(MachineObject* obj);
void update(MachineObject *obj);
void show_status(int status);
void on_sys_color_changed();
MachineObject *m_obj { nullptr };
};
}
}
#endif