FIX: update the fan panel

jira: [STUDIO-10499]
Change-Id: I5b760946229ea1cb24802ddddce250cc276986d6
This commit is contained in:
xin.zhang 2025-02-18 17:07:15 +08:00 committed by lane.wei
parent 2004e769ce
commit 418370ca5c
3 changed files with 36 additions and 13 deletions

View File

@ -1530,7 +1530,7 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent)
m_switch_fan->SetBorderWidth(0);
m_switch_fan->SetCornerRadius(0);
m_switch_fan->SetFont(::Label::Body_10);
m_switch_fan->SetLabel(_L("panel"));
m_switch_fan->UseTextFan();
m_switch_fan->SetTextColor(
StateColor(std::make_pair(DISCONNECT_TEXT_COL, (int)StateColor::Disabled), std::make_pair(NORMAL_FAN_TEXT_COL, (int)StateColor::Normal)));
@ -2944,6 +2944,8 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj)
m_fan_control_popup->Hide();
}
obj->is_series_o() ? m_switch_fan->UseTextAirCondition() : m_switch_fan->UseTextFan();
//update cham fan
/*other*/

View File

@ -285,21 +285,23 @@ void FanSwitchButton::render(wxDC& dc)
if (icon.bmp().IsOk()) {
dc.DrawBitmap(icon.bmp(), pt);
pt.x += icon.GetBmpWidth() + FromDIP(9);
}
wxString fan_txt = _L("Fan");
dc.SetFont(::Label::Head_15);
pt.y = FromDIP(9);
dc.DrawText(fan_txt, pt);
pt.y = size.y / 2 + FromDIP(3);
wxString fan_num_txt = GetLabel();
dc.SetFont(::Label::Body_12);
dc.SetTextForeground(0x6b6b6b);
dc.DrawText(fan_num_txt, pt);
if (!m_text.empty())
{
if (m_text == _L("Fan")) {
dc.SetFont(::Label::Head_15);
pt.x += icon.GetBmpWidth() + FromDIP(9);
} else if (m_text == _L("Air Condition")) {
dc.SetFont(::Label::Head_14);
pt.x += icon.GetBmpWidth() + FromDIP(6);
}
auto text_size = dc.GetMultiLineTextExtent(m_text);
pt.y = (size.y - text_size.GetHeight()) / 2;
//dc.SetTextForeground(0x6b6b6b);
dc.DrawText(m_text, pt);
}
//int content_height = icon.GetBmpHeight() + textSize.y + m_padding;
/*int content_height = m_padding;
@ -361,6 +363,18 @@ void FanSwitchButton::setFanValue(int val)
}
}
void FanSwitchButton::UseTextFan() { SetText(_L("Fan")); }
void FanSwitchButton::UseTextAirCondition() { SetText(_L("Air Condition")); }
void FanSwitchButton::SetText(const wxString &text)
{
if (m_text != text)
{
m_text = text;
Refresh();
}
}
void FanSwitchButton::mouseDown(wxMouseEvent& event)
{
event.Skip();

View File

@ -64,6 +64,9 @@ public:
void Rescale();
void setFanValue(int val);
void UseTextFan();
void UseTextAirCondition();
private:
void messureSize();
void paintEvent(wxPaintEvent& evt);
@ -74,6 +77,8 @@ private:
void mouseLeaveWindow(wxMouseEvent& event);
void sendButtonEvent();
void SetText(const wxString &text);
DECLARE_EVENT_TABLE()
private:
@ -89,6 +94,8 @@ private:
int m_speed;
wxString labels[2];
wxString m_text;
StateColor text_color;
};