Misc. imorvements as discussed in RW/KB worksho

* preparation for a context menu to send text messages from ATC/aircraft view
* preparation for context menu for fast pos. updates
* reverse ICAO lookup at login screen
* display fast updates / parts in GUI
* moved max- aircraft into settings
* made serverselection own component
This commit is contained in:
Klaus Basan
2015-03-15 20:02:08 +01:00
parent fb12c608b1
commit 79b3cf3cd3
42 changed files with 979 additions and 410 deletions

View File

@@ -409,7 +409,7 @@ namespace BlackCore
// send 1st position
if (to == INetwork::Connected)
{
CLogMessage(this).info("Connected, own aircraft %1") << this->ownAircraft().toQString();
CLogMessage(this).info("Connected, own aircraft %1") << this->ownAircraft().getCallsignAsString();
}
// send as message

View File

@@ -73,7 +73,7 @@ namespace BlackCore
//! Own callsign was changed
void changedCallsign(const BlackMisc::Aviation::CCallsign &callsign);
//! Own callsign was changed
//! Own ICAO was changed
void changedIcaoData(const BlackMisc::Aviation::CAircraftIcao &icao);
//! own pilot (aka the swift user) changed

View File

@@ -8,6 +8,7 @@
*/
#include "context_ownaircraft_impl.h"
#include "context_simulator.h"
#include "context_network.h"
#include "context_audio.h"
#include "context_application.h"
@@ -24,7 +25,6 @@ using namespace BlackMisc::Geo;
using namespace BlackMisc::Audio;
using namespace BlackMisc::Simulation;
namespace BlackCore
{
CContextOwnAircraft::CContextOwnAircraft(CRuntimeConfig::ContextMode mode, CRuntime *runtime) :
@@ -69,9 +69,11 @@ namespace BlackCore
this->m_ownAircraft.setSituation(situation);
this->m_ownAircraft.setPilot(this->getIContextSettings()->getNetworkSettings().getCurrentTrafficNetworkServer().getUser());
// from simulator, if available
this->m_ownAircraft.setCallsign(CCallsign("SWIFT")); // would come from settings
// TODO: This would need to come from somewhere (mappings)
// Own callsign, plane ICAO status, model used
this->m_ownAircraft.setCallsign(CCallsign("SWIFT"));
this->m_ownAircraft.setIcaoInfo(CAircraftIcao("C172", "L1P", "GA", "GA", "0000ff"));
// voice rooms, if network is already available
@@ -196,6 +198,18 @@ namespace BlackCore
this->resolveVoiceRooms();
}
void CContextOwnAircraft::ps_changedSimulatorModel(const CSimulatedAircraft &ownAircraft)
{
this->m_ownAircraft.setModel(ownAircraft.getModel());
CAircraftIcao icao(ownAircraft.getIcaoInfo());
if (icao.hasAircraftDesignator())
{
// if the model knows it ICAO, cool
// otherwise we ignore it and take an elsewhere set
this->m_ownAircraft.setIcaoInfo(icao);
}
}
void CContextOwnAircraft::setAudioVoiceRoomOverrideUrls(const QString &voiceRoom1Url, const QString &voiceRoom2Url)
{
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << voiceRoom1Url << voiceRoom2Url;
@@ -213,16 +227,8 @@ namespace BlackCore
CSimulatedAircraft CContextOwnAircraft::getOwnAircraft() const
{
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << this->m_ownAircraft;
if (this->thread() == QThread::currentThread()) { return this->m_ownAircraft; }
CSimulatedAircraft aircraft;
bool s = QMetaObject::invokeMethod(const_cast<CContextOwnAircraft *>(this), // strip away const, invoke will not change anything
"getOwnAircraft",
Qt::BlockingQueuedConnection,
Q_RETURN_ARG(CSimulatedAircraft, aircraft)
);
Q_ASSERT(s);
Q_UNUSED(s);
return aircraft;
Q_ASSERT(this->thread() == QThread::currentThread());
return this->m_ownAircraft;
}
bool CContextOwnAircraft::parseCommandLine(const QString &commandLine, const QString &originator)

View File

@@ -103,9 +103,13 @@ namespace BlackCore
private slots:
//! Station has been changed, needed to tune in/out voice room
//! Set in runtime
//! \note Connected in runtime
void ps_changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &atcStation, bool connected);
//! Simulator model has been changed
//! \note Connected in runtime
void ps_changedSimulatorModel(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
private:
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft; //!< my aircraft
bool m_automaticVoiceRoomResolution = true; //!< automatic voice room resolution, or disable for override

View File

@@ -186,6 +186,9 @@ namespace BlackCore
c = connect(this->m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit,
this->getCContextSimulator(), &CContextSimulator::ps_updateSimulatorCockpitFromContext);
Q_ASSERT(c);
c = connect(this->getCContextSimulator(), &CContextSimulator::ownAircraftModelChanged,
this->getCContextOwnAircraft(), &CContextOwnAircraft::ps_changedSimulatorModel);
Q_ASSERT(c);
}
times.insert("Post setup, sim.connects", time.restart());

View File

@@ -85,7 +85,6 @@ namespace BlackCore
void modelMatchingCompleted(BlackMisc::Simulation::CSimulatedAircraft aircraft);
//! Emitted when own aircraft model changes
//! \todo move to own aircraft context?
void ownAircraftModelChanged(BlackMisc::Simulation::CSimulatedAircraft aircraft);
public slots:

View File

@@ -80,7 +80,7 @@ namespace BlackGui
QScopedPointer<Ui::CAircraftComponent> ui;
CUpdateTimer *m_updateTimer = nullptr;
};
}
}
} // ns
} // ns
#endif // guard

View File

@@ -62,6 +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_AtcStationsBooked, &CAtcStationView::requestUpdate, this, &CAtcStationComponent::ps_reloadAtcStationsBooked);
connect(this->ui->tvp_AtcStationsBooked, &CAtcStationView::rowCountChanged, this, &CAtcStationComponent::ps_onCountChanged);
@@ -264,7 +265,7 @@ namespace BlackGui
this->ui->tvp_AtcStationsOnlineTree->setModel(
this->ui->tvp_AtcStationsOnline->derivedModel()->toAtcGroupModel()
);
if (old) { old->deleteLater(); }
if (old) { old->deleteLater(); } // delete old model replaced by current model
if (!this->ui->tvp_AtcStationsOnlineTree->model()) { return; }
this->ui->tvp_AtcStationsOnlineTree->expandAll();

View File

@@ -52,6 +52,10 @@ namespace BlackGui
//! Number of online stations
int countOnlineStations() const;
signals:
//! Request a text message
void requestTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
public slots:
//! Update stations
void update();

View File

