This commit is contained in:
Klaus Basan
2018-07-07 19:52:43 +02:00
parent 53a7ef2df3
commit ead1a93597
16 changed files with 93 additions and 90 deletions

View File

@@ -678,7 +678,7 @@ namespace BlackCore
{ {
static const BlackMisc::CLogCategoryList cats static const BlackMisc::CLogCategoryList cats
( (
CThreadedReader::getLogCategories().join({ BlackMisc::CLogCategory::swiftDbWebservice(), BlackMisc::CLogCategory::webservice() }) CThreadedReader::getLogCategories().join({ CLogCategory::swiftDbWebservice(), CLogCategory::webservice() })
); );
return cats; return cats;
} }

View File

@@ -279,9 +279,9 @@ namespace BlackCore
qint64 m_statsLastUpdateAircraftRequestedMs = 0; //!< when was the last aircraft update requested qint64 m_statsLastUpdateAircraftRequestedMs = 0; //!< when was the last aircraft update requested
qint64 m_statsUpdateAircraftRequestedDeltaMs = 0; //!< delta time between 2 aircraft updates qint64 m_statsUpdateAircraftRequestedDeltaMs = 0; //!< delta time between 2 aircraft updates
BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object BlackMisc::Simulation::CSimulatorInternals m_simulatorInternals; //!< setup object
BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation BlackMisc::Simulation::CInterpolationLogger m_interpolationLogger; //!< log.interpolation
BlackMisc::Aviation::CTimestampPerCallsign m_clampedLogMsg; //!< when logged last for this callsign, can be used so there is no log message overflow BlackMisc::Aviation::CTimestampPerCallsign m_clampedLogMsg; //!< when logged last for this callsign, can be used so there is no log message overflow
BlackMisc::Aviation::CAircraftSituationPerCallsign m_lastSentSituations; //!< last situation sent to simulator BlackMisc::Aviation::CAircraftSituationPerCallsign m_lastSentSituations; //!< last situation sent to simulator
BlackMisc::Aviation::CAircraftPartsPerCallsign m_lastSentParts; //!< last parts sent to simulator BlackMisc::Aviation::CAircraftPartsPerCallsign m_lastSentParts; //!< last parts sent to simulator

View File

