refs #709, launcher GUI finetuning

* don`t always init caches, only when needed
* init caches when component is 1st displayed
* smaller LEDs
This commit is contained in:
Klaus Basan
2016-07-18 16:35:12 +02:00
parent 90c3c35609
commit 435f345cc6
7 changed files with 98 additions and 31 deletions

View File

@@ -43,12 +43,25 @@ namespace BlackGui
connect(ui->pb_ReloadDistributors, &QPushButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::ps_dataLoaded);
QTimer::singleShot(2000, this, &CDbLoadOverviewComponent::ps_setValues);
// QTimer::singleShot(2000, this, &CDbLoadOverviewComponent::ps_setValues);
}
CDbLoadOverviewComponent::~CDbLoadOverviewComponent()
{ }
void CDbLoadOverviewComponent::display()
{
if (this->isInitialized())
{
this->ps_setValues();
}
else
{
this->showLoading();
QTimer::singleShot(1000, this, &CDbLoadOverviewComponent::ps_setValues);
}
}
void CDbLoadOverviewComponent::ps_setValues()
{
if (!sGui) { return; }
@@ -87,6 +100,7 @@ namespace BlackGui
const QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl();
ui->lbl_DatabaseUrl->setText(urlHtml.arg(url));
ui->lbl_DatabaseUrl->setToolTip(url);
if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
}
void CDbLoadOverviewComponent::showLoading()
@@ -100,6 +114,11 @@ namespace BlackGui
this->m_loadIndicator->startAnimation(true);
}
bool CDbLoadOverviewComponent::isInitialized() const
{
return !ui->le_AircraftIcaoCacheCount->text().isEmpty();
}
QString CDbLoadOverviewComponent::formattedTimestamp(const QDateTime &dateTime)
{
if (!dateTime.isValid()) { return "-"; }
@@ -152,7 +171,6 @@ namespace BlackGui
if (!CEntityFlags::anySwiftDbEntity(entity)) { return; }
if (state == CEntityFlags::ReadFinished || state == CEntityFlags::ReadFinishedRestricted)
{
if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
this->m_reloading = false;
this->ps_setValues();
}