@@ -90,6 +90,7 @@ namespace BlackGui
this->ui->le_AircraftIcaoDesignator->setMaxLength(5);
this->ui->le_AircraftIcaoDesignator->setValidator(new CUpperCaseValidator(this));
connect(ui->le_AircraftIcaoDesignator, &QLineEdit::editingFinished, this, &CLoginComponent::ps_validateAircraftValues);
connect(ui->tb_SimulatorIcaoReverseLookup, &QToolButton::clicked, this, &CLoginComponent::ps_reverseLookupModel);
// server GUI element
this->ui->frp_CurrentServer->setReadOnly(true);
@@ -278,6 +279,13 @@ namespace BlackGui
return values;
}
void CLoginComponent::mergeGuiIcaoValues(CAircraftIcao &icao) const
{
CGuiAircraftValues values = getAircraftValuesFromGui();
CAircraftIcao guiIcao(values.ownAircraftIcaoTypeDesignator, values.ownAircraftCombinedType, values.ownAircraftIcaoAirline, "", "");
icao.updateMissingParts(guiIcao);
}
CLoginComponent::CVatsimValues CLoginComponent::getVatsimValuesFromGui() const
{
CVatsimValues values;
@@ -334,18 +342,23 @@ namespace BlackGui
void CLoginComponent::setOwnModel()
{
static const CAircraftIcao defaultIcao("C172", "L1P", "FOO", "", ""); //! \todo set values for OBS
Q_ASSERT(this->getIContextOwnAircraft());
Q_ASSERT(this->getIContextSimulator());
static const CAircraftIcao defaultIcao("C172", "L1P", "FOO", "", ""); // default values
CAircraftIcao icao;
bool simConnected = this->getIContextSimulator() && this->getIContextSimulator()->isSimulating();
if (simConnected)
{
CAircraftModel model = this->getIContextOwnAircraft()->getOwnAircraft().getModel();
this->ui->le_SimulatorModel->setText(model.getModelString());
this->setIcaoValuesIfEmpty(model.getIcao());
// still empty?
if (this->ui->le_AircraftIcaoDesignator->text().trimmed().isEmpty())
icao = model.getIcao();
if (!icao.hasAircraftDesignator())
{
this->setIcaoValuesIfEmpty(defaultIcao);
// not valid, reverse lookup
this->getIContextSimulator()->getIcaoForModelString(model.getModelString());
}
}
else
@@ -353,22 +366,27 @@ namespace BlackGui
// Set observer mode without simulator
//! \todo Currently not working in OBS mode
this->ui->gbp_LoginMode->setLoginMode(INetwork::LoginNormal);
this->setIcaoValuesIfEmpty(defaultIcao);
this->ui->le_SimulatorModel->setText("No simulator");
}
if (icao.hasAircraftDesignator())
{
this->setGuiIcaoValues(icao, false);
}
}
void CLoginComponent::setIcaoValuesIfEmpty(const CAircraftIcao &icao)
void CLoginComponent::setGuiIcaoValues(const CAircraftIcao &icao, bool onlyIfEmpty)
{
if (this->ui->le_AircraftIcaoDesignator->text().trimmed().isEmpty())
if (!onlyIfEmpty || this->ui->le_AircraftIcaoDesignator->text().trimmed().isEmpty())
{
this->ui->le_AircraftIcaoDesignator->setText(icao.getAircraftDesignator());
}
if (this->ui->le_AircraftIcaoAirline->text().trimmed().isEmpty())
if (!onlyIfEmpty || this->ui->le_AircraftIcaoAirline->text().trimmed().isEmpty())
{
this->ui->le_AircraftIcaoAirline->setText(icao.getAirlineDesignator());
}
if (this->ui->le_AircraftCombinedType->text().trimmed().isEmpty())
if (!onlyIfEmpty || this->ui->le_AircraftCombinedType->text().trimmed().isEmpty())
{
this->ui->le_AircraftCombinedType->setText(icao.getAircraftCombinedType());
}
@@ -437,5 +455,29 @@ namespace BlackGui
}
}
void CLoginComponent::ps_reverseLookupModel()
{
Q_ASSERT(getIContextOwnAircraft());
Q_ASSERT(getIContextSimulator());
CAircraftModel model(this->getIContextOwnAircraft()->getOwnAircraft().getModel());
CAircraftIcao icao = this->getIContextSimulator()->getIcaoForModelString(model.getModelString());
if (icao.hasAircraftDesignator())
{
CLogMessage(this).validationInfo("Reverse lookup for %1") << model.getModelString();
// set value in backend
this->mergeGuiIcaoValues(icao);
this->getIContextOwnAircraft()->updateIcaoData(icao);
// update GUI
this->setGuiIcaoValues(icao, false);
}
else
{
CLogMessage(this).validationWarning("Reverse lookup for %1 failed") << model.getModelString();
}
}
} // namespace
} // namespace

View File

@@ -79,6 +79,9 @@ namespace BlackGui
//! Logoff countdown
void ps_logoffCountdown();
//! Reverse lookup model
void ps_reverseLookupModel();
private:
//! GUI aircraft values, formatted
@@ -136,8 +139,11 @@ namespace BlackGui
//! Own model string
void setOwnModel();
//! Set ICAO values if fields are empty
void setIcaoValuesIfEmpty(const BlackMisc::Aviation::CAircraftIcao &icao);
//! Set ICAO values
void setGuiIcaoValues(const BlackMisc::Aviation::CAircraftIcao &icao, bool onlyIfEmpty);
//! Merge with GUI icao values
void mergeGuiIcaoValues(BlackMisc::Aviation::CAircraftIcao &icao) const;
bool m_visible = false; //!< is this component selected?
QScopedPointer<Ui::CLoginComponent> ui;

View File

