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: