Ref T703, get partner callsign and validate it

* added functions in network details
* validation and login with partner callsign
This commit is contained in:
Klaus Basan
2019-08-17 01:29:00 +02:00
committed by Mat Sutcliffe
parent 6adea91618
commit dd70a67cf0
5 changed files with 54 additions and 14 deletions

View File

@@ -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());