mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-10 22:12:49 +00:00
CrealityPrint: add printer model name and detection UI
Add model_name() to map firmware model codes (F008, F012, F021) to human-readable names (K2 Plus, K2 Pro, K2). Update the send dialog init() to detect multi-color support and show a group box with the printer name. Signed-off-by: Igor Mammedov <niallain@gmail.com>
This commit is contained in:
@@ -967,6 +967,26 @@ CrealityPrintHostSendDialog::CrealityPrintHostSendDialog(const fs::path&
|
||||
void CrealityPrintHostSendDialog::init()
|
||||
{
|
||||
PrintHostSendDialog::init();
|
||||
|
||||
auto* creality_host = static_cast<CrealityPrint*>(m_printhost);
|
||||
bool multi_color;
|
||||
std::string printer_name;
|
||||
{
|
||||
wxBusyCursor wait;
|
||||
multi_color = creality_host->supports_multi_color_print();
|
||||
if (multi_color)
|
||||
printer_name = creality_host->model_name();
|
||||
}
|
||||
if (!multi_color)
|
||||
return;
|
||||
|
||||
auto* group_box = new wxStaticBox(this, wxID_ANY,
|
||||
wxString::Format(_L("Printer: %s"), printer_name));
|
||||
auto* group_sizer = new wxStaticBoxSizer(group_box, wxVERTICAL);
|
||||
content_sizer->Add(group_sizer, 0, wxEXPAND);
|
||||
|
||||
this->Layout();
|
||||
this->Fit();
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> CrealityPrintHostSendDialog::extendedInfo() const
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "CrealityPrint.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <exception>
|
||||
#include <boost/format.hpp>
|
||||
@@ -262,6 +263,20 @@ bool CrealityPrint::supports_multi_color_print() const
|
||||
|| m_model == "F021"; // K2
|
||||
}
|
||||
|
||||
std::string CrealityPrint::model_name() const
|
||||
{
|
||||
static const std::map<std::string, std::string> names = {
|
||||
{"F008", "K2 Plus"},
|
||||
{"F012", "K2 Pro"},
|
||||
{"F021", "K2"},
|
||||
};
|
||||
query_model();
|
||||
if (m_model.empty())
|
||||
return "unreachable";
|
||||
auto it = names.find(m_model);
|
||||
return it != names.end() ? it->second : "unknown (" + m_model + ")";
|
||||
}
|
||||
|
||||
std::string CrealityPrint::query_boxes_info() const
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const override;
|
||||
bool supports_multi_color_print() const;
|
||||
std::string query_boxes_info() const;
|
||||
std::string model_name() const;
|
||||
|
||||
protected:
|
||||
virtual void set_auth(Http& http) const;
|
||||
|
||||
Reference in New Issue
Block a user