mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-10 05:55:33 +08:00
Minor UI and style fixes
* completer for airports in ATC component * log messages * style fixes
This commit is contained in:
@@ -325,7 +325,7 @@ namespace BlackCore
|
||||
|
||||
void CContextOwnAircraft::ps_allSwiftWebDataRead()
|
||||
{
|
||||
// we should already receive a reverse lookup model
|
||||
// we should already have received a reverse lookup model
|
||||
// from the driver
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
|
||||
#include "blackcore/context/contextnetwork.h"
|
||||
#include "blackcore/context/contextownaircraft.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackgui/components/atcstationcomponent.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/infoarea.h"
|
||||
#include "blackgui/uppercasevalidator.h"
|
||||
#include "blackgui/models/atcstationlistmodel.h"
|
||||
#include "blackgui/views/atcstationview.h"
|
||||
#include "blackgui/views/viewbase.h"
|
||||
@@ -34,6 +36,7 @@
|
||||
#include <QTextEdit>
|
||||
#include <QTimer>
|
||||
#include <QTreeView>
|
||||
#include <QCompleter>
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Models;
|
||||
@@ -58,6 +61,8 @@ namespace BlackGui
|
||||
ui->setupUi(this);
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->tabBar()->setUsesScrollButtons(true);
|
||||
CUpperCaseValidator *ucv = new CUpperCaseValidator(ui->le_AtcStationsOnlineMetar);
|
||||
ui->le_AtcStationsOnlineMetar->setValidator(ucv);
|
||||
|
||||
// some icons
|
||||
ui->pb_AtcStationsAtisReload->setIcon(CIcons::atis());
|
||||
@@ -93,10 +98,17 @@ namespace BlackGui
|
||||
connect(&m_updateTimer, &QTimer::timeout, this, &CAtcStationComponent::update);
|
||||
|
||||
// runtime based connects
|
||||
this->connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationsOnlineDigest, this, &CAtcStationComponent::ps_changedAtcStationsOnline);
|
||||
this->connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationsBookedDigest, this, &CAtcStationComponent::ps_changedAtcStationsBooked);
|
||||
this->connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationOnlineConnectionStatus, this, &CAtcStationComponent::changedAtcStationOnlineConnectionStatus);
|
||||
this->connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CAtcStationComponent::ps_connectionStatusChanged);
|
||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationsOnlineDigest, this, &CAtcStationComponent::ps_changedAtcStationsOnline);
|
||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationsBookedDigest, this, &CAtcStationComponent::ps_changedAtcStationsBooked);
|
||||
connect(sGui->getIContextNetwork(), &IContextNetwork::changedAtcStationOnlineConnectionStatus, this, &CAtcStationComponent::changedAtcStationOnlineConnectionStatus);
|
||||
connect(sGui->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &CAtcStationComponent::ps_connectionStatusChanged);
|
||||
|
||||
// web readers
|
||||
if (sGui->hasWebDataServices())
|
||||
{
|
||||
connect(sGui->getWebDataServices(), &CWebDataServices::swiftDbAirportsRead, this, &CAtcStationComponent::ps_airportsRead);
|
||||
this->ps_airportsRead();
|
||||
}
|
||||
|
||||
// settings have
|
||||
this->ps_settingsChanged();
|
||||
@@ -174,6 +186,11 @@ namespace BlackGui
|
||||
ui->tvp_AtcStationsOnline->changedAtcStationConnectionStatus(station, added);
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_getMetarAsEntered()
|
||||
{
|
||||
this->getMetar("");
|
||||
}
|
||||
|
||||
void CAtcStationComponent::getMetar(const QString &airportIcaoCode)
|
||||
{
|
||||
QString icao(airportIcaoCode.isEmpty() ? ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper());
|
||||
@@ -296,6 +313,11 @@ namespace BlackGui
|
||||
this->m_updateTimer.setInterval(settings.getAtcUpdateTime().toMs());
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_airportsRead()
|
||||
{
|
||||
this->initCompleters();
|
||||
}
|
||||
|
||||
void CAtcStationComponent::updateTreeView()
|
||||
{
|
||||
//! \fixme EXPERIMENTAL CODE: change model so we can directly use hierarchies
|
||||
@@ -313,6 +335,18 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CAtcStationComponent::initCompleters()
|
||||
{
|
||||
if (!sGui || !sGui->getWebDataServices()) { return; }
|
||||
const QStringList airports = sGui->getWebDataServices()->getAirports().allIcaoCodes(true);
|
||||
if (!airports.isEmpty())
|
||||
{
|
||||
QCompleter *airportCompleter = new QCompleter(airports, this);
|
||||
airportCompleter->popup()->setMinimumWidth(75);
|
||||
ui->le_AtcStationsOnlineMetar->setCompleter(airportCompleter);
|
||||
}
|
||||
}
|
||||
|
||||
void CAtcStationComponent::ps_onlineAtcStationSelected(QModelIndex index)
|
||||
{
|
||||
ui->te_AtcStationsOnlineInfo->setText(""); // reset
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! Get all METARs
|
||||
void ps_getMetarAsEntered() { this->getMetar(""); }
|
||||
void ps_getMetarAsEntered();
|
||||
|
||||
//! Request new ATIS
|
||||
void ps_requestAtis();
|
||||
@@ -120,8 +120,16 @@ namespace BlackGui
|
||||
//! Settings have been changed
|
||||
void ps_settingsChanged();
|
||||
|
||||
//! Airports read from web readers
|
||||
void ps_airportsRead();
|
||||
|
||||
private:
|
||||
//! Build a tree view for ATC stations
|
||||
void updateTreeView();
|
||||
|
||||
//! Init the completers
|
||||
void initCompleters();
|
||||
|
||||
QScopedPointer<Ui::CAtcStationComponent> ui;
|
||||
QTimer m_updateTimer { this };
|
||||
QDateTime m_timestampLastReadOnlineStations; //!< stations read
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace BlackMisc
|
||||
// 1) values > 1 mean extrapolation
|
||||
// 2) values > 2 mean no new situations coming in
|
||||
double distanceToSplitTime = newSituation.getAdjustedMSecsSinceEpoch() - currentTimeMsSinceEpoc;
|
||||
double simulationTimeFraction = 1 - (distanceToSplitTime / deltaTime);
|
||||
double simulationTimeFraction = 1.0 - (distanceToSplitTime / deltaTime);
|
||||
if (simulationTimeFraction > 2.0)
|
||||
{
|
||||
if (setup.showInterpolatorDebugMessages())
|
||||
@@ -164,9 +164,9 @@ namespace BlackMisc
|
||||
currentSituation.setPitch(pitch);
|
||||
|
||||
// Interpolate bank: Bank = (BankB - BankA) * t + BankA
|
||||
CAngle bankBegin = oldSituation.getBank();
|
||||
CAngle bankEnd = newSituation.getBank();
|
||||
CAngle bank = (bankEnd - bankBegin) * simulationTimeFraction + bankBegin;
|
||||
const CAngle bankBegin = oldSituation.getBank();
|
||||
const CAngle bankEnd = newSituation.getBank();
|
||||
const CAngle bank = (bankEnd - bankBegin) * simulationTimeFraction + bankBegin;
|
||||
currentSituation.setBank(bank);
|
||||
|
||||
currentSituation.setGroundSpeed((newSituation.getGroundSpeed() - oldSituation.getGroundSpeed())
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace BlackSimPlugin
|
||||
if (!simObject.getAircraftModelString().isEmpty())
|
||||
{
|
||||
this->m_outOfRealityBubble.push_back(simObject.getAircraft());
|
||||
CLogMessage(this).info("Aircraft '%1' '%2' '%3' out of reality bubble") << callsign.toQString() << simObject.getAircraftModelString() << objectID;
|
||||
CLogMessage(this).info("Aircraft removed, '%1' '%2' object id '%3' out of reality bubble") << callsign.toQString() << simObject.getAircraftModelString() << objectID;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -600,8 +600,6 @@ namespace BlackSimPlugin
|
||||
// in all cases we remove
|
||||
const int c = m_simConnectObjects.remove(callsign);
|
||||
ok = c > 0;
|
||||
CLogMessage(this).info("FSX: Removed aircraft '%1'") << simObject.getCallsign().toQString();
|
||||
|
||||
const bool updated = this->updateAircraftRendered(simObject.getCallsign(), false);
|
||||
if (updated)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user