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