OrcaSlicer/src/slic3r/GUI/DeviceErrorDialog.hpp
xin.zhang b39bc5bf8f ENH: HMS add action 39; modify display of 29
JIRA: [STUDIO-13191]
Change-Id: I411fb4c56b395d576aaca7b610aa613e4f6cf806
(cherry picked from commit 45f756d5353f84814a2c7baa3290879a7bef3d6f)
2025-10-02 14:08:21 +08:00

90 lines
2.4 KiB
C++

#pragma once
#include <unordered_set>
#include <wx/statbmp.h>
#include <wx/webrequest.h>
#include "GUI_Utils.hpp"
#include "Widgets/StateColor.hpp"
class Label;
class Button;
namespace Slic3r {
class MachineObject;//Previous definitions
namespace GUI {
class DeviceErrorDialog : public DPIDialog
{
public:
enum ActionButton : int {
RESUME_PRINTING = 2,
RESUME_PRINTING_DEFECTS = 3,
RESUME_PRINTING_PROBELM_SOLVED = 4,
STOP_PRINTING = 5,
CHECK_ASSISTANT = 6,
FILAMENT_EXTRUDED = 7,
RETRY_FILAMENT_EXTRUDED = 8,
CONTINUE = 9,
LOAD_VIRTUAL_TRAY = 10,
OK_BUTTON = 11,
FILAMENT_LOAD_RESUME = 12,
JUMP_TO_LIVEVIEW,
NO_REMINDER_NEXT_TIME = 23,
IGNORE_NO_REMINDER_NEXT_TIME = 25,
//LOAD_FILAMENT = 26*/
IGNORE_RESUME = 27,
PROBLEM_SOLVED_RESUME = 28,
TURN_OFF_FIRE_ALARM = 29,
RETRY_PROBLEM_SOLVED = 34,
STOP_DRYING = 35,
REMOVE_CLOSE_BTN = 39, // special case, do not show close button
ERROR_BUTTON_COUNT
};
public:
DeviceErrorDialog(MachineObject* obj,
wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLOSE_BOX | wxCAPTION);
~DeviceErrorDialog();
public:
void show_error_code(int error_code);
protected:
void init_button_list();
void init_button(ActionButton style, wxString buton_text);
void update_contents(const wxString& text, const wxString& error_code,const wxString& image_url, const std::vector<int>& btns);
void on_button_click(ActionButton btn_id);
void on_webrequest_state(wxWebRequestEvent& evt);
void on_dpi_changed(const wxRect& suggested_rect);
private:
MachineObject* m_obj;
int m_error_code;
std::unordered_set<Button*> m_used_button;
wxWebRequest web_request;
wxStaticBitmap* m_error_picture;
Label* m_error_msg_label{ nullptr };
Label* m_error_code_label{ nullptr };
wxBoxSizer* m_sizer_main;
wxBoxSizer* m_sizer_button;
wxScrolledWindow* m_scroll_area{ nullptr };
std::map<int, Button*> m_button_list;
StateColor btn_bg_white;
};
}} // namespace Slic3r::GUI