mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace BlackGui
|
||||
//! Destructor
|
||||
virtual ~CDbLoadOverviewComponent();
|
||||
|
||||
//! Initialize
|
||||
void display();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbLoadOverviewComponent> ui;
|
||||
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||
@@ -45,6 +48,9 @@ namespace BlackGui
|
||||
//! Show loading
|
||||
void showLoading();
|
||||
|
||||
//! Values at least set once
|
||||
bool isInitialized() const;
|
||||
|
||||
//! Timestamp
|
||||
static QString formattedTimestamp(const QDateTime &dateTime);
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace BlackGui
|
||||
|
||||
void CInfoBarWebReadersStatusBase::initLeds()
|
||||
{
|
||||
CLedWidget::LedShape shape = CLedWidget::Circle;
|
||||
CLedWidget::LedShape shape = CLedWidget::Rounded;
|
||||
this->led_SwiftDb->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "DB online", "DB offline", 14);
|
||||
this->led_DataReady->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "all data ready", "data missing", 14);
|
||||
|
||||
this->led_IcaoAircraft->setValues(CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Red, shape, "reading", "idle", "failed", 14);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>381</width>
|
||||
<width>340</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -42,19 +42,6 @@
|
||||
<item>
|
||||
<widget class="BlackGui::CLedWidget" name="led_SwiftDb" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_DataReady">
|
||||
<property name="toolTip">
|
||||
<string>Mappings ready</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>| data</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::CLedWidget" name="led_DataReady" native="true"/>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user