mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
refs #452 adjusted GUI components to
* changed classes (e.g. CAircraft -> CSimulatedAircraft) * changes signatures in contexts / providers * minor fixes as renamed GUI widgets, asserts, paint event
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4a3b553296
commit
6ca0d480d3
@@ -16,7 +16,6 @@
|
|||||||
#include "blackgui/components/enableforruntime.h"
|
#include "blackgui/components/enableforruntime.h"
|
||||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||||
#include "blackgui/components/updatetimer.h"
|
#include "blackgui/components/updatetimer.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|||||||
@@ -10,12 +10,6 @@
|
|||||||
<height>462</height>
|
<height>462</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>ATC stations</string>
|
<string>ATC stations</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -44,12 +38,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Views::CAtcStationView" name="tvp_AtcStationsOnline">
|
<widget class="BlackGui::Views::CAtcStationView" name="tvp_AtcStationsOnline">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>16777215</width>
|
<width>16777215</width>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackcore/context_ownaircraft.h"
|
#include "blackcore/context_ownaircraft.h"
|
||||||
#include "blackcore/context_audio.h"
|
#include "blackcore/context_audio.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
#include "blackmisc/audio/voiceroomlist.h"
|
#include "blackmisc/audio/voiceroomlist.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
|
|
||||||
@@ -25,6 +24,7 @@ using namespace BlackCore;
|
|||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Audio;
|
using namespace BlackMisc::Audio;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -62,7 +62,7 @@ namespace BlackGui
|
|||||||
Q_ASSERT(this->getIContextAudio());
|
Q_ASSERT(this->getIContextAudio());
|
||||||
|
|
||||||
// init from aircraft
|
// init from aircraft
|
||||||
CAircraft ownAircraft = this->getOwnAircraft();
|
CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||||
this->ps_updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
|
this->ps_updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
|
||||||
|
|
||||||
// SELCAL pairs in cockpit
|
// SELCAL pairs in cockpit
|
||||||
@@ -106,7 +106,7 @@ namespace BlackGui
|
|||||||
this->ui->ds_ComPanelCom2Standby->setValue(f);
|
this->ui->ds_ComPanelCom2Standby->setValue(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAircraft ownAircraft = this->cockpitValuesToAircraftObject();
|
const CSimulatedAircraft ownAircraft = this->cockpitValuesToAircraftObject();
|
||||||
this->updateOwnCockpitInContext(ownAircraft);
|
this->updateOwnCockpitInContext(ownAircraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ namespace BlackGui
|
|||||||
this->getIContextOwnAircraft()->updateSelcal(this->getSelcal(), identifier());
|
this->getIContextOwnAircraft()->updateSelcal(this->getSelcal(), identifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCockpitComComponent::ps_updateCockpitFromContext(const CAircraft &ownAircraft, const CIdentifier &originator)
|
void CCockpitComComponent::ps_updateCockpitFromContext(const CSimulatedAircraft &ownAircraft, const CIdentifier &originator)
|
||||||
{
|
{
|
||||||
if (isMyIdentifier(originator)) { return; } // comes from myself
|
if (isMyIdentifier(originator)) { return; } // comes from myself
|
||||||
|
|
||||||
@@ -201,9 +201,9 @@ namespace BlackGui
|
|||||||
this->ui->led_ComPanelCom2->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "COM2 connected", "COM2 disconnected", 14);
|
this->ui->led_ComPanelCom2->setValues(CLedWidget::Yellow, CLedWidget::Black, shape, "COM2 connected", "COM2 disconnected", 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraft CCockpitComComponent::cockpitValuesToAircraftObject()
|
CSimulatedAircraft CCockpitComComponent::cockpitValuesToAircraftObject()
|
||||||
{
|
{
|
||||||
CAircraft ownAircraft = this->getOwnAircraft();
|
CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||||
CTransponder transponder = ownAircraft.getTransponder();
|
CTransponder transponder = ownAircraft.getTransponder();
|
||||||
CComSystem com1 = ownAircraft.getCom1System();
|
CComSystem com1 = ownAircraft.getCom1System();
|
||||||
CComSystem com2 = ownAircraft.getCom2System();
|
CComSystem com2 = ownAircraft.getCom2System();
|
||||||
@@ -238,14 +238,14 @@ namespace BlackGui
|
|||||||
return ownAircraft;
|
return ownAircraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraft CCockpitComComponent::getOwnAircraft() const
|
CSimulatedAircraft CCockpitComComponent::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->getIContextOwnAircraft());
|
Q_ASSERT(this->getIContextOwnAircraft());
|
||||||
if (!this->getIContextOwnAircraft()) return CAircraft();
|
if (!this->getIContextOwnAircraft()) return CSimulatedAircraft();
|
||||||
return this->getIContextOwnAircraft()->getOwnAircraft();
|
return this->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCockpitComComponent::updateOwnCockpitInContext(const CAircraft &ownAircraft)
|
bool CCockpitComComponent::updateOwnCockpitInContext(const CSimulatedAircraft &ownAircraft)
|
||||||
{
|
{
|
||||||
return this->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), ownAircraft.getTransponder(), identifier());
|
return this->getIContextOwnAircraft()->updateCockpit(ownAircraft.getCom1System(), ownAircraft.getCom2System(), ownAircraft.getTransponder(), identifier());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKGUI_COCKPITCOMCOMPONENT_H
|
#ifndef BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||||
#define BLACKGUI_COCKPITCOMCOMPONENT_H
|
#define BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||||
|
|
||||||
@@ -14,7 +16,6 @@
|
|||||||
#include "enablefordockwidgetinfoarea.h"
|
#include "enablefordockwidgetinfoarea.h"
|
||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
#include "blackmisc/aviation/transponder.h"
|
#include "blackmisc/aviation/transponder.h"
|
||||||
#include "blackmisc/audio/voiceroomlist.h"
|
#include "blackmisc/audio/voiceroomlist.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
@@ -68,7 +69,7 @@ namespace BlackGui
|
|||||||
void ps_guiChangedSelcal();
|
void ps_guiChangedSelcal();
|
||||||
|
|
||||||
//! Update cockpit from context
|
//! Update cockpit from context
|
||||||
void ps_updateCockpitFromContext(const BlackMisc::Aviation::CAircraft &ownAircraft, const BlackMisc::CIdentifier &originator);
|
void ps_updateCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator);
|
||||||
|
|
||||||
//! Cockpit values have been changed in GUI
|
//! Cockpit values have been changed in GUI
|
||||||
void ps_testSelcal();
|
void ps_testSelcal();
|
||||||
@@ -84,16 +85,16 @@ namespace BlackGui
|
|||||||
void initLeds();
|
void initLeds();
|
||||||
|
|
||||||
//! Cockpit values to aircraft
|
//! Cockpit values to aircraft
|
||||||
BlackMisc::Aviation::CAircraft cockpitValuesToAircraftObject();
|
BlackMisc::Simulation::CSimulatedAircraft cockpitValuesToAircraftObject();
|
||||||
|
|
||||||
//! Get own aircraft
|
//! Get own aircraft
|
||||||
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const;
|
||||||
|
|
||||||
//! Current SELCAL code
|
//! Current SELCAL code
|
||||||
BlackMisc::Aviation::CSelcal getSelcal() const;
|
BlackMisc::Aviation::CSelcal getSelcal() const;
|
||||||
|
|
||||||
//! Cockpit updates
|
//! Cockpit updates
|
||||||
bool updateOwnCockpitInContext(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
bool updateOwnCockpitInContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||||
|
|
||||||
//! COM frequencies displayed
|
//! COM frequencies displayed
|
||||||
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
* contained in the LICENSE file.
|
* contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
#ifndef BLACKGUI_COCKPITCOMPONENT_H
|
#ifndef BLACKGUI_COCKPITCOMPONENT_H
|
||||||
#define BLACKGUI_COCKPITCOMPONENT_H
|
#define BLACKGUI_COCKPITCOMPONENT_H
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,19 @@
|
|||||||
<property name="dockOptions">
|
<property name="dockOptions">
|
||||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="qw_CockpitInfoAreaComComponent">
|
<widget class="QWidget" name="qw_CockpitInfoAreaComComponentUsedAsPadding">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>3</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_CockpitVoiceRooms">
|
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_CockpitVoiceRooms">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -37,7 +38,7 @@ namespace BlackGui
|
|||||||
this->setMode(getOwnTransponder().getTransponderMode());
|
this->setMode(getOwnTransponder().getTransponderMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCockpitTransponderModeLedsComponent::ps_onAircraftCockpitChanged(const CAircraft &aircraft, const BlackMisc::CIdentifier &originator)
|
void CCockpitTransponderModeLedsComponent::ps_onAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator)
|
||||||
{
|
{
|
||||||
if (isMyIdentifier(originator)) { return; }
|
if (isMyIdentifier(originator)) { return; }
|
||||||
this->setMode(aircraft.getTransponderMode());
|
this->setMode(aircraft.getTransponderMode());
|
||||||
@@ -65,7 +66,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CAircraft ownAircraft = this->getOwnAircraft();
|
CSimulatedAircraft ownAircraft(this->getOwnAircraft());
|
||||||
if (ownAircraft.getTransponderMode() == mode) { return; }
|
if (ownAircraft.getTransponderMode() == mode) { return; }
|
||||||
|
|
||||||
this->setMode(mode);
|
this->setMode(mode);
|
||||||
@@ -128,7 +129,7 @@ namespace BlackGui
|
|||||||
return getIContextOwnAircraft()->getOwnAircraft().getTransponder();
|
return getIContextOwnAircraft()->getOwnAircraft().getTransponder();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraft CCockpitTransponderModeLedsComponent::getOwnAircraft() const
|
CSimulatedAircraft CCockpitTransponderModeLedsComponent::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(getIContextOwnAircraft());
|
Q_ASSERT(getIContextOwnAircraft());
|
||||||
return getIContextOwnAircraft()->getOwnAircraft();
|
return getIContextOwnAircraft()->getOwnAircraft();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "../led.h"
|
#include "../led.h"
|
||||||
#include "blackmisc/identifiable.h"
|
#include "blackmisc/identifiable.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||||
#include "blackmisc/aviation/transponder.h"
|
#include "blackmisc/aviation/transponder.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! \copydoc IContextOwnAircraft::changedAircraftCockpit
|
//! \copydoc IContextOwnAircraft::changedAircraftCockpit
|
||||||
void ps_onAircraftCockpitChanged(const BlackMisc::Aviation::CAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
void ps_onAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||||
|
|
||||||
//! LED clicked
|
//! LED clicked
|
||||||
void ps_onLedClicked();
|
void ps_onLedClicked();
|
||||||
@@ -61,7 +61,7 @@ namespace BlackGui
|
|||||||
BlackMisc::Aviation::CTransponder getOwnTransponder() const;
|
BlackMisc::Aviation::CTransponder getOwnTransponder() const;
|
||||||
|
|
||||||
//! Own Aircraft
|
//! Own Aircraft
|
||||||
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const;
|
||||||
|
|
||||||
QScopedPointer<BlackGui::CLedWidget> m_ledStandby;
|
QScopedPointer<BlackGui::CLedWidget> m_ledStandby;
|
||||||
QScopedPointer<BlackGui::CLedWidget> m_ledModes;
|
QScopedPointer<BlackGui::CLedWidget> m_ledModes;
|
||||||
|
|||||||
@@ -32,14 +32,14 @@
|
|||||||
<property name="dockOptions">
|
<property name="dockOptions">
|
||||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="qw_centralWidgetEmpty">
|
<widget class="QWidget" name="qw_centralWidgetEmptyUsedAsPadding">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>3</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -104,8 +104,8 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Components::CLogComponent" name="comp_Log" native="true">
|
<widget class="BlackGui::Components::CLogComponent" name="comp_Log">
|
||||||
<property name="lineWidth" stdset="0">
|
<property name="lineWidth">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -194,18 +194,18 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
|
||||||
<class>BlackGui::Components::CLogComponent</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>blackgui/components/logcomponent.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::CDockWidgetInfoArea</class>
|
<class>BlackGui::CDockWidgetInfoArea</class>
|
||||||
<extends>QDockWidget</extends>
|
<extends>QDockWidget</extends>
|
||||||
<header>blackgui/dockwidgetinfoarea.h</header>
|
<header>blackgui/dockwidgetinfoarea.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CLogComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/logcomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::Components::CCoreStatusComponent</class>
|
<class>BlackGui::Components::CCoreStatusComponent</class>
|
||||||
<extends>QFrame</extends>
|
<extends>QFrame</extends>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::PhysicalQuantities;
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
|
|
||||||
@@ -69,16 +70,16 @@ namespace BlackGui
|
|||||||
this->prefillWithAircraftData(this->getIContextOwnAircraft()->getOwnAircraft());
|
this->prefillWithAircraftData(this->getIContextOwnAircraft()->getOwnAircraft());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlightPlanComponent::prefillWithAircraftData(const BlackMisc::Aviation::CAircraft &ownAircraft)
|
void CFlightPlanComponent::prefillWithAircraftData(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft)
|
||||||
{
|
{
|
||||||
// only override with valid values
|
// only override with valid values
|
||||||
if (CCallsign::isValidCallsign(ownAircraft.getCallsignAsString()))
|
if (CCallsign::isValidCallsign(ownAircraft.getCallsignAsString()))
|
||||||
{
|
{
|
||||||
this->ui->le_Callsign->setText(ownAircraft.getCallsign().asString());
|
this->ui->le_Callsign->setText(ownAircraft.getCallsign().asString());
|
||||||
}
|
}
|
||||||
if (CAircraftIcaoCode::isValidDesignator(ownAircraft.getIcaoInfo().getAircraftDesignator()))
|
if (CAircraftIcaoCode::isValidDesignator(ownAircraft.getAircraftIcaoCodeDesignator()))
|
||||||
{
|
{
|
||||||
this->ui->le_AircraftType->setText(ownAircraft.getIcaoInfo().getAircraftDesignator());
|
this->ui->le_AircraftType->setText(ownAircraft.getAircraftIcaoCodeDesignator());
|
||||||
}
|
}
|
||||||
if (ownAircraft.hasValidRealName())
|
if (ownAircraft.hasValidRealName())
|
||||||
{
|
{
|
||||||
@@ -340,7 +341,7 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
CFlightPlan loadedPlan = this->getIContextNetwork()->loadFlightPlanFromNetwork(ownAircraft.getCallsign());
|
CFlightPlan loadedPlan = this->getIContextNetwork()->loadFlightPlanFromNetwork(ownAircraft.getCallsign());
|
||||||
if (loadedPlan.wasSentOrLoaded())
|
if (loadedPlan.wasSentOrLoaded())
|
||||||
{
|
{
|
||||||
@@ -419,9 +420,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
CIdentifier CFlightPlanComponent::flightPlanIdentifier()
|
CIdentifier CFlightPlanComponent::flightPlanIdentifier()
|
||||||
{
|
{
|
||||||
if (m_identifier.getName().isEmpty())
|
if (m_identifier.getName().isEmpty()) { m_identifier = CIdentifier(QStringLiteral("FLIGHTPLANCOMPONENT")); }
|
||||||
m_identifier = CIdentifier(QStringLiteral("FLIGHTPLANCOMPONENT"));
|
|
||||||
|
|
||||||
return m_identifier;
|
return m_identifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackgui/components/enableforruntime.h"
|
#include "blackgui/components/enableforruntime.h"
|
||||||
#include "blackmisc/identifier.h"
|
#include "blackmisc/identifier.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
#include "blackmisc/aviation/flightplan.h"
|
#include "blackmisc/aviation/flightplan.h"
|
||||||
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
@@ -45,7 +44,7 @@ namespace BlackGui
|
|||||||
void loginDataSet();
|
void loginDataSet();
|
||||||
|
|
||||||
//! Prefill with aircraft data
|
//! Prefill with aircraft data
|
||||||
void prefillWithAircraftData(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
void prefillWithAircraftData(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||||
|
|
||||||
//! Prefill with aircraft dara
|
//! Prefill with aircraft dara
|
||||||
void fillWithFlightPlanData(const BlackMisc::Aviation::CFlightPlan &flightPlan);
|
void fillWithFlightPlanData(const BlackMisc::Aviation::CFlightPlan &flightPlan);
|
||||||
@@ -70,10 +69,10 @@ namespace BlackGui
|
|||||||
BlackMisc::CIdentifier m_identifier;
|
BlackMisc::CIdentifier m_identifier;
|
||||||
|
|
||||||
//! Default value for airport ICAO airports
|
//! Default value for airport ICAO airports
|
||||||
static const QString &defaultIcao() { static QString d("ICAO"); return d; }
|
static const QString &defaultIcao() { static const QString d("ICAO"); return d; }
|
||||||
|
|
||||||
//! Default value for time
|
//! Default value for time
|
||||||
static const QString &defaultTime() { static QString t("00:00"); return t; }
|
static const QString &defaultTime() { static const QString t("00:00"); return t; }
|
||||||
|
|
||||||
//! Identifier
|
//! Identifier
|
||||||
BlackMisc::CIdentifier flightPlanIdentifier();
|
BlackMisc::CIdentifier flightPlanIdentifier();
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
CInfoWindowComponent::CInfoWindowComponent(QWidget *parent) :
|
CInfoWindowComponent::CInfoWindowComponent(QWidget *parent) :
|
||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
ui(new Ui::InfoWindow)
|
ui(new Ui::InfoWindow)
|
||||||
@@ -34,21 +30,15 @@ namespace BlackGui
|
|||||||
this->hide();
|
this->hide();
|
||||||
this->m_hideTimer = new QTimer(this);
|
this->m_hideTimer = new QTimer(this);
|
||||||
this->m_hideTimer->setSingleShot(true);
|
this->m_hideTimer->setSingleShot(true);
|
||||||
this->onStyleSheetsChanged();
|
this->ps_onStyleSheetsChanged();
|
||||||
|
|
||||||
connect(this->m_hideTimer, &QTimer::timeout, this, &CInfoWindowComponent::hide);
|
connect(this->m_hideTimer, &QTimer::timeout, this, &CInfoWindowComponent::hide);
|
||||||
connect(this->ui->pb_Close, &QPushButton::pressed, this, &CInfoWindowComponent::hide);
|
connect(this->ui->pb_Close, &QPushButton::pressed, this, &CInfoWindowComponent::hide);
|
||||||
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CInfoWindowComponent::onStyleSheetsChanged);
|
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CInfoWindowComponent::ps_onStyleSheetsChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Destructor
|
|
||||||
*/
|
|
||||||
CInfoWindowComponent::~CInfoWindowComponent() { }
|
CInfoWindowComponent::~CInfoWindowComponent() { }
|
||||||
|
|
||||||
/*
|
|
||||||
* Info message for some time
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::displayStringMessage(const QString &message, int displayTimeMs)
|
void CInfoWindowComponent::displayStringMessage(const QString &message, int displayTimeMs)
|
||||||
{
|
{
|
||||||
if (message.isEmpty())
|
if (message.isEmpty())
|
||||||
@@ -63,9 +53,6 @@ namespace BlackGui
|
|||||||
this->showWindow(displayTimeMs);
|
this->showWindow(displayTimeMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Info message for some time
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::displayTextMessage(const CTextMessage &textMessage, int displayTimeMs)
|
void CInfoWindowComponent::displayTextMessage(const CTextMessage &textMessage, int displayTimeMs)
|
||||||
{
|
{
|
||||||
if (textMessage.isEmpty())
|
if (textMessage.isEmpty())
|
||||||
@@ -84,9 +71,6 @@ namespace BlackGui
|
|||||||
this->showWindow(displayTimeMs);
|
this->showWindow(displayTimeMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Display status message
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::displayStatusMessage(const CStatusMessage &statusMessage, int displayTimeMs)
|
void CInfoWindowComponent::displayStatusMessage(const CStatusMessage &statusMessage, int displayTimeMs)
|
||||||
{
|
{
|
||||||
if (statusMessage.isEmpty())
|
if (statusMessage.isEmpty())
|
||||||
@@ -104,9 +88,6 @@ namespace BlackGui
|
|||||||
this->showWindow(displayTimeMs);
|
this->showWindow(displayTimeMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Display
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::display(const BlackMisc::CVariant &variant, int displayTimeMs)
|
void CInfoWindowComponent::display(const BlackMisc::CVariant &variant, int displayTimeMs)
|
||||||
{
|
{
|
||||||
if (variant.isNull())
|
if (variant.isNull())
|
||||||
@@ -128,9 +109,6 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Init this window
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::initWindow()
|
void CInfoWindowComponent::initWindow()
|
||||||
{
|
{
|
||||||
// center
|
// center
|
||||||
@@ -143,9 +121,6 @@ namespace BlackGui
|
|||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Show window
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::showWindow(int displayTimeMs)
|
void CInfoWindowComponent::showWindow(int displayTimeMs)
|
||||||
{
|
{
|
||||||
this->initWindow();
|
this->initWindow();
|
||||||
@@ -154,18 +129,12 @@ namespace BlackGui
|
|||||||
this->m_hideTimer->start(displayTimeMs);
|
this->m_hideTimer->start(displayTimeMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Set current widget
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::setCurrentPage(QWidget *widget)
|
void CInfoWindowComponent::setCurrentPage(QWidget *widget)
|
||||||
{
|
{
|
||||||
this->ui->sw_DifferentModes->setCurrentWidget(widget);
|
this->ui->sw_DifferentModes->setCurrentWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void CInfoWindowComponent::ps_onStyleSheetsChanged()
|
||||||
* Style sheet changed
|
|
||||||
*/
|
|
||||||
void CInfoWindowComponent::onStyleSheetsChanged()
|
|
||||||
{
|
{
|
||||||
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoWindow());
|
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoWindow());
|
||||||
this->setStyleSheet(st);
|
this->setStyleSheet(st);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Multi purpose info window (like pop up window)
|
* Multi purpose info window (like pop up window)
|
||||||
*/
|
*/
|
||||||
@@ -44,7 +43,6 @@ namespace BlackGui
|
|||||||
~CInfoWindowComponent();
|
~CInfoWindowComponent();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
//! Info message, pure string
|
//! Info message, pure string
|
||||||
void displayStringMessage(const QString &message, int displayTimeMs = DefaultDisplayTimeMs);
|
void displayStringMessage(const QString &message, int displayTimeMs = DefaultDisplayTimeMs);
|
||||||
|
|
||||||
@@ -72,7 +70,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Style sheet changed
|
//! Style sheet changed
|
||||||
void onStyleSheetsChanged();
|
void ps_onStyleSheetsChanged();
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "internalscomponent.h"
|
#include "internalscomponent.h"
|
||||||
#include "ui_internalscomponent.h"
|
#include "ui_internalscomponent.h"
|
||||||
#include "blackcore/context_all_interfaces.h"
|
#include "blackcore/context_all_interfaces.h"
|
||||||
|
#include <QJsonParseError>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
|||||||
@@ -16,9 +16,8 @@
|
|||||||
#include "blackcore/context_simulator.h"
|
#include "blackcore/context_simulator.h"
|
||||||
#include "blackcore/network.h"
|
#include "blackcore/network.h"
|
||||||
#include "blackcore/simulator.h"
|
#include "blackcore/simulator.h"
|
||||||
#include "blackcore/global_network_settings.h"
|
#include "blackcore/settings/global_network_settings.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/aviation/aircrafticaodata.h"
|
|
||||||
#include "../uppercasevalidator.h"
|
#include "../uppercasevalidator.h"
|
||||||
#include <QIntValidator>
|
#include <QIntValidator>
|
||||||
|
|
||||||
@@ -27,6 +26,7 @@ using namespace BlackMisc::Aviation;
|
|||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
using namespace BlackCore::Settings;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -183,18 +183,35 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sync values with GUI values
|
||||||
CGuiAircraftValues aircraftValues = this->getAircraftValuesFromGui();
|
CGuiAircraftValues aircraftValues = this->getAircraftValuesFromGui();
|
||||||
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
CAircraftIcaoData icao = ownAircraft.getIcaoInfo();
|
CAircraftIcaoCode aircraftCode(ownAircraft.getAircraftIcaoCode());
|
||||||
icao.setAircraftDesignator(aircraftValues.ownAircraftIcaoTypeDesignator);
|
CAirlineIcaoCode airlineCode(ownAircraft.getAirlineIcaoCode());
|
||||||
icao.setAirlineDesignator(aircraftValues.ownAircraftIcaoAirline);
|
|
||||||
icao.setAircraftCombinedType(aircraftValues.ownAircraftCombinedType);
|
|
||||||
ownAircraft.setIcaoInfo(icao);
|
|
||||||
ownAircraft.setCallsign(aircraftValues.ownCallsign);
|
|
||||||
|
|
||||||
// set latest ICAO, callsign
|
bool setIcaoCodes = false;
|
||||||
this->getIContextOwnAircraft()->updateOwnIcaoData(ownAircraft.getIcaoInfo());
|
if (!ownAircraft.hasAircraftDesignator() && !aircraftValues.ownAircraftIcaoTypeDesignator.isEmpty())
|
||||||
this->getIContextOwnAircraft()->updateOwnCallsign(ownAircraft.getCallsign());
|
{
|
||||||
|
aircraftCode = CAircraftIcaoCode(aircraftValues.ownAircraftIcaoTypeDesignator, aircraftValues.ownAircraftCombinedType);
|
||||||
|
setIcaoCodes = true;
|
||||||
|
}
|
||||||
|
if (!ownAircraft.hasAircraftDesignator() && !aircraftValues.ownAircraftIcaoAirline.isEmpty())
|
||||||
|
{
|
||||||
|
airlineCode = CAirlineIcaoCode(aircraftValues.ownAircraftIcaoAirline);
|
||||||
|
setIcaoCodes = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ownAircraft.getCallsign().asString() != aircraftValues.ownCallsign)
|
||||||
|
{
|
||||||
|
ownAircraft.setCallsign(aircraftValues.ownCallsign);
|
||||||
|
this->getIContextOwnAircraft()->updateOwnCallsign(ownAircraft.getCallsign());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setIcaoCodes)
|
||||||
|
{
|
||||||
|
ownAircraft.setIcaoCodes(aircraftCode, airlineCode);
|
||||||
|
this->getIContextOwnAircraft()->updateOwnIcaoCodes(ownAircraft.getAircraftIcaoCode(), ownAircraft.getAirlineIcaoCode());
|
||||||
|
}
|
||||||
|
|
||||||
// Login mode
|
// Login mode
|
||||||
INetwork::LoginMode mode = ui->gbp_LoginMode->getLoginMode();
|
INetwork::LoginMode mode = ui->gbp_LoginMode->getLoginMode();
|
||||||
@@ -258,13 +275,13 @@ namespace BlackGui
|
|||||||
this->ui->cbp_VatsimServer->setServers(vatsimFsdServers);
|
this->ui->cbp_VatsimServer->setServers(vatsimFsdServers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::setGuiValuesFromAircraft(const CAircraft &ownAircraft)
|
void CLoginComponent::setGuiValuesFromAircraft(const CSimulatedAircraft &ownAircraft)
|
||||||
{
|
{
|
||||||
CAircraftIcaoData icao = ownAircraft.getIcaoInfo();
|
CAircraftIcaoCode aircraftIcao = ownAircraft.getAircraftIcaoCode();
|
||||||
this->ui->le_Callsign->setText(ownAircraft.getCallsignAsString());
|
this->ui->le_Callsign->setText(ownAircraft.getCallsignAsString());
|
||||||
this->ui->le_AircraftIcaoDesignator->setText(icao.getAircraftDesignator());
|
this->ui->le_AircraftIcaoDesignator->setText(aircraftIcao.getDesignator());
|
||||||
this->ui->le_AircraftIcaoAirline->setText(icao.getAirlineDesignator());
|
this->ui->le_AircraftIcaoAirline->setText(ownAircraft.getAirlineIcaoCodeDesignator());
|
||||||
this->ui->le_AircraftCombinedType->setText(icao.getAircraftCombinedType());
|
this->ui->le_AircraftCombinedType->setText(aircraftIcao.getCombinedType());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::loadFromSettings()
|
void CLoginComponent::loadFromSettings()
|
||||||
@@ -288,15 +305,6 @@ namespace BlackGui
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::mergeGuiIcaoValues(CAircraftIcaoData &icao) const
|
|
||||||
{
|
|
||||||
CGuiAircraftValues values = getAircraftValuesFromGui();
|
|
||||||
CAircraftIcaoData guiIcao(
|
|
||||||
CAircraftIcaoCode(values.ownAircraftIcaoTypeDesignator, values.ownAircraftCombinedType),
|
|
||||||
CAirlineIcaoCode(values.ownAircraftIcaoAirline));
|
|
||||||
icao.updateMissingParts(guiIcao);
|
|
||||||
}
|
|
||||||
|
|
||||||
CLoginComponent::CVatsimValues CLoginComponent::getVatsimValuesFromGui() const
|
CLoginComponent::CVatsimValues CLoginComponent::getVatsimValuesFromGui() const
|
||||||
{
|
{
|
||||||
CVatsimValues values;
|
CVatsimValues values;
|
||||||
@@ -356,55 +364,46 @@ namespace BlackGui
|
|||||||
Q_ASSERT(this->getIContextOwnAircraft());
|
Q_ASSERT(this->getIContextOwnAircraft());
|
||||||
Q_ASSERT(this->getIContextSimulator());
|
Q_ASSERT(this->getIContextSimulator());
|
||||||
|
|
||||||
static const CAircraftIcaoData defaultIcao(
|
static const CAircraftModel defaultModel(
|
||||||
CAircraftIcaoCode("C172", "L1P"),
|
"", CAircraftModel::TypeOwnSimulatorModel, "default model",
|
||||||
CAirlineIcaoCode()
|
CAircraftIcaoCode("C172", "L1P", "Cessna", "172", "L", true, false, false, 0));
|
||||||
); // default values
|
|
||||||
|
|
||||||
CAircraftIcaoData icao;
|
|
||||||
|
|
||||||
|
CAircraftModel model;
|
||||||
bool simulating = this->getIContextSimulator() &&
|
bool simulating = this->getIContextSimulator() &&
|
||||||
(this->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
(this->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
||||||
if (simulating)
|
if (simulating)
|
||||||
{
|
{
|
||||||
CAircraftModel model = this->getIContextOwnAircraft()->getOwnAircraft().getModel();
|
model = this->getIContextOwnAircraft()->getOwnAircraft().getModel();
|
||||||
this->ui->le_SimulatorModel->setText(model.getModelString());
|
this->ui->le_SimulatorModel->setText(model.getModelString());
|
||||||
|
|
||||||
icao = model.getIcao();
|
|
||||||
if (!icao.hasAircraftDesignator())
|
|
||||||
{
|
|
||||||
// not valid, reverse lookup
|
|
||||||
this->getIContextSimulator()->getIcaoForModelString(model.getModelString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set observer mode without simulator
|
// Set observer mode without simulator
|
||||||
//! \todo Currently not working in OBS mode
|
//! \todo Currently not working in OBS mode
|
||||||
|
model = CAircraftModel(defaultModel);
|
||||||
this->ui->gbp_LoginMode->setLoginMode(INetwork::LoginNormal);
|
this->ui->gbp_LoginMode->setLoginMode(INetwork::LoginNormal);
|
||||||
this->ui->le_SimulatorModel->setText("No simulator");
|
this->ui->le_SimulatorModel->setText("No simulator");
|
||||||
icao = defaultIcao;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icao.hasAircraftDesignator())
|
if (model.hasAircraftDesignator())
|
||||||
{
|
{
|
||||||
this->setGuiIcaoValues(icao, false);
|
this->setGuiIcaoValues(model, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::setGuiIcaoValues(const CAircraftIcaoData &icao, bool onlyIfEmpty)
|
void CLoginComponent::setGuiIcaoValues(const CAircraftModel &model, bool onlyIfEmpty)
|
||||||
{
|
{
|
||||||
if (!onlyIfEmpty || this->ui->le_AircraftIcaoDesignator->text().trimmed().isEmpty())
|
if (!onlyIfEmpty || this->ui->le_AircraftIcaoDesignator->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
this->ui->le_AircraftIcaoDesignator->setText(icao.getAircraftDesignator());
|
this->ui->le_AircraftIcaoDesignator->setText(model.getAircraftIcaoCode().getDesignator());
|
||||||
}
|
}
|
||||||
if (!onlyIfEmpty || this->ui->le_AircraftIcaoAirline->text().trimmed().isEmpty())
|
if (!onlyIfEmpty || this->ui->le_AircraftIcaoAirline->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
this->ui->le_AircraftIcaoAirline->setText(icao.getAirlineDesignator());
|
this->ui->le_AircraftIcaoAirline->setText(model.getAirlineIcaoCode().getDesignator());
|
||||||
}
|
}
|
||||||
if (!onlyIfEmpty || this->ui->le_AircraftCombinedType->text().trimmed().isEmpty())
|
if (!onlyIfEmpty || this->ui->le_AircraftCombinedType->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
this->ui->le_AircraftCombinedType->setText(icao.getAircraftCombinedType());
|
this->ui->le_AircraftCombinedType->setText(model.getAircraftIcaoCode().getCombinedType());
|
||||||
}
|
}
|
||||||
this->ps_validateAircraftValues();
|
this->ps_validateAircraftValues();
|
||||||
}
|
}
|
||||||
@@ -477,17 +476,12 @@ namespace BlackGui
|
|||||||
Q_ASSERT(getIContextSimulator());
|
Q_ASSERT(getIContextSimulator());
|
||||||
|
|
||||||
CAircraftModel model(this->getIContextOwnAircraft()->getOwnAircraft().getModel());
|
CAircraftModel model(this->getIContextOwnAircraft()->getOwnAircraft().getModel());
|
||||||
CAircraftIcaoData icao = this->getIContextSimulator()->getIcaoForModelString(model.getModelString());
|
if (model.getAircraftIcaoCode().hasDesignator())
|
||||||
if (icao.hasAircraftDesignator())
|
|
||||||
{
|
{
|
||||||
CLogMessage(this).validationInfo("Reverse lookup for %1") << model.getModelString();
|
CLogMessage(this).validationInfo("Reverse lookup for %1") << model.getModelString();
|
||||||
|
|
||||||
// set value in backend
|
|
||||||
this->mergeGuiIcaoValues(icao);
|
|
||||||
this->getIContextOwnAircraft()->updateOwnIcaoData(icao);
|
|
||||||
|
|
||||||
// update GUI
|
// update GUI
|
||||||
this->setGuiIcaoValues(icao, false);
|
this->setGuiIcaoValues(model, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "blackcore/settings/network.h"
|
#include "blackcore/settings/network.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
#include "blackmisc/network/server.h"
|
#include "blackmisc/network/server.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
@@ -106,7 +105,7 @@ namespace BlackGui
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! GUI values from aircraft
|
//! GUI values from aircraft
|
||||||
void setGuiValuesFromAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
void setGuiValuesFromAircraft(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||||
|
|
||||||
//! Load from settings
|
//! Load from settings
|
||||||
void loadFromSettings();
|
void loadFromSettings();
|
||||||
@@ -142,16 +141,12 @@ namespace BlackGui
|
|||||||
void setOwnModel();
|
void setOwnModel();
|
||||||
|
|
||||||
//! Set ICAO values
|
//! Set ICAO values
|
||||||
void setGuiIcaoValues(const BlackMisc::Aviation::CAircraftIcaoData &icao, bool onlyIfEmpty);
|
void setGuiIcaoValues(const BlackMisc::Simulation::CAircraftModel &model, bool onlyIfEmpty);
|
||||||
|
|
||||||
//! Merge with GUI icao values
|
|
||||||
void mergeGuiIcaoValues(BlackMisc::Aviation::CAircraftIcaoData &icao) const;
|
|
||||||
|
|
||||||
bool m_visible = false; //!< is this component selected?
|
bool m_visible = false; //!< is this component selected?
|
||||||
QScopedPointer<Ui::CLoginComponent> ui;
|
QScopedPointer<Ui::CLoginComponent> ui;
|
||||||
const int LogoffIntervalSeconds = 10;
|
const int LogoffIntervalSeconds = 10;
|
||||||
QTimer *m_logoffCountdownTimer = nullptr;
|
QTimer *m_logoffCountdownTimer { nullptr };
|
||||||
|
|
||||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace BlackGui
|
|||||||
case InfoAreaAtc:
|
case InfoAreaAtc:
|
||||||
return CIcons::appAtc16();
|
return CIcons::appAtc16();
|
||||||
case InfoAreaAircraft:
|
case InfoAreaAircraft:
|
||||||
return CIcons::appAircrafts16();
|
return CIcons::appAircraft16();
|
||||||
case InfoAreaSettings:
|
case InfoAreaSettings:
|
||||||
return CIcons::appSettings16();
|
return CIcons::appSettings16();
|
||||||
case InfoAreaFlightPlan:
|
case InfoAreaFlightPlan:
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1533</width>
|
<width>1530</width>
|
||||||
<height>242</height>
|
<height>71</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<property name="dockOptions">
|
<property name="dockOptions">
|
||||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="qw_centralWidgetEmpty">
|
<widget class="QWidget" name="qw_centralWidgetEmptyUsedAsPadding">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -160,7 +161,7 @@ namespace BlackGui
|
|||||||
this->ui->le_CommandLineInput->clear();
|
this->ui->le_CommandLineInput->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged(const CAircraft &aircraft, const CIdentifier &originator)
|
void CMainKeypadAreaComponent::ps_ownAircraftCockpitChanged(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
|
||||||
{
|
{
|
||||||
Q_UNUSED(originator);
|
Q_UNUSED(originator);
|
||||||
bool ident = aircraft.getTransponder().getTransponderMode() == CTransponder::StateIdent;
|
bool ident = aircraft.getTransponder().getTransponderMode() == CTransponder::StateIdent;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
#include "maininfoareacomponent.h"
|
#include "maininfoareacomponent.h"
|
||||||
#include "enableforruntime.h"
|
#include "enableforruntime.h"
|
||||||
#include "blackmisc/identifier.h"
|
#include "blackmisc/identifier.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
|
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
@@ -83,7 +82,7 @@ namespace BlackGui
|
|||||||
void ps_commandEntered();
|
void ps_commandEntered();
|
||||||
|
|
||||||
//! \copydoc BlackCore::IContextOwnAircraft::changedAircraftCockpit
|
//! \copydoc BlackCore::IContextOwnAircraft::changedAircraftCockpit
|
||||||
void ps_ownAircraftCockpitChanged(const BlackMisc::Aviation::CAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
void ps_ownAircraftCockpitChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator);
|
||||||
|
|
||||||
//! \copydoc BlackCore::IContextAudio::changedMute
|
//! \copydoc BlackCore::IContextAudio::changedMute
|
||||||
void ps_muteChanged(bool muted);
|
void ps_muteChanged(bool muted);
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (aircraft.getCallsign().isEmpty()) { continue; }
|
if (aircraft.getCallsign().isEmpty()) { continue; }
|
||||||
QString i(aircraft.getCallsign().toQString());
|
QString i(aircraft.getCallsign().toQString());
|
||||||
if (aircraft.hasValidAircraftDesignator())
|
if (aircraft.hasAircraftDesignator())
|
||||||
{
|
{
|
||||||
i += " (";
|
i += " (";
|
||||||
i += aircraft.getIcaoInfo().toQString(false);
|
i += aircraft.getAircraftIcaoCode().toQString(false);
|
||||||
i += ")";
|
i += ")";
|
||||||
}
|
}
|
||||||
if (aircraft.hasValidRealName())
|
if (aircraft.hasValidRealName())
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackgui/components/enableforruntime.h"
|
#include "blackgui/components/enableforruntime.h"
|
||||||
#include "blackmisc/network/server.h"
|
#include "blackmisc/network/server.h"
|
||||||
#include "blackmisc/aviation/aircrafticaodata.h"
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QUrl>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
|||||||
@@ -11,12 +11,14 @@
|
|||||||
#include "ui_settingsnetworkserverscomponent.h"
|
#include "ui_settingsnetworkserverscomponent.h"
|
||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackcore/context_settings.h"
|
#include "blackcore/context_settings.h"
|
||||||
#include "blackcore/global_network_settings.h"
|
#include "blackcore/settings/global_network_settings.h"
|
||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/project.h"
|
#include "blackmisc/project.h"
|
||||||
#include "blackmisc/settingsblackmiscclasses.h"
|
#include "blackmisc/settingsblackmiscclasses.h"
|
||||||
|
#include <QModelIndex>
|
||||||
|
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
using namespace BlackCore::Settings;
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackGui;
|
using namespace BlackGui;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
@@ -57,7 +59,7 @@ namespace BlackGui
|
|||||||
this->ui->tvp_SettingsTnServers->updateContainer(serverList);
|
this->ui->tvp_SettingsTnServers->updateContainer(serverList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsNetworkServersComponent::ps_networkServerSelected(QModelIndex index)
|
void CSettingsNetworkServersComponent::ps_networkServerSelected(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
const CServer clickedServer = this->ui->tvp_SettingsTnServers->at(index);
|
const CServer clickedServer = this->ui->tvp_SettingsTnServers->at(index);
|
||||||
this->ui->frp_ServerForm->setServer(clickedServer);
|
this->ui->frp_ServerForm->setServer(clickedServer);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//! Network server selected
|
//! Network server selected
|
||||||
void ps_networkServerSelected(QModelIndex index);
|
void ps_networkServerSelected(const QModelIndex &index);
|
||||||
|
|
||||||
//! Alter traffic server
|
//! Alter traffic server
|
||||||
void ps_alterTrafficServer();
|
void ps_alterTrafficServer();
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
#include "blackcore/context_ownaircraft.h"
|
#include "blackcore/context_ownaircraft.h"
|
||||||
#include "blackcore/simulator.h"
|
#include "blackcore/simulator.h"
|
||||||
#include "blackmisc/iconlist.h"
|
#include "blackmisc/iconlist.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackCore;
|
using namespace BlackCore;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -90,7 +90,7 @@ namespace BlackGui
|
|||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
CAircraftSituation s = ownAircraft.getSituation();
|
CAircraftSituation s = ownAircraft.getSituation();
|
||||||
CComSystem c1 = ownAircraft.getCom1System();
|
CComSystem c1 = ownAircraft.getCom1System();
|
||||||
CComSystem c2 = ownAircraft.getCom2System();
|
CComSystem c2 = ownAircraft.getCom2System();
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ namespace BlackGui
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// frequency message
|
// frequency message
|
||||||
const CAircraft ownAircraft = this->getOwnAircraft();
|
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||||
if (this->ui->tw_TextMessages->currentWidget() == this->ui->tb_TextMessagesAll) { return true; }
|
if (this->ui->tw_TextMessages->currentWidget() == this->ui->tb_TextMessagesAll) { return true; }
|
||||||
if (textMessage.isSendToFrequency(ownAircraft.getCom1System().getFrequencyActive()))
|
if (textMessage.isSendToFrequency(ownAircraft.getCom1System().getFrequencyActive()))
|
||||||
{
|
{
|
||||||
@@ -213,7 +213,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
|
void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
|
||||||
{
|
{
|
||||||
const CAircraft ownAircraft = this->getOwnAircraft();
|
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||||
QString f1n, f2n;
|
QString f1n, f2n;
|
||||||
f1n.sprintf("%03.3f", ownAircraft.getCom1System().getFrequencyActive().valueRounded(CFrequencyUnit::MHz(), 3));
|
f1n.sprintf("%03.3f", ownAircraft.getCom1System().getFrequencyActive().valueRounded(CFrequencyUnit::MHz(), 3));
|
||||||
f2n.sprintf("%03.3f", ownAircraft.getCom2System().getFrequencyActive().valueRounded(CFrequencyUnit::MHz(), 3));
|
f2n.sprintf("%03.3f", ownAircraft.getCom2System().getFrequencyActive().valueRounded(CFrequencyUnit::MHz(), 3));
|
||||||
@@ -276,7 +276,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAircraft CTextMessageComponent::getOwnAircraft() const
|
const CSimulatedAircraft CTextMessageComponent::getOwnAircraft() const
|
||||||
{
|
{
|
||||||
Q_ASSERT(this->getIContextOwnAircraft());
|
Q_ASSERT(this->getIContextOwnAircraft());
|
||||||
return this->getIContextOwnAircraft()->getOwnAircraft();
|
return this->getIContextOwnAircraft()->getOwnAircraft();
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "blackgui/textmessagetextedit.h"
|
#include "blackgui/textmessagetextedit.h"
|
||||||
#include "blackmisc/identifier.h"
|
#include "blackmisc/identifier.h"
|
||||||
#include "blackmisc/network/textmessage.h"
|
#include "blackmisc/network/textmessage.h"
|
||||||
#include "blackmisc/aviation/aircraft.h"
|
|
||||||
#include "blackmisc/network/textmessagelist.h"
|
#include "blackmisc/network/textmessagelist.h"
|
||||||
#include "blackcore/context_network.h"
|
#include "blackcore/context_network.h"
|
||||||
#include "blackcore/context_ownaircraft.h"
|
#include "blackcore/context_ownaircraft.h"
|
||||||
@@ -107,7 +106,7 @@ namespace BlackGui
|
|||||||
void addPrivateChannelTextMessage(const BlackMisc::Network::CTextMessage &textMessage);
|
void addPrivateChannelTextMessage(const BlackMisc::Network::CTextMessage &textMessage);
|
||||||
|
|
||||||
//! own aircraft
|
//! own aircraft
|
||||||
const BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
const BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const;
|
||||||
|
|
||||||
//! For this text message's recepient, is the current tab selected?
|
//! For this text message's recepient, is the current tab selected?
|
||||||
bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const;
|
bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const;
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QShortcut>
|
|
||||||
#include <QKeySequence>
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
@@ -240,7 +238,7 @@ namespace BlackGui
|
|||||||
void CInfoArea::paintEvent(QPaintEvent *event)
|
void CInfoArea::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
CStyleSheetUtility::useStyleSheetInDerivedWidget(this, QStyle::PE_FrameWindow);
|
CStyleSheetUtility::useStyleSheetInDerivedWidget(this, QStyle::PE_FrameWindow);
|
||||||
QMainWindow::paintEvent(event);
|
Q_UNUSED(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoArea::keyPressEvent(QKeyEvent *event)
|
void CInfoArea::keyPressEvent(QKeyEvent *event)
|
||||||
@@ -793,7 +791,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInfoArea::ps_setTabBarPosition(QTabWidget::TabPosition position)
|
void CInfoArea::ps_setTabBarPosition(QTabWidget::TabPosition position)
|
||||||
{
|
{
|
||||||
Q_ASSERT(position == QTabWidget::North || position == QTabWidget::South);
|
Q_ASSERT_X(position == QTabWidget::North || position == QTabWidget::South, Q_FUNC_INFO, "Wrong tabbar position");
|
||||||
this->setTabPosition(Qt::TopDockWidgetArea, position);
|
this->setTabPosition(Qt::TopDockWidgetArea, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CManagedStatusBar::displayStatusMessage(const CStatusMessage &statusMessage)
|
void CManagedStatusBar::displayStatusMessage(const CStatusMessage &statusMessage)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT_X(this->m_statusBarIcon, Q_FUNC_INFO, "Missing status bar icon");
|
||||||
|
Q_ASSERT_X(this->m_statusBar, Q_FUNC_INFO, "Missing status bar");
|
||||||
|
|
||||||
if (statusMessage.isRedundant()) { return; }
|
if (statusMessage.isRedundant()) { return; }
|
||||||
if (statusMessage.wasHandledBy(this)) { return; }
|
if (statusMessage.wasHandledBy(this)) { return; }
|
||||||
statusMessage.markAsHandledBy(this);
|
statusMessage.markAsHandledBy(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user