@@ -275,7 +275,7 @@
<property name="bottomMargin">
<number>3</number>
</property>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="lbl_AircraftIcaoAirline">
<property name="toolTip">
<string>e.g. DLH, LHA, ...</string>
@@ -285,14 +285,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_SimulatorModel">
<property name="text">
<string>Model</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QLineEdit" name="le_AircraftIcaoAirline">
<property name="toolTip">
<string>e.g. DLH</string>
@@ -311,7 +304,7 @@
</property>
</widget>
</item>
<item row="3" column="4">
<item row="4" column="4">
<widget class="QLineEdit" name="le_AircraftCombinedType">
<property name="toolTip">
<string>e.g. L2J</string>
@@ -330,7 +323,7 @@
</property>
</widget>
</item>
<item row="3" column="3">
<item row="4" column="3">
<widget class="QLabel" name="lbl_AircraftCombinedType">
<property name="toolTip">
<string>e.g. L2J, L1P, ....</string>
@@ -405,14 +398,14 @@
</property>
</widget>
</item>
<item row="3" column="2">
<item row="4" column="2">
<widget class="BlackGui::CTickLabel" name="lblp_AircraftIcaoAirline">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="5">
<item row="4" column="5">
<widget class="BlackGui::CTickLabel" name="lblp_AircraftCombinedType">
<property name="text">
<string/>
@@ -426,6 +419,13 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="BlackGui::CTickLabel" name="lblp_SimulatorModel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLineEdit" name="le_SimulatorModel">
<property name="readOnly">
@@ -433,12 +433,30 @@
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="BlackGui::CTickLabel" name="lblp_SimulatorModel">
<property name="text">
<string/>
<item row="0" column="0">
<layout class="QHBoxLayout" name="hl_AircraftModel">
<property name="spacing">
<number>0</number>
</property>
</widget>
<item>
<widget class="QLabel" name="lbl_SimulatorModel">
<property name="text">
<string>Model</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tb_SimulatorIcaoReverseLookup">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../blackmisc/blackmisc.qrc">
<normaloff>:/diagona/icons/diagona/icons/arrow-circle-225.png</normaloff>:/diagona/icons/diagona/icons/arrow-circle-225.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@@ -575,6 +593,8 @@
<tabstop>cbp_OtherServers</tabstop>
<tabstop>pb_OtherServersGotoSettings</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../blackmisc/blackmisc.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -44,24 +44,15 @@ namespace BlackGui
this->ui->tvp_AircraftModels->setResizeMode(CAircraftModelView::ResizingOff);
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested);
connect(this->ui->tvp_CurrentMappings, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onMappingsUpdateRequested);
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged);
connect(this->ui->tvp_CurrentMappings, &CAircraftModelView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged);
connect(this->ui->tvp_CurrentMappings, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onAircraftSelectedInView);
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView);
connect(this->ui->pb_ApplyMaxAircraft, &QPushButton::clicked, this, &CMappingComponent::ps_onApplyNewMaxRemoteAircraft);
connect(this->ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::ps_onSaveAircraft);
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);
// sync slider and text field
connect(this->ui->hs_MaxAircraft, &QSlider::valueChanged, [ = ](int newValue)
{
this->ui->sb_MaxAircraft->setValue(newValue);
});
connect(this->ui->sb_MaxAircraft, static_cast<void (QSpinBox::*)(int)> (&QSpinBox::valueChanged), [ = ](int newValue)
{
this->ui->hs_MaxAircraft->setValue(newValue);
});
connect(this->ui->pb_SaveAircraft, &QPushButton::clicked, this, &CMappingComponent::ps_onSaveAircraft);
this->m_modelCompleter = new QCompleter(this);
this->m_currentMappingsViewDelegate = new CCheckBoxDelegate(":/diagona/icons/diagona/icons/tick.png", ":/diagona/icons/diagona/icons/cross.png", this);
@@ -106,9 +97,6 @@ namespace BlackGui
// requires simulator context
connect(this->ui->tvp_CurrentMappings, &CAircraftModelView::objectChanged, this, &CMappingComponent::ps_onChangedSimulatedAircraftInView);
// data
this->ui->hs_MaxAircraft->setValue(getIContextSimulator()->getMaxRenderedAircraft());
// with external core models might be already available
this->ps_onAircraftModelsLoaded();
}
@@ -197,32 +185,6 @@ namespace BlackGui
}
}
void CMappingComponent::ps_onApplyNewMaxRemoteAircraft()
{
Q_ASSERT(getIContextSimulator());
Q_ASSERT(getIContextNetwork());
// get initial aircraft to render
int noRequested = this->ui->hs_MaxAircraft->value();
CSimulatedAircraftList inRange(this->getIContextNetwork()->getAircraftInRange());
inRange.truncate(noRequested);
inRange.sortByDistanceToOwnAircraft();
CCallsignList initialCallsigns(inRange.getCallsigns());
this->getIContextSimulator()->setMaxRenderedAircraft(noRequested, initialCallsigns);
// real value
int noRendered = this->getIContextSimulator()->getMaxRenderedAircraft();
if (noRequested == noRendered)
{
CLogMessage(this).info("Max.rendered aircraft: %1") << noRendered;
}
else
{
CLogMessage(this).info("Max.rendered aircraft: %1, requested: %2") << noRendered << noRequested;
this->ui->sb_MaxAircraft->setValue(noRendered);
}
}
void CMappingComponent::ps_onSaveAircraft()
{
Q_ASSERT(getIContextSimulator());
@@ -292,12 +254,18 @@ namespace BlackGui
void CMappingComponent::ps_onModelPreviewChanged(int state)
{
static const QPixmap empty;
Qt::CheckState s = static_cast<Qt::CheckState>(state);
if (s == Qt::Unchecked)
{
this->ui->lbl_AircraftIconDisplayed->setPixmap(QPixmap());
this->ui->lbl_AircraftIconDisplayed->setPixmap(empty);
this->ui->lbl_AircraftIconDisplayed->setText("Icon disabled");
}
else if (s == Qt::Checked)
{
this->ui->lbl_AircraftIconDisplayed->setPixmap(empty);
this->ui->lbl_AircraftIconDisplayed->setText("Icon will go here");
}
}
void CMappingComponent::ps_onMappingsUpdateRequested()

View File

@@ -51,6 +51,10 @@ namespace BlackGui
//! \copydoc CListModelBase::getModelsStartsWith
BlackMisc::Simulation::CAircraftModelList findModelsStartingWith(const QString modelName, Qt::CaseSensitivity cs);
signals:
//! Request a text message
void requestTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
protected:
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
virtual void runtimeHasBeenSet() override;
@@ -75,9 +79,6 @@ namespace BlackGui
//! Model selected (in view)
void ps_onModelSelectedInView(const QModelIndex &index);
//! Apply new max remote aircraft
void ps_onApplyNewMaxRemoteAircraft();
//! Save changed aircraft
void ps_onSaveAircraft();

View File

@@ -19,7 +19,7 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gl_MappingComponent" columnstretch="0,0,1,4,0">
<layout class="QGridLayout" name="gl_MappingComponent" columnstretch="0,0,1,3,0">
<property name="leftMargin">
<number>0</number>
</property>
@@ -35,10 +35,30 @@
<property name="horizontalSpacing">
<number>3</number>
</property>
<item row="3" column="2">
<widget class="QSpinBox" name="sb_MaxAircraft">
<property name="maximum">
<number>50</number>
<item row="1" column="0">
<widget class="QLabel" name="lbl_AircraftIcon">
<property name="text">
<string>Icon</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3" alignment="Qt::AlignLeft">
<widget class="QLabel" name="lbl_AircraftIconDisplayed">
<property name="text">
<string>aircraft icon will go here</string>
</property>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignRight">
<widget class="QCheckBox" name="cb_AircraftIconDisplayed">
<property name="toolTip">
<string>show / hide icon</string>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
@@ -116,41 +136,6 @@
<item row="2" column="3">
<widget class="QLineEdit" name="le_AircraftModel"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="lbl_MaxAircraft">
<property name="text">
<string>Max. aircraft </string>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QSlider" name="hs_MaxAircraft">
<property name="maximum">
<number>50</number>
</property>
<property name="pageStep">
<number>5</number>
</property>
<property name="value">
<number>40</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksAbove</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="le_Callsign">
<property name="maxLength">
@@ -175,13 +160,6 @@
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="2" column="1" alignment="Qt::AlignRight">
<widget class="QCheckBox" name="cb_AircraftEnabled">
<property name="toolTip">
@@ -192,33 +170,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_AircraftIcon">
<property name="text">
<string>Icon</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="3" alignment="Qt::AlignLeft">
<widget class="QLabel" name="lbl_AircraftIconDisplayed">
<property name="text">
<string>aircraft icon will go here</string>
</property>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignRight">
<widget class="QCheckBox" name="cb_AircraftIconDisplayed">
<property name="toolTip">
<string>show / hide icon</string>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@@ -37,7 +37,6 @@ namespace BlackGui
{
CSettingsComponent::CSettingsComponent(QWidget *parent) :
QTabWidget(parent),
CEnableForRuntime(nullptr, false),
ui(new Ui::CSettingsComponent)
{
ui->setupUi(this);
@@ -77,11 +76,9 @@ namespace BlackGui
*/
void CSettingsComponent::reloadSettings()
{
// local copy
CSettingsNetwork nws = this->getIContextSettings()->getNetworkSettings();
// update servers
this->ui->tvp_SettingsTnServers->updateContainer(nws.getTrafficNetworkServers());
// reload components
this->ui->comp_AudioSetup->reloadSettings();
this->ui->comp_SettingsServersComponent->reloadSettings();
// update hot keys
this->ui->tvp_SettingsMiscHotkeys->updateContainer(this->getIContextSettings()->getHotkeys());
@@ -100,7 +97,7 @@ namespace BlackGui
*/
void CSettingsComponent::runtimeHasBeenSet()
{
if (!this->getIContextSettings()) qFatal("Settings missing");
Q_ASSERT_X(this->getIContextSettings(), "runtimeHasBeenSet", "Missing settings");
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsComponent::ps_changedSettings);
// Opacity, intervals
@@ -109,11 +106,6 @@ namespace BlackGui
this->connect(this->ui->hs_SettingsGuiAtcRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAtcStationsUpdateInterval);
this->connect(this->ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedUsersUpdateInterval);
// Settings server
this->connect(this->ui->pb_SettingsTnRemoveServer, &QPushButton::released, this, &CSettingsComponent::ps_alterTrafficServer);
this->connect(this->ui->pb_SettingsTnSaveServer, &QPushButton::released, this, &CSettingsComponent::ps_alterTrafficServer);
this->connect(this->ui->tvp_SettingsTnServers, &QTableView::clicked, this, &CSettingsComponent::ps_networkServerSelected);
// Settings hotkeys
this->connect(this->ui->pb_SettingsMiscCancel, &QPushButton::clicked, this, &CSettingsComponent::reloadSettings);
this->connect(this->ui->pb_SettingsMiscSave, &QPushButton::clicked, this, &CSettingsComponent::ps_saveHotkeys);
@@ -136,42 +128,6 @@ namespace BlackGui
Q_UNUSED(connected);
}
/*
* Network has been selected
*/
void CSettingsComponent::ps_networkServerSelected(QModelIndex index)
{
const CServer clickedServer = this->ui->tvp_SettingsTnServers->at(index);
this->ui->frp_ServerForm->setServer(clickedServer);
}
/*
* Alter server
*/
void CSettingsComponent::ps_alterTrafficServer()
{
CServer server = this->ui->frp_ServerForm->getServer();
CStatusMessageList msgs = server.validate();
if (!msgs.isEmpty())
{
msgs.addCategories(this);
msgs.addCategory(CLogCategory::validation());
CLogMessage::preformatted(msgs);
return;
}
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathNetworkSettings(), CSettingsNetwork::ValueTrafficServers());
QObject *sender = QObject::sender();
if (sender == this->ui->pb_SettingsTnRemoveServer)
{
this->getIContextSettings()->value(path, CSettingUtilities::CmdRemove(), server.toCVariant());
}
else if (sender == this->ui->pb_SettingsTnSaveServer)
{
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), server.toCVariant());
}
}
/*
* Settings did change
*/

