refs #325, reduced loading in users component

This commit is contained in:
Klaus Basan
2014-09-16 22:18:20 +02:00
parent 530d4b89ef
commit d9cc02844d
2 changed files with 27 additions and 0 deletions

View File

@@ -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());
}

View File

@@ -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();