mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +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>
|
||||
|
||||
@@ -46,6 +46,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
||||
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::ps_showMainPage);
|
||||
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::ps_tabChanged);
|
||||
|
||||
// use version signal as trigger for completion
|
||||
this->ps_loadedUpdateInfo(true); // defaults from settings, overridden by signal/slot when changed
|
||||
@@ -405,6 +406,14 @@ void CSwiftLauncher::ps_showMainPage()
|
||||
this->ui->sw_SwiftLauncher->setCurrentWidget(this->ui->pg_SwiftLauncherMain);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_tabChanged(int current)
|
||||
{
|
||||
if (current == static_cast<int>(PageUpdates))
|
||||
{
|
||||
ui->comp_DataUpdates->display();
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_showLogPage()
|
||||
{
|
||||
this->ui->sw_SwiftLauncher->setCurrentWidget(this->ui->pg_SwiftLauncherLog);
|
||||
|
||||
@@ -40,6 +40,16 @@ class CSwiftLauncher :
|
||||
Q_INTERFACES(BlackGui::IMainWindowAccess)
|
||||
|
||||
public:
|
||||
|
||||
//! Pages
|
||||
enum Pages
|
||||
{
|
||||
PageNews = 0,
|
||||
PageWindowType,
|
||||
PageCoreMode,
|
||||
PageUpdates
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
explicit CSwiftLauncher(QWidget *parent = nullptr);
|
||||
|
||||
@@ -151,6 +161,9 @@ private slots:
|
||||
//! Show set main page
|
||||
void ps_showMainPage();
|
||||
|
||||
//! Tab changed
|
||||
void ps_tabChanged(int current);
|
||||
|
||||
//! Show the log page
|
||||
void ps_showLogPage();
|
||||
};
|
||||
|
||||
@@ -413,7 +413,26 @@
|
||||
<attribute name="label">
|
||||
<string>Check for updates</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<layout class="QVBoxLayout" name="vl_Updates">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CInfoBarWebReadersStatusSmallComponent" name="comp_InfoBar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<zorder>fr_SoftwareUpdates</zorder>
|
||||
<zorder>fr_SoftwareUpdates</zorder>
|
||||
<zorder>fr_SoftwareUpdates</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_SoftwareUpdates">
|
||||
<property name="frameShape">
|
||||
@@ -422,7 +441,19 @@
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<layout class="QGridLayout" name="gl_Version">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Channel">
|
||||
<property name="text">
|
||||
@@ -533,17 +564,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CInfoBarWebReadersStatusSmallComponent" name="comp_InfoBar">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CDbLoadOverviewComponent" name="fr_DataUpdates">
|
||||
<widget class="BlackGui::Components::CDbLoadOverviewComponent" name="comp_DataUpdates">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@@ -749,7 +770,19 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_SwiftLauncherLog">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="vl_SwiftLauncerLog">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CLogComponent" name="fr_SwiftLauncherLog">
|
||||
<property name="frameShape">
|
||||
|
||||
Reference in New Issue
Block a user