View File

@@ -39,7 +39,8 @@ namespace BlackGui
//! Tabs
enum SettingTab
{
SettingTabNetwork = 0,
SettingTabNetworkServers = 0,
SettingTabNetwork,
SettingTabAircraftAudio,
SettingTabSimulator,
SettingTabGui,
@@ -93,12 +94,6 @@ namespace BlackGui
private slots:
//! Network server selected
void ps_networkServerSelected(QModelIndex index);
//! Alter traffic server
void ps_alterTrafficServer();
//! Settings have been changed
void ps_changedSettings(uint typeValue);

View File

@@ -22,6 +22,38 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tb_SettingsTrafficNetworkServers">
<attribute name="title">
<string>Servers</string>
</attribute>
<layout class="QVBoxLayout" name="vl_SettingsTrafficNetworkServers">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="BlackGui::Components::CSettingsNetworkServersComponent" name="comp_SettingsServersComponent">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_SettingsTrafficNetwork">
<attribute name="title">
<string>Network</string>
@@ -43,41 +75,7 @@
<number>1</number>
</property>
<item>
<widget class="BlackGui::Views::CServerView" name="tvp_SettingsTnServers">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="BlackGui::CServerForm" name="frp_ServerForm">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<widget class="BlackGui::Components::CSettingsNetworkComponent" name="comp_SettingsNetwork">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -86,63 +84,6 @@
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="fr_SettingsTnButtons">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="hl_SettingsBottomBar">
<property name="topMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<spacer name="hs_SettingsTnSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_SettingsTnSaveServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_SettingsTnRemoveServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_SettingsAudio">
@@ -609,11 +550,6 @@
<extends>QTableView</extends>
<header>blackgui/views/keyboardkeyview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::Views::CServerView</class>
<extends>QTableView</extends>
<header>blackgui/views/serverview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::Components::CSettingsSimulatorComponent</class>
<extends>QFrame</extends>
@@ -621,9 +557,15 @@
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::CServerForm</class>
<class>BlackGui::Components::CSettingsNetworkServersComponent</class>
<extends>QFrame</extends>
<header>blackgui/serverform.h</header>
<header>blackgui/components/settingsnetworkserverscomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CSettingsNetworkComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/settingsnetworkcomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>

View File

@@ -0,0 +1,50 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "settingsnetworkcomponent.h"
#include "ui_settingsnetworkcomponent.h"
#include "blackcore/context_network.h"
using namespace BlackCore;
namespace BlackGui
{
namespace Components
{
CSettingsNetworkComponent::CSettingsNetworkComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CSettingsNetworkComponent)
{
ui->setupUi(this);
connect(this->ui->cb_FastPositionUpdates, &QCheckBox::released, this, &CSettingsNetworkComponent::ps_guiValuesChanged);
}
CSettingsNetworkComponent::~CSettingsNetworkComponent() { }
void CSettingsNetworkComponent::runtimeHasBeenSet()
{
Q_ASSERT(this->getIContextNetwork());
bool enabled = this->getIContextNetwork()->isFastPositionSendingEnabled();
this->ui->cb_FastPositionUpdates->setChecked(enabled);
}
void CSettingsNetworkComponent::ps_guiValuesChanged()
{
Q_ASSERT(this->getIContextNetwork());
QObject *sender = QObject::sender();
if (sender == ui->cb_FastPositionUpdates)
{
bool enabled = this->ui->cb_FastPositionUpdates->isChecked();
this->getIContextNetwork()->enableFastPositionSending(enabled);
}
}
} // ns
} // ns

View File

