mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +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/enablefordockwidgetinfoarea.h"
|
||||
#include "blackgui/components/updatetimer.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -10,12 +10,6 @@
|
||||
<height>462</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ATC stations</string>
|
||||
</property>
|
||||
@@ -44,12 +38,6 @@
|
||||
</property>
|
||||
<item>
|
||||
<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">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
#include "blackcore/context_audio.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/audio/voiceroomlist.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
@@ -25,6 +24,7 @@ using namespace BlackCore;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Audio;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -62,7 +62,7 @@ namespace BlackGui
|
||||
Q_ASSERT(this->getIContextAudio());
|
||||
|
||||
// init from aircraft
|
||||
CAircraft ownAircraft = this->getOwnAircraft();
|
||||
CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||
this->ps_updateCockpitFromContext(ownAircraft, CIdentifier("dummyInitialValues")); // intentionally different name here
|
||||
|
||||
// SELCAL pairs in cockpit
|
||||
@@ -106,7 +106,7 @@ namespace BlackGui
|
||||
this->ui->ds_ComPanelCom2Standby->setValue(f);
|
||||
}
|
||||
|
||||
const CAircraft ownAircraft = this->cockpitValuesToAircraftObject();
|
||||
const CSimulatedAircraft ownAircraft = this->cockpitValuesToAircraftObject();
|
||||
this->updateOwnCockpitInContext(ownAircraft);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace BlackGui
|
||||
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
|
||||
|
||||
@@ -201,9 +201,9 @@ namespace BlackGui
|
||||
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();
|
||||
CComSystem com1 = ownAircraft.getCom1System();
|
||||
CComSystem com2 = ownAircraft.getCom2System();
|
||||
@@ -238,14 +238,14 @@ namespace BlackGui
|
||||
return ownAircraft;
|
||||
}
|
||||
|
||||
CAircraft CCockpitComComponent::getOwnAircraft() const
|
||||
CSimulatedAircraft CCockpitComComponent::getOwnAircraft() const
|
||||
{
|
||||
Q_ASSERT(this->getIContextOwnAircraft());
|
||||
if (!this->getIContextOwnAircraft()) return CAircraft();
|
||||
if (!this->getIContextOwnAircraft()) return CSimulatedAircraft();
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||
#define BLACKGUI_COCKPITCOMCOMPONENT_H
|
||||
|
||||
@@ -14,7 +16,6 @@
|
||||
#include "enablefordockwidgetinfoarea.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/aviation/transponder.h"
|
||||
#include "blackmisc/audio/voiceroomlist.h"
|
||||
#include <QFrame>
|
||||
@@ -68,7 +69,7 @@ namespace BlackGui
|
||||
void ps_guiChangedSelcal();
|
||||
|
||||
//! 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
|
||||
void ps_testSelcal();
|
||||
@@ -84,16 +85,16 @@ namespace BlackGui
|
||||
void initLeds();
|
||||
|
||||
//! Cockpit values to aircraft
|
||||
BlackMisc::Aviation::CAircraft cockpitValuesToAircraftObject();
|
||||
BlackMisc::Simulation::CSimulatedAircraft cockpitValuesToAircraftObject();
|
||||
|
||||
//! Get own aircraft
|
||||
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
||||
BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const;
|
||||
|
||||
//! Current SELCAL code
|
||||
BlackMisc::Aviation::CSelcal getSelcal() const;
|
||||
|
||||
//! Cockpit updates
|
||||
bool updateOwnCockpitInContext(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
||||
bool updateOwnCockpitInContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||
|
||||
//! COM frequencies displayed
|
||||
void updateFrequencyDisplaysFromComSystems(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKGUI_COCKPITCOMPONENT_H
|
||||
#define BLACKGUI_COCKPITCOMPONENT_H
|
||||
|
||||
|
||||
@@ -28,13 +28,19 @@
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_CockpitInfoAreaComComponent">
|
||||
<widget class="QWidget" name="qw_CockpitInfoAreaComComponentUsedAsPadding">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>3</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="BlackGui::CDockWidgetInfoArea" name="dwp_CockpitVoiceRooms">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -37,7 +38,7 @@ namespace BlackGui
|
||||
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; }
|
||||
this->setMode(aircraft.getTransponderMode());
|
||||
@@ -65,7 +66,7 @@ namespace BlackGui
|
||||
{
|
||||
return;
|
||||
}
|
||||
CAircraft ownAircraft = this->getOwnAircraft();
|
||||
CSimulatedAircraft ownAircraft(this->getOwnAircraft());
|
||||
if (ownAircraft.getTransponderMode() == mode) { return; }
|
||||
|
||||
this->setMode(mode);
|
||||
@@ -128,7 +129,7 @@ namespace BlackGui
|
||||
return getIContextOwnAircraft()->getOwnAircraft().getTransponder();
|
||||
}
|
||||
|
||||
CAircraft CCockpitTransponderModeLedsComponent::getOwnAircraft() const
|
||||
CSimulatedAircraft CCockpitTransponderModeLedsComponent::getOwnAircraft() const
|
||||
{
|
||||
Q_ASSERT(getIContextOwnAircraft());
|
||||
return getIContextOwnAircraft()->getOwnAircraft();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "enableforruntime.h"
|
||||
#include "../led.h"
|
||||
#include "blackmisc/identifiable.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/simulation/simulatedaircraft.h"
|
||||
#include "blackmisc/aviation/transponder.h"
|
||||
#include <QFrame>
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! \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
|
||||
void ps_onLedClicked();
|
||||
@@ -61,7 +61,7 @@ namespace BlackGui
|
||||
BlackMisc::Aviation::CTransponder getOwnTransponder() const;
|
||||
|
||||
//! Own Aircraft
|
||||
BlackMisc::Aviation::CAircraft getOwnAircraft() const;
|
||||
BlackMisc::Simulation::CSimulatedAircraft getOwnAircraft() const;
|
||||
|
||||
QScopedPointer<BlackGui::CLedWidget> m_ledStandby;
|
||||
QScopedPointer<BlackGui::CLedWidget> m_ledModes;
|
||||
|
||||
@@ -32,14 +32,14 @@
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_centralWidgetEmpty">
|
||||
<widget class="QWidget" name="qw_centralWidgetEmptyUsedAsPadding">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
<height>3</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -104,8 +104,8 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CLogComponent" name="comp_Log" native="true">
|
||||
<property name="lineWidth" stdset="0">
|
||||
<widget class="BlackGui::Components::CLogComponent" name="comp_Log">
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -194,18 +194,18 @@
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CLogComponent</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/components/logcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CDockWidgetInfoArea</class>
|
||||
<extends>QDockWidget</extends>
|
||||
<header>blackgui/dockwidgetinfoarea.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CLogComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/logcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CCoreStatusComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackGui;
|
||||
|
||||
@@ -69,16 +70,16 @@ namespace BlackGui
|
||||
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
|
||||
if (CCallsign::isValidCallsign(ownAircraft.getCallsignAsString()))
|
||||
{
|
||||
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())
|
||||
{
|
||||
@@ -340,7 +341,7 @@ namespace BlackGui
|
||||
return;
|
||||
}
|
||||
|
||||
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
CFlightPlan loadedPlan = this->getIContextNetwork()->loadFlightPlanFromNetwork(ownAircraft.getCallsign());
|
||||
if (loadedPlan.wasSentOrLoaded())
|
||||
{
|
||||
@@ -419,9 +420,7 @@ namespace BlackGui
|
||||
|
||||
CIdentifier CFlightPlanComponent::flightPlanIdentifier()
|
||||
{
|
||||
if (m_identifier.getName().isEmpty())
|
||||
m_identifier = CIdentifier(QStringLiteral("FLIGHTPLANCOMPONENT"));
|
||||
|
||||
if (m_identifier.getName().isEmpty()) { m_identifier = CIdentifier(QStringLiteral("FLIGHTPLANCOMPONENT")); }
|
||||
return m_identifier;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/aviation/flightplan.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
@@ -45,7 +44,7 @@ namespace BlackGui
|
||||
void loginDataSet();
|
||||
|
||||
//! Prefill with aircraft data
|
||||
void prefillWithAircraftData(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
||||
void prefillWithAircraftData(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||
|
||||
//! Prefill with aircraft dara
|
||||
void fillWithFlightPlanData(const BlackMisc::Aviation::CFlightPlan &flightPlan);
|
||||
@@ -70,10 +69,10 @@ namespace BlackGui
|
||||
BlackMisc::CIdentifier m_identifier;
|
||||
|
||||
//! 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
|
||||
static const QString &defaultTime() { static QString t("00:00"); return t; }
|
||||
static const QString &defaultTime() { static const QString t("00:00"); return t; }
|
||||
|
||||
//! Identifier
|
||||
BlackMisc::CIdentifier flightPlanIdentifier();
|
||||
|
||||
@@ -22,10 +22,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CInfoWindowComponent::CInfoWindowComponent(QWidget *parent) :
|
||||
QWizardPage(parent),
|
||||
ui(new Ui::InfoWindow)
|
||||
@@ -34,21 +30,15 @@ namespace BlackGui
|
||||
this->hide();
|
||||
this->m_hideTimer = new QTimer(this);
|
||||
this->m_hideTimer->setSingleShot(true);
|
||||
this->onStyleSheetsChanged();
|
||||
this->ps_onStyleSheetsChanged();
|
||||
|
||||
connect(this->m_hideTimer, &QTimer::timeout, 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() { }
|
||||
|
||||
/*
|
||||
* Info message for some time
|
||||
*/
|
||||
void CInfoWindowComponent::displayStringMessage(const QString &message, int displayTimeMs)
|
||||
{
|
||||
if (message.isEmpty())
|
||||
@@ -63,9 +53,6 @@ namespace BlackGui
|
||||
this->showWindow(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Info message for some time
|
||||
*/
|
||||
void CInfoWindowComponent::displayTextMessage(const CTextMessage &textMessage, int displayTimeMs)
|
||||
{
|
||||
if (textMessage.isEmpty())
|
||||
@@ -84,9 +71,6 @@ namespace BlackGui
|
||||
this->showWindow(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display status message
|
||||
*/
|
||||
void CInfoWindowComponent::displayStatusMessage(const CStatusMessage &statusMessage, int displayTimeMs)
|
||||
{
|
||||
if (statusMessage.isEmpty())
|
||||
@@ -104,9 +88,6 @@ namespace BlackGui
|
||||
this->showWindow(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display
|
||||
*/
|
||||
void CInfoWindowComponent::display(const BlackMisc::CVariant &variant, int displayTimeMs)
|
||||
{
|
||||
if (variant.isNull())
|
||||
@@ -128,9 +109,6 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Init this window
|
||||
*/
|
||||
void CInfoWindowComponent::initWindow()
|
||||
{
|
||||
// center
|
||||
@@ -143,9 +121,6 @@ namespace BlackGui
|
||||
this->show();
|
||||
}
|
||||
|
||||
/*
|
||||
* Show window
|
||||
*/
|
||||
void CInfoWindowComponent::showWindow(int displayTimeMs)
|
||||
{
|
||||
this->initWindow();
|
||||
@@ -154,18 +129,12 @@ namespace BlackGui
|
||||
this->m_hideTimer->start(displayTimeMs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set current widget
|
||||
*/
|
||||
void CInfoWindowComponent::setCurrentPage(QWidget *widget)
|
||||
{
|
||||
this->ui->sw_DifferentModes->setCurrentWidget(widget);
|
||||
}
|
||||
|
||||
/*
|
||||
* Style sheet changed
|
||||
*/
|
||||
void CInfoWindowComponent::onStyleSheetsChanged()
|
||||
void CInfoWindowComponent::ps_onStyleSheetsChanged()
|
||||
{
|
||||
QString st = CStyleSheetUtility::instance().style(CStyleSheetUtility::fileNameInfoWindow());
|
||||
this->setStyleSheet(st);
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
|
||||
/*!
|
||||
* Multi purpose info window (like pop up window)
|
||||
*/
|
||||
@@ -44,7 +43,6 @@ namespace BlackGui
|
||||
~CInfoWindowComponent();
|
||||
|
||||
public slots:
|
||||
|
||||
//! Info message, pure string
|
||||
void displayStringMessage(const QString &message, int displayTimeMs = DefaultDisplayTimeMs);
|
||||
|
||||
@@ -72,7 +70,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! Style sheet changed
|
||||
void onStyleSheetsChanged();
|
||||
void ps_onStyleSheetsChanged();
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "internalscomponent.h"
|
||||
#include "ui_internalscomponent.h"
|
||||
#include "blackcore/context_all_interfaces.h"
|
||||
#include <QJsonParseError>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
#include "blackcore/context_simulator.h"
|
||||
#include "blackcore/network.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackcore/global_network_settings.h"
|
||||
#include "blackcore/settings/global_network_settings.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include "blackmisc/aviation/aircrafticaodata.h"
|
||||
#include "../uppercasevalidator.h"
|
||||
#include <QIntValidator>
|
||||
|
||||
@@ -27,6 +26,7 @@ using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Settings;
|
||||
using namespace BlackGui;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -183,18 +183,35 @@ namespace BlackGui
|
||||
return;
|
||||
}
|
||||
|
||||
// sync values with GUI values
|
||||
CGuiAircraftValues aircraftValues = this->getAircraftValuesFromGui();
|
||||
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
CAircraftIcaoData icao = ownAircraft.getIcaoInfo();
|
||||
icao.setAircraftDesignator(aircraftValues.ownAircraftIcaoTypeDesignator);
|
||||
icao.setAirlineDesignator(aircraftValues.ownAircraftIcaoAirline);
|
||||
icao.setAircraftCombinedType(aircraftValues.ownAircraftCombinedType);
|
||||
ownAircraft.setIcaoInfo(icao);
|
||||
ownAircraft.setCallsign(aircraftValues.ownCallsign);
|
||||
CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
CAircraftIcaoCode aircraftCode(ownAircraft.getAircraftIcaoCode());
|
||||
CAirlineIcaoCode airlineCode(ownAircraft.getAirlineIcaoCode());
|
||||
|
||||
// set latest ICAO, callsign
|
||||
this->getIContextOwnAircraft()->updateOwnIcaoData(ownAircraft.getIcaoInfo());
|
||||
this->getIContextOwnAircraft()->updateOwnCallsign(ownAircraft.getCallsign());
|
||||
bool setIcaoCodes = false;
|
||||
if (!ownAircraft.hasAircraftDesignator() && !aircraftValues.ownAircraftIcaoTypeDesignator.isEmpty())
|
||||
{
|
||||
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
|
||||
INetwork::LoginMode mode = ui->gbp_LoginMode->getLoginMode();
|
||||
@@ -258,13 +275,13 @@ namespace BlackGui
|
||||
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_AircraftIcaoDesignator->setText(icao.getAircraftDesignator());
|
||||
this->ui->le_AircraftIcaoAirline->setText(icao.getAirlineDesignator());
|
||||
this->ui->le_AircraftCombinedType->setText(icao.getAircraftCombinedType());
|
||||
this->ui->le_AircraftIcaoDesignator->setText(aircraftIcao.getDesignator());
|
||||
this->ui->le_AircraftIcaoAirline->setText(ownAircraft.getAirlineIcaoCodeDesignator());
|
||||
this->ui->le_AircraftCombinedType->setText(aircraftIcao.getCombinedType());
|
||||
}
|
||||
|
||||
void CLoginComponent::loadFromSettings()
|
||||
@@ -288,15 +305,6 @@ namespace BlackGui
|
||||
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
|
||||
{
|
||||
CVatsimValues values;
|
||||
@@ -356,55 +364,46 @@ namespace BlackGui
|
||||
Q_ASSERT(this->getIContextOwnAircraft());
|
||||
Q_ASSERT(this->getIContextSimulator());
|
||||
|
||||
static const CAircraftIcaoData defaultIcao(
|
||||
CAircraftIcaoCode("C172", "L1P"),
|
||||
CAirlineIcaoCode()
|
||||
); // default values
|
||||
|
||||
CAircraftIcaoData icao;
|
||||
static const CAircraftModel defaultModel(
|
||||
"", CAircraftModel::TypeOwnSimulatorModel, "default model",
|
||||
CAircraftIcaoCode("C172", "L1P", "Cessna", "172", "L", true, false, false, 0));
|
||||
|
||||
CAircraftModel model;
|
||||
bool simulating = this->getIContextSimulator() &&
|
||||
(this->getIContextSimulator()->getSimulatorStatus() & ISimulator::Simulating);
|
||||
if (simulating)
|
||||
{
|
||||
CAircraftModel model = this->getIContextOwnAircraft()->getOwnAircraft().getModel();
|
||||
model = this->getIContextOwnAircraft()->getOwnAircraft().getModel();
|
||||
this->ui->le_SimulatorModel->setText(model.getModelString());
|
||||
|
||||
icao = model.getIcao();
|
||||
if (!icao.hasAircraftDesignator())
|
||||
{
|
||||
// not valid, reverse lookup
|
||||
this->getIContextSimulator()->getIcaoForModelString(model.getModelString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set observer mode without simulator
|
||||
//! \todo Currently not working in OBS mode
|
||||
model = CAircraftModel(defaultModel);
|
||||
this->ui->gbp_LoginMode->setLoginMode(INetwork::LoginNormal);
|
||||
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())
|
||||
{
|
||||
this->ui->le_AircraftIcaoDesignator->setText(icao.getAircraftDesignator());
|
||||
this->ui->le_AircraftIcaoDesignator->setText(model.getAircraftIcaoCode().getDesignator());
|
||||
}
|
||||
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())
|
||||
{
|
||||
this->ui->le_AircraftCombinedType->setText(icao.getAircraftCombinedType());
|
||||
this->ui->le_AircraftCombinedType->setText(model.getAircraftIcaoCode().getCombinedType());
|
||||
}
|
||||
this->ps_validateAircraftValues();
|
||||
}
|
||||
@@ -477,17 +476,12 @@ namespace BlackGui
|
||||
Q_ASSERT(getIContextSimulator());
|
||||
|
||||
CAircraftModel model(this->getIContextOwnAircraft()->getOwnAircraft().getModel());
|
||||
CAircraftIcaoData icao = this->getIContextSimulator()->getIcaoForModelString(model.getModelString());
|
||||
if (icao.hasAircraftDesignator())
|
||||
if (model.getAircraftIcaoCode().hasDesignator())
|
||||
{
|
||||
CLogMessage(this).validationInfo("Reverse lookup for %1") << model.getModelString();
|
||||
|
||||
// set value in backend
|
||||
this->mergeGuiIcaoValues(icao);
|
||||
this->getIContextOwnAircraft()->updateOwnIcaoData(icao);
|
||||
|
||||
// update GUI
|
||||
this->setGuiIcaoValues(icao, false);
|
||||
this->setGuiIcaoValues(model, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackcore/settings/network.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/network/server.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
@@ -106,7 +105,7 @@ namespace BlackGui
|
||||
};
|
||||
|
||||
//! GUI values from aircraft
|
||||
void setGuiValuesFromAircraft(const BlackMisc::Aviation::CAircraft &ownAircraft);
|
||||
void setGuiValuesFromAircraft(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft);
|
||||
|
||||
//! Load from settings
|
||||
void loadFromSettings();
|
||||
@@ -142,16 +141,12 @@ namespace BlackGui
|
||||
void setOwnModel();
|
||||
|
||||
//! Set ICAO values
|
||||
void setGuiIcaoValues(const BlackMisc::Aviation::CAircraftIcaoData &icao, bool onlyIfEmpty);
|
||||
|
||||
//! Merge with GUI icao values
|
||||
void mergeGuiIcaoValues(BlackMisc::Aviation::CAircraftIcaoData &icao) const;
|
||||
void setGuiIcaoValues(const BlackMisc::Simulation::CAircraftModel &model, bool onlyIfEmpty);
|
||||
|
||||
bool m_visible = false; //!< is this component selected?
|
||||
QScopedPointer<Ui::CLoginComponent> ui;
|
||||
const int LogoffIntervalSeconds = 10;
|
||||
QTimer *m_logoffCountdownTimer = nullptr;
|
||||
|
||||
QTimer *m_logoffCountdownTimer { nullptr };
|
||||
BlackCore::CSetting<BlackCore::Settings::Network::TrafficServers> m_trafficNetworkServers { this };
|
||||
};
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace BlackGui
|
||||
case InfoAreaAtc:
|
||||
return CIcons::appAtc16();
|
||||
case InfoAreaAircraft:
|
||||
return CIcons::appAircrafts16();
|
||||
return CIcons::appAircraft16();
|
||||
case InfoAreaSettings:
|
||||
return CIcons::appSettings16();
|
||||
case InfoAreaFlightPlan:
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1533</width>
|
||||
<height>242</height>
|
||||
<width>1530</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -32,7 +32,7 @@
|
||||
<property name="dockOptions">
|
||||
<set>QMainWindow::AllowTabbedDocks|QMainWindow::ForceTabbedDocks</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="qw_centralWidgetEmpty">
|
||||
<widget class="QWidget" name="qw_centralWidgetEmptyUsedAsPadding">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -160,7 +161,7 @@ namespace BlackGui
|
||||
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);
|
||||
bool ident = aircraft.getTransponder().getTransponderMode() == CTransponder::StateIdent;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "maininfoareacomponent.h"
|
||||
#include "enableforruntime.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QPushButton>
|
||||
@@ -83,7 +82,7 @@ namespace BlackGui
|
||||
void ps_commandEntered();
|
||||
|
||||
//! \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
|
||||
void ps_muteChanged(bool muted);
|
||||
|
||||
@@ -87,10 +87,10 @@ namespace BlackGui
|
||||
{
|
||||
if (aircraft.getCallsign().isEmpty()) { continue; }
|
||||
QString i(aircraft.getCallsign().toQString());
|
||||
if (aircraft.hasValidAircraftDesignator())
|
||||
if (aircraft.hasAircraftDesignator())
|
||||
{
|
||||
i += " (";
|
||||
i += aircraft.getIcaoInfo().toQString(false);
|
||||
i += aircraft.getAircraftIcaoCode().toQString(false);
|
||||
i += ")";
|
||||
}
|
||||
if (aircraft.hasValidRealName())
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackmisc/network/server.h"
|
||||
#include "blackmisc/aviation/aircrafticaodata.h"
|
||||
#include <QTabWidget>
|
||||
#include <QModelIndex>
|
||||
#include <QTimer>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
#include "ui_settingsnetworkserverscomponent.h"
|
||||
#include "blackcore/context_network.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/project.h"
|
||||
#include "blackmisc/settingsblackmiscclasses.h"
|
||||
#include <QModelIndex>
|
||||
|
||||
using namespace BlackCore;
|
||||
using namespace BlackCore::Settings;
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -57,7 +59,7 @@ namespace BlackGui
|
||||
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);
|
||||
this->ui->frp_ServerForm->setServer(clickedServer);
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace BlackGui
|
||||
|
||||
private slots:
|
||||
//! Network server selected
|
||||
void ps_networkServerSelected(QModelIndex index);
|
||||
void ps_networkServerSelected(const QModelIndex &index);
|
||||
|
||||
//! Alter traffic server
|
||||
void ps_alterTrafficServer();
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackmisc/iconlist.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -90,7 +90,7 @@ namespace BlackGui
|
||||
this->clear();
|
||||
}
|
||||
|
||||
CAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
CSimulatedAircraft ownAircraft = this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
CAircraftSituation s = ownAircraft.getSituation();
|
||||
CComSystem c1 = ownAircraft.getCom1System();
|
||||
CComSystem c2 = ownAircraft.getCom2System();
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace BlackGui
|
||||
else
|
||||
{
|
||||
// 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 (textMessage.isSendToFrequency(ownAircraft.getCom1System().getFrequencyActive()))
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace BlackGui
|
||||
|
||||
void CTextMessageComponent::showCurrentFrequenciesFromCockpit()
|
||||
{
|
||||
const CAircraft ownAircraft = this->getOwnAircraft();
|
||||
const CSimulatedAircraft ownAircraft = this->getOwnAircraft();
|
||||
QString f1n, f2n;
|
||||
f1n.sprintf("%03.3f", ownAircraft.getCom1System().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());
|
||||
return this->getIContextOwnAircraft()->getOwnAircraft();
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "blackgui/textmessagetextedit.h"
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/network/textmessage.h"
|
||||
#include "blackmisc/aviation/aircraft.h"
|
||||
#include "blackmisc/network/textmessagelist.h"
|
||||
#include "blackcore/context_network.h"
|
||||
#include "blackcore/context_ownaircraft.h"
|
||||
@@ -107,7 +106,7 @@ namespace BlackGui
|
||||
void addPrivateChannelTextMessage(const BlackMisc::Network::CTextMessage &textMessage);
|
||||
|
||||
//! 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?
|
||||
bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const;
|
||||
|
||||
Reference in New Issue
Block a user