mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Removed old model/views for aircraft, now all with simulated aircraft
Updates of models in view now manually / automatic possible Allow to reload models (in backend)
This commit is contained in:
@@ -117,6 +117,9 @@ namespace BlackCore
|
||||
//! Airports in range
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const = 0;
|
||||
|
||||
//! Reload models from disk
|
||||
virtual void reloadInstalledModels() = 0;
|
||||
|
||||
//! Installed models in simulator eco system
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
||||
|
||||
|
||||
@@ -58,49 +58,49 @@ namespace BlackCore
|
||||
|
||||
bool CContextSimulator::isConnected() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->isConnected();
|
||||
}
|
||||
|
||||
bool CContextSimulator::canConnect() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->canConnect();
|
||||
}
|
||||
|
||||
bool CContextSimulator::connectToSimulator()
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->connectTo();
|
||||
}
|
||||
|
||||
void CContextSimulator::asyncConnectToSimulator()
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator || m_canConnectResult.isRunning()) return; // already checking
|
||||
m_simulator->asyncConnectTo();
|
||||
}
|
||||
|
||||
bool CContextSimulator::disconnectFromSimulator()
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return m_simulator->disconnectFrom();
|
||||
}
|
||||
|
||||
BlackSim::CSimulatorInfo CContextSimulator::getSimulatorInfo() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return BlackSim::CSimulatorInfo::UnspecifiedSim();
|
||||
return m_simulator->getSimulatorInfo();
|
||||
}
|
||||
|
||||
CAirportList CContextSimulator::getAirportsInRange() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
// If no ISimulator object is available, return a dummy.
|
||||
if (!m_simulator) { return CAirportList(); }
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace BlackCore
|
||||
|
||||
CAircraftModelList CContextSimulator::getInstalledModels() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
// If no ISimulator object is available, return a dummy.
|
||||
if (!m_simulator) { return CAircraftModelList(); }
|
||||
|
||||
@@ -118,21 +118,28 @@ namespace BlackCore
|
||||
|
||||
CAircraftModelList CContextSimulator::getInstalledModelsStartingWith(const QString modelString) const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
|
||||
if (!m_simulator) { return CAircraftModelList(); }
|
||||
return this->m_simulator->getInstalledModels().findModelsStartingWith(modelString);
|
||||
}
|
||||
|
||||
void CContextSimulator::reloadInstalledModels()
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) { return; }
|
||||
m_simulator->reloadInstalledModels();
|
||||
}
|
||||
|
||||
CAircraftIcao CContextSimulator::getIcaoForModelString(const QString &modelString) const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << modelString; }
|
||||
if (!m_simulator) { return CAircraftIcao(); }
|
||||
return this->m_simulator->getIcaoForModelString(modelString);
|
||||
}
|
||||
|
||||
bool CContextSimulator::setTimeSynchronization(bool enable, CTime offset)
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) { return false; }
|
||||
bool c = this->m_simulator->setTimeSynchronization(enable, offset);
|
||||
if (!c) { return false; }
|
||||
@@ -149,7 +156,7 @@ namespace BlackCore
|
||||
|
||||
bool CContextSimulator::isTimeSynchronized() const
|
||||
{
|
||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO;
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (!m_simulator) return false;
|
||||
return this->m_simulator->isTimeSynchronized();
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
||||
|
||||
//! \copydoc IContextSimulator::reloadInstalledModels
|
||||
virtual void reloadInstalledModels() override;
|
||||
|
||||
//! \copydoc IContextSimulator::getIcaoForModelString
|
||||
virtual BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const override;
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<BlackMisc::Simulation::CAircraftModelList>(QLatin1Literal("getInstalledModelsStartingWith"), modelString);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::reloadInstalledModels()
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("reloadInstalledModels"));
|
||||
}
|
||||
|
||||
CAircraftIcao CContextSimulatorProxy::getIcaoForModelString(const QString &modelString) const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<CAircraftIcao>(QLatin1Literal("getIcaoForModelString"), modelString);
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextSimulator::getInstalledModelsStartingWith
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModelsStartingWith(const QString modelString) const override;
|
||||
|
||||
//! \copydoc IContextSimulator::reloadInstalledModels
|
||||
virtual void reloadInstalledModels() override;
|
||||
|
||||
//! \copydoc IContextSimulator::getIcaoForModelString
|
||||
virtual BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const override;
|
||||
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace BlackCore
|
||||
//! Aircraft models for available remote aircrafts
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const = 0;
|
||||
|
||||
//! Reload the installed models
|
||||
virtual void reloadInstalledModels() = 0;
|
||||
|
||||
//! Airports in range
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const = 0;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace BlackGui
|
||||
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestUpdate, this, &CMappingComponent::ps_onModelsUpdateRequested);
|
||||
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
||||
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::ps_onModelSelectedInView);
|
||||
connect(this->ui->tvp_AircraftModels, &CAircraftModelView::requestModelReload, this, &CMappingComponent::ps_onMenuRequestModelReload);
|
||||
|
||||
connect(this->ui->tvp_SimulatedAircraft, &CSimulatedAircraftView::rowCountChanged, this, &CMappingComponent::ps_onRowCountChanged);
|
||||
connect(this->ui->tvp_SimulatedAircraft, &CSimulatedAircraftView::clicked, this, &CMappingComponent::ps_onAircraftSelectedInView);
|
||||
@@ -106,7 +107,14 @@ namespace BlackGui
|
||||
|
||||
void CMappingComponent::ps_onAircraftModelsLoaded()
|
||||
{
|
||||
this->ps_onModelsUpdateRequested();
|
||||
if (ui->tvp_AircraftModels->displayAutomatically())
|
||||
{
|
||||
this->ps_onModelsUpdateRequested();
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).info("Models loaded, you can update the model view");
|
||||
}
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onModelMatchingCompleted(const BlackMisc::Simulation::CSimulatedAircraft &aircraft)
|
||||
@@ -339,6 +347,15 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CMappingComponent::ps_onMenuRequestModelReload()
|
||||
{
|
||||
if (this->getIContextSimulator())
|
||||
{
|
||||
this->getIContextSimulator()->reloadInstalledModels();
|
||||
CLogMessage(this).info("Requested to reload simulator aircraft models");
|
||||
}
|
||||
}
|
||||
|
||||
const QString &CMappingComponent::mappingtOriginator()
|
||||
{
|
||||
// string is generated once, the timestamp allows to use multiple
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace BlackGui
|
||||
//! Enable / disable aircraft
|
||||
void ps_onMenuEnableAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
|
||||
|
||||
//! Reload models
|
||||
void ps_onMenuRequestModelReload();
|
||||
|
||||
private:
|
||||
static const QString &mappingtOriginator();
|
||||
void updateSimulatedAircraftView();
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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 "aircraftlistmodel.h"
|
||||
#include "blackmisc/nwuser.h"
|
||||
#include "blackmisc/avaircraftsituation.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CAircraftListModel::CAircraftListModel(QObject *parent) : CListModelBase("ViewAircraftList", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CAircraft::IndexCallsign, CCallsign::IndexCallsignString }));
|
||||
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CAircraft::IndexPilot, CUser::IndexRealName }));
|
||||
this->m_columns.addColumn(CColumn("dist.", "distance", CAircraft::IndexDistanceToOwnAircraft, new CAirspaceDistanceFormatter()));
|
||||
this->m_columns.addColumn(CColumn("frequency", { CAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter()));
|
||||
this->m_columns.addColumn(CColumn::standardString("icao", { CAircraft::IndexIcao, CAircraftIcao::IndexAsString}));
|
||||
this->m_columns.addColumn(CColumn::standardString("transponder", { CAircraft::IndexTransponder, CTransponder::IndexTransponderCodeAndModeFormatted }));
|
||||
this->m_columns.addColumn(CColumn("latitude", { CAircraft::IndexSituation, CAircraftSituation::IndexLatitude }, new CLatLonFormatter()));
|
||||
this->m_columns.addColumn(CColumn("longitude", { CAircraft::IndexSituation, CAircraftSituation::IndexLongitude }, new CLatLonFormatter()));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("altitude", { CAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, CDefaultFormatter::alignRightVCenter()));
|
||||
this->m_columns.addColumn(CColumn("gs", { CAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter()));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CAircraft::IndexDistanceToOwnAircraft);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "callsign");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "pilotrealname");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "latitude");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "longitude");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "altitude");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "distance");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "height");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "transponder");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "groundspeed");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAircraftList", "icao");
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
@@ -1,40 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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_AIRCRAFTLISTMODEL_H
|
||||
#define BLACKGUI_AIRCRAFTLISTMODEL_H
|
||||
|
||||
#include "blackmisc/avaircraftlist.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDBusConnection>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
//! Aircraft list model
|
||||
class CAircraftListModel : public CListModelBase<BlackMisc::Aviation::CAircraft, BlackMisc::Aviation::CAircraftList>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
explicit CAircraftListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAircraftListModel() {}
|
||||
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
#endif // guard
|
||||
@@ -38,6 +38,11 @@ namespace BlackGui
|
||||
this->m_model->setAircraftModelMode(mode);
|
||||
}
|
||||
|
||||
bool CAircraftModelView::displayAutomatically() const
|
||||
{
|
||||
return m_displayAutomatically;
|
||||
}
|
||||
|
||||
bool CAircraftModelView::ps_filterDialogFinished(int status)
|
||||
{
|
||||
if (CViewBase::ps_filterDialogFinished(status)) { return true; }
|
||||
@@ -47,6 +52,24 @@ namespace BlackGui
|
||||
return true;
|
||||
}
|
||||
|
||||
void CAircraftModelView::customMenu(QMenu &menu) const
|
||||
{
|
||||
QAction *a = menu.addAction(CIcons::appMappings16(), "Automatically display", this, SLOT(ps_toggleAutoDisplay()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(m_displayAutomatically);
|
||||
menu.addAction(CIcons::refresh16(), "Reload model data", this, SIGNAL(requestModelReload()));
|
||||
menu.addSeparator();
|
||||
CViewBase::customMenu(menu);
|
||||
}
|
||||
|
||||
void CAircraftModelView::ps_toggleAutoDisplay()
|
||||
{
|
||||
QAction *a = qobject_cast<QAction *>(QObject::sender());
|
||||
if (!a) { return; }
|
||||
Q_ASSERT(a->isCheckable());
|
||||
this->m_displayAutomatically = a->isChecked();
|
||||
}
|
||||
|
||||
CAircraftModelFilterForm *CAircraftModelView::getFilterForm() const
|
||||
{
|
||||
return static_cast<CAircraftModelFilterForm *>(this->m_filterDialog.data());
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace BlackGui
|
||||
//! Aircrafts view
|
||||
class CAircraftModelView : public CViewBase<Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
@@ -32,14 +33,30 @@ namespace BlackGui
|
||||
//! Set display mode
|
||||
void setAircraftModelMode(Models::CAircraftModelListModel::AircraftModelMode mode);
|
||||
|
||||
//! Display automatically (when models are loaded)
|
||||
bool displayAutomatically() const;
|
||||
|
||||
signals:
|
||||
//! Request reloading of backend models
|
||||
void requestModelReload();
|
||||
|
||||
protected slots:
|
||||
//! \copydoc CViewBaseNonTemplate::ps_filterDialogFinished
|
||||
virtual bool ps_filterDialogFinished(int status) override;
|
||||
|
||||
protected:
|
||||
//! \copydoc CViewBase::customMenu
|
||||
virtual void customMenu(QMenu &menu) const override;
|
||||
|
||||
private slots:
|
||||
//! Toggle auto display
|
||||
void ps_toggleAutoDisplay();
|
||||
|
||||
private:
|
||||
//! Filter form
|
||||
CAircraftModelFilterForm *getFilterForm() const;
|
||||
bool m_displayAutomatically = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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 "aircraftview.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
CAircraftView::CAircraftView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->standardInit(new CAircraftListModel(this));
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
@@ -1,34 +0,0 @@
|
||||
/* Copyright (C) 2013
|
||||
* 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_AIRCRAFTVIEW_H
|
||||
#define BLACKGUI_AIRCRAFTVIEW_H
|
||||
|
||||
#include "viewbase.h"
|
||||
#include "../models/aircraftlistmodel.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
//! Aircrafts view
|
||||
//! \deprecated use simulated aircraft instead
|
||||
class CAircraftView : public CViewBase<Models::CAircraftListModel, BlackMisc::Aviation::CAircraftList, BlackMisc::Aviation::CAircraft>
|
||||
{
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAircraftView(QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
#endif // guard
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "../models/statusmessagelistmodel.h"
|
||||
#include "../models/namevariantpairlistmodel.h"
|
||||
#include "../models/atcstationlistmodel.h"
|
||||
#include "../models/aircraftlistmodel.h"
|
||||
#include "../models/aircraftmodellistmodel.h"
|
||||
#include "../models/textmessagelistmodel.h"
|
||||
#include "../models/airportlistmodel.h"
|
||||
@@ -87,8 +86,14 @@ 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()));
|
||||
if (m_rowResizeMode == Interactive)
|
||||
{
|
||||
menu.addAction(BlackMisc::CIcons::resizeVertical16(), "Resize rows to content", this, SLOT(rowsResizeModeToContent()));
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
@@ -398,7 +403,6 @@ namespace BlackGui
|
||||
template class CViewBase<BlackGui::Models::CStatusMessageListModel, BlackMisc::CStatusMessageList, BlackMisc::CStatusMessage>;
|
||||
template class CViewBase<BlackGui::Models::CNameVariantPairModel, BlackMisc::CNameVariantPairList, BlackMisc::CNameVariantPair>;
|
||||
template class CViewBase<BlackGui::Models::CAtcStationListModel, BlackMisc::Aviation::CAtcStationList, BlackMisc::Aviation::CAtcStation>;
|
||||
template class CViewBase<BlackGui::Models::CAircraftListModel, BlackMisc::Aviation::CAircraftList, BlackMisc::Aviation::CAircraft>;
|
||||
template class CViewBase<BlackGui::Models::CAirportListModel, BlackMisc::Aviation::CAirportList, BlackMisc::Aviation::CAirport>;
|
||||
template class CViewBase<BlackGui::Models::CServerListModel, BlackMisc::Network::CServerList, BlackMisc::Network::CServer>;
|
||||
template class CViewBase<BlackGui::Models::CUserListModel, BlackMisc::Network::CUserList, BlackMisc::Network::CUser>;
|
||||
|
||||
@@ -98,6 +98,11 @@ namespace BlackSim
|
||||
this->m_init = false;
|
||||
}
|
||||
|
||||
void CAircraftMapper::markUninitialized()
|
||||
{
|
||||
this->m_init = false;
|
||||
}
|
||||
|
||||
const CAircraftModel &CAircraftMapper::getDefaultModel()
|
||||
{
|
||||
static const CAircraftModel aircraftModel(
|
||||
|
||||
@@ -99,6 +99,9 @@ namespace BlackSim
|
||||
//! Shutdown
|
||||
void gracefulShutdown();
|
||||
|
||||
//! To force reload
|
||||
void markUninitialized();
|
||||
|
||||
//! default model
|
||||
static const BlackMisc::Simulation::CAircraftModel &getDefaultModel();
|
||||
|
||||
|
||||
@@ -211,6 +211,15 @@ namespace BlackSimPlugin
|
||||
return mapperInstance()->getIcaoForModelString(modelString);
|
||||
}
|
||||
|
||||
void CSimulatorFsCommon::reloadInstalledModels()
|
||||
{
|
||||
if (mapperInstance())
|
||||
{
|
||||
mapperInstance()->markUninitialized();
|
||||
mapperInstance()->initCompletelyInBackground();
|
||||
}
|
||||
}
|
||||
|
||||
CPixmap CSimulatorFsCommon::iconForModel(const QString &modelString) const
|
||||
{
|
||||
static const CPixmap empty;
|
||||
|
||||
@@ -56,15 +56,18 @@ namespace BlackSimPlugin
|
||||
//! \copydoc ISimulator::setTimeSynchronization
|
||||
virtual bool setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
||||
|
||||
//! \copydoc BlackCore::ISimulator::getAirportsInRange
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const;
|
||||
//! \copydoc ISimulator::getAirportsInRange
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const override;
|
||||
|
||||
//! \copydoc BlackCore::ISimulator::getInstalledModels
|
||||
//! \copydoc ISimulator::getInstalledModels
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const override;
|
||||
|
||||
//! \copydoc BlackCore::ISimulator::getIcaoForModelString
|
||||
//! \copydoc ISimulator::getIcaoForModelString
|
||||
virtual BlackMisc::Aviation::CAircraftIcao getIcaoForModelString(const QString &modelString) const override;
|
||||
|
||||
//! \copydoc ISimulator::reloadInstalledModels
|
||||
virtual void reloadInstalledModels() override;
|
||||
|
||||
//! \copydoc IContextSimulator::iconForModel
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
|
||||
|
||||
|
||||
@@ -254,16 +254,22 @@ namespace BlackSimPlugin
|
||||
void CSimulatorXPlane::displayTextMessage(const BlackMisc::Network::CTextMessage &message) const
|
||||
{
|
||||
if (! isConnected()) { return; }
|
||||
// TODO
|
||||
Q_UNUSED(message);
|
||||
}
|
||||
|
||||
BlackMisc::Simulation::CAircraftModelList CSimulatorXPlane::getInstalledModels() const
|
||||
{
|
||||
// TODO
|
||||
//! \todo XP driver, function not available
|
||||
CLogMessage(this).error("Function not avialable");
|
||||
return {};
|
||||
}
|
||||
|
||||
void CSimulatorXPlane::reloadInstalledModels()
|
||||
{
|
||||
//! \todo XP driver, function not available
|
||||
CLogMessage(this).error("Function not avialable");
|
||||
}
|
||||
|
||||
void CSimulatorXPlane::ps_setAirportsInRange(const QStringList &icaos, const QStringList &names, const BlackMisc::CSequence<double> &lats, const BlackMisc::CSequence<double> &lons, const BlackMisc::CSequence<double> &alts)
|
||||
{
|
||||
qDebug() << alts;
|
||||
@@ -296,7 +302,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
CLogMessage(this).warning("X-Plane already provides real time synchronization");
|
||||
CLogMessage(this).info("X-Plane provides real time synchronization, use this on");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,9 @@ namespace BlackSimPlugin
|
||||
//! \copydoc BlackCore::ISimulator::getInstalledModels
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getInstalledModels() const override;
|
||||
|
||||
//! \copydoc ISimulator::reloadInstalledModels
|
||||
virtual void reloadInstalledModels() override;
|
||||
|
||||
//! \copydoc BlackCore::ISimulator::getAirportsInRange
|
||||
virtual BlackMisc::Aviation::CAirportList getAirportsInRange() const;
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "blackgui/transpondermodeselector.h"
|
||||
#include "blackgui/models/atcstationlistmodel.h"
|
||||
#include "blackgui/models/serverlistmodel.h"
|
||||
#include "blackgui/models/aircraftlistmodel.h"
|
||||
#include "blackgui/models/userlistmodel.h"
|
||||
#include "blackgui/models/statusmessagelistmodel.h"
|
||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||
|
||||
Reference in New Issue
Block a user