mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 22:29:13 +08:00
Ref T164, show (by LED) when consolidating data
* added LED in info bar * signal in background updater and * connecting them
This commit is contained in:
@@ -45,6 +45,7 @@ namespace BlackCore
|
|||||||
if (!this->doWorkCheck()) { return; }
|
if (!this->doWorkCheck()) { return; }
|
||||||
m_inWork = true;
|
m_inWork = true;
|
||||||
|
|
||||||
|
emit this->consolidating(true);
|
||||||
const int cycle = m_cycle;
|
const int cycle = m_cycle;
|
||||||
switch (cycle)
|
switch (cycle)
|
||||||
{
|
{
|
||||||
@@ -72,6 +73,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
++m_cycle %= 5;
|
++m_cycle %= 5;
|
||||||
m_inWork = false;
|
m_inWork = false;
|
||||||
|
emit this->consolidating(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBackgroundDataUpdater::triggerInfoReads()
|
void CBackgroundDataUpdater::triggerInfoReads()
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ namespace BlackCore
|
|||||||
*/
|
*/
|
||||||
class BLACKCORE_EXPORT CBackgroundDataUpdater : public BlackMisc::CContinuousWorker
|
class BLACKCORE_EXPORT CBackgroundDataUpdater : public BlackMisc::CContinuousWorker
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! Log categories
|
//! Log categories
|
||||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
@@ -35,6 +37,10 @@ namespace BlackCore
|
|||||||
//! Constructor
|
//! Constructor
|
||||||
CBackgroundDataUpdater(QObject *owner);
|
CBackgroundDataUpdater(QObject *owner);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! Consolidation
|
||||||
|
void consolidating(bool started);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_cycle = 0; //!< cycle
|
int m_cycle = 0; //!< cycle
|
||||||
bool m_inWork = false; //!< indicates a running update
|
bool m_inWork = false; //!< indicates a running update
|
||||||
|
|||||||
@@ -57,11 +57,18 @@ namespace BlackGui
|
|||||||
m_timer.stop();
|
m_timer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInfoBarWebReadersStatusBase::consolidationRunning(bool running)
|
||||||
|
{
|
||||||
|
if (!this->led_Consolidation) { return; }
|
||||||
|
this->led_Consolidation->setOn(running);
|
||||||
|
}
|
||||||
|
|
||||||
void CInfoBarWebReadersStatusBase::initLeds()
|
void CInfoBarWebReadersStatusBase::initLeds()
|
||||||
{
|
{
|
||||||
CLedWidget::LedShape shape = CLedWidget::Rounded;
|
CLedWidget::LedShape shape = CLedWidget::Rounded;
|
||||||
this->led_SwiftDb->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "DB online", "DB offline", 14);
|
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);
|
||||||
|
if (this->led_Consolidation) { this->led_Consolidation->setValues(CLedWidget::Blue, CLedWidget::Black, shape, "consolidation running", "idle", 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);
|
||||||
this->led_IcaoAirline->setValues(CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Red, shape, "reading", "idle", "failed", 14);
|
this->led_IcaoAirline->setValues(CLedWidget::Yellow, CLedWidget::Black, CLedWidget::Red, shape, "reading", "idle", "failed", 14);
|
||||||
@@ -93,6 +100,14 @@ namespace BlackGui
|
|||||||
this->led_DataReady->setOn(allData);
|
this->led_DataReady->setOn(allData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInfoBarWebReadersStatusBase::showConsolidationStatus(bool show)
|
||||||
|
{
|
||||||
|
if (this->led_Consolidation)
|
||||||
|
{
|
||||||
|
this->led_Consolidation->setVisible(show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CInfoBarWebReadersStatusBase::setLedReadStates(const QList<CLedWidget *> &leds, CEntityFlags::ReadState readState)
|
void CInfoBarWebReadersStatusBase::setLedReadStates(const QList<CLedWidget *> &leds, CEntityFlags::ReadState readState)
|
||||||
{
|
{
|
||||||
for (CLedWidget *led : leds)
|
for (CLedWidget *led : leds)
|
||||||
@@ -146,10 +161,11 @@ namespace BlackGui
|
|||||||
sGui->getWebDataServices()->getCountriesCount() > 0;
|
sGui->getWebDataServices()->getCountriesCount() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoBarWebReadersStatusBase::setLeds(CLedWidget *ledDb, CLedWidget *dataReady, CLedWidget *ledIcaoAircraft, CLedWidget *ledIcaoAirline, CLedWidget *ledCountries, CLedWidget *ledDistributors, CLedWidget *ledLiveries, CLedWidget *ledModels)
|
void CInfoBarWebReadersStatusBase::setLeds(CLedWidget *ledDb, CLedWidget *ledDataReady, CLedWidget *ledConsolidation, CLedWidget *ledIcaoAircraft, CLedWidget *ledIcaoAirline, CLedWidget *ledCountries, CLedWidget *ledDistributors, CLedWidget *ledLiveries, CLedWidget *ledModels)
|
||||||
{
|
{
|
||||||
this->led_SwiftDb = ledDb;
|
this->led_SwiftDb = ledDb;
|
||||||
this->led_DataReady = dataReady;
|
this->led_DataReady = ledDataReady;
|
||||||
|
this->led_Consolidation = ledConsolidation;
|
||||||
this->led_IcaoAircraft = ledIcaoAircraft;
|
this->led_IcaoAircraft = ledIcaoAircraft;
|
||||||
this->led_IcaoAirline = ledIcaoAirline;
|
this->led_IcaoAirline = ledIcaoAirline;
|
||||||
this->led_Countries = ledCountries;
|
this->led_Countries = ledCountries;
|
||||||
@@ -162,11 +178,17 @@ namespace BlackGui
|
|||||||
CInfoBarWebReadersStatusBase(parent), ui(new Ui::CInfoBarWebReadersStatusComponent)
|
CInfoBarWebReadersStatusBase(parent), ui(new Ui::CInfoBarWebReadersStatusComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setLeds(ui->led_SwiftDb, ui->led_DataReady, ui->led_IcaoAircraft, ui->led_IcaoAirline, ui->led_Countries, ui->led_Distributors, ui->led_Liveries, ui->led_Models);
|
this->setLeds(ui->led_SwiftDb, ui->led_DataReady, ui->led_Consolidation, ui->led_IcaoAircraft, ui->led_IcaoAirline, ui->led_Countries, ui->led_Distributors, ui->led_Liveries, ui->led_Models);
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
CInfoBarWebReadersStatusComponent::~CInfoBarWebReadersStatusComponent()
|
CInfoBarWebReadersStatusComponent::~CInfoBarWebReadersStatusComponent()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void CInfoBarWebReadersStatusComponent::showConsolidationStatus(bool show)
|
||||||
|
{
|
||||||
|
ui->lbl_Consolidation->setVisible(show);
|
||||||
|
CInfoBarWebReadersStatusBase::showConsolidationStatus(show);
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ namespace BlackGui
|
|||||||
//!Destructor
|
//!Destructor
|
||||||
virtual ~CInfoBarWebReadersStatusBase();
|
virtual ~CInfoBarWebReadersStatusBase();
|
||||||
|
|
||||||
//! Init the LEDs
|
//! Consolidation is running
|
||||||
void initLeds();
|
virtual void consolidationRunning(bool running);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CInfoBarWebReadersStatusBase(QWidget *parent = nullptr);
|
explicit CInfoBarWebReadersStatusBase(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Init the LEDs
|
||||||
|
void initLeds();
|
||||||
|
|
||||||
//! Init
|
//! Init
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ namespace BlackGui
|
|||||||
bool hasAllData() const;
|
bool hasAllData() const;
|
||||||
|
|
||||||
//! Initial setup of leds
|
//! Initial setup of leds
|
||||||
void setLeds(BlackGui::CLedWidget *ledDb, BlackGui::CLedWidget *dataReady,
|
void setLeds(BlackGui::CLedWidget *ledDb, BlackGui::CLedWidget *ledDataReady, CLedWidget *ledConsolidation,
|
||||||
BlackGui::CLedWidget *led_IcaoAircraft, BlackGui::CLedWidget *led_IcaoAirline, BlackGui::CLedWidget *led_Countries,
|
BlackGui::CLedWidget *led_IcaoAircraft, BlackGui::CLedWidget *led_IcaoAirline, BlackGui::CLedWidget *led_Countries,
|
||||||
BlackGui::CLedWidget *led_Distributors, BlackGui::CLedWidget *led_Liveries, BlackGui::CLedWidget *led_Models);
|
BlackGui::CLedWidget *led_Distributors, BlackGui::CLedWidget *led_Liveries, BlackGui::CLedWidget *led_Models);
|
||||||
|
|
||||||
@@ -75,10 +78,14 @@ namespace BlackGui
|
|||||||
//! Check server status
|
//! Check server status
|
||||||
void checkServerAndData();
|
void checkServerAndData();
|
||||||
|
|
||||||
|
//! Show the consolidation status
|
||||||
|
virtual void showConsolidationStatus(bool show);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTimer m_timer { this }; //!< check timer
|
QTimer m_timer { this }; //!< check timer
|
||||||
BlackGui::CLedWidget *led_SwiftDb = nullptr;
|
BlackGui::CLedWidget *led_SwiftDb = nullptr;
|
||||||
BlackGui::CLedWidget *led_DataReady = nullptr;
|
BlackGui::CLedWidget *led_DataReady = nullptr;
|
||||||
|
BlackGui::CLedWidget *led_Consolidation = nullptr;
|
||||||
BlackGui::CLedWidget *led_IcaoAircraft = nullptr;
|
BlackGui::CLedWidget *led_IcaoAircraft = nullptr;
|
||||||
BlackGui::CLedWidget *led_IcaoAirline = nullptr;
|
BlackGui::CLedWidget *led_IcaoAirline = nullptr;
|
||||||
BlackGui::CLedWidget *led_Countries = nullptr;
|
BlackGui::CLedWidget *led_Countries = nullptr;
|
||||||
@@ -99,6 +106,9 @@ namespace BlackGui
|
|||||||
//!Destructor
|
//!Destructor
|
||||||
virtual ~CInfoBarWebReadersStatusComponent();
|
virtual ~CInfoBarWebReadersStatusComponent();
|
||||||
|
|
||||||
|
//! Show the consolidation status
|
||||||
|
virtual void showConsolidationStatus(bool show) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CInfoBarWebReadersStatusComponent> ui;
|
QScopedPointer<Ui::CInfoBarWebReadersStatusComponent> ui;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>632</width>
|
<width>691</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Frame</string>
|
<string>Web reader status bar</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
@@ -58,6 +58,19 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::CLedWidget" name="led_DataReady" native="true"/>
|
<widget class="BlackGui::CLedWidget" name="led_DataReady" native="true"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lbl_Consolidation">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>consolidation</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>cons.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::CLedWidget" name="led_Consolidation" native="true"/>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hs_Spacer">
|
<spacer name="hs_Spacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace BlackGui
|
|||||||
ui(new Ui::CInfoBarWebReadersStatusSmallComponent)
|
ui(new Ui::CInfoBarWebReadersStatusSmallComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
this->setLeds(ui->led_SwiftDb, ui->led_DataReady, ui->led_IcaoAircraft, ui->led_IcaoAirline, ui->led_Countries, ui->led_Distributors, ui->led_Liveries, ui->led_Models);
|
this->setLeds(ui->led_SwiftDb, ui->led_DataReady, nullptr, ui->led_IcaoAircraft, ui->led_IcaoAirline, ui->led_Countries, ui->led_Distributors, ui->led_Liveries, ui->led_Models);
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ void CSwiftData::consolidationSettingChanged()
|
|||||||
if (m_updater)
|
if (m_updater)
|
||||||
{
|
{
|
||||||
ui->comp_MainInfoArea->getDataSettingsComponent()->setBackgroundUpdater(nullptr);
|
ui->comp_MainInfoArea->getDataSettingsComponent()->setBackgroundUpdater(nullptr);
|
||||||
|
disconnect(m_updater.data());
|
||||||
m_updater->abandonAndWait();
|
m_updater->abandonAndWait();
|
||||||
m_updater = nullptr;
|
m_updater = nullptr;
|
||||||
}
|
}
|
||||||
@@ -170,6 +171,7 @@ void CSwiftData::consolidationSettingChanged()
|
|||||||
if (!m_updater)
|
if (!m_updater)
|
||||||
{
|
{
|
||||||
m_updater = m_updater.create(this);
|
m_updater = m_updater.create(this);
|
||||||
|
connect(m_updater.data(), &CBackgroundDataUpdater::consolidating, ui->comp_InfoBar, &CInfoBarWebReadersStatusComponent::consolidationRunning, Qt::QueuedConnection);
|
||||||
m_updater->start(QThread::LowestPriority);
|
m_updater->start(QThread::LowestPriority);
|
||||||
ui->comp_MainInfoArea->getDataSettingsComponent()->setBackgroundUpdater(m_updater.data());
|
ui->comp_MainInfoArea->getDataSettingsComponent()->setBackgroundUpdater(m_updater.data());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user