@@ -42,46 +42,46 @@ namespace BlackGui
bool CMenuAction::isCheckableQAction() const bool CMenuAction::isCheckableQAction() const
{ {
if (!this->m_action) { return false; } if (!m_action) { return false; }
return this->m_action->isCheckable(); return m_action->isCheckable();
} }
void CMenuAction::setActionChecked(bool checked) void CMenuAction::setActionChecked(bool checked)
{ {
if (this->m_action) { m_action->setChecked(checked); } if (m_action) { m_action->setChecked(checked); }
} }
bool CMenuAction::isActionEnabled() const bool CMenuAction::isActionEnabled() const
{ {
if (!this->m_action) { return false; } if (!m_action) { return false; }
return this->m_action->isEnabled(); return m_action->isEnabled();
} }
void CMenuAction::setActionEnabled(bool enabled) void CMenuAction::setActionEnabled(bool enabled)
{ {
if (this->m_action) { m_action->setEnabled(enabled); } if (m_action) { m_action->setEnabled(enabled); }
} }
bool CMenuAction::hasNoPathWithSeparator() const bool CMenuAction::hasNoPathWithSeparator() const
{ {
return this->m_separator && this->hasNoPath(); return m_separator && this->hasNoPath();
} }
bool CMenuAction::hasNoPath() const bool CMenuAction::hasNoPath() const
{ {
return this->m_path.isEmpty() || this->m_path == pathNone(); return m_path.isEmpty() || m_path == pathNone();
} }
QPixmap CMenuAction::getPixmap() const QPixmap CMenuAction::getPixmap() const
{ {
if (this->m_icon.isNull()) { return QPixmap(); } if (m_icon.isNull()) { return QPixmap(); }
return this->m_icon.pixmap(this->m_icon.actualSize(QSize(16, 16))); return m_icon.pixmap(m_icon.actualSize(QSize(16, 16)));
} }
void CMenuAction::setEnabled(bool enabled) void CMenuAction::setEnabled(bool enabled)
{ {
Q_ASSERT_X(this->m_action, Q_FUNC_INFO, "No action"); Q_ASSERT_X(m_action, Q_FUNC_INFO, "No action");
this->m_action->setEnabled(enabled); m_action->setEnabled(enabled);
} }
const CMenuAction &CMenuAction::subMenuDatabase() const CMenuAction &CMenuAction::subMenuDatabase()
@@ -104,18 +104,18 @@ namespace BlackGui
QString CMenuAction::getLastPathPart() const QString CMenuAction::getLastPathPart() const
{ {
if (this->m_path.contains('/')) if (m_path.contains('/'))
{ {
if (this->m_path.endsWith('/')) { return ""; } if (m_path.endsWith('/')) { return ""; }
const int i = this->m_path.lastIndexOf('/'); const int i = m_path.lastIndexOf('/');
return this->m_path.mid(i + 1); return m_path.mid(i + 1);
} }
return ""; return "";
} }
void CMenuActions::splitSubMenus(const QString &key, QList<CMenuAction> &actions, QList<CMenuAction> &menus) const void CMenuActions::splitSubMenus(const QString &key, QList<CMenuAction> &actions, QList<CMenuAction> &menus) const
{ {
QList<CMenuAction> myActions(this->m_actions.values(key)); QList<CMenuAction> myActions(m_actions.values(key));
QList<CMenuAction> checkableActions; QList<CMenuAction> checkableActions;
std::reverse(myActions.begin(), myActions.end()); // the order is reverse because of the insert multi value std::reverse(myActions.begin(), myActions.end()); // the order is reverse because of the insert multi value
for (const CMenuAction &action : myActions) for (const CMenuAction &action : myActions)
@@ -163,8 +163,8 @@ namespace BlackGui
CMenuActions CMenuActions::getMenuActions(const QString &path) const CMenuActions CMenuActions::getMenuActions(const QString &path) const
{ {
if (this->m_actions.contains(path)) { return QList<CMenuAction>(); }; if (m_actions.contains(path)) { return QList<CMenuAction>(); };
const QList<CMenuAction> allActions(this->m_actions.values(path)); const QList<CMenuAction> allActions(m_actions.values(path));
QList<CMenuAction> menuActions; QList<CMenuAction> menuActions;
for (const CMenuAction &a : allActions) for (const CMenuAction &a : allActions)
{ {
@@ -178,7 +178,7 @@ namespace BlackGui
bool CMenuActions::containsMenu(const QString &path) const bool CMenuActions::containsMenu(const QString &path) const
{ {
if (!this->m_actions.contains(path)) { return false; } if (!m_actions.contains(path)) { return false; }
return getMenuActions(path).size() > 0; return getMenuActions(path).size() > 0;
} }
@@ -218,7 +218,7 @@ namespace BlackGui
CMenuAction CMenuActions::addAction(const CMenuAction &menuAction) CMenuAction CMenuActions::addAction(const CMenuAction &menuAction)
{ {
Q_ASSERT_X(!menuAction.getPath().isEmpty(), Q_FUNC_INFO, "Need path"); Q_ASSERT_X(!menuAction.getPath().isEmpty(), Q_FUNC_INFO, "Need path");
this->m_actions.insertMulti(menuAction.getPath(), menuAction); m_actions.insertMulti(menuAction.getPath(), menuAction);
return menuAction; return menuAction;
} }
@@ -323,8 +323,8 @@ namespace BlackGui
void CMenuActions::toQMenu(QMenu &menu, bool separateGroups) const void CMenuActions::toQMenu(QMenu &menu, bool separateGroups) const
{ {
if (this->m_actions.isEmpty()) { return; } if (m_actions.isEmpty()) { return; }
const QStringList keys = this->m_actions.uniqueKeys(); // Sorted ascending const QStringList keys = m_actions.uniqueKeys(); // Sorted ascending
QMap<QString, QMenu *> subMenus; // all sub menus QMap<QString, QMenu *> subMenus; // all sub menus
for (const QString &key : keys) for (const QString &key : keys)
@@ -399,7 +399,7 @@ namespace BlackGui
QList<CMenuAction> CMenuActions::toQList() const QList<CMenuAction> CMenuActions::toQList() const
{ {
return this->m_actions.values(); return m_actions.values();
} }
CMenuActions::operator QList<QAction *>() const CMenuActions::operator QList<QAction *>() const

View File

@@ -151,7 +151,7 @@ namespace BlackGui
//! Client COM related //! Client COM related
static const QString &pathClientCom() { static const QString p("Client.ATC"); return p; } static const QString &pathClientCom() { static const QString p("Client.ATC"); return p; }
//! Client COM related //! Client simulation related
static const QString &pathClientSimulation() { static const QString p("Client.Simulation"); return p; } static const QString &pathClientSimulation() { static const QString p("Client.Simulation"); return p; }
// ---- standard view paths -------- // ---- standard view paths --------

View File

@@ -40,6 +40,7 @@ namespace BlackGui
m_columns.addColumn(CColumn::standardString("gnd.elv.", CAircraftSituation::IndexGroundElevationPlusInfo)); m_columns.addColumn(CColumn::standardString("gnd.elv.", CAircraftSituation::IndexGroundElevationPlusInfo));
m_columns.addColumn(CColumn::standardString("gnd.elv.alt.", { CAircraftSituation::IndexGroundElevationPlane, CElevationPlane::IndexGeodeticHeightAsString })); m_columns.addColumn(CColumn::standardString("gnd.elv.alt.", { CAircraftSituation::IndexGroundElevationPlane, CElevationPlane::IndexGeodeticHeightAsString }));
m_columns.addColumn(CColumn("elv.radius", { CAircraftSituation::IndexGroundElevationPlane, CElevationPlane::IndexRadius }, new CPhysiqalQuantiyFormatter<CLengthUnit, CLength>(CLengthUnit::m(), 1))); m_columns.addColumn(CColumn("elv.radius", { CAircraftSituation::IndexGroundElevationPlane, CElevationPlane::IndexRadius }, new CPhysiqalQuantiyFormatter<CLengthUnit, CLength>(CLengthUnit::m(), 1)));
m_columns.addColumn(CColumn::standardString("cs.", "callsign", { CAircraftSituation::IndexCallsign, CCallsign::IndexCallsignStringAsSet }));
// default sort order // default sort order
this->setSortColumnByPropertyIndex(CAircraftSituation::IndexAdjustedMsWithOffset); this->setSortColumnByPropertyIndex(CAircraftSituation::IndexAdjustedMsWithOffset);

View File

@@ -58,48 +58,48 @@ namespace BlackGui
void CAtcStationListModel::setStationMode(CAtcStationListModel::AtcStationMode stationMode) void CAtcStationListModel::setStationMode(CAtcStationListModel::AtcStationMode stationMode)
{ {
if (this->m_stationMode == stationMode) return; if (m_stationMode == stationMode) return;
this->m_stationMode = stationMode; m_stationMode = stationMode;
this->m_columns.clear(); m_columns.clear();
switch (stationMode) switch (stationMode)
{ {
case NotSet: case NotSet:
case StationsOnline: case StationsOnline:
{ {
this->m_columns.addColumn(CColumn::standardString("cs.", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet })); m_columns.addColumn(CColumn::standardString("cs.", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet }));
CColumn col("type", CAtcStation::IndexIcon); CColumn col("type", CAtcStation::IndexIcon);
col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix }); col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix });
this->m_columns.addColumn(col); m_columns.addColumn(col);
this->m_columns.addColumn(CColumn("distance", CAtcStation::IndexRelativeDistance, new CAirspaceDistanceFormatter())); m_columns.addColumn(CColumn("distance", CAtcStation::IndexRelativeDistance, new CAirspaceDistanceFormatter()));
this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter())); m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter()));
this->m_columns.addColumn(CColumn("r.", "in range", CAtcStation::IndexIsInRange, new CBoolIconFormatter("in range", "outside range"))); m_columns.addColumn(CColumn("r.", "in range", CAtcStation::IndexIsInRange, new CBoolIconFormatter("in range", "outside range")));
this->m_columns.addColumn(CColumn("range", CAtcStation::IndexRange, new CAirspaceDistanceFormatter())); m_columns.addColumn(CColumn("range", CAtcStation::IndexRange, new CAirspaceDistanceFormatter()));
this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName })); m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName }));
this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatHm()))); m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatHm())));
this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatHm()))); m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatHm())));
this->m_columns.addColumn(CColumn::standardString("voiceroomurl", { CAtcStation::IndexVoiceRoom, CVoiceRoom::IndexUrl })); m_columns.addColumn(CColumn::standardString("voiceroomurl", { CAtcStation::IndexVoiceRoom, CVoiceRoom::IndexUrl }));
// default sort order // default sort order
this->setSortColumnByPropertyIndex(CAtcStation::IndexRelativeDistance); this->setSortColumnByPropertyIndex(CAtcStation::IndexRelativeDistance);
this->m_sortOrder = Qt::AscendingOrder; m_sortOrder = Qt::AscendingOrder;
} }
break; break;
case StationsBooked: case StationsBooked:
{ {
this->m_columns.addColumn(CColumn::standardString("cs.", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet })); m_columns.addColumn(CColumn::standardString("cs.", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet }));
CColumn col = CColumn("type", CAtcStation::IndexIcon); CColumn col = CColumn("type", CAtcStation::IndexIcon);
col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix }); col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix });
this->m_columns.addColumn(col); m_columns.addColumn(col);
this->m_columns.addColumn(CColumn("", "on/offline", CAtcStation::IndexIsOnline, new CBoolLedFormatter("online", "offline"))); m_columns.addColumn(CColumn("", "on/offline", CAtcStation::IndexIsOnline, new CBoolLedFormatter("online", "offline")));
this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName })); m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName }));
this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm()))); m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm())));
this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm()))); m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm())));
this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter())); m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter()));
// default sort order // default sort order
this->setSortColumnByPropertyIndex(CAtcStation::IndexBookedFrom); this->setSortColumnByPropertyIndex(CAtcStation::IndexBookedFrom);
this->m_sortOrder = Qt::AscendingOrder; m_sortOrder = Qt::AscendingOrder;
} }
break; break;
@@ -161,7 +161,7 @@ namespace BlackGui
if (station.getCallsign().isEmpty()) return; if (station.getCallsign().isEmpty()) return;
if (added) if (added)
{ {
bool c = this->m_container.contains(&CAtcStation::getCallsign, station.getCallsign()); bool c = m_container.contains(&CAtcStation::getCallsign, station.getCallsign());
if (!c) { this->insert(station); } if (!c) { this->insert(station); }
} }
else else

View File

@@ -28,12 +28,12 @@ namespace BlackGui
//! Airports view //! Airports view
class BLACKGUI_EXPORT CAirportView : public CViewBase<Models::CAirportListModel, BlackMisc::Aviation::CAirportList, BlackMisc::Aviation::CAirport> class BLACKGUI_EXPORT CAirportView : public CViewBase<Models::CAirportListModel, BlackMisc::Aviation::CAirportList, BlackMisc::Aviation::CAirport>
{ {
public: public:
//! Constructor //! Constructor
explicit CAirportView(QWidget *parent = nullptr); explicit CAirportView(QWidget *parent = nullptr);
}; };
} }
} } // ns
#endif // guard #endif // guard

View File

@@ -56,36 +56,36 @@ namespace BlackGui
if (BlackConfig::CBuildConfig::isDebugBuild()) if (BlackConfig::CBuildConfig::isDebugBuild())
{ {
if (this->m_debugActions.isEmpty()) { this->m_actions = QList<QAction *>({nullptr, nullptr}); } if (this->m_debugActions.isEmpty()) { this->m_actions = QList<QAction *>({nullptr, nullptr}); }
this->m_actions[0] = menuActions.addAction(this->m_actions[0], CIcons::tableSheet16(), "Test: 1k ATC online stations", CMenuAction::pathClientCom(), { this, &CAtcStationView::ps_testRequest1kAtcOnlineDummies }); this->m_actions[0] = menuActions.addAction(this->m_actions[0], CIcons::tableSheet16(), "Test: 1k ATC online stations", CMenuAction::pathClientCom(), { this, &CAtcStationView::emitTestRequest1kAtcOnlineDummies });
this->m_actions[1] = menuActions.addAction(this->m_actions[1], CIcons::tableSheet16(), "Test: 3k ATC online stations", CMenuAction::pathClientCom(), { this, &CAtcStationView::ps_testRequest1kAtcOnlineDummies }); this->m_actions[1] = menuActions.addAction(this->m_actions[1], CIcons::tableSheet16(), "Test: 3k ATC online stations", CMenuAction::pathClientCom(), { this, &CAtcStationView::emitTestRequest3kAtcOnlineDummies });
} }
if (this->hasSelection()) if (this->hasSelection())
{ {
if (this->m_debugActions.isEmpty()) { this->m_debugActions = QList<QAction *>({nullptr, nullptr, nullptr}); } if (this->m_debugActions.isEmpty()) { this->m_debugActions = QList<QAction *>({nullptr, nullptr, nullptr}); }
this->m_debugActions[0] = menuActions.addAction(this->m_debugActions[0], CIcons::appCockpit16(), "Tune in COM1", CMenuAction::pathClientCom(), { this, &CAtcStationView::ps_tuneInAtcCom1 }); this->m_debugActions[0] = menuActions.addAction(this->m_debugActions[0], CIcons::appCockpit16(), "Tune in COM1", CMenuAction::pathClientCom(), { this, &CAtcStationView::tuneInAtcCom1 });
this->m_debugActions[1] = menuActions.addAction(this->m_debugActions[1], CIcons::appCockpit16(), "Tune in COM2", CMenuAction::pathClientCom(), { this, &CAtcStationView::ps_tuneInAtcCom2 }); this->m_debugActions[1] = menuActions.addAction(this->m_debugActions[1], CIcons::appCockpit16(), "Tune in COM2", CMenuAction::pathClientCom(), { this, &CAtcStationView::tuneInAtcCom2 });
this->m_debugActions[2] = menuActions.addAction(this->m_debugActions[2], CIcons::appTextMessages16(), "Show text messages", CMenuAction::pathClientCom(), { this, &CAtcStationView::ps_requestTextMessage }); this->m_debugActions[2] = menuActions.addAction(this->m_debugActions[2], CIcons::appTextMessages16(), "Show text messages", CMenuAction::pathClientCom(), { this, &CAtcStationView::requestTextMessage });
} }
CViewBase::customMenu(menuActions); CViewBase::customMenu(menuActions);
} }
void CAtcStationView::ps_tuneInAtcCom1() void CAtcStationView::tuneInAtcCom1()
{ {
const CAtcStation s(this->selectedObject()); const CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; } if (s.getCallsign().isEmpty()) { return; }
emit this->requestComFrequency(s.getFrequency(), CComSystem::Com1); emit this->requestComFrequency(s.getFrequency(), CComSystem::Com1);
} }
void CAtcStationView::ps_tuneInAtcCom2() void CAtcStationView::tuneInAtcCom2()
{ {
const CAtcStation s(this->selectedObject()); const CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; } if (s.getCallsign().isEmpty()) { return; }
emit this->requestComFrequency(s.getFrequency(), CComSystem::Com2); emit this->requestComFrequency(s.getFrequency(), CComSystem::Com2);
} }
void CAtcStationView::ps_requestTextMessage() void CAtcStationView::requestTextMessage()
{ {
const CAtcStation s(this->selectedObject()); const CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; } if (s.getCallsign().isEmpty()) { return; }

View File

@@ -44,6 +44,9 @@ namespace BlackGui
//! Set station mode //! Set station mode
void setStationMode(BlackGui::Models::CAtcStationListModel::AtcStationMode stationMode); void setStationMode(BlackGui::Models::CAtcStationListModel::AtcStationMode stationMode);
//! \copydoc Models::CAtcStationListModel::changedAtcStationConnectionStatus
void changedAtcStationConnectionStatus(const BlackMisc::Aviation::CAtcStation &station, bool added);
signals: signals:
//! Request some dummy ATC stations //! Request some dummy ATC stations
void testRequestDummyAtcOnlineStations(int number); void testRequestDummyAtcOnlineStations(int number);
@@ -54,25 +57,21 @@ namespace BlackGui
//! Request a text message to //! Request a text message to
void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign); void requestTextMessageWidget(const BlackMisc::Aviation::CCallsign &callsign);
public slots:
//! \copydoc Models::CAtcStationListModel::changedAtcStationConnectionStatus
void changedAtcStationConnectionStatus(const BlackMisc::Aviation::CAtcStation &station, bool added);
protected: protected:
//! \copydoc CViewBase::customMenu //! \copydoc CViewBase::customMenu
virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override; virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override;
private slots:
void ps_testRequest1kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(1000); }
void ps_testRequest3kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(3000); }
void ps_tuneInAtcCom1();
void ps_tuneInAtcCom2();
void ps_requestTextMessage();
private: private:
void emitTestRequest1kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(1000); }
void emitTestRequest3kAtcOnlineDummies() { emit this->testRequestDummyAtcOnlineStations(3000); }
void tuneInAtcCom1();
void tuneInAtcCom2();
void requestTextMessage();
QList<QAction *> m_actions; QList<QAction *> m_actions;
QList<QAction *> m_debugActions; QList<QAction *> m_debugActions;
}; };
} }
} } // ns
#endif // guard #endif // guard

View File

@@ -69,7 +69,7 @@ namespace BlackGui
protected: protected:
//! \copydoc CViewBase::customMenu //! \copydoc CViewBase::customMenu
virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override; virtual void customMenu(Menus::CMenuActions &menuActions) override;
private: private:
//! Request text message for selected aircraft //! Request text message for selected aircraft

View File

@@ -20,7 +20,6 @@
class QWidget; class QWidget;
namespace BlackMisc { namespace Network { class CTextMessage; } } namespace BlackMisc { namespace Network { class CTextMessage; } }
namespace BlackGui namespace BlackGui
{ {
namespace Views namespace Views
@@ -28,7 +27,6 @@ namespace BlackGui
//! Airports view //! Airports view
class BLACKGUI_EXPORT CTextMessageView : public CViewBase<Models::CTextMessageListModel, BlackMisc::Network::CTextMessageList, BlackMisc::Network::CTextMessage> class BLACKGUI_EXPORT CTextMessageView : public CViewBase<Models::CTextMessageListModel, BlackMisc::Network::CTextMessageList, BlackMisc::Network::CTextMessage>
{ {
public: public:
//! Constructor //! Constructor
explicit CTextMessageView(QWidget *parent = nullptr); explicit CTextMessageView(QWidget *parent = nullptr);

View File

@@ -19,7 +19,6 @@
class QWidget; class QWidget;
namespace BlackMisc { namespace Weather { class CWindLayer; } } namespace BlackMisc { namespace Weather { class CWindLayer; } }
namespace BlackGui namespace BlackGui
{ {
namespace Views namespace Views
@@ -29,7 +28,6 @@ namespace BlackGui
{ {
public: public:
//! Constructor //! Constructor
explicit CWindLayerView(QWidget *parent = nullptr); explicit CWindLayerView(QWidget *parent = nullptr);
}; };

View File

@@ -31,7 +31,7 @@ namespace BlackMisc
CAltitude CAltitude::withOffset(const CLength &offset) const CAltitude CAltitude::withOffset(const CLength &offset) const
{ {
if (this->isNull()) { return CAltitude(offset, CAltitude::MeanSeaLevel); } if (this->isNull()) { return CAltitude::null(); }
CAltitude copy(*this); CAltitude copy(*this);
if (!offset.isNull() && !offset.isZeroEpsilonConsidered()) if (!offset.isNull() && !offset.isZeroEpsilonConsidered())
{ {

View File

@@ -83,7 +83,7 @@ namespace BlackMisc
//! Normal vector with double precision //! Normal vector with double precision
virtual std::array<double, 3> normalVectorDouble() const = 0; virtual std::array<double, 3> normalVectorDouble() const = 0;
//! Is equal, epsilon considered? //! Is equal? Epsilon considered.
bool equalNormalVectorDouble(const std::array<double, 3> &otherVector) const; bool equalNormalVectorDouble(const std::array<double, 3> &otherVector) const;
//! Is equal, epsilon considered? //! Is equal, epsilon considered?
@@ -120,7 +120,7 @@ namespace BlackMisc
//! \copydoc Mixin::Index::propertyByIndex //! \copydoc Mixin::Index::propertyByIndex
CVariant propertyByIndex(const CPropertyIndex &index) const; CVariant propertyByIndex(const CPropertyIndex &index) const;
//! Compare by index //! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const; int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateGeodetic &compareValue) const;
//! \copydoc Mixin::String::toQString //! \copydoc Mixin::String::toQString
@@ -184,7 +184,7 @@ namespace BlackMisc
//! \copydoc Mixin::Index::setPropertyByIndex //! \copydoc Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant); void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
//! Compare by index //! \copydoc Mixin::Index::comparePropertyByIndex
int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const; int comparePropertyByIndex(const CPropertyIndex &index, const ICoordinateWithRelativePosition &compareValue) const;
//! \copydoc Mixin::String::toQString //! \copydoc Mixin::String::toQString

View File

@@ -286,6 +286,11 @@ namespace BlackMisc
int Index<Derived>::comparePropertyByIndex(const CPropertyIndex &index, const Derived &compareValue) const int Index<Derived>::comparePropertyByIndex(const CPropertyIndex &index, const Derived &compareValue) const
{ {
if (this == &compareValue) { return 0; } if (this == &compareValue) { return 0; }
if (index.isMyself()) {
// slow, only last resort
return derived()->toQString().compare(compareValue.toQString());
}
const auto i = index.frontCasted<ColumnIndex>(); const auto i = index.frontCasted<ColumnIndex>();
switch (i) switch (i)
{ {
@@ -295,6 +300,8 @@ namespace BlackMisc
default: default:
break; break;
} }
// slow, only last resort
return derived()->toQString().compare(compareValue.toQString()); return derived()->toQString().compare(compareValue.toQString());
} }
} // Mixin } // Mixin

View File

@@ -246,10 +246,10 @@ namespace BlackMisc
// list from new to old // list from new to old
CAircraftSituationList updatedSituations; // copy of updated situations CAircraftSituationList updatedSituations; // copy of updated situations
{ {
const qint64 ts = QDateTime::currentMSecsSinceEpoch(); const qint64 now = QDateTime::currentMSecsSinceEpoch();
QWriteLocker lock(&m_lockSituations); QWriteLocker lock(&m_lockSituations);
m_situationsAdded++; m_situationsAdded++;
m_situationsLastModified[cs] = ts; m_situationsLastModified[cs] = now;
CAircraftSituationList &newSituationsList = m_situationsByCallsign[cs]; CAircraftSituationList &newSituationsList = m_situationsByCallsign[cs];
newSituationsList.setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst); newSituationsList.setAdjustedSortHint(CAircraftSituationList::AdjustedTimestampLatestFirst);
const int situations = newSituationsList.size(); const int situations = newSituationsList.size();
@@ -469,7 +469,7 @@ namespace BlackMisc
if (!this->isAircraftInRange(callsign)) { return 0; } if (!this->isAircraftInRange(callsign)) { return 0; }
// update aircraft situation // update aircraft situation
const qint64 ts = QDateTime::currentMSecsSinceEpoch(); const qint64 now = QDateTime::currentMSecsSinceEpoch();
const CAircraftModel model = this->getAircraftInRangeModelForCallsign(callsign); const CAircraftModel model = this->getAircraftInRangeModelForCallsign(callsign);
CAircraftSituationChange change; CAircraftSituationChange change;
int updated = 0; int updated = 0;
@@ -479,11 +479,11 @@ namespace BlackMisc
if (situations.isEmpty()) { return 0; } if (situations.isEmpty()) { return 0; }
updated = situations.setGroundElevationCheckedAndGuessGround(elevation, info, model, &change); updated = situations.setGroundElevationCheckedAndGuessGround(elevation, info, model, &change);
if (updated < 1) { return 0; } if (updated < 1) { return 0; }
m_situationsLastModified[callsign] = ts; m_situationsLastModified[callsign] = now;
const CAircraftSituation latest = situations.front(); const CAircraftSituation latestSituation = situations.front();
if (info == CAircraftSituation::FromProvider && latest.isOnGround()) if (info == CAircraftSituation::FromProvider && latestSituation.isOnGround())
{ {
m_latestOnGroundProviderElevation[callsign] = latest; m_latestOnGroundProviderElevation[callsign] = latestSituation;
} }
} }