@@ -0,0 +1,54 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_SETTINGSNETWORKCOMPONENT_H
#define BLACKGUI_SETTINGSNETWORKCOMPONENT_H
#include "blackgui/components/enableforruntime.h"
#include <QFrame>
namespace Ui { class CSettingsNetworkComponent; }
namespace BlackGui
{
namespace Components
{
//! General settings for network
class CSettingsNetworkComponent :
public QFrame,
public CEnableForRuntime
{
Q_OBJECT
public:
//! Constructor
explicit CSettingsNetworkComponent(QWidget *parent = nullptr);
//! Destructor
~CSettingsNetworkComponent();
protected:
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
virtual void runtimeHasBeenSet() override;
private:
//! GUI values have been changed
void ps_guiValuesChanged();
private:
QScopedPointer<Ui::CSettingsNetworkComponent> ui;
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSettingsNetworkComponent</class>
<widget class="QFrame" name="CSettingsNetworkComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QCheckBox" name="cb_FastPositionUpdates">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_FastPositionUpdates">
<property name="text">
<string>Enable fast position updates</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="vs_NetworkSettings">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,98 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "settingsnetworkserverscomponent.h"
#include "ui_settingsnetworkserverscomponent.h"
#include "blackcore/context_network.h"
#include "blackcore/context_settings.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/settingsblackmiscclasses.h"
using namespace BlackCore;
using namespace BlackMisc;
using namespace BlackGui;
using namespace BlackMisc::Network;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::Audio;
using namespace BlackMisc::Settings;
namespace BlackGui
{
namespace Components
{
CSettingsNetworkServersComponent::CSettingsNetworkServersComponent(QWidget *parent) :
QFrame(parent),
ui(new Ui::CSettingsNetworkServersComponent)
{
ui->setupUi(this);
// Settings server
this->connect(this->ui->pb_SettingsTnServersRemoveServer, &QPushButton::pressed, this, &CSettingsNetworkServersComponent::ps_alterTrafficServer);
this->connect(this->ui->pb_SettingsTnServersSaveServer, &QPushButton::pressed, this, &CSettingsNetworkServersComponent::ps_alterTrafficServer);
this->connect(this->ui->tvp_SettingsTnServers, &QTableView::clicked, this, &CSettingsNetworkServersComponent::ps_networkServerSelected);
}
CSettingsNetworkServersComponent::~CSettingsNetworkServersComponent()
{ }
void CSettingsNetworkServersComponent::runtimeHasBeenSet()
{
Q_ASSERT_X(this->getIContextSettings(), "runtimeHasBeenSet", "Missing settings");
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsNetworkServersComponent::ps_changedSettings);
}
void CSettingsNetworkServersComponent::reloadSettings()
{
// local copy
CSettingsNetwork nws = this->getIContextSettings()->getNetworkSettings();
// update servers
this->ui->tvp_SettingsTnServers->updateContainer(nws.getTrafficNetworkServers());
}
void CSettingsNetworkServersComponent::ps_networkServerSelected(QModelIndex index)
{
const CServer clickedServer = this->ui->tvp_SettingsTnServers->at(index);
this->ui->frp_ServerForm->setServer(clickedServer);
}
void CSettingsNetworkServersComponent::ps_alterTrafficServer()
{
CServer server = this->ui->frp_ServerForm->getServer();
CStatusMessageList msgs = server.validate();
if (!msgs.isEmpty())
{
msgs.addCategories(this);
msgs.addCategory(CLogCategory::validation());
CLogMessage::preformatted(msgs);
return;
}
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathNetworkSettings(), CSettingsNetwork::ValueTrafficServers());
QObject *sender = QObject::sender();
if (sender == this->ui->pb_SettingsTnServersRemoveServer)
{
this->getIContextSettings()->value(path, CSettingUtilities::CmdRemove(), server.toCVariant());
}
else if (sender == this->ui->pb_SettingsTnServersSaveServer)
{
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), server.toCVariant());
}
}
void CSettingsNetworkServersComponent::ps_changedSettings(uint typeValue)
{
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
Q_UNUSED(type);
}
} // namespace
} // namespace

View File

@@ -0,0 +1,63 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_SETTINGSNETWORKSERVERSCOMPONENT_H
#define BLACKGUI_SETTINGSNETWORKSERVERSCOMPONENT_H
#include "blackgui/components/enableforruntime.h"
#include <QFrame>
#include <QScopedPointer>
namespace Ui { class CSettingsNetworkServersComponent; }
namespace BlackGui
{
namespace Components
{
//! Settings for network servers
class CSettingsNetworkServersComponent :
public QFrame,
public CEnableForRuntime
{
Q_OBJECT
public:
//! Constructor
explicit CSettingsNetworkServersComponent(QWidget *parent = nullptr);
//! Destructor
~CSettingsNetworkServersComponent();
protected:
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
virtual void runtimeHasBeenSet() override;
public slots:
//! Reload settings
void reloadSettings();
private slots:
//! Network server selected
void ps_networkServerSelected(QModelIndex index);
//! Alter traffic server
void ps_alterTrafficServer();
//! Changed settings
void ps_changedSettings(uint typeValue);
private:
QScopedPointer<Ui::CSettingsNetworkServersComponent> ui;
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CSettingsNetworkServersComponent</class>
<widget class="QFrame" name="CSettingsNetworkServersComponent">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="vl_SettingsNetworkSevers">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="BlackGui::Views::CServerView" name="tvp_SettingsTnServers">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<widget class="BlackGui::CServerForm" name="frp_ServerForm">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="fr_SettingsTnServersButtons">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="hl_SettingsBottomBar">
<property name="topMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<spacer name="hs_SettingsTnServersSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_SettingsTnServersSaveServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_SettingsTnServersRemoveServer">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::Views::CServerView</class>
<extends>QTableView</extends>
<header>blackgui/views/serverview.h</header>
</customwidget>
<customwidget>
<class>BlackGui::CServerForm</class>
<extends>QFrame</extends>
<header>blackgui/serverform.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -3,8 +3,10 @@
#include "blackcore/context_settings.h"
#include "blackcore/context_simulator.h"
#include "blackcore/context_network.h"
#include "blacksim/simulatorinfolist.h"
#include "blacksim/setsimulator.h"
#include "blackmisc/simulation/simulatedaircraftlist.h"
#include "blackmisc/settingutilities.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/variant.h"
@@ -14,6 +16,8 @@
using namespace BlackMisc;
using namespace BlackMisc::Settings;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Simulation;
using namespace BlackMisc::Aviation;
using namespace BlackSim;
using namespace BlackSim::Settings;
using namespace BlackCore;
@@ -57,6 +61,9 @@ namespace BlackGui
CTime timeOffset = this->getIContextSimulator()->getTimeSynchronizationOffset();
this->ui->le_TimeSyncOffset->setText(timeOffset.formattedHrsMin());
// max.aircraft
this->ui->sb_MaxAircraft->setValue(getIContextSimulator()->getMaxRenderedAircraft());
// only with simulator context set GUI values
bool connected = this->connect(this->ui->cb_Plugins, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_pluginHasChanged(int)));
Q_ASSERT(connected);
@@ -68,8 +75,8 @@ namespace BlackGui
connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsSimulatorComponent::ps_settingsHaveChanged);
}
connect(this->ui->cb_TimeSync, &QCheckBox::released, this, &CSettingsSimulatorComponent::ps_guiValueHasChanged);
connect(this->ui->le_TimeSyncOffset, &QLineEdit::returnPressed, this, &CSettingsSimulatorComponent::ps_guiValueHasChanged);
connect(this->ui->pb_ApplyMaxAircraft, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyNewMaxRemoteAircraft);
connect(this->ui->pb_ApplyTimeSync, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::ps_onApplyTimeSync);
}
void CSettingsSimulatorComponent::setCurrentPlugin(const CSimulatorInfo &plugin)
@@ -124,37 +131,50 @@ namespace BlackGui
this->ui->cb_TimeSync->setChecked(simSettings.isTimeSyncEnabled());
}
void CSettingsSimulatorComponent::ps_guiValueHasChanged()
void CSettingsSimulatorComponent::ps_onApplyNewMaxRemoteAircraft()
{
Q_ASSERT(this->getIContextSettings());
if (!this->getIContextSettings()) return;
Q_ASSERT(getIContextSimulator());
Q_ASSERT(getIContextNetwork());
QObject *sender = QObject::sender();
if (!sender) return;
// get initial aircraft to render
int noRequested = this->ui->sb_MaxAircraft->value();
CSimulatedAircraftList inRange(this->getIContextNetwork()->getAircraftInRange());
inRange.truncate(noRequested);
inRange.sortByDistanceToOwnAircraft();
CCallsignList initialCallsigns(inRange.getCallsigns());
this->getIContextSimulator()->setMaxRenderedAircraft(noRequested, initialCallsigns);
const QString ps = IContextSettings::PathSimulatorSettings();
if (sender == this->ui->cb_TimeSync)
// real value
int noRendered = this->getIContextSimulator()->getMaxRenderedAircraft();
if (noRequested == noRendered)
{
bool timeSync = this->ui->cb_TimeSync->isChecked();
this->getIContextSettings()->value(CSettingUtilities::appendPaths(ps, CSettingsSimulator::ValueSyncTime()), CSettingUtilities::CmdUpdate(), CVariant::from(timeSync));
CLogMessage(this).info("Max.rendered aircraft: %1") << noRendered;
}
else if (sender == this->ui->le_TimeSyncOffset)
else
{
const QString os = this->ui->le_TimeSyncOffset->text();
CTime ost(0, CTimeUnit::hrmin());
if (!os.isEmpty())
{
ost.parseFromString(os);
}
if (ost.isNull())
{
CLogMessage().validationWarning("Invalid offset time");
}
else
{
this->getIContextSettings()->value(CSettingUtilities::appendPaths(ps, CSettingsSimulator::ValueSyncTimeOffset()), CSettingUtilities::CmdUpdate(), ost.toCVariant());
}
CLogMessage(this).info("Max.rendered aircraft: %1, requested: %2") << noRendered << noRequested;
this->ui->sb_MaxAircraft->setValue(noRendered);
}
}
void CSettingsSimulatorComponent::ps_onApplyTimeSync()
{
bool timeSync = this->ui->cb_TimeSync->isChecked();
const QString os = this->ui->le_TimeSyncOffset->text();
CTime ost(0, CTimeUnit::hrmin());
if (!os.isEmpty())
{
ost.parseFromString(os);
}
if (ost.isNull())
{
CLogMessage().validationWarning("Invalid offset time");
}
else
{
getIContextSimulator()->setTimeSynchronization(timeSync, ost);
}
}
}
} // namespace

View File

@@ -46,8 +46,11 @@ namespace BlackGui
//! Settings have been changed
void ps_settingsHaveChanged(uint settingsType);
//! A GUI value has been changed
void ps_guiValueHasChanged();
//! Apply max aircraft
void ps_onApplyNewMaxRemoteAircraft();
//! Apply time sync
void ps_onApplyTimeSync();
private:
Ui::CSettingsSimulatorComponent *ui; //!< UI

View File

@@ -118,6 +118,9 @@
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>offset +/-hh:mm</string>
</property>
<property name="inputMask">
<string>#99:99</string>
</property>
@@ -130,34 +133,72 @@
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_TimeSyncOffset">
<widget class="QPushButton" name="pb_ApplyTimeSync">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>offset +/-hh:mm</string>
<string>apply</string>
</property>
</widget>
</item>
<item>
<spacer name="hs_TimeSync">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lbl_MaxAircraft">
<property name="text">
<string>Max.aircraft</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="hl_MaxAircraft">
<item>
<widget class="QSpinBox" name="sb_MaxAircraft"/>
</item>
<item>
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>75</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>apply</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>

View File

@@ -42,7 +42,6 @@ namespace BlackGui
this->ui->le_textMessages->setVisible(false);
connect(this->ui->le_textMessages, &QLineEdit::returnPressed, this, &CTextMessageComponent::ps_textMessageEntered);
this->ui->tvp_TextMessagesAll->rowsResizeModeToContent();
this->ui->tvp_TextMessagesAll->setResizeMode(CTextMessageView::ResizingAuto);
}

View File

@@ -70,11 +70,15 @@ namespace BlackGui
case ModelMode:
this->m_columns.addColumn(CColumn("e.", "enabled", CSimulatedAircraft::IndexEnabled,
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "enabled", "disabled"), true));
this->m_columns.addColumn(CColumn("r.", "rendered", CSimulatedAircraft::IndexRendered,
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "rendered", "skipped"), true));
this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString }));
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
this->m_columns.addColumn(CColumn("distance", CSimulatedAircraft::IndexDistanceToOwnAircraft, new CAirspaceDistanceFormatter()));
this->m_columns.addColumn(CColumn("p.", "parts", CSimulatedAircraft::IndexPartsSynchronized,
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "parts", "no parts"), true));
this->m_columns.addColumn(CColumn("f.", "fast position updates", CSimulatedAircraft::IndexFastPositionUpdates,
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "enabled", "disabled"), true));
this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcao::IndexAsString}));
this->m_columns.addColumn(CColumn::standardString("model", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelString}));
this->m_columns.addColumn(CColumn::standardString("desc.", "description", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexDescription}));
@@ -83,7 +87,7 @@ namespace BlackGui
this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter()));
// default sort order
this->setSortColumnByPropertyIndex(CSimulatedAircraft::IndexCallsign);
this->setSortColumnByPropertyIndex(CSimulatedAircraft::IndexDistanceToOwnAircraft);
this->m_sortOrder = Qt::AscendingOrder;
break;

View File

@@ -21,5 +21,6 @@ namespace BlackGui
{
this->standardInit(new CAircraftListModel(this));
}
}
}
} // ns
} // ns

View File

@@ -20,6 +20,7 @@ namespace BlackGui
namespace Views
{
//! Aircrafts view
//! \deprecated use simulated aircraft instead
class CAircraftView : public CViewBase<Models::CAircraftListModel, BlackMisc::Aviation::CAircraftList, BlackMisc::Aviation::CAircraft>
{

View File

@@ -53,6 +53,7 @@ namespace BlackGui
{
menu.addAction(CIcons::appCockpit16(), "Tune in COM1", this, SLOT(ps_tuneInAtcCom1()));
menu.addAction(CIcons::appCockpit16(), "Tune in COM2", this, SLOT(ps_tuneInAtcCom2()));
menu.addAction(CIcons::appTextMessages16(), "Text message", this, SLOT(ps_requestTextMessage()));
menu.addSeparator();
}
CViewBase::customMenu(menu);
@@ -60,16 +61,23 @@ namespace BlackGui
void CAtcStationView::ps_tuneInAtcCom1()
{
CAtcStationList l = this->selectedObjects();
if (l.isEmpty()) { return; }
emit this->requestComFrequency(l.front().getFrequency(), CComSystem::Com1);
CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; }
emit this->requestComFrequency(s.getFrequency(), CComSystem::Com1);
}
void CAtcStationView::ps_tuneInAtcCom2()
{
CAtcStationList l = this->selectedObjects();
if (l.isEmpty()) { return; }
emit this->requestComFrequency(l.front().getFrequency(), CComSystem::Com2);
CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; }
emit this->requestComFrequency(s.getFrequency(), CComSystem::Com2);
}
void CAtcStationView::ps_requestTextMessage()
{
CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; }
emit this->requestTextMessage(s.getCallsign());
}
} // namespace

View File

@@ -40,6 +40,9 @@ namespace BlackGui
//! Request COM frequency
void requestComFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency, BlackMisc::Aviation::CComSystem::ComUnit unit);
//! Request a text message to
void requestTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
public slots:
//! \copydoc CAtcStationListModel::changedAtcStationConnectionStatus
void changedAtcStationConnectionStatus(const BlackMisc::Aviation::CAtcStation &station, bool added);
@@ -53,6 +56,7 @@ namespace BlackGui
void ps_testRequest3kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(3000); }
void ps_tuneInAtcCom1();
void ps_tuneInAtcCom2();
void ps_requestTextMessage();
};
}
}

