Files
OrcaSlicer/src/slic3r/GUI/PrePrintChecker.hpp
T
HanifKoh 1a5f91d727 Add Missing Includes Across src/slic3r/GUI (#16048)
* Add Missing Includes Across src/slic3r/GUI

Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained.

* Drop the OS-Specific Includes Added Outside Their Platform Guards

GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build.

* Add the clang-tidy Configuration That Generated These Includes

Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly.

* Match Windows Paths in the clang-tidy Ignore List

Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
2026-10-02 14:56:56 +08:00

234 lines
8.1 KiB
C++

#ifndef slic3r_GUI_PRE_PRINT_CHECK_hpp_
#define slic3r_GUI_PRE_PRINT_CHECK_hpp_
#include <functional>
#include <wx/string.h>
#include <vector>
#include <string>
#include <wx/panel.h>
#include <wx/sizer.h>
#include <wx/wx.h>
#include "Widgets/Label.hpp"
namespace Slic3r { namespace GUI {
enum prePrintInfoLevel {
Normal,
Warning,
Error
};
enum prePrintInfoType {
Printer,
Filament
};
struct prePrintInfo
{
prePrintInfoLevel level;
prePrintInfoType type;
wxString msg;
wxString tips;
wxString wiki_url;
wxString link_label; // optional: clickable text appended after msg
std::function<void()> link_callback; // optional: internal action for link_label click
wxString checkbox_label; // optional: an acknowledgement checkbox under msg
bool checkbox_checked{false};
std::function<void(bool)> checkbox_callback; // called with the new state on toggle
int index{0};
public:
bool operator==(const prePrintInfo& other) const {
return level == other.level && type == other.type &&
msg == other.msg && tips == other.tips &&
wiki_url == other.wiki_url && link_label == other.link_label &&
checkbox_label == other.checkbox_label && checkbox_checked == other.checkbox_checked &&
index == other.index;
// link_callback / checkbox_callback excluded: std::function is not comparable
}
};
enum PrintDialogStatus : unsigned int {
PrintStatusErrorBegin,//->start error<-
// Errors for printer, Block Print
PrintStatusPrinterErrorBegin,
PrintStatusInit,
PrintStatusNoUserLogin,
PrintStatusInvalidPrinter,
PrintStatusConnectingServer,
PrintStatusReadingTimeout,
PrintStatusReading,
PrintStatusConnecting,
PrintStatusReconnecting,
PrintStatusInUpgrading,
PrintStatusFirmwareNotSupportTpuAtLeft,
PrintStatusModeNotFDM,
PrintStatusInSystemPrinting,
PrintStatusInPrinting,
PrintStatusNozzleMatchInvalid,
PrintStatusNozzleDataInvalid,
PrintStatusNozzleTypeMismatch,
PrintStatusNozzleNoMatchedHotends,
PrintStatusNozzleRackMaximumInstalled,
PrintStatusRefreshingMachineList,
PrintStatusSending,
PrintStatusLanModeNoSdcard,
PrintStatusNoSdcard,
PrintStatusLanModeSDcardNotAvailable,
PrintStatusNeedForceUpgrading,
PrintStatusNeedConsistencyUpgrading,
PrintStatusNotSupportedPrintAll,
PrintStatusBlankPlate,
PrintStatusUnsupportedPrinter,
PrintStatusRackNozzleMappingWaiting,
PrintStatusRackNozzleMappingError,
PrintStatusRackReading,
PrintStatusFilaSwitcherError,
PrintStatusPrinterErrorEnd,
// Errors for filament, Block Print
PrintStatusFilamentErrorBegin,
PrintStatusAmsOnSettingup,
PrintStatusAmsMappingInvalid,
PrintStatusAmsMappingU0Invalid,
PrintStatusAmsMappingMixInvalid,
PrintStatusTPUUnsupportAutoCali,
PrintStatusHasFilamentInBlackListError,
PrintStatusColorQuantityExceed,
PrintStatusFilamentErrorEnd,
PrintStatusErrorEnd,//->end error<-
PrintStatusWarningBegin,//->start warning<-
// Warnings for printer
PrintStatusPrinterWarningBegin,
PrintStatusTimelapseNoSdcard,
PrintStatusTimelapseWarning,
PrintStatusTimelapseStorageLow,
PrintStatusMixAmsAndVtSlotWarning,
PrintStatusToolHeadCoolingFanWarning,
PrintStatusRackNozzleMappingWarning,
PrintStatusFilaSwitcherSlicingNotMatch,
PrintStatusRackNozzleNumUnmeetWarning,
PrintStatusHasUnreliableNozzleWarning,
// Orca: a nozzle diameter that differs from the one the printer remembers is a warning,
// not an error, so non-standard nozzles can still be printed with.
PrintStatusNozzleDiameterMismatch,
PrintStatusOptionalPrinterModel,
PrintStatusPrinterWarningEnd,
// Warnings for filament
PrintStatusFilamentWarningBegin,
PrintStatusWarningKvalueNotUsed,
PrintStatusHasFilamentInBlackListWarning,
PrintStatusFilamentWarningHighChamberTemp,
PrintStatusFilamentWarningHighChamberTempCloseDoor,
PrintStatusFilamentWarningHighChamberTempSoft,
PrintStatusFilamentWarningUnknownHighChamberTempSoft,
PrintStatusWarningExtFilamentNotMatch,
PrintStatusFilamentWarningNozzleHRC,
PrintStatusFilamentCrossExtruderWarning,
// Non-blocking advisories. FilamentWarningRemainNotEnough is declared but not wired (missing
// device-model surface); PrintTimeEstimateWarning has no call site or message and is kept only
// to match the reference enum table.
PrintStatusTPUUnsupportCaliOn,
PrintStatusTPUUnsuggestCali,
PrintStatusSmartNozzleBlobNeedAuto,
PrintStatusFilamentWarningRemainNotEnough,
PrintStatusPrintTimeEstimateWarning,
PrintStatusFilamentWarningEnd,
PrintStatusWarningEnd,//->end error<-
/*success*/
// printer
PrintStatusReadingFinished,
PrintStatusSendingCanceled,
PrintStatusReadyToGo,
// filament
PrintStatusAmsMappingSuccess,
/*Other, SendToPrinterDialog*/
PrintStatusNotOnTheSameLAN,
PrintStatusNotSupportedSendToSDCard,
PrintStatusPublicInitFailed,
PrintStatusPublicUploadFiled,
};
class PrePrintChecker
{
public:
std::vector<prePrintInfo> printerList;
std::vector<prePrintInfo> filamentList;
public:
void clear();
/*auto merge*/
void add(PrintDialogStatus state, wxString msg, wxString tip, const wxString& wiki_url);
// Orca: minimal callback-link render path instead of the full style-bitmask machinery.
void add_with_link(PrintDialogStatus state, wxString msg, wxString link_label, std::function<void()> link_callback);
// Orca: render msg with an acknowledgement checkbox beneath it, for an overridable warning that
// the user must tick before proceeding (checkbox_callback reports the new state).
void add_with_checkbox(PrintDialogStatus state, wxString msg, wxString checkbox_label, bool checked, std::function<void(bool)> checkbox_callback);
static ::std::string get_print_status_info(PrintDialogStatus status);
static wxString get_pre_state_msg(PrintDialogStatus status);
static bool is_error(PrintDialogStatus status) { return (PrintStatusErrorBegin < status) && (PrintStatusErrorEnd > status); };
static bool is_error_printer(PrintDialogStatus status) { return (PrintStatusPrinterErrorBegin < status) && (PrintStatusPrinterErrorEnd > status); };
static bool is_error_filament(PrintDialogStatus status) { return (PrintStatusFilamentErrorBegin < status) && (PrintStatusFilamentErrorEnd > status); };
static bool is_warning(PrintDialogStatus status) { return (PrintStatusWarningBegin < status) && (PrintStatusWarningEnd > status); };
static bool is_warning_printer(PrintDialogStatus status) { return (PrintStatusPrinterWarningBegin < status) && (PrintStatusPrinterWarningEnd > status); };
static bool is_warning_filament(PrintDialogStatus status) { return (PrintStatusFilamentWarningBegin < status) && (PrintStatusFilamentWarningEnd > status); };
};
//class PrePrintMsgBoard : public wxWindow
//{
//public:
// PrePrintMsgBoard(wxWindow * parent,
// wxWindowID winid = wxID_ANY,
// const wxPoint & pos = wxDefaultPosition,
// const wxSize & size = wxDefaultSize,
// long style = wxTAB_TRAVERSAL | wxNO_BORDER,
// const wxString &name = wxASCII_STR(wxPanelNameStr)
// );
//
//public:
// // Operations
// void addError(const wxString &msg, const wxString &tips = wxEmptyString) { Add(msg, tips, true); };
// void addWarning(const wxString &msg, const wxString &tips = wxEmptyString) { Add(msg, tips, false); };
// void clear() { m_sizer->Clear(); };
//
// // Const Access
// bool isEmpty() const { return m_sizer->IsEmpty(); }
//
//private:
// void add(const wxString &msg, const wxString &tips, bool is_error);
//
//private:
// wxBoxSizer *m_sizer{nullptr};
//};
class PrinterMsgPanel : public wxPanel
{
public:
PrinterMsgPanel(wxWindow *parent);
public:
bool UpdateInfos(const std::vector<prePrintInfo>& infos);
private:
wxBoxSizer* m_sizer = nullptr;
std::vector<prePrintInfo> m_infos;
};
}} // namespace Slic3r::GUI
#endif