mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Use Qt::QueuedConnection for reader -> UI component signal/slots
For DB load overview also text descriptions (long/short) are adjusted
This commit is contained in:
@@ -496,8 +496,8 @@ namespace BlackCore
|
||||
{
|
||||
// never emit when lock is held, deadlock
|
||||
Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "Expect single entity");
|
||||
emit this->dataRead(entity, res.isRestricted() ? CEntityFlags::ReadFinishedRestricted : CEntityFlags::ReadFinished, number);
|
||||
CLogMessage(this).info("Read %1 entities of '%2' from '%3' (%4)") << number << CEntityFlags::flagToString(entity) << res.getUrlString() << res.getLoadTimeStringWithStartedHint();
|
||||
emit this->dataRead(entity, res.isRestricted() ? CEntityFlags::ReadFinishedRestricted : CEntityFlags::ReadFinished, number);
|
||||
}
|
||||
|
||||
void CDatabaseReader::logNoWorkingUrl(CEntityFlags::Entity entity)
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
||||
ui->tvp_AircraftIcao->setFilterWidget(ui->filter_AircraftIcao);
|
||||
ui->tvp_AircraftIcao->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoComponent::onIcaoRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoComponent::onIcaoRead, Qt::QueuedConnection);
|
||||
this->onIcaoRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace BlackGui
|
||||
this->setAcceptedMetaTypeIds({qMetaTypeId<CAircraftIcaoCode>(), qMetaTypeId<CAircraftIcaoCodeList>()});
|
||||
ui->le_Aircraft->setValidator(new CUpperCaseValidator(this));
|
||||
connect(ui->le_Aircraft, &QLineEdit::editingFinished, this, &CDbAircraftIcaoSelectorComponent::onDataChanged);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoSelectorComponent::onCodesRead);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAircraftIcaoSelectorComponent::onCodesRead, Qt::QueuedConnection);
|
||||
this->onCodesRead(CEntityFlags::AircraftIcaoEntity, CEntityFlags::ReadFinished, sApp->getWebDataServices()->getAircraftIcaoCodesCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
||||
ui->tvp_AirlineIcao->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(ui->tvp_AirlineIcao, &CAirlineIcaoCodeView::requestNewBackendData, this, &CDbAirlineIcaoComponent::onReload);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoComponent::onIcaoRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoComponent::onIcaoRead, Qt::QueuedConnection);
|
||||
this->onIcaoRead(CEntityFlags::AirlineIcaoEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getAirlineIcaoCodesCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackGui
|
||||
this->setAcceptDrops(true);
|
||||
this->setAcceptedMetaTypeIds({qMetaTypeId<CAirlineIcaoCode>(), qMetaTypeId<CAirlineIcaoCodeList>()});
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoSelectorBase::onCodesRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAirlineIcaoSelectorBase::onCodesRead, Qt::QueuedConnection);
|
||||
|
||||
// when we already have data, init completers. This can not be done directly in the
|
||||
// constructor due to virtual functions
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BlackGui
|
||||
ui->le_MaxModelsStashed->setValidator(new QIntValidator(10, CDbStashComponent::MaxModelPublished, this));
|
||||
Q_ASSERT_X(this->getMappingComponent(), Q_FUNC_INFO, "Expect mapping componet");
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAutoStashingComponent::onEntitiesRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbAutoStashingComponent::onEntitiesRead, Qt::QueuedConnection);
|
||||
connect(ui->tb_ResetDescription, &QToolButton::clicked, this, &CDbAutoStashingComponent::resetDescription);
|
||||
|
||||
this->resetDescription();
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BlackGui
|
||||
ui->tvp_Countries->setFilterWidget(ui->filter_CountryComponent);
|
||||
ui->tvp_Countries->allowDragDrop(true, false);
|
||||
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbCountryComponent::onCountriesRead);
|
||||
connect(sApp->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbCountryComponent::onCountriesRead, Qt::QueuedConnection);
|
||||
this->onCountriesRead(CEntityFlags::CountryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getCountriesCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace BlackGui
|
||||
connect(ui->le_CountryName, &QLineEdit::returnPressed, this, &CDbCountrySelectorComponent::onDataChanged);
|
||||
|
||||
ui->le_CountryIso->setValidator(new CUpperCaseValidator(this));
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbCountrySelectorComponent::onCountriesRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbCountrySelectorComponent::onCountriesRead, Qt::QueuedConnection);
|
||||
this->onCountriesRead(CEntityFlags::DistributorEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getCountriesCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace BlackGui
|
||||
ui->tvp_Liveries->allowDragDrop(true, false);
|
||||
ui->tvp_Liveries->menuAddItems(CViewBaseNonTemplate::MenuCopy);
|
||||
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiveryComponent::onLiveriesRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLiveryComponent::onLiveriesRead, Qt::QueuedConnection);
|
||||
this->onLiveriesRead(CEntityFlags::LiveryEntity, CEntityFlags::ReadFinished, sGui->getWebDataServices()->getLiveriesCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
#include "dbloadoverviewcomponent.h"
|
||||
#include "ui_dbloadoverviewcomponent.h"
|
||||
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackcore/db/infodatareader.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
|
||||
#include <QPointer>
|
||||
@@ -73,6 +74,7 @@ namespace BlackGui
|
||||
{
|
||||
if (!myself) { return; }
|
||||
this->loadInfoObjects();
|
||||
this->adjustTextWidth();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -115,6 +117,7 @@ namespace BlackGui
|
||||
{
|
||||
// re-center
|
||||
this->centerLoadIndicator();
|
||||
this->adjustTextWidth();
|
||||
}
|
||||
QFrame::resizeEvent(event);
|
||||
}
|
||||
@@ -381,5 +384,24 @@ namespace BlackGui
|
||||
m_dsTriggerGuiUpdate.inputSignal();
|
||||
}
|
||||
}
|
||||
|
||||
void CDbLoadOverviewComponent::adjustTextWidth()
|
||||
{
|
||||
const QSize s = this->size();
|
||||
const QSizeF sizeFont = CGuiUtility::fontMetricsLazyDog43Chars();
|
||||
const int thresholdW = qRound(sizeFont.width() * 2.0);
|
||||
if (s.width() > thresholdW)
|
||||
{
|
||||
ui->lbl_DbCount->setText("DB count");
|
||||
ui->lbl_CacheCount->setText("Cache count");
|
||||
ui->lbl_SharedCount->setText("Shared count");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lbl_DbCount->setText("DB#");
|
||||
ui->lbl_CacheCount->setText("C#");
|
||||
ui->lbl_SharedCount->setText("S#");
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -96,6 +96,9 @@ namespace BlackGui
|
||||
//! Load info objects if not already loaded
|
||||
void loadInfoObjects();
|
||||
|
||||
//! Adjust text width
|
||||
void adjustTextWidth();
|
||||
|
||||
//! Timestamp
|
||||
static QString formattedTimestamp(const QDateTime &dateTime);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
||||
|
||||
if (sGui->hasWebDataServices())
|
||||
{
|
||||
c = connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CInfoBarWebReadersStatusBase::dataRead);
|
||||
c = connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CInfoBarWebReadersStatusBase::dataRead, Qt::QueuedConnection);
|
||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect");
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace BlackGui
|
||||
connect(ui->tb_Timeout, &QToolButton::clicked, this, &CLoginComponent::toggleTimeout);
|
||||
|
||||
// web service data
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CLoginComponent::onWebServiceDataRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CLoginComponent::onWebServiceDataRead, Qt::QueuedConnection);
|
||||
|
||||
// inital setup, if data already available
|
||||
this->validateAircraftValues();
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackGui
|
||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CModelMatcherComponent::onSimulatorChanged);
|
||||
connect(ui->pb_ModelMatching, &QPushButton::pressed, this, &CModelMatcherComponent::testModelMatching);
|
||||
connect(ui->pb_ReverseLookup, &QPushButton::pressed, this, &CModelMatcherComponent::reverseLookup);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CModelMatcherComponent::onWebDataRead);
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CModelMatcherComponent::onWebDataRead, Qt::QueuedConnection);
|
||||
|
||||
this->redisplay();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user