View File

@@ -8,8 +8,10 @@
*/
#include "simulatedaircraftview.h"
#include "blackmisc/project.h"
#include <QHeaderView>
using namespace BlackMisc;
using namespace BlackMisc::Simulation;
using namespace BlackGui::Models;
@@ -27,5 +29,44 @@ namespace BlackGui
{
this->m_model->setAircraftMode(mode);
}
}
}
void CSimulatedAircraftView::customMenu(QMenu &menu) const
{
if (BlackMisc::CProject::isDebugBuild())
{
// tbd
}
if (this->hasSelection())
{
CSimulatedAircraft aircraft(selectedObject());
Q_ASSERT(!aircraft.getCallsign().isEmpty());
menu.addAction(CIcons::appTextMessages16(), "Text message", this, SLOT(ps_requestTextMessage()));
menu.addAction(CIcons::appAircrafts16(), aircraft.isEnabled() ? "disable aircraft" : "enabled aircraft", this, SLOT(ps_enableAircraft()));
menu.addAction(CIcons::globe16(), aircraft.fastPositionUpdates() ? "normal updates" : "fast position updates", this, SLOT(ps_fastPositionUpdates()));
menu.addSeparator();
}
CViewBase::customMenu(menu);
}
void CSimulatedAircraftView::ps_requestTextMessage()
{
CSimulatedAircraft aircraft(selectedObject());
if (aircraft.getCallsign().isEmpty()) { return; }
emit requestTextMessage(aircraft.getCallsign());
}
void CSimulatedAircraftView::ps_enableAircraft()
{
CSimulatedAircraft aircraft(selectedObject());
if (aircraft.getCallsign().isEmpty()) { return; }
}
void CSimulatedAircraftView::ps_fastPositionUpdates()
{
CSimulatedAircraft aircraft(selectedObject());
if (aircraft.getCallsign().isEmpty()) { return; }
}
} // ns
} // ns

View File

@@ -14,6 +14,7 @@
#include "viewbase.h"
#include "../models/simulatedaircraftlistmodel.h"
#include <QMenu>
namespace BlackGui
{
@@ -22,6 +23,7 @@ namespace BlackGui
//! Aircrafts view
class CSimulatedAircraftView : public CViewBase<Models::CSimulatedAircraftListModel, BlackMisc::Simulation::CSimulatedAircraftList, BlackMisc::Simulation::CSimulatedAircraft>
{
Q_OBJECT
public:
//! Constructor
@@ -29,7 +31,21 @@ namespace BlackGui
//! Mode
void setAircraftMode(Models::CSimulatedAircraftListModel::AircraftMode mode);
signals:
//! Request a text message
void requestTextMessage(const BlackMisc::Aviation::CCallsign &callsign);
protected:
//! \copydoc CViewBase::customMenu
virtual void customMenu(QMenu &menu) const override;
private slots:
void ps_requestTextMessage();
void ps_enableAircraft();
void ps_fastPositionUpdates();
};
}
}
} // ns
} // ns
#endif // guard

View File

@@ -87,6 +87,8 @@ namespace BlackGui
}
if (!menu.isEmpty()) { menu.addSeparator(); }
menu.addAction(BlackMisc::CIcons::resize16(), "Full resize", this, SLOT(fullResizeToContents()));
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows to content", this, SLOT(rowsResizeModeToContent()));
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows interactive", this, SLOT(rowsResizeModeToInteractive()));
// resize to content might decrease performance,
// so I only allow changing to "content resizing" if size matches
@@ -126,7 +128,15 @@ namespace BlackGui
this->horizontalHeader()->setStretchLastSection(true);
this->verticalHeader()->setDefaultSectionSize(fh); // for height
this->verticalHeader()->setMinimumSectionSize(fh); // for height
this->initRowsResizeModeToInteractive();
switch (this->m_rowResizeMode)
{
case Interactive: this->rowsResizeModeToInteractive(); break;
case Content: this->rowsResizeModeToContent(); break;
default:
Q_ASSERT(false);
break;
}
}
int CViewBaseNonTemplate::ps_updateContainer(const CVariant &variant, bool sort, bool resize)
@@ -141,13 +151,14 @@ namespace BlackGui
this->m_filterDialog->show();
}
void CViewBaseNonTemplate::initRowsResizeModeToInteractive()
void CViewBaseNonTemplate::rowsResizeModeToInteractive()
{
const int height = this->verticalHeader()->minimumSectionSize();
QHeaderView *verticalHeader = this->verticalHeader();
Q_ASSERT(verticalHeader);
verticalHeader->setSectionResizeMode(QHeaderView::Interactive);
verticalHeader->setDefaultSectionSize(height);
this->m_rowResizeMode = Interactive;
}
void CViewBaseNonTemplate::rowsResizeModeToContent()
@@ -155,6 +166,7 @@ namespace BlackGui
QHeaderView *verticalHeader = this->verticalHeader();
Q_ASSERT(verticalHeader);
verticalHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
this->m_rowResizeMode = Content;
}
bool CViewBaseNonTemplate::performResizing() const
@@ -240,26 +252,30 @@ namespace BlackGui
}
}
template <class ModelClass, class ContainerType, class ObjectType> void CViewBase<ModelClass, ContainerType, ObjectType>::insert(const ObjectType &value, bool resize)
template <class ModelClass, class ContainerType, class ObjectType>
void CViewBase<ModelClass, ContainerType, ObjectType>::insert(const ObjectType &value, bool resize)
{
Q_ASSERT(this->m_model);
this->m_model->insert(value);
if (resize) { this->performResizeToContents(); }
}
template <class ModelClass, class ContainerType, class ObjectType> const ObjectType &CViewBase<ModelClass, ContainerType, ObjectType>::at(const QModelIndex &index) const
template <class ModelClass, class ContainerType, class ObjectType>
const ObjectType &CViewBase<ModelClass, ContainerType, ObjectType>::at(const QModelIndex &index) const
{
Q_ASSERT(this->m_model);
return this->m_model->at(index);
}
template <class ModelClass, class ContainerType, class ObjectType> const ContainerType &CViewBase<ModelClass, ContainerType, ObjectType>::getContainer() const
template <class ModelClass, class ContainerType, class ObjectType>
const ContainerType &CViewBase<ModelClass, ContainerType, ObjectType>::getContainer() const
{
Q_ASSERT(this->m_model);
return this->m_model->getContainer();
}
template <class ModelClass, class ContainerType, class ObjectType> ContainerType CViewBase<ModelClass, ContainerType, ObjectType>::selectedObjects() const
template <class ModelClass, class ContainerType, class ObjectType>
ContainerType CViewBase<ModelClass, ContainerType, ObjectType>::selectedObjects() const
{
if (!this->hasSelection()) { return ContainerType(); }
ContainerType c;
@@ -271,6 +287,13 @@ namespace BlackGui
return c;
}
template <class ModelClass, class ContainerType, class ObjectType>
ObjectType CViewBase<ModelClass, ContainerType, ObjectType>::selectedObject() const
{
ContainerType c = this->selectedObjects();
return c.frontOrDefault();
}
template <class ModelClass, class ContainerType, class ObjectType>
int CViewBase<ModelClass, ContainerType, ObjectType>::rowCount() const
{

View File

@@ -44,6 +44,13 @@ namespace BlackGui
ResizingOff //!< never
};
//! How rows are resizes
enum RowsResizeMode
{
Interactive,
Content
};
//! When (rows count) to use asynchronous updates
static const int asyncRowsCountThreshold = 50;
@@ -74,9 +81,6 @@ namespace BlackGui
//! Filter dialog
void setFilterDialog(QDialog *filterDialog);
//! Resize mode to content
void rowsResizeModeToContent();
//! Main application window widget if any
QWidget *mainApplicationWindowWidget() const;
@@ -100,6 +104,12 @@ namespace BlackGui
//! Full resizing to content, might be slow
virtual void fullResizeToContents();
//! Init as interactive, as this allows manually resizing
void rowsResizeModeToInteractive();
//! Resize mode to content
void rowsResizeModeToContent();
protected:
//! Constructor
CViewBaseNonTemplate(QWidget *parent);
@@ -111,9 +121,6 @@ namespace BlackGui
//! Perform resizing / non slot method for template
virtual void performResizeToContents() = 0;
//! Init as interactive, as this allows manually resizing
void initRowsResizeModeToInteractive();
//! Helper method with template free signature
//! \param variant contains the container
//! \param sort
@@ -130,6 +137,7 @@ namespace BlackGui
void init();
ResizeMode m_resizeMode = ResizingAuto; //!< mode
RowsResizeMode m_rowResizeMode = Interactive; //!< row resize mode
int m_resizeCount = 0; //!< flag / counter, how many resize activities
int m_skipResizeThreshold = 40; //!< when to skip resize (rows count)
int m_resizeAutoNthTime = 1; //!< with ResizeAuto, resize every n-th time
@@ -201,6 +209,9 @@ namespace BlackGui
//! Selected objects
ContainerType selectedObjects() const;
//! Selected object (or default)
ObjectType selectedObject() const;
//! Row count
int rowCount() const;

