mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +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(ui->pb_ReloadDistributors, &QPushButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
|
||||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::ps_dataLoaded);
|
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()
|
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()
|
void CDbLoadOverviewComponent::ps_setValues()
|
||||||
{
|
{
|
||||||
if (!sGui) { return; }
|
if (!sGui) { return; }
|
||||||
@@ -87,6 +100,7 @@ namespace BlackGui
|
|||||||
const QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl();
|
const QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl();
|
||||||
ui->lbl_DatabaseUrl->setText(urlHtml.arg(url));
|
ui->lbl_DatabaseUrl->setText(urlHtml.arg(url));
|
||||||
ui->lbl_DatabaseUrl->setToolTip(url);
|
ui->lbl_DatabaseUrl->setToolTip(url);
|
||||||
|
if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbLoadOverviewComponent::showLoading()
|
void CDbLoadOverviewComponent::showLoading()
|
||||||
@@ -100,6 +114,11 @@ namespace BlackGui
|
|||||||
this->m_loadIndicator->startAnimation(true);
|
this->m_loadIndicator->startAnimation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CDbLoadOverviewComponent::isInitialized() const
|
||||||
|
{
|
||||||
|
return !ui->le_AircraftIcaoCacheCount->text().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
QString CDbLoadOverviewComponent::formattedTimestamp(const QDateTime &dateTime)
|
QString CDbLoadOverviewComponent::formattedTimestamp(const QDateTime &dateTime)
|
||||||
{
|
{
|
||||||
if (!dateTime.isValid()) { return "-"; }
|
if (!dateTime.isValid()) { return "-"; }
|
||||||
@@ -152,7 +171,6 @@ namespace BlackGui
|
|||||||
if (!CEntityFlags::anySwiftDbEntity(entity)) { return; }
|
if (!CEntityFlags::anySwiftDbEntity(entity)) { return; }
|
||||||
if (state == CEntityFlags::ReadFinished || state == CEntityFlags::ReadFinishedRestricted)
|
if (state == CEntityFlags::ReadFinished || state == CEntityFlags::ReadFinishedRestricted)
|
||||||
{
|
{
|
||||||
if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
|
|
||||||
this->m_reloading = false;
|
this->m_reloading = false;
|
||||||
this->ps_setValues();
|
this->ps_setValues();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace BlackGui
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CDbLoadOverviewComponent();
|
virtual ~CDbLoadOverviewComponent();
|
||||||
|
|
||||||
|
//! Initialize
|
||||||
|
void display();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbLoadOverviewComponent> ui;
|
QScopedPointer<Ui::CDbLoadOverviewComponent> ui;
|
||||||
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
BlackGui::CLoadIndicator *m_loadIndicator = nullptr; //!< load indicator if needed
|
||||||
@@ -45,6 +48,9 @@ namespace BlackGui
|
|||||||
//! Show loading
|
//! Show loading
|
||||||
void showLoading();
|
void showLoading();
|
||||||
|
|
||||||
|
//! Values at least set once
|
||||||
|
bool isInitialized() const;
|
||||||
|
|
||||||
//! Timestamp
|
//! Timestamp
|
||||||
static QString formattedTimestamp(const QDateTime &dateTime);
|
static QString formattedTimestamp(const QDateTime &dateTime);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInfoBarWebReadersStatusBase::initLeds()
|
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_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);
|
this->led_IcaoAircraft->setValues(CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Red, shape, "reading", "idle", "failed", 14);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>381</width>
|
<width>340</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -42,19 +42,6 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::CLedWidget" name="led_SwiftDb" native="true"/>
|
<widget class="BlackGui::CLedWidget" name="led_SwiftDb" native="true"/>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="BlackGui::CLedWidget" name="led_DataReady" native="true"/>
|
<widget class="BlackGui::CLedWidget" name="led_DataReady" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
|||||||
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||||
connect(ui->tb_Database, &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_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::ps_showMainPage);
|
||||||
|
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::ps_tabChanged);
|
||||||
|
|
||||||
// use version signal as trigger for completion
|
// use version signal as trigger for completion
|
||||||
this->ps_loadedUpdateInfo(true); // defaults from settings, overridden by signal/slot when changed
|
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);
|
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()
|
void CSwiftLauncher::ps_showLogPage()
|
||||||
{
|
{
|
||||||
this->ui->sw_SwiftLauncher->setCurrentWidget(this->ui->pg_SwiftLauncherLog);
|
this->ui->sw_SwiftLauncher->setCurrentWidget(this->ui->pg_SwiftLauncherLog);
|
||||||
|
|||||||
@@ -40,6 +40,16 @@ class CSwiftLauncher :
|
|||||||
Q_INTERFACES(BlackGui::IMainWindowAccess)
|
Q_INTERFACES(BlackGui::IMainWindowAccess)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//! Pages
|
||||||
|
enum Pages
|
||||||
|
{
|
||||||
|
PageNews = 0,
|
||||||
|
PageWindowType,
|
||||||
|
PageCoreMode,
|
||||||
|
PageUpdates
|
||||||
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CSwiftLauncher(QWidget *parent = nullptr);
|
explicit CSwiftLauncher(QWidget *parent = nullptr);
|
||||||
|
|
||||||
@@ -151,6 +161,9 @@ private slots:
|
|||||||
//! Show set main page
|
//! Show set main page
|
||||||
void ps_showMainPage();
|
void ps_showMainPage();
|
||||||
|
|
||||||
|
//! Tab changed
|
||||||
|
void ps_tabChanged(int current);
|
||||||
|
|
||||||
//! Show the log page
|
//! Show the log page
|
||||||
void ps_showLogPage();
|
void ps_showLogPage();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -413,7 +413,26 @@
|
|||||||
<attribute name="label">
|
<attribute name="label">
|
||||||
<string>Check for updates</string>
|
<string>Check for updates</string>
|
||||||
</attribute>
|
</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>
|
<item>
|
||||||
<widget class="QFrame" name="fr_SoftwareUpdates">
|
<widget class="QFrame" name="fr_SoftwareUpdates">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
@@ -422,7 +441,19 @@
|
|||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</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">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lbl_Channel">
|
<widget class="QLabel" name="lbl_Channel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -533,17 +564,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Components::CInfoBarWebReadersStatusSmallComponent" name="comp_InfoBar">
|
<widget class="BlackGui::Components::CDbLoadOverviewComponent" name="comp_DataUpdates">
|
||||||
<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">
|
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -749,7 +770,19 @@ p, li { white-space: pre-wrap; }
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="pg_SwiftLauncherLog">
|
<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>
|
<item>
|
||||||
<widget class="BlackGui::Components::CLogComponent" name="fr_SwiftLauncherLog">
|
<widget class="BlackGui::Components::CLogComponent" name="fr_SwiftLauncherLog">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
|
|||||||
Reference in New Issue
Block a user