Don't print "connected to" after disconnection.

This commit is contained in:
Bartosz Taudul 2020-11-18 01:09:01 +01:00
parent 3fe4e7c3a7
commit 78fd523a4b

View File

@ -1345,10 +1345,11 @@ bool View::DrawConnection()
{
const auto ty = ImGui::GetFontSize();
const auto cs = ty * 0.9f;
const auto isConnected = m_worker.IsConnected();
{
std::shared_lock<std::shared_mutex> lock( m_worker.GetMbpsDataLock() );
TextFocused( "Connected to:", m_worker.GetAddr().c_str() );
TextFocused( isConnected ? "Connected to:" : "Disconnected:", m_worker.GetAddr().c_str() );
const auto& mbpsVector = m_worker.GetMbpsData();
const auto mbps = mbpsVector.back();
char buf[64];
@ -1375,7 +1376,7 @@ bool View::DrawConnection()
}
const auto wpos = ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin();
ImGui::GetWindowDrawList()->AddCircleFilled( wpos + ImVec2( 1 + cs * 0.5, 3 + ty * 1.75 ), cs * 0.5, m_worker.IsConnected() ? 0xFF2222CC : 0xFF444444, 10 );
ImGui::GetWindowDrawList()->AddCircleFilled( wpos + ImVec2( 1 + cs * 0.5, 3 + ty * 1.75 ), cs * 0.5, isConnected ? 0xFF2222CC : 0xFF444444, 10 );
{
std::shared_lock<std::shared_mutex> lock( m_worker.GetDataLock() );