mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #325, reduced loading in users component
This commit is contained in:
@@ -30,6 +30,18 @@ namespace BlackGui
|
||||
delete ui;
|
||||
}
|
||||
|
||||
int CUserComponent::countClients() const
|
||||
{
|
||||
Q_ASSERT(this->ui->tvp_Clients);
|
||||
return this->ui->tvp_Clients->rowCount();
|
||||
}
|
||||
|
||||
int CUserComponent::countUsers() const
|
||||
{
|
||||
Q_ASSERT(this->ui->tvp_AllUsers);
|
||||
return this->ui->tvp_AllUsers->rowCount();
|
||||
}
|
||||
|
||||
void CUserComponent::update()
|
||||
{
|
||||
Q_ASSERT(this->ui->tvp_AllUsers);
|
||||
@@ -38,6 +50,15 @@ namespace BlackGui
|
||||
|
||||
if (this->getIContextNetwork()->isConnected())
|
||||
{
|
||||
bool withData = countUsers() > 0 || countClients() > 0;
|
||||
if (withData && !isVisibleWidget())
|
||||
{
|
||||
// KWB remove: qDebug() will be removed soo
|
||||
qDebug() << this->objectName() << "Skipping update";
|
||||
return;
|
||||
}
|
||||
|
||||
// load data
|
||||
this->ui->tvp_Clients->updateContainer(this->getIContextNetwork()->getOtherClients());
|
||||
this->ui->tvp_AllUsers->updateContainer(this->getIContextNetwork()->getUsers());
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ namespace BlackGui
|
||||
//! Timer for updating
|
||||
CTimerBasedComponent *getTimerComponent() { return this->m_timerComponent; }
|
||||
|
||||
//! Number of clients
|
||||
int countClients() const;
|
||||
|
||||
//! Number of users
|
||||
int countUsers() const;
|
||||
|
||||
public slots:
|
||||
//! Update users
|
||||
void update();
|
||||
|
||||
Reference in New Issue
Block a user