From 95bcd4c15b2bb8bf7c84c1fd570ac50f8d6e23ca Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 24 Apr 2019 13:38:25 +0200 Subject: [PATCH] Ref T632, filter out clients not in range --- src/blackgui/components/usercomponent.cpp | 13 ++++++++----- src/blackgui/components/usercomponent.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/blackgui/components/usercomponent.cpp b/src/blackgui/components/usercomponent.cpp index f05c3a306..42acf3d8e 100644 --- a/src/blackgui/components/usercomponent.cpp +++ b/src/blackgui/components/usercomponent.cpp @@ -6,18 +6,20 @@ * or distributed except according to the terms contained in the LICENSE file. */ -#include "blackcore/context/contextnetwork.h" -#include "blackcore/network.h" #include "blackgui/components/usercomponent.h" #include "blackgui/guiapplication.h" #include "blackgui/guiutility.h" #include "blackgui/views/clientview.h" #include "blackgui/views/userview.h" +#include "blackcore/context/contextnetwork.h" +#include "blackcore/network.h" +#include "blackmisc/network/userlist.h" #include "ui_usercomponent.h" #include #include +using namespace BlackMisc::Network; using namespace BlackGui; using namespace BlackGui::Views; using namespace BlackGui::Settings; @@ -62,7 +64,7 @@ namespace BlackGui void CUserComponent::update() { - if (!sGui || !sGui->getIContextNetwork()) { return; } + if (!sGui || sGui->isShuttingDown() || !sGui->getIContextNetwork()) { return; } Q_ASSERT(ui->tvp_AllUsers); Q_ASSERT(ui->tvp_Clients); @@ -76,8 +78,9 @@ namespace BlackGui } // load data - ui->tvp_Clients->updateContainer(sGui->getIContextNetwork()->getClients()); - ui->tvp_AllUsers->updateContainer(sGui->getIContextNetwork()->getUsers()); + const CUserList users = sGui->getIContextNetwork()->getUsers(); + ui->tvp_AllUsers->updateContainer(users); + ui->tvp_Clients->updateContainer(sGui->getIContextNetwork()->getClientsForCallsigns(users.getCallsigns())); } } diff --git a/src/blackgui/components/usercomponent.h b/src/blackgui/components/usercomponent.h index 25145a861..ea2e0f03d 100644 --- a/src/blackgui/components/usercomponent.h +++ b/src/blackgui/components/usercomponent.h @@ -39,7 +39,7 @@ namespace BlackGui explicit CUserComponent(QWidget *parent = nullptr); //! Destructor - virtual ~CUserComponent(); + virtual ~CUserComponent() override; //! Number of clients int countClients() const;