mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Allow max. length of route and remarks combined
This commit is contained in:
@@ -319,6 +319,7 @@ namespace BlackGui
|
||||
|
||||
// route
|
||||
v = ui->pte_Route->toPlainText().trimmed();
|
||||
const int routeLength = v.length();
|
||||
if (v.isEmpty())
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validation(
|
||||
@@ -326,7 +327,7 @@ namespace BlackGui
|
||||
CStatusMessage::SeverityInfo :
|
||||
CStatusMessage::SeverityWarning, u"Missing '%1'") << ui->lbl_Route->text());
|
||||
}
|
||||
else if (v.length() > CFlightPlan::MaxRouteLength)
|
||||
else if (routeLength > CFlightPlan::MaxRouteLength)
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validationError(u"Flight plan route length exceeded (%1 chars max.)") << CFlightPlan::MaxRouteLength);
|
||||
}
|
||||
@@ -337,11 +338,12 @@ namespace BlackGui
|
||||
|
||||
// remarks
|
||||
v = ui->pte_Remarks->toPlainText().trimmed();
|
||||
const int remarksLength = v.length();
|
||||
if (v.isEmpty())
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validationError(u"No '%1', voice capabilities are mandatory") << ui->pb_Remarks->text());
|
||||
}
|
||||
else if (v.length() > CFlightPlan::MaxRemarksLength)
|
||||
else if (remarksLength > CFlightPlan::MaxRemarksLength)
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validationError(u"Flight plan remarks length exceeded (%1 chars max.)") << CFlightPlan::MaxRemarksLength);
|
||||
}
|
||||
@@ -350,6 +352,12 @@ namespace BlackGui
|
||||
flightPlan.setRemarks(v);
|
||||
}
|
||||
|
||||
// Total length
|
||||
if ((remarksLength + routeLength) > CFlightPlan::MaxRouteAndRemarksLength)
|
||||
{
|
||||
messages.push_back(CStatusMessage(this).validationError(u"Flight plan route (%1) and remarks (%2) length exceeded (%3 chars max.)") << routeLength << remarksLength << CFlightPlan::MaxRemarksLength);
|
||||
}
|
||||
|
||||
// time enroute
|
||||
v = ui->le_EstimatedTimeEnroute->text();
|
||||
if (v.isEmpty() || v == defaultTime())
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackGui
|
||||
explicit CFlightPlanComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CFlightPlanComponent();
|
||||
virtual ~CFlightPlanComponent() override;
|
||||
|
||||
//! Login data were set
|
||||
void loginDataSet();
|
||||
|
||||
@@ -171,8 +171,10 @@ namespace BlackMisc
|
||||
|
||||
//! \fixme max.length of complete flight plan is 768 characters, this here is an assumption and should be part of the underlying network layers
|
||||
// https://forums.vatsim.net/viewtopic.php?f=6&t=63416
|
||||
static constexpr int MaxRemarksLength = 256; //!< Max.remarks length
|
||||
static constexpr int MaxRouteLength = 256; //!< Max.route length
|
||||
static constexpr int MaxRemarksLength = 512; //!< Max.remarks length
|
||||
static constexpr int MaxRouteLength = 512; //!< Max.route length
|
||||
static constexpr int MaxRouteAndRemarksLength = 624; //!< Max.length for Route and Remarks
|
||||
|
||||
|
||||
//! Default constructor
|
||||
CFlightPlan();
|
||||
|
||||
Reference in New Issue
Block a user