diff --git a/src/blackgui/components/loginadvcomponent.cpp b/src/blackgui/components/loginadvcomponent.cpp
index a0dda8302..9196b06aa 100644
--- a/src/blackgui/components/loginadvcomponent.cpp
+++ b/src/blackgui/components/loginadvcomponent.cpp
@@ -82,7 +82,7 @@ namespace BlackGui
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CLoginAdvComponent::loginCancelled, Qt::QueuedConnection);
connect(ui->pb_Connect, &QPushButton::clicked, this, &CLoginAdvComponent::toggleNetworkConnection, Qt::QueuedConnection);
- connect(ui->comp_NetworkDetails, &CNetworkDetailsComponent::overridePilot, this, &CLoginAdvComponent::overrideCredentialsToPilot, Qt::QueuedConnection);
+ connect(ui->comp_NetworkDetails, &CNetworkDetailsComponent::overridePilot, this, &CLoginAdvComponent::overrideCredentialsToPilot, Qt::QueuedConnection);
connect(ui->comp_NetworkDetails, &CNetworkDetailsComponent::requestNetworkSettings, this, &CLoginAdvComponent::requestNetworkSettings, Qt::QueuedConnection);
// overlay
@@ -104,6 +104,7 @@ namespace BlackGui
// Stored data
this->loadRememberedUserData();
+ // signals
if (sGui && sGui->getIContextSimulator())
{
connect(sGui->getIContextSimulator(), &IContextSimulator::vitalityLost, this, &CLoginAdvComponent::autoLogoffDetection, Qt::QueuedConnection);
@@ -155,7 +156,8 @@ namespace BlackGui
const CStatusMessageList pilotMsgs = ui->form_Pilot->validate();
if (pilotMsgs.isFailure())
{
- this->showOverlayHTMLMessage(CStatusMessage(this).validationWarning(u"Invalid pilot data, login not possible"), OverlayMessageMs);
+ // this->showOverlayHTMLMessage(CStatusMessage(this).validationWarning(u"Invalid pilot data, login not possible"), OverlayMessageMs);
+ this->showOverlayMessagesOrHTMLMessage(pilotMsgs, false, OverlayMessageMs);
return;
}
@@ -168,13 +170,13 @@ namespace BlackGui
const INetwork::LoginMode mode = ui->comp_NetworkDetails->getLoginMode();
switch (mode)
{
- case INetwork::LoginStealth: CLogMessage(this).info(u"login in stealth mode"); break;
+ case INetwork::LoginStealth: CLogMessage(this).info(u"login in stealth mode"); break;
case INetwork::LoginAsObserver: CLogMessage(this).info(u"login in observer mode"); break;
default: break; // INetwork::LoginNormal
}
// Server
- currentServer = this->getCurrentServer();
+ currentServer = this->getCurrentServer();
const CUser user = this->getUserFromPilotGuiValues();
currentServer.setUser(user);
@@ -191,18 +193,38 @@ namespace BlackGui
currentServer.setVoiceSetup(voice);
}
+ // update for own aircraft context
sGui->getIContextOwnAircraft()->updateOwnAircraftPilot(currentServer.getUser());
// set own aircraft from all values
ownAircraft = sGui->getIContextOwnAircraft()->getOwnAircraft();
+ // check the copilot stuff
+ CCallsign partnerCs;
+ if (ui->comp_NetworkDetails->hasPartnerCallsign())
+ {
+ partnerCs = ui->comp_NetworkDetails->getPartnerCallsign();
+ if (partnerCs == ownAircraft.getCallsign())
+ {
+ this->showOverlayHTMLMessage("Your callsign and the pilot/copilot callsign must be NOT the same", OverlayMessageMs);
+ return;
+ }
+
+ const bool ok = (partnerCs.asString().startsWith(ownAircraft.getCallsignAsString(), Qt::CaseInsensitive) || ownAircraft.getCallsignAsString().startsWith(partnerCs.asString(), Qt::CaseInsensitive));
+ if (!ok)
+ {
+ this->showOverlayHTMLMessage("Callsign and the pilot/copilot callsign appear not to be synchronized", OverlayMessageMs);
+ return;
+ }
+ }
+
// Login
- if (sGui->getIContextAudio())
+ if (sGui && sGui->getIContextAudio())
{
sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup());
}
- msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, values.ownLiverySend, values.useLivery, values.ownAircraftModelStringSend, values.useModelString, mode);
+ msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, values.ownLiverySend, values.useLivery, values.ownAircraftModelStringSend, values.useModelString, partnerCs, mode);
if (msg.isSuccess())
{
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
diff --git a/src/blackgui/components/logincomponent.cpp b/src/blackgui/components/logincomponent.cpp
index 483c3cf97..20b2028c1 100644
--- a/src/blackgui/components/logincomponent.cpp
+++ b/src/blackgui/components/logincomponent.cpp
@@ -327,7 +327,7 @@ namespace BlackGui
sGui->getIContextAudio()->setVoiceSetup(currentServer.getVoiceSetup());
}
- msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, {}, true, {}, true, mode);
+ msg = sGui->getIContextNetwork()->connectToNetwork(currentServer, {}, true, {}, true, {}, mode);
if (msg.isSuccess())
{
Q_ASSERT_X(currentServer.isValidForLogin(), Q_FUNC_INFO, "invalid server");
diff --git a/src/blackgui/components/networkdetailscomponent.cpp b/src/blackgui/components/networkdetailscomponent.cpp
index 2c4a83486..43fa55c5f 100644
--- a/src/blackgui/components/networkdetailscomponent.cpp
+++ b/src/blackgui/components/networkdetailscomponent.cpp
@@ -17,6 +17,7 @@
using namespace BlackMisc::Network;
using namespace BlackMisc::Audio;
+using namespace BlackMisc::Aviation;
using namespace BlackCore;
using namespace BlackCore::Data;
@@ -59,10 +60,10 @@ namespace BlackGui
constexpr int MaxLength = 10;
constexpr int MinLength = 0;
- CUpperCaseValidator *ucv = new CUpperCaseValidator(MinLength, MaxLength, ui->le_Copilot);
+ CUpperCaseValidator *ucv = new CUpperCaseValidator(MinLength, MaxLength, ui->le_PartnerCallsign);
ucv->setAllowedCharacters09AZ();
- ui->le_Copilot->setMaxLength(MaxLength);
- ui->le_Copilot->setValidator(ucv);
+ ui->le_PartnerCallsign->setMaxLength(MaxLength);
+ ui->le_PartnerCallsign->setValidator(ucv);
const int tab = m_networkSetup.wasLastUsedWithOtherServer() ? LoginOthers : LoginVATSIM;
ui->tw_Network->setCurrentIndex(tab);
@@ -243,6 +244,17 @@ namespace BlackGui
return this->isVatsimServerSelected() ? this->getCurrentVatsimServer() : this->getCurrentOtherServer();
}
+ bool CNetworkDetailsComponent::hasPartnerCallsign() const
+ {
+ return !ui->le_PartnerCallsign->text().isEmpty();
+ }
+
+ CCallsign CNetworkDetailsComponent::getPartnerCallsign() const
+ {
+ if (ui->le_PartnerCallsign->text().isEmpty()) { return {}; }
+ return CCallsign(ui->le_PartnerCallsign->text(), CCallsign::Aircraft);
+ }
+
void CNetworkDetailsComponent::reloadOtherServersSetup()
{
const CServerList otherServers(m_networkSetup.getOtherServersPlusPredefinedServers());
diff --git a/src/blackgui/components/networkdetailscomponent.h b/src/blackgui/components/networkdetailscomponent.h
index 2fac1bc06..762a9beb4 100644
--- a/src/blackgui/components/networkdetailscomponent.h
+++ b/src/blackgui/components/networkdetailscomponent.h
@@ -100,6 +100,12 @@ namespace BlackGui
//! Current server based on selected tab
BlackMisc::Network::CServer getCurrentServer() const;
+ //! Pilot or Co-pilot callsign?
+ bool hasPartnerCallsign() const;
+
+ //! Pilot or Co-pilot callsign
+ BlackMisc::Aviation::CCallsign getPartnerCallsign() const;
+
signals:
//! Override the pilot
void overridePilot(const BlackMisc::Network::CUser &user);
diff --git a/src/blackgui/components/networkdetailscomponent.ui b/src/blackgui/components/networkdetailscomponent.ui
index 5a57fbc8e..ca6e8edaf 100644
--- a/src/blackgui/components/networkdetailscomponent.ui
+++ b/src/blackgui/components/networkdetailscomponent.ui
@@ -250,9 +250,9 @@
0
-
-
+
- partner callsign
+ partner callsign (pilot/co-pilot)
@@ -276,7 +276,7 @@
-
- Co/Pilot callsign
+ Partner callsign
@@ -418,7 +418,7 @@
comp_VatsimServers
pb_DetailsVatsim
pb_OverrideCredentialsVatsim
- le_Copilot
+ le_PartnerCallsign
comp_OtherServers
pb_RefreshOtherServers
pb_OtherServersGotoSettings