Files
OrcaSlicer/src/slic3r/GUI/DeviceCore/DevFilaAmsSetting.h
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

105 lines
3.3 KiB
C++

#pragma once
#include <memory>
#include <optional>
#include <string>
#include <unordered_map> // Orca: for m_firmwares / GetSuppotedFirmwares() — the unordered_map AMSSetting.cpp mirrors and iterates
#include <nlohmann/json.hpp>
#include "DevCtrl.h"
namespace Slic3r
{
class DevFilaSystem;
class DevAmsSystemSetting
{
public:
DevAmsSystemSetting(DevFilaSystem* owner) : m_owner(owner) {};
public:
// getters
std::optional<bool> IsDetectOnInsertEnabled() const { return m_enable_detect_on_insert; };
bool IsDetectOnPowerupEnabled() const { return m_enable_detect_on_powerup; }
bool IsDetectRemainEnabled() const { return m_enable_detect_remain; }
bool IsAutoRefillEnabled() const { return m_enable_auto_refill; }
// setters
void Reset();
void SetDetectOnInsertEnabled(bool enable) { m_enable_detect_on_insert = enable; }
void SetDetectOnPowerupEnabled(bool enable) { m_enable_detect_on_powerup = enable; }
void SetDetectRemainEnabled(bool enable) { m_enable_detect_remain = enable; }
void SetAutoRefillEnabled(bool enable) { m_enable_auto_refill = enable; }
private:
[[maybe_unused]] DevFilaSystem* m_owner = nullptr;
std::optional<bool> m_enable_detect_on_insert = false;
bool m_enable_detect_on_powerup = false;
bool m_enable_detect_remain = false;
bool m_enable_auto_refill = false;
};
class DevAmsSystemFirmwareSwitch
{
public:
enum DevAmsSystemIdx : int
{
IDX_DC = -1,
IDX_LITE = 0,
IDX_AMS_AMS2_AMSHT = 1,
};
struct DevAmsSystemFirmware
{
DevAmsSystemIdx m_firmare_idx = IDX_DC;
std::string m_name;
std::string m_version;
public:
bool operator==(const DevAmsSystemFirmware& o) const
{
return (m_firmare_idx == o.m_firmare_idx) &&
(m_name == o.m_name) &&
(m_version == o.m_version);
};
};
public:
static std::shared_ptr<DevAmsSystemFirmwareSwitch> Create(DevFilaSystem* owner)
{
return std::shared_ptr<DevAmsSystemFirmwareSwitch>(new DevAmsSystemFirmwareSwitch(owner));
};
protected:
DevAmsSystemFirmwareSwitch(DevFilaSystem* owner) : m_owner(owner) {};
public:
DevFilaSystem* GetFilaSystem() const { return m_owner; };
bool SupportSwitchFirmware() const { return !m_firmwares.empty();};
DevAmsSystemIdx GetCurrentFirmwareIdxSel() const { return m_current_firmware_sel.m_firmare_idx; };
DevAmsSystemIdx GetCurrentFirmwareIdxRun() const { return m_current_firmware_run.m_firmare_idx; };
std::unordered_map<int, DevAmsSystemFirmware> GetSuppotedFirmwares() const { return m_firmwares;}; // Orca: unordered (mirrored by AMSSetting.cpp)
bool IsSwitching() const { return m_status == "SWITCHING";};
bool IsIdle() const { return m_status == "IDLE";};
// commands
int CrtlSwitchFirmware(int firmware_idx);
// setters
void Reset();
void ParseFirmwareSwitch(const nlohmann::json& j);
private:
DevFilaSystem* m_owner = nullptr;
std::string m_status;
DevAmsSystemFirmware m_current_firmware_run;
DevAmsSystemFirmware m_current_firmware_sel;
std::unordered_map<int, DevAmsSystemFirmware> m_firmwares; // Orca: unordered (mirrored by AMSSetting.cpp)
DevCtrlInfo m_ctrl_switching;
};
}// namespace Slic3r