View File

@@ -55,6 +55,8 @@ namespace BlackMisc
return CVariant::fromValue(this->isRendered());
case IndexPartsSynchronized:
return CVariant::fromValue(this->isPartsSynchronized());
case IndexFastPositionUpdates:
return CVariant::fromValue(this->fastPositionUpdates());
default:
return CAircraft::propertyByIndex(index);
}
@@ -85,6 +87,9 @@ namespace BlackMisc
case IndexPartsSynchronized:
this->m_partsSynchronized = variant.toBool();
break;
case IndexFastPositionUpdates:
this->m_fastPositionUpdates = variant.toBool();
break;
default:
CAircraft::setPropertyByIndex(variant, index);
break;

View File

@@ -32,7 +32,8 @@ namespace BlackMisc
IndexClient,
IndexEnabled,
IndexRendered,
IndexPartsSynchronized
IndexPartsSynchronized,
IndexFastPositionUpdates
};
//! Default constructor.
@@ -85,6 +86,12 @@ namespace BlackMisc
//! Rendered?
bool isRendered() const { return m_rendered; }
//! Support fast position updates
bool fastPositionUpdates() const {return m_fastPositionUpdates;}
//! Support fast position updates
void setFastPositionUpdates(bool useFastPositions) { m_fastPositionUpdates = useFastPositions; }
//! Rendered?
void setRendered(bool rendered) { m_rendered = rendered; }
@@ -104,10 +111,12 @@ namespace BlackMisc
private:
BLACK_ENABLE_TUPLE_CONVERSION(CSimulatedAircraft)
BlackMisc::Simulation::CAircraftModel m_model;
BlackMisc::Network::CClient m_client;
bool m_enabled = true; // to be displayed in sim
bool m_rendered = false; // really shown in sim
bool m_partsSynchronized = false;
BlackMisc::Network::CClient m_client;
bool m_enabled = true; //!< to be displayed in sim
bool m_rendered = false; //!< really shown in simulator
bool m_partsSynchronized = false; //!< sync.parts
bool m_fastPositionUpdates =false; //!<use fast position updates
void init();
};
@@ -119,7 +128,8 @@ BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Simulation::CSimulatedAircraft, (
attr(o.m_client),
attr(o.m_enabled),
attr(o.m_rendered),
attr(o.m_partsSynchronized)
attr(o.m_partsSynchronized),
attr(o.m_fastPositionUpdates)
))
Q_DECLARE_METATYPE(BlackMisc::Simulation::CSimulatedAircraft)

View File

@@ -21,8 +21,6 @@
#include "blackcore/interpolator_linear.h"
#include <QTimer>
#include <QtConcurrent>
#include <type_traits>
using namespace BlackMisc;

View File

@@ -50,7 +50,7 @@ namespace BlackSimPlugin
bool c = remoteAircraftProvider->connectRemoteAircraftProviderSignals(
std::bind(&CSimulatorXPlane::ps_addAircraftSituation, this, std::placeholders::_1),
std::bind(&CSimulatorXPlane::ps_addAircraftParts, this, std::placeholders::_1),
[] (const BlackMisc::Aviation::CCallsign &) {});
[](const BlackMisc::Aviation::CCallsign &) {});
Q_ASSERT(c);
Q_UNUSED(c);
}
@@ -129,10 +129,13 @@ namespace BlackSimPlugin
engines.push_back(engine);
}
Aviation::CAircraftParts parts { { m_xplaneData.strobeLightsOn, m_xplaneData.landingLightsOn, m_xplaneData.taxiLightsOn,
m_xplaneData.beaconLightsOn, m_xplaneData.navLightsOn, false },
{ m_xplaneData.gearReployRatio > 0 }, { static_cast<int>(m_xplaneData.flapsReployRatio * 100) },
{ m_xplaneData.speedBrakeRatio > 0.5 }, engines, { m_xplaneData.onGroundAll } };
Aviation::CAircraftParts parts { {
m_xplaneData.strobeLightsOn, m_xplaneData.landingLightsOn, m_xplaneData.taxiLightsOn,
m_xplaneData.beaconLightsOn, m_xplaneData.navLightsOn, false
},
{ m_xplaneData.gearReployRatio > 0 }, { static_cast<int>(m_xplaneData.flapsReployRatio * 100) },
{ m_xplaneData.speedBrakeRatio > 0.5 }, engines, { m_xplaneData.onGroundAll }
};
ownAircraft().setParts(parts);
}
}
@@ -228,7 +231,9 @@ namespace BlackSimPlugin
void CSimulatorXPlane::ps_emitOwnAircraftModelChanged(const QString &path, const QString &filename, const QString &livery, const QString &icao)
{
//! \todo change as appropriate
//! \todo XP, change as appropriate
// try to set correct model and ICAO values here
// thy show up in GUI
CAircraftModel model(ownAircraft().getModel());
model.setModelType(CAircraftModel::TypeOwnSimulatorModel);
model.setFileName(path + "/" + filename);

View File

@@ -179,7 +179,7 @@ void SwiftGuiStd::initGuiSignals()
connect(this->ui->comp_Login, &CLoginComponent::requestNetworkSettings, this->ui->comp_MainInfoArea->getFlightPlanComponent(), [ = ]()
{
this->ps_setMainPageInfoArea(CMainInfoAreaComponent::InfoAreaSettings);
this->ui->comp_MainInfoArea->getSettingsComponent()->setSettingsTab(CSettingsComponent::SettingTabNetwork);
this->ui->comp_MainInfoArea->getSettingsComponent()->setSettingsTab(CSettingsComponent::SettingTabNetworkServers);
});
// main info area