OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::uiDeviceUpdateVersion Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceTab/uiDeviceUpdateVersion.h>

Inheritance diagram for Slic3r::GUI::uiDeviceUpdateVersion:
Collaboration diagram for Slic3r::GUI::uiDeviceUpdateVersion:

Public Member Functions

 uiDeviceUpdateVersion (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~uiDeviceUpdateVersion ()=default
void UpdateInfo (const DevFirmwareVersionInfo &info)

Private Member Functions

void CreateWidgets ()
void SetName (const wxString &str)
void SetSerial (const wxString &str)
void SetVersion (const wxString &cur_version, const wxString &latest_version)

Private Attributes

wxStaticText * m_dev_name
wxStaticText * m_dev_snl
wxStaticText * m_dev_version
wxStaticBitmap * m_dev_upgrade_indicator

Detailed Description

Constructor & Destructor Documentation

◆ uiDeviceUpdateVersion()

uiDeviceUpdateVersion::uiDeviceUpdateVersion ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
35 : wxPanel(parent, id, pos, size, style)
36{
37 SetBackgroundColour(*wxWHITE);
39}
#define style
Definition WipeTowerDialog.cpp:101
void CreateWidgets()
Definition uiDeviceUpdateVersion.cpp:75

References CreateWidgets(), and style.

Here is the call graph for this function:

◆ ~uiDeviceUpdateVersion()

Slic3r::GUI::uiDeviceUpdateVersion::~uiDeviceUpdateVersion ( )
default

Member Function Documentation

◆ CreateWidgets()

void uiDeviceUpdateVersion::CreateWidgets ( )
private
76{
77 m_dev_name = new wxStaticText(this, wxID_ANY, "-");
78 m_dev_snl = new wxStaticText(this, wxID_ANY, "-");
79 m_dev_version = new wxStaticText(this, wxID_ANY, "-");
80
81 wxStaticText* serial_text = new wxStaticText(this, wxID_ANY, _L(SERIAL_STR));
82 wxStaticText* version_text = new wxStaticText(this, wxID_ANY, _L(VERSION_STR));
83 wxStaticText *model_text = new wxStaticText(this, wxID_ANY, _L(MODEL_STR));
84
85 // Use bold font
86 wxFont font = Label::Head_14;
87 font.SetWeight(wxFONTWEIGHT_BOLD);
88 m_dev_name->SetFont(font);
89 serial_text->SetFont(font);
90 version_text->SetFont(font);
91 model_text->SetFont(font);
92 // The grid sizer
93 wxFlexGridSizer* grid_sizer = new wxFlexGridSizer(0, 2, 0, 0);
94 //grid_sizer->AddGrowableCol(1);
95 grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
96 grid_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
97
98 grid_sizer->Add(model_text, 0, wxALIGN_RIGHT | wxALL, FromDIP(5));
99 grid_sizer->Add(m_dev_name, 0, wxALL | wxEXPAND, FromDIP(5));
100 grid_sizer->Add(serial_text, 0, wxALIGN_RIGHT | wxALL, FromDIP(5));
101 grid_sizer->Add(m_dev_snl, 0, wxALL | wxEXPAND, FromDIP(5));
102
103 m_dev_upgrade_indicator = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(FromDIP(5), FromDIP(5)));
104 m_dev_upgrade_indicator->SetBitmap(ScalableBitmap(this, "monitor_upgrade_online", 5).bmp());
105
106 wxBoxSizer* version_hsizer = new wxBoxSizer(wxHORIZONTAL);
107 version_hsizer->Add(0, 0, 1, wxEXPAND, 0);
108 version_hsizer->Add(m_dev_upgrade_indicator, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5));
109 version_hsizer->Add(version_text, 0, wxALL, FromDIP(5));
110
111 grid_sizer->Add(version_hsizer, 0, wxEXPAND, 0);
112 grid_sizer->Add(m_dev_version, 0, wxEXPAND | wxALL, FromDIP(5));
113
114 // Updating
115 wxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
116 main_sizer->AddSpacer(FromDIP(40)); // Orca: top spacing above the firmware-info grid
117 main_sizer->Add(grid_sizer, 0, wxALIGN_LEFT, FromDIP(5));
118
119 SetSizer(main_sizer);
120 Layout();
121
122 wxGetApp().UpdateDarkUIWin(this);
123}
#define _L(s)
Definition OBJ.cpp:34
class WXDLLIMPEXP_FWD_CORE wxStaticText
Definition ProgressDialog.hpp:30
static wxFont Head_14
Definition Label.hpp:45
wxStaticText * m_dev_snl
Definition uiDeviceUpdateVersion.h:47
wxStaticText * m_dev_name
Definition uiDeviceUpdateVersion.h:46
wxStaticBitmap * m_dev_upgrade_indicator
Definition uiDeviceUpdateVersion.h:49
wxStaticText * m_dev_version
Definition uiDeviceUpdateVersion.h:48
#define MODEL_STR
Definition uiDeviceUpdateVersion.cpp:23
#define VERSION_STR
Definition uiDeviceUpdateVersion.cpp:25
#define SERIAL_STR
Definition uiDeviceUpdateVersion.cpp:24

