FIX: hyperlink style and size of status label in media panel
Change-Id: I06431002ef7c86f6992c4c3cc48932503e2aab00
This commit is contained in:
parent
0239cf34a1
commit
17076cc1bd
|
@ -95,7 +95,7 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||||
if (m_next_retry.IsValid())
|
if (m_next_retry.IsValid())
|
||||||
Play();
|
Play();
|
||||||
else
|
else
|
||||||
SetStatus("");
|
SetStatus("", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaPlayCtrl::Play()
|
void MediaPlayCtrl::Play()
|
||||||
|
@ -108,10 +108,12 @@ void MediaPlayCtrl::Play()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_machine.empty()) {
|
if (m_machine.empty()) {
|
||||||
|
Stop();
|
||||||
SetStatus(_L("Initialize failed (No Device)!"));
|
SetStatus(_L("Initialize failed (No Device)!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!m_camera_exists) {
|
if (!m_camera_exists) {
|
||||||
|
Stop();
|
||||||
SetStatus(_L("Initialize failed (No Camera Device)!"));
|
SetStatus(_L("Initialize failed (No Camera Device)!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,6 +143,7 @@ void MediaPlayCtrl::Play()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_lan_mode) {
|
if (m_lan_mode) {
|
||||||
|
Stop();
|
||||||
SetStatus(m_lan_passwd.empty()
|
SetStatus(m_lan_passwd.empty()
|
||||||
? _L("Initialize failed (Not supported with LAN-only mode)!")
|
? _L("Initialize failed (Not supported with LAN-only mode)!")
|
||||||
: _L("Initialize failed (Not accessible in LAN-only mode)!"));
|
: _L("Initialize failed (Not accessible in LAN-only mode)!"));
|
||||||
|
@ -148,6 +151,7 @@ void MediaPlayCtrl::Play()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_tutk_support) { // not support tutk
|
if (!m_tutk_support) { // not support tutk
|
||||||
|
Stop();
|
||||||
SetStatus(_L("Initialize failed (Not supported without remote video tunnel)!"));
|
SetStatus(_L("Initialize failed (Not supported without remote video tunnel)!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +193,7 @@ void MediaPlayCtrl::Stop()
|
||||||
m_tasks.push_back("<stop>");
|
m_tasks.push_back("<stop>");
|
||||||
m_cond.notify_all();
|
m_cond.notify_all();
|
||||||
m_last_state = MEDIASTATE_IDLE;
|
m_last_state = MEDIASTATE_IDLE;
|
||||||
SetStatus(_L("Stopped."));
|
SetStatus(_L("Stopped."), false);
|
||||||
if (m_failed_code >= 100) // not keep retry on local error
|
if (m_failed_code >= 100) // not keep retry on local error
|
||||||
m_next_retry = wxDateTime();
|
m_next_retry = wxDateTime();
|
||||||
}
|
}
|
||||||
|
@ -210,7 +214,7 @@ void MediaPlayCtrl::TogglePlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaPlayCtrl::SetStatus(wxString const& msg2)
|
void MediaPlayCtrl::SetStatus(wxString const &msg2, bool hyperlink)
|
||||||
{
|
{
|
||||||
auto msg = wxString::Format(msg2, m_failed_code);
|
auto msg = wxString::Format(msg2, m_failed_code);
|
||||||
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::SetStatus: " << msg.ToUTF8().data();
|
BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::SetStatus: " << msg.ToUTF8().data();
|
||||||
|
@ -221,10 +225,11 @@ void MediaPlayCtrl::SetStatus(wxString const& msg2)
|
||||||
#endif // __WXMSW__
|
#endif // __WXMSW__
|
||||||
m_label_status->SetLabel(msg);
|
m_label_status->SetLabel(msg);
|
||||||
long style = m_label_status->GetWindowStyle() & ~LB_HYPERLINK;
|
long style = m_label_status->GetWindowStyle() & ~LB_HYPERLINK;
|
||||||
if (m_failed_code && msg != msg2) {
|
if (hyperlink) {
|
||||||
style |= LB_HYPERLINK;
|
style |= LB_HYPERLINK;
|
||||||
}
|
}
|
||||||
m_label_status->SetWindowStyle(style);
|
m_label_status->SetWindowStyle(style);
|
||||||
|
m_label_status->InvalidateBestSize();
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +295,7 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent& event)
|
||||||
m_failed_code = m_media_ctrl->GetLastError();
|
m_failed_code = m_media_ctrl->GetLastError();
|
||||||
if (size.GetWidth() > 1000) {
|
if (size.GetWidth() > 1000) {
|
||||||
m_last_state = state;
|
m_last_state = state;
|
||||||
SetStatus(_L("Playing..."));
|
SetStatus(_L("Playing..."), false);
|
||||||
m_failed_retry = 0;
|
m_failed_retry = 0;
|
||||||
boost::unique_lock lock(m_mutex);
|
boost::unique_lock lock(m_mutex);
|
||||||
m_tasks.push_back("<play>");
|
m_tasks.push_back("<play>");
|
||||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
||||||
|
|
||||||
void TogglePlay();
|
void TogglePlay();
|
||||||
|
|
||||||
void SetStatus(wxString const & msg);
|
void SetStatus(wxString const &msg, bool hyperlink = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void media_proc();
|
void media_proc();
|
||||||
|
|
|
@ -109,6 +109,8 @@ Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long st
|
||||||
|
|
||||||
void Label::SetWindowStyleFlag(long style)
|
void Label::SetWindowStyleFlag(long style)
|
||||||
{
|
{
|
||||||
|
if (style == GetWindowStyle())
|
||||||
|
return;
|
||||||
wxStaticText::SetWindowStyleFlag(style);
|
wxStaticText::SetWindowStyleFlag(style);
|
||||||
if (style & LB_HYPERLINK) {
|
if (style & LB_HYPERLINK) {
|
||||||
this->color = GetForegroundColour();
|
this->color = GetForegroundColour();
|
||||||
|
|
Loading…
Reference in New Issue