mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
As of RW/KB workshop
* changed aircraft view to siumlated aircraft models / views * functionality to change fast pos. updates (signals, slots) * allow to request text message widget from aircraft component
This commit is contained in:
@@ -17,8 +17,9 @@
|
||||
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Views;
|
||||
using namespace BlackGui::Models;
|
||||
using namespace BlackCore;
|
||||
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -33,9 +34,12 @@ namespace BlackGui
|
||||
this->tabBar()->setExpanding(false);
|
||||
this->ui->tvp_AirportsInRange->setResizeMode(CAirportView::ResizingOnce);
|
||||
m_updateTimer = new CUpdateTimer(&CAircraftComponent::update, this);
|
||||
this->ui->tvp_AircraftInRange->setAircraftMode(CSimulatedAircraftListModel::InfoMode);
|
||||
|
||||
connect(this->ui->tvp_AircraftInRange, &CSimulatedAircraftView::rowCountChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||
connect(this->ui->tvp_AircraftInRange, &CSimulatedAircraftView::requestTextMessageWidget, this, &CAircraftComponent::requestTextMessageWidget);
|
||||
connect(this->ui->tvp_AirportsInRange, &CSimulatedAircraftView::rowCountChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||
|
||||
connect(this->ui->tvp_AircraftInRange, &CAircraftView::rowCountChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||
connect(this->ui->tvp_AirportsInRange, &CAircraftView::rowCountChanged, this, &CAircraftComponent::ps_onRowCountChanged);
|
||||
}
|
||||
|
||||
CAircraftComponent::~CAircraftComponent()
|
||||
@@ -64,7 +68,7 @@ namespace BlackGui
|
||||
bool visible = (this->isVisibleWidget() && this->currentWidget() == this->ui->tb_AircraftInRange);
|
||||
if (this->countAircraft() < 1 || visible)
|
||||
{
|
||||
this->ui->tvp_AircraftInRange->updateContainer(this->getIContextNetwork()->getAircraftInRange().toAircraftList());
|
||||
this->ui->tvp_AircraftInRange->updateContainer(this->getIContextNetwork()->getAircraftInRange());
|
||||
}
|
||||
}
|
||||
if (this->getIContextSimulator()->isConnected())
|
||||
|
||||
@@ -49,6 +49,10 @@ namespace BlackGui
|
||||
//! Airports in range
|
||||
int countAirportsInRange() const;
|
||||
|
||||
signals:
|
||||
//! Request a text message
|
||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
public slots:
|
||||
//! Update aircrafts
|
||||
void update();
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CAircraftView" name="tvp_AircraftInRange">
|
||||
<widget class="BlackGui::Views::CSimulatedAircraftView" name="tvp_AircraftInRange">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
@@ -94,16 +94,16 @@
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAircraftView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/aircraftview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CAirportView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/airportview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CSimulatedAircraftView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/simulatedaircraftview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace BlackGui
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::rowCountChanged, this, &CAtcStationComponent::ps_onCountChanged);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::rowCountChanged, this, &CAtcStationComponent::ps_onCountChanged);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestComFrequency, this, &CAtcStationComponent::ps_setComFrequency);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestTextMessage, this, &CAtcStationComponent::requestTextMessage);
|
||||
connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::requestTextMessageWidget, this, &CAtcStationComponent::requestTextMessageWidget);
|
||||
|
||||
connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_reloadAtcStationsBooked);
|
||||
connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::rowCountChanged, this, &CAtcStationComponent::ps_onCountChanged);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlackGui
|
||||
|
||||
signals:
|
||||
//! Request a text message
|
||||
void requestTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
public slots:
|
||||
//! Update stations
|
||||
|
||||
@@ -49,8 +49,10 @@ namespace BlackGui
|
||||
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::clicked, this, &CMappingComponent::ps_onAircraftSelectedInView);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView ::requestUpdate, this, &CMappingComponent::ps_onMappingsUpdateRequested);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::requestTextMessage, this, &CMappingComponent::requestTextMessage);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::requestUpdate, this, &CMappingComponent::ps_onMappingsUpdateRequested);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::requestTextMessageWidget, this, &CMappingComponent::requestTextMessageWidget);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::requestEnableAircraft, this, &CMappingComponent::ps_onMenuEnableAircraft);
|
||||
connect(this->ui->tvp_CurrentMappings, &CSimulatedAircraftView::requestFastPositionUpdates, this, &CMappingComponent::ps_onMenuChangeFastPositionUpdates);
|
||||
|
||||
connect(this->ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::ps_onSaveAircraft);
|
||||
|
||||
@@ -304,6 +306,13 @@ namespace BlackGui
|
||||
Q_UNUSED(aircraft);
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onFastPositionUpdatesEnabled(const CSimulatedAircraft &aircraft, const QString &originator)
|
||||
{
|
||||
if (originator == mappingtOriginator()) { return; }
|
||||
this->ps_onMappingsUpdateRequested();
|
||||
Q_UNUSED(aircraft);
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onConnectionStatusChanged(uint from, uint to)
|
||||
{
|
||||
INetwork::ConnectionStatus fromStatus = static_cast<INetwork::ConnectionStatus>(from);
|
||||
@@ -315,6 +324,22 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onMenuChangeFastPositionUpdates(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
if (getIContextNetwork())
|
||||
{
|
||||
getIContextNetwork()->updateFastPositionUpdates(aircraft.getCallsign(), aircraft.fastPositionUpdates(), mappingtOriginator());
|
||||
}
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onMenuEnableAircraft(const CSimulatedAircraft &aircraft)
|
||||
{
|
||||
if (getIContextNetwork())
|
||||
{
|
||||
getIContextNetwork()->updateAircraftEnabled(aircraft.getCallsign(), aircraft.isEnabled(), mappingtOriginator());
|
||||
}
|
||||
}
|
||||
|
||||
const QString &CMappingComponent::mappingtOriginator()
|
||||
{
|
||||
// string is generated once, the timestamp allows to use multiple
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
|
||||
signals:
|
||||
//! Request a text message
|
||||
void requestTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
protected:
|
||||
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||
@@ -85,23 +85,32 @@ namespace BlackGui
|
||||
//! Model preview
|
||||
void ps_onModelPreviewChanged(int state);
|
||||
|
||||
//! Requested update for mappings from backend
|
||||
//! Request update for mappings from backend
|
||||
void ps_onMappingsUpdateRequested();
|
||||
|
||||
//! Request update for models from backend
|
||||
void ps_onModelsUpdateRequested();
|
||||
|
||||
//! Rendered aircraft changed
|
||||
//! Rendered aircraft changed in backend
|
||||
void ps_onRenderedAircraftModelChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator);
|
||||
|
||||
//! aircraft enabled, disabled
|
||||
//! Aircraft enabled, disabled in backend
|
||||
void ps_onChangedAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator);
|
||||
|
||||
//! Fast position updates on/off in backend
|
||||
void ps_onFastPositionUpdatesEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const QString &originator);
|
||||
|
||||
//! Connection status has been changed
|
||||
void ps_onConnectionStatusChanged(uint from, uint to);
|
||||
|
||||
//! Fast position updates onf/off
|
||||
void ps_onMenuChangeFastPositionUpdates(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
//! Enable / disable aircraft
|
||||
void ps_onMenuEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
private:
|
||||
const QString &mappingtOriginator();
|
||||
static const QString &mappingtOriginator();
|
||||
QScopedPointer<Ui::CMappingComponent> ui;
|
||||
QCompleter *m_modelCompleter = nullptr;
|
||||
BlackGui::Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user