References _L, Label::Head_14, m_dev_name, m_dev_snl, m_dev_upgrade_indicator, m_dev_version, MODEL_STR, SERIAL_STR, VERSION_STR, and wxStaticText.

Referenced by uiDeviceUpdateVersion().

Here is the caller graph for this function:

◆ SetName()

void Slic3r::GUI::uiDeviceUpdateVersion::SetName ( const wxString & str)
inlineprivate
41{ m_dev_name->SetLabel(str); };

References m_dev_name.

Referenced by UpdateInfo().

Here is the caller graph for this function:

◆ SetSerial()

void Slic3r::GUI::uiDeviceUpdateVersion::SetSerial ( const wxString & str)
inlineprivate
42{ m_dev_snl->SetLabel(str); };

References m_dev_snl.

Referenced by UpdateInfo().

Here is the caller graph for this function:

◆ SetVersion()

void uiDeviceUpdateVersion::SetVersion ( const wxString & cur_version,
const wxString & latest_version )
private
49{
50 if (cur_version.empty())
51 {
52 return;
53 }
54
55 if (!latest_version.empty() && (cur_version != latest_version))
56 {
57 const wxString& shown_ver = wxString::Format("%s->%s", cur_version, latest_version);
58 m_dev_version->SetLabel(shown_ver);
59 if (!m_dev_upgrade_indicator->IsShown())
60 {
61 m_dev_upgrade_indicator->Show(true);
62 }
63 }
64 else
65 {
66 const wxString& shown_ver = wxString::Format("%s(%s)", cur_version, _L("Latest version"));
67 m_dev_version->SetLabel(shown_ver);
68 if (m_dev_upgrade_indicator->IsShown())
69 {
71 }
72 }
73}

References _L, m_dev_upgrade_indicator, and m_dev_version.

Referenced by UpdateInfo().

Here is the caller graph for this function:

◆ UpdateInfo()

void uiDeviceUpdateVersion::UpdateInfo ( const DevFirmwareVersionInfo & info)
42{
43 SetName(I18N::translate(info.product_name));
44 SetSerial(info.sn);
45 SetVersion(info.sw_ver, info.sw_new_ver);
46}
void SetName(const wxString &str)
Definition uiDeviceUpdateVersion.h:41
void SetVersion(const wxString &cur_version, const wxString &latest_version)
Definition uiDeviceUpdateVersion.cpp:48
void SetSerial(const wxString &str)
Definition uiDeviceUpdateVersion.h:42
wxString translate(const char *s)
Definition I18N.hpp:47

References Slic3r::DevFirmwareVersionInfo::product_name, SetName(), SetSerial(), SetVersion(), Slic3r::DevFirmwareVersionInfo::sn, Slic3r::DevFirmwareVersionInfo::sw_new_ver, Slic3r::DevFirmwareVersionInfo::sw_ver, and Slic3r::GUI::I18N::translate().

Here is the call graph for this function:

Member Data Documentation

◆ m_dev_name

wxStaticText* Slic3r::GUI::uiDeviceUpdateVersion::m_dev_name
private

Referenced by CreateWidgets(), and SetName().

◆ m_dev_snl

wxStaticText* Slic3r::GUI::uiDeviceUpdateVersion::m_dev_snl
private

Referenced by CreateWidgets(), and SetSerial().

◆ m_dev_upgrade_indicator

wxStaticBitmap* Slic3r::GUI::uiDeviceUpdateVersion::m_dev_upgrade_indicator
private

Referenced by CreateWidgets(), and SetVersion().

◆ m_dev_version

wxStaticText* Slic3r::GUI::uiDeviceUpdateVersion::m_dev_version
private

Referenced by CreateWidgets(), and SetVersion().


The documentation for this class was generated from the following files: