mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-11 12:15:36 +08:00
refs #199, adjusted GUI to new runtime. The central change is in mainwindow_init, where no longer own context pointers will be used, but an own runtime object.
This commit is contained in:
@@ -26,8 +26,6 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
ui(new Ui::MainWindow),
|
||||
m_infoWindow(nullptr),
|
||||
m_init(false), m_windowMode(windowMode), m_audioTestRunning(NoAudioTest),
|
||||
// misc
|
||||
m_dBusConnection("dummy"),
|
||||
// table view models
|
||||
m_statusMessageList(nullptr),
|
||||
m_modelAtcListOnline(nullptr), m_modelAtcListBooked(nullptr), m_modelTrafficServerList(nullptr), m_modelAircraftsInRange(nullptr),
|
||||
@@ -35,8 +33,7 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
||||
// contexts and runtime
|
||||
m_coreMode(GuiModes::CoreExternal),
|
||||
m_coreAvailable(false), m_contextNetworkAvailable(false), m_contextAudioAvailable(false),
|
||||
m_contextApplication(nullptr), m_contextNetwork(nullptr), m_contextAudio(nullptr), m_contextSettings(nullptr),
|
||||
m_contextSimulator(nullptr),
|
||||
|
||||
// timers
|
||||
m_timerUpdateAtcStationsOnline(nullptr), m_timerUpdateAircraftsInRange(nullptr), m_timerUpdateUsers(nullptr),
|
||||
m_timerCollectedCockpitUpdates(nullptr), m_timerContextWatchdog(nullptr),
|
||||
@@ -94,15 +91,15 @@ void MainWindow::gracefulShutdown()
|
||||
// if we have a context, we shut some things down
|
||||
if (this->m_contextNetworkAvailable)
|
||||
{
|
||||
if (this->m_contextNetwork->isConnected())
|
||||
if (this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
this->m_contextAudio->leaveAllVoiceRooms();
|
||||
this->m_contextAudio->disconnect(this); // break down signal / slots
|
||||
this->m_rt->getIContextAudio()->leaveAllVoiceRooms();
|
||||
this->m_rt->getIContextAudio()->disconnect(this); // break down signal / slots
|
||||
}
|
||||
this->m_contextNetwork->disconnectFromNetwork();
|
||||
this->m_contextNetwork->disconnect(this); // avoid any status update signals, etc.
|
||||
this->m_rt->getIContextNetwork()->disconnectFromNetwork();
|
||||
this->m_rt->getIContextNetwork()->disconnect(this); // avoid any status update signals, etc.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,7 +195,7 @@ void MainWindow::toggleNetworkConnection()
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
|
||||
this->ui->lbl_StatusNetworkConnectedIcon->setPixmap(this->m_resPixmapConnectionConnecting);
|
||||
if (!this->m_contextNetwork->isConnected())
|
||||
if (!this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
if (this->m_ownAircraft.getCallsign().isEmpty())
|
||||
{
|
||||
@@ -207,8 +204,8 @@ void MainWindow::toggleNetworkConnection()
|
||||
}
|
||||
|
||||
// send latest aircraft to network/voice
|
||||
this->m_contextNetwork->setOwnAircraft(this->m_ownAircraft);
|
||||
if (this->m_contextAudioAvailable) this->m_contextAudio->setOwnAircraft(this->m_ownAircraft);
|
||||
this->m_rt->getIContextNetwork()->setOwnAircraft(this->m_ownAircraft);
|
||||
if (this->m_contextAudioAvailable) this->m_rt->getIContextAudio()->setOwnAircraft(this->m_ownAircraft);
|
||||
|
||||
// Login is based on setting current server
|
||||
INetwork::LoginMode mode = INetwork::LoginNormal;
|
||||
@@ -222,14 +219,14 @@ void MainWindow::toggleNetworkConnection()
|
||||
mode = INetwork::LoginAsObserver;
|
||||
this->displayStatusMessage(CStatusMessage::getInfoMessage("login in observer mode"));
|
||||
}
|
||||
msgs = this->m_contextNetwork->connectToNetwork(static_cast<uint>(mode));
|
||||
msgs = this->m_rt->getIContextNetwork()->connectToNetwork(static_cast<uint>(mode));
|
||||
}
|
||||
else
|
||||
{
|
||||
// disconnect from network
|
||||
this->stopUpdateTimers(); // stop update timers, to avoid updates during disconnecting (a short time frame)
|
||||
if (this->m_contextAudioAvailable) this->m_contextAudio->leaveAllVoiceRooms();
|
||||
msgs = this->m_contextNetwork->disconnectFromNetwork();
|
||||
if (this->m_contextAudioAvailable) this->m_rt->getIContextAudio()->leaveAllVoiceRooms();
|
||||
msgs = this->m_rt->getIContextNetwork()->disconnectFromNetwork();
|
||||
}
|
||||
if (!msgs.isEmpty()) this->displayStatusMessages(msgs);
|
||||
}
|
||||
@@ -372,9 +369,9 @@ void MainWindow::timerBasedUpdates()
|
||||
void MainWindow::setContextAvailability()
|
||||
{
|
||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
||||
this->m_coreAvailable = this->m_contextApplication->ping(t) == t;
|
||||
this->m_contextNetworkAvailable = this->m_coreAvailable || this->m_contextNetwork->usingLocalObjects();
|
||||
this->m_contextAudioAvailable = this->m_coreAvailable || this->m_contextAudio->usingLocalObjects();
|
||||
this->m_coreAvailable = this->m_rt->getIContextApplication()->ping(t) == t;
|
||||
this->m_contextNetworkAvailable = this->m_coreAvailable || this->m_rt->getIContextNetwork()->usingLocalObjects();
|
||||
this->m_contextAudioAvailable = this->m_coreAvailable || this->m_rt->getIContextAudio()->usingLocalObjects();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -403,14 +400,14 @@ void MainWindow::updateGuiStatusInformation()
|
||||
QString network("unavailable");
|
||||
if (this->m_contextNetworkAvailable)
|
||||
{
|
||||
network = this->m_contextNetwork->usingLocalObjects() ? "local" : now;
|
||||
network = this->m_rt->getIContextNetwork()->usingLocalObjects() ? "local" : now;
|
||||
}
|
||||
|
||||
// handle voice, mute
|
||||
QString voice("unavailable");
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
voice = this->m_contextAudio->usingLocalObjects() ? "local" : now;
|
||||
voice = this->m_rt->getIContextAudio()->usingLocalObjects() ? "local" : now;
|
||||
this->ui->pb_SoundMute->setEnabled(true);
|
||||
}
|
||||
else
|
||||
@@ -425,7 +422,7 @@ void MainWindow::updateGuiStatusInformation()
|
||||
this->ui->cb_StatusWithDBus->setCheckState(this->m_coreMode ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
// Connected button
|
||||
if (this->m_contextNetworkAvailable && this->m_contextNetwork->isConnected())
|
||||
if (this->m_contextNetworkAvailable && this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
if (this->ui->lbl_StatusNetworkConnectedIcon->toolTip().startsWith("dis", Qt::CaseInsensitive))
|
||||
this->ui->lbl_StatusNetworkConnectedIcon->setToolTip(now);
|
||||
@@ -499,7 +496,7 @@ void MainWindow::displayOverlayInfo(const CStatusMessage &message)
|
||||
void MainWindow::reloadAllUsers()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->m_modelAllUsers->update(this->m_contextNetwork->getUsers());
|
||||
this->m_modelAllUsers->update(this->m_rt->getIContextNetwork()->getUsers());
|
||||
this->ui->tv_AllUsers->resizeColumnsToContents();
|
||||
this->ui->tv_AllUsers->resizeRowsToContents();
|
||||
this->ui->tv_AllUsers->horizontalHeader()->setStretchLastSection(true);
|
||||
@@ -507,12 +504,12 @@ void MainWindow::reloadAllUsers()
|
||||
|
||||
void MainWindow::updateSimulatorData()
|
||||
{
|
||||
if (m_contextSimulator->isConnected())
|
||||
if (this->m_rt->getIContextSimulator()->isConnected())
|
||||
ui->le_SimulatorStatus->setText("Connected");
|
||||
else
|
||||
ui->le_SimulatorStatus->setText("Not connected");
|
||||
|
||||
CAircraft ownAircraft = m_contextSimulator->getOwnAircraft();
|
||||
CAircraft ownAircraft = this->m_rt->getIContextSimulator()->getOwnAircraft();
|
||||
ui->le_SimulatorLatitude->setText(ownAircraft.getSituation().latitude().toFormattedQString());
|
||||
ui->le_SimulatorLongitude->setText(ownAircraft.getSituation().longitude().toFormattedQString());
|
||||
ui->le_SimulatorAltitude->setText(ownAircraft.getSituation().getAltitude().toFormattedQString());
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "blackcore/context_settings.h"
|
||||
#include "blackcore/context_application.h"
|
||||
#include "blackcore/context_simulator.h"
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackgui/transpondermodeselector.h"
|
||||
#include "blackgui/atcstationlistmodel.h"
|
||||
#include "blackgui/serverlistmodel.h"
|
||||
@@ -113,7 +113,6 @@ private:
|
||||
bool m_init;
|
||||
GuiModes::WindowMode m_windowMode;
|
||||
AudioTest m_audioTestRunning;
|
||||
QDBusConnection m_dBusConnection;
|
||||
|
||||
// the table view models
|
||||
// normal pointers, as these will be deleted by parent
|
||||
@@ -132,12 +131,7 @@ private:
|
||||
bool m_coreAvailable;
|
||||
bool m_contextNetworkAvailable;
|
||||
bool m_contextAudioAvailable;
|
||||
QScopedPointer<BlackCore::CCoreRuntime> m_coreRuntime; /*!< runtime, if working with local core */
|
||||
BlackCore::IContextApplication *m_contextApplication; /*!< overall application state */
|
||||
BlackCore::IContextNetwork *m_contextNetwork;
|
||||
BlackCore::IContextAudio *m_contextAudio;
|
||||
BlackCore::IContextSettings *m_contextSettings;
|
||||
BlackCore::IContextSimulator *m_contextSimulator;
|
||||
QScopedPointer<BlackCore::CRuntime> m_rt; /*!< runtime */
|
||||
BlackMisc::Aviation::CAircraft m_ownAircraft; /*!< own aircraft's state */
|
||||
QTimer *m_timerUpdateAtcStationsOnline; /*!< timer for update of stations */
|
||||
QTimer *m_timerUpdateAircraftsInRange; /*!< timer for update of aircrafts */
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace BlackMisc::Audio;
|
||||
void MainWindow::reloadAircraftsInRange()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->m_modelAircraftsInRange->update(this->m_contextNetwork->getAircraftsInRange());
|
||||
this->m_modelAircraftsInRange->update(this->m_rt->getIContextNetwork()->getAircraftsInRange());
|
||||
this->ui->tv_AircraftsInRange->resizeColumnsToContents();
|
||||
this->ui->tv_AircraftsInRange->resizeRowsToContents();
|
||||
}
|
||||
@@ -35,7 +35,7 @@ bool MainWindow::reloadOwnAircraft()
|
||||
|
||||
// check for changed aircraft
|
||||
bool changed = false;
|
||||
CAircraft loadedAircraft = this->m_contextNetwork->getOwnAircraft();
|
||||
CAircraft loadedAircraft = this->m_rt->getIContextNetwork()->getOwnAircraft();
|
||||
if (loadedAircraft != this->m_ownAircraft)
|
||||
{
|
||||
this->m_ownAircraft = loadedAircraft;
|
||||
@@ -57,7 +57,7 @@ void MainWindow::setTestPosition(const QString &wgsLatitude, const QString &wgsL
|
||||
|
||||
this->m_ownAircraft.setPosition(coordinate);
|
||||
this->m_ownAircraft.setAltitude(altitude);
|
||||
this->m_contextNetwork->updateOwnPosition(
|
||||
this->m_rt->getIContextNetwork()->updateOwnPosition(
|
||||
coordinate,
|
||||
altitude
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace BlackMisc::Settings;
|
||||
void MainWindow::reloadAtcStationsBooked()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->m_modelAtcListBooked->update(this->m_contextNetwork->getAtcStationsBooked());
|
||||
this->m_modelAtcListBooked->update(this->m_rt->getIContextNetwork()->getAtcStationsBooked());
|
||||
this->ui->tv_AtcStationsBooked->resizeColumnsToContents();
|
||||
this->ui->tv_AtcStationsBooked->resizeRowsToContents();
|
||||
}
|
||||
@@ -31,11 +31,11 @@ void MainWindow::reloadAtcStationsBooked()
|
||||
void MainWindow::reloadAtcStationsOnline()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
this->m_modelAtcListOnline->update(this->m_contextNetwork->getAtcStationsOnline());
|
||||
this->m_modelAtcListOnline->update(this->m_rt->getIContextNetwork()->getAtcStationsOnline());
|
||||
this->ui->tv_AtcStationsOnline->resizeColumnsToContents();
|
||||
this->ui->tv_AtcStationsOnline->resizeRowsToContents();
|
||||
|
||||
if (!this->m_contextNetwork->isConnected())
|
||||
if (!this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
// clear metar/ATIS
|
||||
this->ui->te_AtcStationsOnlineInfo->clear();
|
||||
@@ -72,11 +72,11 @@ void MainWindow::onlineAtcStationSelected(QModelIndex index)
|
||||
void MainWindow::getMetar(const QString &airportIcaoCode)
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
if (!this->m_contextNetwork->isConnected()) return;
|
||||
if (!this->m_rt->getIContextNetwork()->isConnected()) return;
|
||||
QString icao = airportIcaoCode.isEmpty() ? this->ui->le_AtcStationsOnlineMetar->text().trimmed().toUpper() : airportIcaoCode.trimmed().toUpper();
|
||||
this->ui->le_AtcStationsOnlineMetar->setText(icao);
|
||||
if (icao.length() != 4) return;
|
||||
CInformationMessage metar = this->m_contextNetwork->getMetar(icao);
|
||||
CInformationMessage metar = this->m_rt->getIContextNetwork()->getMetar(icao);
|
||||
if (metar.getType() != CInformationMessage::METAR) return;
|
||||
if (metar.isEmpty()) return;
|
||||
this->ui->te_AtcStationsOnlineInfo->setText(metar.getMessage());
|
||||
@@ -88,8 +88,8 @@ void MainWindow::getMetar(const QString &airportIcaoCode)
|
||||
void MainWindow::requestAtis()
|
||||
{
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
if (!this->m_contextNetwork->isConnected()) return;
|
||||
this->m_contextNetwork->requestAtisUpdates();
|
||||
if (!this->m_rt->getIContextNetwork()->isConnected()) return;
|
||||
this->m_rt->getIContextNetwork()->requestAtisUpdates();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -96,7 +96,7 @@ void MainWindow::updateCockpitFromContext()
|
||||
|
||||
if (this->m_contextNetworkAvailable)
|
||||
{
|
||||
CAtcStationList selectedStations = this->m_contextNetwork->getSelectedAtcStations();
|
||||
CAtcStationList selectedStations = this->m_rt->getIContextNetwork()->getSelectedAtcStations();
|
||||
CAtcStation com1Station = selectedStations[0];
|
||||
CAtcStation com2Station = selectedStations[1];
|
||||
if (com1Station.getCallsign().isEmpty())
|
||||
@@ -116,7 +116,7 @@ void MainWindow::updateCockpitFromContext()
|
||||
{
|
||||
// get all rooms, it is important to get the rooms from voice context here
|
||||
// these are the ones featuring the real audio status
|
||||
CVoiceRoomList rooms = this->m_contextAudio->getComVoiceRoomsWithAudioStatus();
|
||||
CVoiceRoomList rooms = this->m_rt->getIContextAudio()->getComVoiceRoomsWithAudioStatus();
|
||||
Q_ASSERT(rooms.size() == 2);
|
||||
Q_ASSERT(this->m_modelUsersVoiceCom1);
|
||||
Q_ASSERT(this->m_modelUsersVoiceCom2);
|
||||
@@ -127,12 +127,12 @@ void MainWindow::updateCockpitFromContext()
|
||||
bool com2Connected = room2.isConnected();
|
||||
|
||||
// update views
|
||||
this->m_modelUsersVoiceCom1->update(this->m_contextAudio->getCom1RoomUsers());
|
||||
this->m_modelUsersVoiceCom1->update(this->m_rt->getIContextAudio()->getCom1RoomUsers());
|
||||
this->ui->tv_CockpitVoiceRoom1->resizeColumnsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom1->resizeRowsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom1->horizontalHeader()->setStretchLastSection(true);
|
||||
|
||||
this->m_modelUsersVoiceCom2->update(this->m_contextAudio->getCom2RoomUsers());
|
||||
this->m_modelUsersVoiceCom2->update(this->m_rt->getIContextAudio()->getCom2RoomUsers());
|
||||
this->ui->tv_CockpitVoiceRoom2->resizeColumnsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom2->resizeRowsToContents();
|
||||
this->ui->tv_CockpitVoiceRoom2->horizontalHeader()->setStretchLastSection(true);
|
||||
@@ -261,7 +261,7 @@ void MainWindow::sendCockpitUpdates()
|
||||
this->m_ownAircraft.getCom2System() != com2 ||
|
||||
this->m_ownAircraft.getTransponder() != transponder)
|
||||
{
|
||||
this->m_contextNetwork->updateOwnCockpit(com1, com2, transponder);
|
||||
this->m_rt->getIContextNetwork()->updateOwnCockpit(com1, com2, transponder);
|
||||
this->reloadOwnAircraft(); // also loads resolved voice rooms
|
||||
changedCockpit = true;
|
||||
}
|
||||
@@ -288,7 +288,7 @@ void MainWindow::setAudioVoiceRooms()
|
||||
|
||||
CVoiceRoom room1;
|
||||
CVoiceRoom room2;
|
||||
CVoiceRoomList selectedVoiceRooms = this->m_contextNetwork->getSelectedVoiceRooms();
|
||||
CVoiceRoomList selectedVoiceRooms = this->m_rt->getIContextNetwork()->getSelectedVoiceRooms();
|
||||
Q_ASSERT(selectedVoiceRooms.size() == 2);
|
||||
|
||||
if (this->ui->cb_CockpitVoiceRoom1Override->isChecked())
|
||||
@@ -310,7 +310,7 @@ void MainWindow::setAudioVoiceRooms()
|
||||
}
|
||||
|
||||
// set the real voice rooms for audio output
|
||||
this->m_contextAudio->setComVoiceRooms(room1, room2);
|
||||
this->m_rt->getIContextAudio()->setComVoiceRooms(room1, room2);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -328,7 +328,7 @@ void MainWindow::testSelcal()
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
CSelcal selcal(selcalCode);
|
||||
this->m_contextAudio->playSelcalTone(selcal);
|
||||
this->m_rt->getIContextAudio()->playSelcalTone(selcal);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "blackcore/context_settings_proxy.h"
|
||||
#include "blackcore/context_audio_impl.h"
|
||||
#include "blackcore/context_audio_proxy.h"
|
||||
#include "blackcore/coreruntime.h"
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackgui/atcstationlistmodel.h"
|
||||
#include "blackgui/keyboardkeylistmodel.h"
|
||||
#include "blackmisc/avselcal.h"
|
||||
@@ -170,21 +170,11 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
// context
|
||||
if (this->m_coreMode != GuiModes::CoreInGuiProcess)
|
||||
{
|
||||
this->m_dBusConnection = QDBusConnection::sessionBus();
|
||||
this->m_contextNetwork = new BlackCore::CContextNetworkProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextAudio = new BlackCore::CContextAudioProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextSettings = new BlackCore::CContextSettingsProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextApplication = new BlackCore::CContextApplicationProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_contextSimulator = new BlackCore::CContextSimulatorProxy(BlackCore::CDBusServer::ServiceName, this->m_dBusConnection, this);
|
||||
this->m_rt.reset(new CRuntime(CRuntimeConfig::remote(), this));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_coreRuntime.reset(new CCoreRuntime(false, this));
|
||||
this->m_contextNetwork = this->m_coreRuntime->getIContextNetwork();
|
||||
this->m_contextAudio = this->m_coreRuntime->getIContextAudio();
|
||||
this->m_contextSettings = this->m_coreRuntime->getIContextSettings();
|
||||
this->m_contextApplication = this->m_coreRuntime->getIContextApplication();
|
||||
this->m_contextSimulator = this->m_coreRuntime->getIContextSimulator();
|
||||
this->m_rt.reset(new CRuntime(CRuntimeConfig::local(), this));
|
||||
}
|
||||
|
||||
// wire GUI signals
|
||||
@@ -214,15 +204,14 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
|
||||
// signal / slots contexts / timers
|
||||
bool connect;
|
||||
this->connect(this->m_contextNetwork, &IContextNetwork::statusMessage, this, &MainWindow::displayStatusMessage);
|
||||
this->connect(this->m_contextNetwork, &IContextNetwork::statusMessages, this, &MainWindow::displayStatusMessages);
|
||||
this->connect(this->m_contextNetwork, &IContextNetwork::connectionTerminated, this, &MainWindow::connectionTerminated);
|
||||
this->connect(this->m_contextNetwork, &IContextNetwork::connectionStatusChanged, this, &MainWindow::connectionStatusChanged);
|
||||
this->connect(this->m_contextSettings, &IContextSettings::changedSettings, this, &MainWindow::changedSettings);
|
||||
connect = this->connect(this->m_contextNetwork, SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)), this, SLOT(appendTextMessagesToGui(BlackMisc::Network::CTextMessageList)));
|
||||
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::statusMessage, this, &MainWindow::displayStatusMessage);
|
||||
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::statusMessages, this, &MainWindow::displayStatusMessages);
|
||||
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::connectionTerminated, this, &MainWindow::connectionTerminated);
|
||||
this->connect(this->m_rt->getIContextNetwork(), &IContextNetwork::connectionStatusChanged, this, &MainWindow::connectionStatusChanged);
|
||||
this->connect(this->m_rt->getIContextSettings(), &IContextSettings::changedSettings, this, &MainWindow::changedSettings);
|
||||
connect = this->connect(this->m_rt->getIContextNetwork(), SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)), this, SLOT(appendTextMessagesToGui(BlackMisc::Network::CTextMessageList)));
|
||||
Q_ASSERT(connect);
|
||||
Q_UNUSED(connect); // suppress GCC warning in release build
|
||||
this->connect(this->m_contextSimulator, &IContextSimulator::connectionChanged, this, &MainWindow::simulatorAvailable);
|
||||
this->connect(this->m_rt->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorAvailable);
|
||||
this->connect(this->m_timerUpdateAircraftsInRange, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
this->connect(this->m_timerUpdateAtcStationsOnline, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
this->connect(this->m_timerUpdateUsers, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
@@ -230,8 +219,10 @@ void MainWindow::init(GuiModes::CoreMode coreMode)
|
||||
this->connect(this->m_timerCollectedCockpitUpdates, &QTimer::timeout, this, &MainWindow::sendCockpitUpdates);
|
||||
this->connect(this->m_timerAudioTests, &QTimer::timeout, this, &MainWindow::audioTestUpdate);
|
||||
this->connect(this->m_timerSimulator, &QTimer::timeout, this, &MainWindow::timerBasedUpdates);
|
||||
connect = this->connect(this->m_contextAudio, &IContextAudio::audioTestCompleted, this, &MainWindow::audioTestUpdate);
|
||||
|
||||
connect = this->connect(this->m_rt->getIContextAudio(), &IContextAudio::audioTestCompleted, this, &MainWindow::audioTestUpdate);
|
||||
Q_ASSERT(connect);
|
||||
Q_UNUSED(connect); // suppress GCC warning in release build
|
||||
|
||||
// start timers, update timers will be started when network is connected
|
||||
this->m_timerContextWatchdog->start(2 * 1000);
|
||||
|
||||
@@ -383,7 +374,7 @@ void MainWindow::initGuiSignals()
|
||||
void MainWindow::initialDataReads()
|
||||
{
|
||||
qint64 t = QDateTime::currentMSecsSinceEpoch();
|
||||
this->m_coreAvailable = (this->m_contextNetwork->usingLocalObjects() || (this->m_contextApplication->ping(t) == t));
|
||||
this->m_coreAvailable = (this->m_rt->getIContextNetwork()->usingLocalObjects() || (this->m_rt->getIContextApplication()->ping(t) == t));
|
||||
if (!this->m_coreAvailable)
|
||||
{
|
||||
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeGui, CStatusMessage::SeverityError,
|
||||
@@ -395,7 +386,7 @@ void MainWindow::initialDataReads()
|
||||
this->reloadAtcStationsBooked(); // init read, to do this no traffic network required
|
||||
this->reloadOwnAircraft(); // init read, independent of traffic network
|
||||
|
||||
if (this->m_contextNetwork->isConnected())
|
||||
if (this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
// connection is already established
|
||||
this->reloadAircraftsInRange();
|
||||
|
||||
@@ -23,7 +23,7 @@ using namespace BlackSim::Fsx;
|
||||
void MainWindow::reloadSettings()
|
||||
{
|
||||
// local copy
|
||||
CSettingsNetwork nws = this->m_contextSettings->getNetworkSettings();
|
||||
CSettingsNetwork nws = this->m_rt->getIContextSettings()->getNetworkSettings();
|
||||
|
||||
// update servers
|
||||
this->m_modelTrafficServerList->setSelectedServer(nws.getCurrentTrafficNetworkServer());
|
||||
@@ -32,7 +32,7 @@ void MainWindow::reloadSettings()
|
||||
this->ui->tv_SettingsTnServers->resizeRowsToContents();
|
||||
|
||||
// update hot keys
|
||||
this->m_modelSettingsHotKeys->update(this->m_contextSettings->getHotkeys());
|
||||
this->m_modelSettingsHotKeys->update(this->m_rt->getIContextSettings()->getHotkeys());
|
||||
this->ui->tv_SettingsMiscHotkeys->resizeColumnsToContents();
|
||||
this->ui->tv_SettingsMiscHotkeys->resizeRowsToContents();
|
||||
|
||||
@@ -68,15 +68,15 @@ void MainWindow::alterTrafficServer()
|
||||
CStatusMessageList msgs;
|
||||
if (sender == this->ui->pb_SettingsTnCurrentServer)
|
||||
{
|
||||
msgs = this->m_contextSettings->value(path, CSettingsNetwork::CmdSetCurrentServer(), server.toQVariant());
|
||||
msgs = this->m_rt->getIContextSettings()->value(path, CSettingsNetwork::CmdSetCurrentServer(), server.toQVariant());
|
||||
}
|
||||
else if (sender == this->ui->pb_SettingsTnRemoveServer)
|
||||
{
|
||||
msgs = this->m_contextSettings->value(path, CSettingUtilities::CmdRemove(), server.toQVariant());
|
||||
msgs = this->m_rt->getIContextSettings()->value(path, CSettingUtilities::CmdRemove(), server.toQVariant());
|
||||
}
|
||||
else if (sender == this->ui->pb_SettingsTnSaveServer)
|
||||
{
|
||||
msgs = this->m_contextSettings->value(path, CSettingUtilities::CmdUpdate(), server.toQVariant());
|
||||
msgs = this->m_rt->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), server.toQVariant());
|
||||
}
|
||||
|
||||
// status messages
|
||||
@@ -134,7 +134,7 @@ CServer MainWindow::selectedServerFromTextboxes() const
|
||||
void MainWindow::saveHotkeys()
|
||||
{
|
||||
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathRoot(), IContextSettings::PathHotkeys());
|
||||
CStatusMessageList msgs = this->m_contextSettings->value(path, CSettingUtilities::CmdUpdate(), this->m_modelSettingsHotKeys->getContainer().toQVariant());
|
||||
CStatusMessageList msgs = this->m_rt->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), this->m_modelSettingsHotKeys->getContainer().toQVariant());
|
||||
|
||||
// status messages
|
||||
this->displayStatusMessages(msgs);
|
||||
|
||||
@@ -28,7 +28,7 @@ void MainWindow::appendTextMessagesToGui(const CTextMessageList &messages, bool
|
||||
// this is SELCAL for me
|
||||
if (this->m_contextAudioAvailable)
|
||||
{
|
||||
CAudioDevice dev = this->m_contextAudio->getCurrentAudioDevices().getOutputDevices()[0];
|
||||
CAudioDevice dev = this->m_rt->getIContextAudio()->getCurrentAudioDevices().getOutputDevices()[0];
|
||||
BlackSound::CSoundGenerator::playSelcal(90, CSelcal(currentSelcal), dev);
|
||||
}
|
||||
else
|
||||
@@ -261,7 +261,7 @@ void MainWindow::commandEntered()
|
||||
QString cmd = parts[0].startsWith('.') ? parts[0].toLower() : "";
|
||||
if (cmd == ".m" || cmd == ".msg")
|
||||
{
|
||||
if (!this->m_contextNetworkAvailable || !this->m_contextNetwork->isConnected())
|
||||
if (!this->m_contextNetworkAvailable || !this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityError, "network needs to be connected"));
|
||||
return;
|
||||
@@ -308,7 +308,7 @@ void MainWindow::commandEntered()
|
||||
if (tm.isEmpty()) return;
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
CTextMessageList tml(tm);
|
||||
this->m_contextNetwork->sendTextMessages(tml);
|
||||
this->m_rt->getIContextNetwork()->sendTextMessages(tml);
|
||||
this->appendTextMessagesToGui(tml, true);
|
||||
this->ui->le_CommandLineInput->setText("");
|
||||
}
|
||||
@@ -320,7 +320,7 @@ void MainWindow::commandEntered()
|
||||
{
|
||||
// single line, no command
|
||||
// line is considered to be a message to the selected channel, send
|
||||
if (!this->m_contextNetwork->isConnected())
|
||||
if (!this->m_rt->getIContextNetwork()->isConnected())
|
||||
{
|
||||
this->displayStatusMessage(CStatusMessage(CStatusMessage::TypeTrafficNetwork, CStatusMessage::SeverityError, "network needs to be connected"));
|
||||
return;
|
||||
@@ -344,7 +344,7 @@ void MainWindow::commandEntered()
|
||||
if (tm.isEmpty()) return;
|
||||
if (!this->isContextNetworkAvailableCheck()) return;
|
||||
CTextMessageList textMessageList(tm);
|
||||
this->m_contextNetwork->sendTextMessages(textMessageList);
|
||||
this->m_rt->getIContextNetwork()->sendTextMessages(textMessageList);
|
||||
this->appendTextMessagesToGui(textMessageList, true);
|
||||
this->ui->le_CommandLineInput->setText("");
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ void MainWindow::setAudioDeviceLists()
|
||||
this->ui->cb_SettingsAudioOutputDevice->clear();
|
||||
this->ui->cb_SettingsAudioInputDevice->clear();
|
||||
|
||||
foreach(CAudioDevice device, this->m_contextAudio->getAudioDevices())
|
||||
foreach(CAudioDevice device, this->m_rt->getIContextAudio()->getAudioDevices())
|
||||
{
|
||||
if (device.getType() == CAudioDevice::InputDevice)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ void MainWindow::setAudioDeviceLists()
|
||||
}
|
||||
}
|
||||
|
||||
foreach(CAudioDevice device, this->m_contextAudio->getCurrentAudioDevices())
|
||||
foreach(CAudioDevice device, this->m_rt->getIContextAudio()->getCurrentAudioDevices())
|
||||
{
|
||||
if (device.getType() == CAudioDevice::InputDevice)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ void MainWindow::audioDeviceSelected(int index)
|
||||
if (!this->m_init) return; // not during init
|
||||
if (!this->isContextAudioAvailableCheck()) return;
|
||||
if (index < 0)return;
|
||||
CAudioDeviceList devices = this->m_contextAudio->getAudioDevices();
|
||||
CAudioDeviceList devices = this->m_rt->getIContextAudio()->getAudioDevices();
|
||||
if (devices.isEmpty()) return;
|
||||
CAudioDevice selectedDevice;
|
||||
QObject *sender = QObject::sender();
|
||||
@@ -69,14 +69,14 @@ void MainWindow::audioDeviceSelected(int index)
|
||||
CAudioDeviceList inputDevices = devices.getInputDevices();
|
||||
if (index >= inputDevices.size()) return;
|
||||
selectedDevice = inputDevices[index];
|
||||
this->m_contextAudio->setCurrentAudioDevice(selectedDevice);
|
||||
this->m_rt->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
||||
}
|
||||
else if (sender == this->ui->cb_SettingsAudioOutputDevice)
|
||||
{
|
||||
CAudioDeviceList outputDevices = devices.getOutputDevices();
|
||||
if (index >= outputDevices.size()) return;
|
||||
selectedDevice = outputDevices[index];
|
||||
this->m_contextAudio->setCurrentAudioDevice(selectedDevice);
|
||||
this->m_rt->getIContextAudio()->setCurrentAudioDevice(selectedDevice);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void MainWindow::audioVolumes()
|
||||
|
||||
if (sender == this->ui->pb_SoundMute)
|
||||
{
|
||||
if (this->m_contextAudio->isMuted())
|
||||
if (this->m_rt->getIContextAudio()->isMuted())
|
||||
{
|
||||
// muted right now, now unmute
|
||||
muted = false;
|
||||
@@ -146,7 +146,7 @@ void MainWindow::audioVolumes()
|
||||
// update own aircraft, also set volume/mute in voice
|
||||
this->m_ownAircraft.setCom1System(com1);
|
||||
this->m_ownAircraft.setCom2System(com2);
|
||||
this->m_contextAudio->setVolumes(this->m_ownAircraft.getCom1System(), this->m_ownAircraft.getCom2System());
|
||||
this->m_rt->getIContextAudio()->setVolumes(this->m_ownAircraft.getCom1System(), this->m_ownAircraft.getCom2System());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -174,13 +174,13 @@ void MainWindow::startAudioTest()
|
||||
if (sender == this->ui->pb_SettingsAudioMicrophoneTest)
|
||||
{
|
||||
this->m_audioTestRunning = MicrophoneTest;
|
||||
this->m_contextAudio->runMicrophoneTest();
|
||||
this->m_rt->getIContextAudio()->runMicrophoneTest();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText("Speak normally for 5 seconds");
|
||||
}
|
||||
else if (sender == this->ui->pb_SettingsAudioSquelchTest)
|
||||
{
|
||||
this->m_audioTestRunning = SquelchTest;
|
||||
this->m_contextAudio->runSquelchTest();
|
||||
this->m_rt->getIContextAudio()->runSquelchTest();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText("Silence for 5 seconds");
|
||||
}
|
||||
this->ui->prb_SettingsAudioTestProgress->setVisible(true);
|
||||
@@ -214,12 +214,12 @@ void MainWindow::audioTestUpdate()
|
||||
{
|
||||
if (this->m_audioTestRunning == SquelchTest)
|
||||
{
|
||||
double s = this->m_contextAudio->getSquelchValue();
|
||||
double s = this->m_rt->getIContextAudio()->getSquelchValue();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText(QString::number(s));
|
||||
}
|
||||
else if (this->m_audioTestRunning == MicrophoneTest)
|
||||
{
|
||||
QString m = this->m_contextAudio->getMicrophoneTestResult();
|
||||
QString m = this->m_rt->getIContextAudio()->getMicrophoneTestResult();
|
||||
this->ui->pte_SettingsAudioTestActionAndResult->appendPlainText(m);
|
||||
}
|
||||
}
|
||||
@@ -239,5 +239,5 @@ void MainWindow::playNotifcationSound(CSoundGenerator::Notification notification
|
||||
if (!this->m_contextAudioAvailable) return;
|
||||
if (!this->ui->cb_SettingsAudioPlayNotificationSounds->isChecked()) return;
|
||||
if (notification == CSoundGenerator::NotificationTextMessage && !this->ui->cb_SettingsAudioNotificationTextMessage->isChecked()) return;
|
||||
this->m_contextAudio->playNotification(static_cast<uint>(notification));
|
||||
this->m_rt->getIContextAudio()->playNotification(static_cast<uint>(notification));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user