mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Ref T489, display read state in model component for livery, airline, aircraft
* similar to model component * distributor/countries too few data to benefit, hence not implemented
This commit is contained in:
committed by
Mat Sutcliffe
parent
ea7694248e
commit
e810dfecf5
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -30,19 +31,20 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CDbAircraftIcaoComponent::CDbAircraftIcaoComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CDbAircraftIcaoComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setViewWithIndicator(ui->tvp_AircraftIcao);
|
||||
ui->tvp_AircraftIcao->setResizeMode(CAircraftIcaoCodeView::ResizingOff);
|
||||
connect(ui->tvp_AircraftIcao, &CAircraftIcaoCodeView::requestNewBackendData, this, &CDbAircraftIcaoComponent::onReload);
|
||||
|
||||
ui->tvp_AircraftIcao->allowDragDrop(true, false);
|
||||
ui->tvp_AircraftIcao->setFilterWidget(ui->filter_AircraftIcao);
|
||||
ui->tvp_AircraftIcao->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(ui->tvp_AircraftIcao, &CAircraftIcaoCodeView::requestNewBackendData, this, &CDbAircraftIcaoComponent::onReload);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoComponent::onIcaoRead, Qt::QueuedConnection);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::entityDownloadProgress, this, &CDbAircraftIcaoComponent::onEntityDownloadProgress, Qt::QueuedConnection);
|
||||
this->onIcaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||
}
|
||||
|
||||
@@ -63,10 +65,24 @@ namespace BlackGui
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
if (!entity.testFlag(CEntityFlags::AircraftIcaoEntity) && CEntityFlags::isFinishedReadState(readState)) { return; }
|
||||
|
||||
if (CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
this->showOverlayHTMLMessage(QStringLiteral("Updating"), 2000);
|
||||
ui->tvp_AircraftIcao->updateContainerMaybeAsync(sGui->getWebDataServices()->getAircraftIcaoCodes());
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayHTMLMessage(u"Current state: " % CEntityFlags::stateToString(readState), 10000);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoComponent::onEntityDownloadProgress(CEntityFlags::Entity entity, int logId, int progress, qint64 current, qint64 max, const QUrl &url)
|
||||
{
|
||||
if (CEntityFlags::AircraftIcaoEntity != entity) { return; }
|
||||
this->showDownloadProgress(progress, current, max, url, 5000);
|
||||
Q_UNUSED(logId);
|
||||
}
|
||||
|
||||
void CDbAircraftIcaoComponent::onReload()
|
||||
|
||||
@@ -12,19 +12,18 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBAIRCRAFTICAOCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBAIRCRAFTICAOCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace BlackMisc { namespace Aviation { class CAircraftIcaoCode; } }
|
||||
namespace Ui { class CDbAircraftIcaoComponent; }
|
||||
namespace BlackMisc { namespace Aviation { class CAircraftIcaoCode; } }
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views { class CAircraftIcaoCodeView; }
|
||||
@@ -34,7 +33,7 @@ namespace BlackGui
|
||||
* DB aircraft ICAO data
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbAircraftIcaoComponent :
|
||||
public QFrame,
|
||||
public COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public CEnableForViewBasedIndicator
|
||||
{
|
||||
@@ -50,7 +49,6 @@ namespace BlackGui
|
||||
//! Get the view
|
||||
BlackGui::Views::CAircraftIcaoCodeView *view() const;
|
||||
|
||||
public slots:
|
||||
//! Filter by ICAO as default
|
||||
void filter(const BlackMisc::Aviation::CAircraftIcaoCode &icao);
|
||||
|
||||
@@ -58,6 +56,9 @@ namespace BlackGui
|
||||
//! ICAO codes have been read
|
||||
void onIcaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Download progress for an entity
|
||||
void onEntityDownloadProgress(BlackMisc::Network::CEntityFlags::Entity entity, int logId, int progress, qint64 current, qint64 max, const QUrl &url);
|
||||
|
||||
//! Reload models
|
||||
void onReload();
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -28,7 +29,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CDbAirlineIcaoComponent::CDbAirlineIcaoComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CDbAirlineIcaoComponent)
|
||||
{
|
||||
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
|
||||
@@ -43,6 +44,7 @@ namespace BlackGui
|
||||
|
||||
connect(ui->tvp_AirlineIcao, &CAirlineIcaoCodeView::requestNewBackendData, this, &CDbAirlineIcaoComponent::onReload);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoComponent::onIcaoRead, Qt::QueuedConnection);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::entityDownloadProgress, this, &CDbAirlineIcaoComponent::onEntityDownloadProgress, Qt::QueuedConnection);
|
||||
this->onIcaoRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAirlineIcaoCodesCount());
|
||||
}
|
||||
|
||||
@@ -58,10 +60,24 @@ namespace BlackGui
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->hasWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
if (!entity.testFlag(CEntityFlags::AirlineIcaoEntity) && CEntityFlags::isFinishedReadState(readState)) { return; }
|
||||
|
||||
if (CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
this->showOverlayHTMLMessage(QStringLiteral("Updating"), 2000);
|
||||
ui->tvp_AirlineIcao->updateContainerMaybeAsync(sGui->getWebDataServices()->getAirlineIcaoCodes());
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayHTMLMessage(u"Current state: " % CEntityFlags::stateToString(readState), 10000);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbAirlineIcaoComponent::onEntityDownloadProgress(CEntityFlags::Entity entity, int logId, int progress, qint64 current, qint64 max, const QUrl &url)
|
||||
{
|
||||
if (CEntityFlags::AirlineIcaoEntity != entity) { return; }
|
||||
this->showDownloadProgress(progress, current, max, url, 5000);
|
||||
Q_UNUSED(logId);
|
||||
}
|
||||
|
||||
void CDbAirlineIcaoComponent::onReload()
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBAIRLINEICAOCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBAIRLINEICAOCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
#include <QFrame>
|
||||
@@ -31,7 +32,7 @@ namespace BlackGui
|
||||
* Airline ICAO code
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbAirlineIcaoComponent :
|
||||
public QFrame,
|
||||
public COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public CEnableForViewBasedIndicator
|
||||
{
|
||||
@@ -51,6 +52,9 @@ namespace BlackGui
|
||||
//! ICAO codes have been read
|
||||
void onIcaoRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Download progress for an entity
|
||||
void onEntityDownloadProgress(BlackMisc::Network::CEntityFlags::Entity entity, int logId, int progress, qint64 current, qint64 max, const QUrl &url);
|
||||
|
||||
//! Reload models
|
||||
void onReload();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "ui_dbliverycomponent.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackGui::Views;
|
||||
@@ -26,7 +27,7 @@ namespace BlackGui
|
||||
namespace Components
|
||||
{
|
||||
CDbLiveryComponent::CDbLiveryComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CDbLiveryComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -39,6 +40,7 @@ namespace BlackGui
|
||||
ui->tvp_Liveries->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiveryComponent::onLiveriesRead, Qt::QueuedConnection);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::entityDownloadProgress, this, &CDbLiveryComponent::onEntityDownloadProgress, Qt::QueuedConnection);
|
||||
this->onLiveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getLiveriesCount());
|
||||
}
|
||||
|
||||
@@ -64,10 +66,24 @@ namespace BlackGui
|
||||
{
|
||||
Q_UNUSED(count);
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||
if (entity.testFlag(CEntityFlags::LiveryEntity) && CEntityFlags::isFinishedReadState(readState))
|
||||
if (!entity.testFlag(CEntityFlags::LiveryEntity) && CEntityFlags::isFinishedReadState(readState)) { return; }
|
||||
|
||||
if (CEntityFlags::isFinishedReadState(readState))
|
||||
{
|
||||
this->showOverlayHTMLMessage(QStringLiteral("Updating"), 2000);
|
||||
ui->tvp_Liveries->updateContainerMaybeAsync(sGui->getWebDataServices()->getLiveries());
|
||||
}
|
||||
else
|
||||
{
|
||||
this->showOverlayHTMLMessage(u"Current state: " % CEntityFlags::stateToString(readState), 10000);
|
||||
}
|
||||
}
|
||||
|
||||
void CDbLiveryComponent::onEntityDownloadProgress(CEntityFlags::Entity entity, int logId, int progress, qint64 current, qint64 max, const QUrl &url)
|
||||
{
|
||||
if (CEntityFlags::LiveryEntity != entity) { return; }
|
||||
this->showDownloadProgress(progress, current, max, url, 5000);
|
||||
Q_UNUSED(logId);
|
||||
}
|
||||
|
||||
void CDbLiveryComponent::onReload()
|
||||
|
||||
@@ -12,18 +12,17 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_DBLIVERYCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_DBLIVERYCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackgui/enableforviewbasedindicator.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
#include "blackmisc/network/entityflags.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace BlackMisc { namespace Aviation { class CLivery; } }
|
||||
namespace Ui { class CDbLiveryComponent; }
|
||||
namespace BlackGui
|
||||
@@ -35,7 +34,7 @@ namespace BlackGui
|
||||
* Liveries from DB
|
||||
*/
|
||||
class BLACKGUI_EXPORT CDbLiveryComponent :
|
||||
public QFrame,
|
||||
public COverlayMessagesFrame,
|
||||
public CEnableForDockWidgetInfoArea,
|
||||
public BlackGui::CEnableForViewBasedIndicator
|
||||
{
|
||||
@@ -51,7 +50,6 @@ namespace BlackGui
|
||||
//! The livery view
|
||||
BlackGui::Views::CLiveryView *view();
|
||||
|
||||
public slots:
|
||||
//! Filter by livery
|
||||
void filter(const BlackMisc::Aviation::CLivery &livery);
|
||||
|
||||
@@ -62,6 +60,9 @@ namespace BlackGui
|
||||
//! Liveries codes have been read
|
||||
void onLiveriesRead(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState readState, int count);
|
||||
|
||||
//! Download progress for an entity
|
||||
void onEntityDownloadProgress(BlackMisc::Network::CEntityFlags::Entity entity, int logId, int progress, qint64 current, qint64 max, const QUrl &url);
|
||||
|
||||
//! Reload models
|
||||
void onReload();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user