mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #681, FSD UI at login screen
* plus completers for login GUI (ICAO, ...) * some utility functions in related value object classed
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include "blackcore/contextnetwork.h"
|
#include "blackcore/contextnetwork.h"
|
||||||
#include "blackcore/contextownaircraft.h"
|
#include "blackcore/contextownaircraft.h"
|
||||||
#include "blackcore/contextsimulator.h"
|
#include "blackcore/contextsimulator.h"
|
||||||
|
#include "blackcore/webdataservices.h"
|
||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackcore/network.h"
|
#include "blackcore/network.h"
|
||||||
#include "blackcore/simulator.h"
|
#include "blackcore/simulator.h"
|
||||||
@@ -43,6 +44,8 @@
|
|||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
#include <QCompleter>
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
using namespace BlackConfig;
|
using namespace BlackConfig;
|
||||||
@@ -58,6 +61,12 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
const CLogCategoryList &CLoginComponent::getLogCategories()
|
||||||
|
{
|
||||||
|
static const BlackMisc::CLogCategoryList cats { BlackMisc::CLogCategory::guiComponent() };
|
||||||
|
return cats;
|
||||||
|
}
|
||||||
|
|
||||||
CLoginComponent::CLoginComponent(QWidget *parent) :
|
CLoginComponent::CLoginComponent(QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
ui(new Ui::CLoginComponent)
|
ui(new Ui::CLoginComponent)
|
||||||
@@ -74,6 +83,9 @@ namespace BlackGui
|
|||||||
connect(this->ui->bb_OkCancel, &QDialogButtonBox::accepted, this, &CLoginComponent::ps_toggleNetworkConnection);
|
connect(this->ui->bb_OkCancel, &QDialogButtonBox::accepted, this, &CLoginComponent::ps_toggleNetworkConnection);
|
||||||
connect(this->ui->pb_OtherServersGotoSettings, &QPushButton::pressed, this, &CLoginComponent::requestNetworkSettings);
|
connect(this->ui->pb_OtherServersGotoSettings, &QPushButton::pressed, this, &CLoginComponent::requestNetworkSettings);
|
||||||
|
|
||||||
|
this->ui->comp_FsdDetails->showEnableInfo(true);
|
||||||
|
this->ui->comp_FsdDetails->setFsdSetupEnabled(false);
|
||||||
|
|
||||||
this->ui->lblp_SimulatorModel->setToolTips("available", "unavailable");
|
this->ui->lblp_SimulatorModel->setToolTips("available", "unavailable");
|
||||||
this->ui->lblp_SimulatorModel->setPixmapUnticked(CIcons::empty());
|
this->ui->lblp_SimulatorModel->setPixmapUnticked(CIcons::empty());
|
||||||
this->ui->lblp_AircraftCombinedType->setToolTips("ok", "wrong");
|
this->ui->lblp_AircraftCombinedType->setToolTips("ok", "wrong");
|
||||||
@@ -110,9 +122,9 @@ namespace BlackGui
|
|||||||
this->ui->le_AircraftCombinedType->setValidator(new CUpperCaseValidator(this));
|
this->ui->le_AircraftCombinedType->setValidator(new CUpperCaseValidator(this));
|
||||||
connect(ui->le_AircraftCombinedType, &QLineEdit::editingFinished, this, &CLoginComponent::ps_validateAircraftValues);
|
connect(ui->le_AircraftCombinedType, &QLineEdit::editingFinished, this, &CLoginComponent::ps_validateAircraftValues);
|
||||||
|
|
||||||
this->ui->le_AircraftIcaoAirline->setMaxLength(5);
|
this->ui->le_AirlineIcaoDesignator->setMaxLength(5);
|
||||||
this->ui->le_AircraftIcaoAirline->setValidator(new CUpperCaseValidator(this));
|
this->ui->le_AirlineIcaoDesignator->setValidator(new CUpperCaseValidator(this));
|
||||||
connect(ui->le_AircraftIcaoAirline, &QLineEdit::editingFinished, this, &CLoginComponent::ps_validateAircraftValues);
|
connect(ui->le_AirlineIcaoDesignator, &QLineEdit::editingFinished, this, &CLoginComponent::ps_validateAircraftValues);
|
||||||
|
|
||||||
this->ui->le_AircraftIcaoDesignator->setMaxLength(5);
|
this->ui->le_AircraftIcaoDesignator->setMaxLength(5);
|
||||||
this->ui->le_AircraftIcaoDesignator->setValidator(new CUpperCaseValidator(this));
|
this->ui->le_AircraftIcaoDesignator->setValidator(new CUpperCaseValidator(this));
|
||||||
@@ -126,9 +138,9 @@ namespace BlackGui
|
|||||||
connect(sGui->getIContextNetwork(), &IContextNetwork::webServiceDataRead, this, &CLoginComponent::ps_onWebServiceDataRead);
|
connect(sGui->getIContextNetwork(), &IContextNetwork::webServiceDataRead, this, &CLoginComponent::ps_onWebServiceDataRead);
|
||||||
|
|
||||||
// inital setup, if data already available
|
// inital setup, if data already available
|
||||||
ps_validateAircraftValues();
|
this->ps_validateAircraftValues();
|
||||||
ps_validateVatsimValues();
|
this->ps_validateVatsimValues();
|
||||||
ps_onWebServiceDataRead(CEntityFlags::VatsimDataFile, CEntityFlags::ReadFinished, -1);
|
this->ps_onWebServiceDataRead(CEntityFlags::VatsimDataFile, CEntityFlags::ReadFinished, -1);
|
||||||
CServerList otherServers(this->m_otherTrafficNetworkServers.getThreadLocal());
|
CServerList otherServers(this->m_otherTrafficNetworkServers.getThreadLocal());
|
||||||
|
|
||||||
// add a testserver when no servers can be loaded
|
// add a testserver when no servers can be loaded
|
||||||
@@ -180,6 +192,11 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CLoginComponent::ps_toggleNetworkConnection()
|
void CLoginComponent::ps_toggleNetworkConnection()
|
||||||
{
|
{
|
||||||
|
if (this->ui->tw_Network->currentWidget() == this->ui->pg_FsdDetails)
|
||||||
|
{
|
||||||
|
CLogMessage(this).validationError("No login possible from this very tab, use VATSIM or other servers");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const bool isConnected = sGui->getIContextNetwork()->isConnected();
|
const bool isConnected = sGui->getIContextNetwork()->isConnected();
|
||||||
const bool vatsimLogin = (this->ui->tw_Network->currentWidget() == this->ui->pg_NetworkVatsim);
|
const bool vatsimLogin = (this->ui->tw_Network->currentWidget() == this->ui->pg_NetworkVatsim);
|
||||||
CServer currentServer; // used for login
|
CServer currentServer; // used for login
|
||||||
@@ -190,13 +207,13 @@ namespace BlackGui
|
|||||||
|
|
||||||
if (!this->ps_validateAircraftValues())
|
if (!this->ps_validateAircraftValues())
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("Invalid aircraft data, login not possible");
|
CLogMessage(this).validationWarning("Invalid aircraft data, login not possible");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vatsimLogin && !this->ps_validateVatsimValues())
|
if (vatsimLogin && !this->ps_validateVatsimValues())
|
||||||
{
|
{
|
||||||
CLogMessage(this).warning("Invalid VATSIM data, login not possible");
|
CLogMessage(this).validationWarning("Invalid VATSIM data, login not possible");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +273,14 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
currentServer = this->getCurrentOtherServer();
|
currentServer = this->getCurrentOtherServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FSD setup, then override
|
||||||
|
if (ui->comp_FsdDetails->isFsdSetuoEnabled())
|
||||||
|
{
|
||||||
|
const CFsdSetup fsd = ui->comp_FsdDetails->getValue();
|
||||||
|
currentServer.setFsdSetup(fsd);
|
||||||
|
}
|
||||||
|
|
||||||
this->ui->frp_CurrentServer->setServer(currentServer);
|
this->ui->frp_CurrentServer->setServer(currentServer);
|
||||||
sGui->getIContextOwnAircraft()->updateOwnAircraftPilot(currentServer.getUser());
|
sGui->getIContextOwnAircraft()->updateOwnAircraftPilot(currentServer.getUser());
|
||||||
|
|
||||||
@@ -287,25 +312,33 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::ps_onWebServiceDataRead(int entityInt, int stateI, int number)
|
void CLoginComponent::ps_onWebServiceDataRead(int entityInt, int stateInt, int number)
|
||||||
{
|
{
|
||||||
const CEntityFlags::EntityFlag entity = static_cast<CEntityFlags::EntityFlag>(entityInt);
|
const CEntityFlags::EntityFlag entity = static_cast<CEntityFlags::EntityFlag>(entityInt);
|
||||||
const CEntityFlags::ReadState state = static_cast<CEntityFlags::ReadState>(stateI);
|
const CEntityFlags::ReadState state = static_cast<CEntityFlags::ReadState>(stateInt);
|
||||||
if (entity != CEntityFlags::VatsimDataFile || state != CEntityFlags::ReadFinished) { return; }
|
if (state != CEntityFlags::ReadFinished) { return; }
|
||||||
Q_UNUSED(number);
|
Q_UNUSED(number);
|
||||||
const CServerList vatsimFsdServers = sGui->getIContextNetwork()->getVatsimFsdServers();
|
|
||||||
if (vatsimFsdServers.isEmpty()) { return; }
|
if (entity == CEntityFlags::VatsimDataFile)
|
||||||
const CServer currentServer = this->m_currentVatsimServer.get();
|
{
|
||||||
this->ui->comp_VatsimServer->setServers(vatsimFsdServers);
|
const CServerList vatsimFsdServers = sGui->getIContextNetwork()->getVatsimFsdServers();
|
||||||
this->ui->comp_VatsimServer->preSelect(currentServer.getName());
|
if (vatsimFsdServers.isEmpty()) { return; }
|
||||||
|
const CServer currentServer = this->m_currentVatsimServer.get();
|
||||||
|
this->ui->comp_VatsimServer->setServers(vatsimFsdServers);
|
||||||
|
this->ui->comp_VatsimServer->preSelect(currentServer.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->initCompleters(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLoginComponent::setGuiValuesFromAircraft(const CSimulatedAircraft &ownAircraft)
|
void CLoginComponent::setGuiValuesFromAircraft(const CSimulatedAircraft &ownAircraft)
|
||||||
{
|
{
|
||||||
CAircraftIcaoCode aircraftIcao = ownAircraft.getAircraftIcaoCode();
|
const CAircraftIcaoCode aircraftIcao = ownAircraft.getAircraftIcaoCode();
|
||||||
this->ui->le_Callsign->setText(ownAircraft.getCallsignAsString());
|
this->ui->le_Callsign->setText(ownAircraft.getCallsignAsString());
|
||||||
this->ui->le_AircraftIcaoDesignator->setText(aircraftIcao.getDesignator());
|
this->ui->le_AircraftIcaoDesignator->setText(aircraftIcao.getDesignator());
|
||||||
this->ui->le_AircraftIcaoAirline->setText(ownAircraft.getAirlineIcaoCodeDesignator());
|
this->ui->le_AirlineIcaoDesignator->setText(ownAircraft.getAirlineIcaoCodeDesignator());
|
||||||
this->ui->le_AircraftCombinedType->setText(aircraftIcao.getCombinedType());
|
this->ui->le_AircraftCombinedType->setText(aircraftIcao.getCombinedType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,8 +369,8 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
CGuiAircraftValues values;
|
CGuiAircraftValues values;
|
||||||
values.ownCallsign = this->ui->le_Callsign->text().trimmed().toUpper();
|
values.ownCallsign = this->ui->le_Callsign->text().trimmed().toUpper();
|
||||||
values.ownAircraftIcaoTypeDesignator = this->ui->le_AircraftIcaoDesignator->text().trimmed().toUpper();
|
values.ownAircraftIcaoTypeDesignator = CAircraftIcaoCode::normalizeDesignator(this->ui->le_AircraftIcaoDesignator->text());
|
||||||
values.ownAircraftIcaoAirline = this->ui->le_AircraftIcaoAirline->text().trimmed().toUpper();
|
values.ownAircraftIcaoAirline = CAirlineIcaoCode::normalizeDesignator(this->ui->le_AirlineIcaoDesignator->text());
|
||||||
values.ownAircraftCombinedType = this->ui->le_AircraftCombinedType->text().trimmed().toUpper();
|
values.ownAircraftCombinedType = this->ui->le_AircraftCombinedType->text().trimmed().toUpper();
|
||||||
values.ownAircraftSimulatorModel = this->ui->le_SimulatorModel->text().trimmed().toUpper();
|
values.ownAircraftSimulatorModel = this->ui->le_SimulatorModel->text().trimmed().toUpper();
|
||||||
return values;
|
return values;
|
||||||
@@ -434,9 +467,9 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
this->ui->le_AircraftIcaoDesignator->setText(model.getAircraftIcaoCode().getDesignator());
|
this->ui->le_AircraftIcaoDesignator->setText(model.getAircraftIcaoCode().getDesignator());
|
||||||
}
|
}
|
||||||
if (!onlyIfEmpty || this->ui->le_AircraftIcaoAirline->text().trimmed().isEmpty())
|
if (!onlyIfEmpty || this->ui->le_AirlineIcaoDesignator->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
this->ui->le_AircraftIcaoAirline->setText(model.getAirlineIcaoCode().getDesignator());
|
this->ui->le_AirlineIcaoDesignator->setText(model.getAirlineIcaoCode().getDesignator());
|
||||||
}
|
}
|
||||||
if (!onlyIfEmpty || this->ui->le_AircraftCombinedType->text().trimmed().isEmpty())
|
if (!onlyIfEmpty || this->ui->le_AircraftCombinedType->text().trimmed().isEmpty())
|
||||||
{
|
{
|
||||||
@@ -523,5 +556,42 @@ namespace BlackGui
|
|||||||
CLogMessage(this).validationInfo("Reverse lookup for %1 failed, set data manually") << modelStr;
|
CLogMessage(this).validationInfo("Reverse lookup for %1 failed, set data manually") << modelStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CLoginComponent::initCompleters(CEntityFlags::Entity entity)
|
||||||
|
{
|
||||||
|
// completers where possible
|
||||||
|
if (sGui && sGui->getWebDataServices())
|
||||||
|
{
|
||||||
|
//! \todo fill in when airports are ready
|
||||||
|
|
||||||
|
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) && !ui->le_AircraftIcaoDesignator->completer())
|
||||||
|
{
|
||||||
|
const QStringList aircraftDesignators = sGui->getWebDataServices()->getAircraftIcaoCodes().toCompleterStrings();
|
||||||
|
if (!aircraftDesignators.isEmpty())
|
||||||
|
{
|
||||||
|
QCompleter *completer = new QCompleter(aircraftDesignators, this);
|
||||||
|
QStyledItemDelegate *itemDelegate = new QStyledItemDelegate(completer);
|
||||||
|
completer->popup()->setItemDelegate(itemDelegate);
|
||||||
|
ui->le_AircraftIcaoDesignator->setCompleter(completer);
|
||||||
|
completer->popup()->setObjectName("AircraftCompleter");
|
||||||
|
completer->popup()->setMinimumWidth(175);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.testFlag(CEntityFlags::AirlineIcaoEntity) && !ui->le_AirlineIcaoDesignator->completer())
|
||||||
|
{
|
||||||
|
const QStringList airlineDesignators = sGui->getWebDataServices()->getAirlineIcaoCodes().toIcaoDesignatorNameCountryCompleterStrings();
|
||||||
|
if (!airlineDesignators.isEmpty())
|
||||||
|
{
|
||||||
|
QCompleter *completer = new QCompleter(airlineDesignators, this);
|
||||||
|
QStyledItemDelegate *itemDelegate = new QStyledItemDelegate(completer);
|
||||||
|
completer->popup()->setItemDelegate(itemDelegate);
|
||||||
|
ui->le_AirlineIcaoDesignator->setCompleter(completer);
|
||||||
|
completer->popup()->setObjectName("AirlineCompleter");
|
||||||
|
completer->popup()->setMinimumWidth(175);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ namespace BlackGui
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//! Log categories
|
||||||
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CLoginComponent(QWidget *parent = nullptr);
|
explicit CLoginComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
@@ -80,7 +83,7 @@ namespace BlackGui
|
|||||||
void ps_toggleNetworkConnection();
|
void ps_toggleNetworkConnection();
|
||||||
|
|
||||||
//! VATSIM data file was loaded
|
//! VATSIM data file was loaded
|
||||||
void ps_onWebServiceDataRead(int entity, int state, int number);
|
void ps_onWebServiceDataRead(int entity, int stateInt, int number);
|
||||||
|
|
||||||
//! Validate aircaft
|
//! Validate aircaft
|
||||||
bool ps_validateAircraftValues();
|
bool ps_validateAircraftValues();
|
||||||
@@ -156,6 +159,8 @@ namespace BlackGui
|
|||||||
//! Set ICAO values
|
//! Set ICAO values
|
||||||
void setGuiIcaoValues(const BlackMisc::Simulation::CAircraftModel &model, bool onlyIfEmpty);
|
void setGuiIcaoValues(const BlackMisc::Simulation::CAircraftModel &model, bool onlyIfEmpty);
|
||||||
|
|
||||||
|
void initCompleters(BlackMisc::Network::CEntityFlags::Entity entity);
|
||||||
|
|
||||||
QScopedPointer<Ui::CLoginComponent> ui;
|
QScopedPointer<Ui::CLoginComponent> ui;
|
||||||
bool m_visible = false; //!< is this component selected?
|
bool m_visible = false; //!< is this component selected?
|
||||||
const int LogoffIntervalSeconds = 10;
|
const int LogoffIntervalSeconds = 10;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>463</width>
|
<width>384</width>
|
||||||
<height>443</height>
|
<height>576</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -93,6 +93,30 @@
|
|||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="verticalSpacing">
|
||||||
|
<number>4</number>
|
||||||
|
</property>
|
||||||
|
<item row="3" column="5">
|
||||||
|
<widget class="BlackGui::CTickLabel" name="lblp_VatsimHomeAirport">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="5">
|
||||||
|
<widget class="BlackGui::CTickLabel" name="lblp_VatsimRealName">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_VatsimId">
|
||||||
|
<property name="text">
|
||||||
|
<string>Id:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="5">
|
<item row="1" column="5">
|
||||||
<widget class="BlackGui::CTickLabel" name="lblp_VatsimPassword">
|
<widget class="BlackGui::CTickLabel" name="lblp_VatsimPassword">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -100,16 +124,39 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" colspan="4">
|
<item row="1" column="2">
|
||||||
<widget class="QLineEdit" name="le_VatsimRealName"/>
|
<widget class="BlackGui::CTickLabel" name="lblp_VatsimId">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QLineEdit" name="le_VatsimPassword">
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::PasswordEchoOnEdit</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="le_VatsimHomeAirport">
|
<widget class="QLineEdit" name="le_VatsimHomeAirport">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>e.g. "KLAX"</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1" colspan="4">
|
||||||
|
<widget class="BlackGui::Components::CServerListSelector" name="comp_VatsimServer"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="4">
|
||||||
|
<widget class="QLineEdit" name="le_VatsimRealName"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_VatsimId"/>
|
||||||
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lbl_VatsimHomeAirport">
|
<widget class="QLabel" name="lbl_VatsimHomeAirport">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -131,23 +178,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4">
|
|
||||||
<widget class="QLineEdit" name="le_VatsimPassword">
|
|
||||||
<property name="echoMode">
|
|
||||||
<enum>QLineEdit::PasswordEchoOnEdit</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_VatsimId">
|
|
||||||
<property name="text">
|
|
||||||
<string>Id:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_VatsimId"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QLabel" name="lbl_VatsimPassword">
|
<widget class="QLabel" name="lbl_VatsimPassword">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -155,30 +185,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1" colspan="4">
|
|
||||||
<widget class="BlackGui::Components::CServerListSelector" name="comp_VatsimServer"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="BlackGui::CTickLabel" name="lblp_VatsimId">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="5">
|
|
||||||
<widget class="BlackGui::CTickLabel" name="lblp_VatsimRealName">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="5">
|
|
||||||
<widget class="BlackGui::CTickLabel" name="lblp_VatsimHomeAirport">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="pg_OtherServers">
|
<widget class="QWidget" name="pg_OtherServers">
|
||||||
@@ -196,7 +202,7 @@
|
|||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
@@ -214,14 +220,14 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="BlackGui::Components::CServerListSelector" name="comp_OtherServers"/>
|
<widget class="BlackGui::Components::CServerListSelector" name="comp_OtherServers"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="lbl_OtherServersEdit">
|
<widget class="QLabel" name="lbl_OtherServersEdit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edit</string>
|
<string>Edit</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="pb_OtherServersGotoSettings">
|
<widget class="QPushButton" name="pb_OtherServersGotoSettings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>goto settings</string>
|
<string>goto settings</string>
|
||||||
@@ -230,6 +236,38 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="pg_FsdDetails">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>FSD details</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="vl_FsdDetails">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Editors::CFsdSetupForm" name="comp_FsdDetails">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
@@ -286,21 +324,15 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLineEdit" name="le_AircraftIcaoAirline">
|
<widget class="QLineEdit" name="le_AirlineIcaoDesignator">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>e.g. DLH</string>
|
<string>e.g. DLH</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="inputMask">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>6</number>
|
<number>128</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string/>
|
<string>e.g. "DLH"</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -319,7 +351,7 @@
|
|||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string/>
|
<string>e.g. "L2J"</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -348,18 +380,9 @@
|
|||||||
<property name="inputMethodHints">
|
<property name="inputMethodHints">
|
||||||
<set>Qt::ImhUppercaseOnly</set>
|
<set>Qt::ImhUppercaseOnly</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="inputMask">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="4">
|
<item row="1" column="4">
|
||||||
@@ -367,17 +390,11 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>e.g. B737</string>
|
<string>e.g. B737</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="inputMask">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
<number>6</number>
|
<number>128</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string/>
|
<string>e.g. "B737"</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -502,6 +519,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Editors::CServerForm" name="frp_CurrentServer">
|
<widget class="BlackGui::Editors::CServerForm" name="frp_CurrentServer">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>80</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -529,21 +552,14 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="vs_LoginComponent">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
<widget class="QDialogButtonBox" name="bb_OkCancel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
@@ -577,6 +593,12 @@
|
|||||||
<header>blackgui/editors/serverform.h</header>
|
<header>blackgui/editors/serverform.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Editors::CFsdSetupForm</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/editors/fsdsetupform.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tw_Network</tabstop>
|
<tabstop>tw_Network</tabstop>
|
||||||
@@ -588,7 +610,7 @@
|
|||||||
<tabstop>le_SimulatorModel</tabstop>
|
<tabstop>le_SimulatorModel</tabstop>
|
||||||
<tabstop>le_Callsign</tabstop>
|
<tabstop>le_Callsign</tabstop>
|
||||||
<tabstop>le_AircraftIcaoDesignator</tabstop>
|
<tabstop>le_AircraftIcaoDesignator</tabstop>
|
||||||
<tabstop>le_AircraftIcaoAirline</tabstop>
|
<tabstop>le_AirlineIcaoDesignator</tabstop>
|
||||||
<tabstop>le_AircraftCombinedType</tabstop>
|
<tabstop>le_AircraftCombinedType</tabstop>
|
||||||
<tabstop>comp_OtherServers</tabstop>
|
<tabstop>comp_OtherServers</tabstop>
|
||||||
<tabstop>pb_OtherServersGotoSettings</tabstop>
|
<tabstop>pb_OtherServersGotoSettings</tabstop>
|
||||||
|
|||||||
@@ -490,9 +490,10 @@ namespace BlackMisc
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString CAircraftIcaoCode::normalizeDesignator(const QString candidate)
|
QString CAircraftIcaoCode::normalizeDesignator(const QString candidate)
|
||||||
{
|
{
|
||||||
QString n(candidate.trimmed().toUpper());
|
QString n(candidate.trimmed().toUpper());
|
||||||
|
if (n.contains(' ')) { n = n.left(n.indexOf(' ')); } // cutoff as first space
|
||||||
if (n.isEmpty()) { return n; }
|
if (n.isEmpty()) { return n; }
|
||||||
|
|
||||||
static QThreadStorage<QRegularExpression> tsRegex;
|
static QThreadStorage<QRegularExpression> tsRegex;
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace BlackMisc
|
|||||||
static const QStringList &getSpecialDesignators();
|
static const QStringList &getSpecialDesignators();
|
||||||
|
|
||||||
//! Normalize designator, remove illegal characters
|
//! Normalize designator, remove illegal characters
|
||||||
static const QString normalizeDesignator(const QString candidate);
|
static QString normalizeDesignator(const QString candidate);
|
||||||
|
|
||||||
//! Create relaxed combined codes, e.g "L2J" -> "L3J", ...
|
//! Create relaxed combined codes, e.g "L2J" -> "L3J", ...
|
||||||
static QStringList alternativeCombinedCodes(const QString &combinedCode);
|
static QStringList alternativeCombinedCodes(const QString &combinedCode);
|
||||||
|
|||||||
@@ -263,6 +263,18 @@ namespace BlackMisc
|
|||||||
return (regexp.match(airline).hasMatch());
|
return (regexp.match(airline).hasMatch());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CAirlineIcaoCode::normalizeDesignator(const QString candidate)
|
||||||
|
{
|
||||||
|
QString n(candidate.trimmed().toUpper());
|
||||||
|
if (n.contains(' ')) { n = n.left(n.indexOf(' ')); } // cutoff as first space
|
||||||
|
if (n.isEmpty()) { return n; }
|
||||||
|
|
||||||
|
static QThreadStorage<QRegularExpression> tsRegex;
|
||||||
|
if (! tsRegex.hasLocalData()) { tsRegex.setLocalData(QRegularExpression("[^a-zA-Z\\d\\s]")); }
|
||||||
|
const QRegularExpression ®exp = tsRegex.localData();
|
||||||
|
return n.remove(regexp);
|
||||||
|
}
|
||||||
|
|
||||||
QString CAirlineIcaoCode::getCombinedStringWithKey() const
|
QString CAirlineIcaoCode::getCombinedStringWithKey() const
|
||||||
{
|
{
|
||||||
QString s(getVDesignator());
|
QString s(getVDesignator());
|
||||||
|
|||||||
@@ -180,6 +180,9 @@ namespace BlackMisc
|
|||||||
//! Valid designator?
|
//! Valid designator?
|
||||||
static bool isValidAirlineDesignator(const QString &airline);
|
static bool isValidAirlineDesignator(const QString &airline);
|
||||||
|
|
||||||
|
//! Normalize string as airline designator
|
||||||
|
static QString normalizeDesignator(const QString candidate);
|
||||||
|
|
||||||
//! From our DB JSON
|
//! From our DB JSON
|
||||||
static CAirlineIcaoCode fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
static CAirlineIcaoCode fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,20 @@ namespace BlackMisc
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList CAirlineIcaoCodeList::toIcaoDesignatorNameCountryCompleterStrings(bool sort) const
|
||||||
|
{
|
||||||
|
QStringList c;
|
||||||
|
for (const CAirlineIcaoCode &icao : *this)
|
||||||
|
{
|
||||||
|
if (!icao.hasValidDesignator()) { continue; }
|
||||||
|
const QString cs(icao.getDesignatorNameCountry());
|
||||||
|
if (cs.isEmpty()) { continue; }
|
||||||
|
c.append(cs);
|
||||||
|
}
|
||||||
|
if (sort) { c.sort(); }
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList CAirlineIcaoCodeList::toNameCompleterStrings(bool sort) const
|
QStringList CAirlineIcaoCodeList::toNameCompleterStrings(bool sort) const
|
||||||
{
|
{
|
||||||
QStringList c;
|
QStringList c;
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ namespace BlackMisc
|
|||||||
//! String list for completion by ICAO designator
|
//! String list for completion by ICAO designator
|
||||||
QStringList toIcaoDesignatorCompleterStrings(bool combinedString = true, bool sort = true) const;
|
QStringList toIcaoDesignatorCompleterStrings(bool combinedString = true, bool sort = true) const;
|
||||||
|
|
||||||
|
//! String list for completion by ICAO designator plus Name
|
||||||
|
QStringList toIcaoDesignatorNameCountryCompleterStrings(bool sort = true) const;
|
||||||
|
|
||||||
//! String list for completion by name
|
//! String list for completion by name
|
||||||
QStringList toNameCompleterStrings(bool sort = true) const;
|
QStringList toNameCompleterStrings(bool sort = true) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user