mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T472, completer displays category
This commit is contained in:
committed by
Mat Sutcliffe
parent
3a10483379
commit
0b29894bd8
@@ -69,30 +69,18 @@ namespace BlackGui
|
||||
const QString icaoStr(m_display == DisplayIcaoAndId ? setIcao.getDesignatorDbKey() : setIcao.getCombinedIcaoStringWithKey());
|
||||
ui->le_Aircraft->setText(icaoStr);
|
||||
ui->lbl_Description->setText(setIcao.getManufacturer());
|
||||
if (setIcao != m_currentIcao)
|
||||
{
|
||||
m_currentIcao = setIcao;
|
||||
emit changedAircraftIcao(setIcao);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (setIcao == m_currentIcao) { return false; }
|
||||
|
||||
m_currentIcao = setIcao;
|
||||
emit changedAircraftIcao(setIcao);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDbAircraftIcaoSelectorComponent::setAircraftIcao(int key)
|
||||
{
|
||||
const CAircraftIcaoCode icao(sGui->getWebDataServices()->getAircraftIcaoCodeForDbKey(key));
|
||||
ui->lbl_Description->setText("");
|
||||
if (icao.hasCompleteData())
|
||||
{
|
||||
return this->setAircraftIcao(icao);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return icao.hasCompleteData() ? this->setAircraftIcao(icao) : false;
|
||||
}
|
||||
|
||||
CAircraftIcaoCode CDbAircraftIcaoSelectorComponent::getAircraftIcao() const
|
||||
@@ -164,7 +152,7 @@ namespace BlackGui
|
||||
void CDbAircraftIcaoSelectorComponent::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if (!event || !acceptDrop(event->mimeData())) { return; }
|
||||
CVariant valueVariant(toCVariant(event->mimeData()));
|
||||
const CVariant valueVariant(toCVariant(event->mimeData()));
|
||||
if (valueVariant.isValid())
|
||||
{
|
||||
if (valueVariant.canConvert<CAircraftIcaoCode>())
|
||||
@@ -191,7 +179,7 @@ namespace BlackGui
|
||||
{
|
||||
CAircraftIcaoCodeList icaos(sGui->getWebDataServices()->getAircraftIcaoCodes());
|
||||
icaos.removeInvalidCombinedCodes();
|
||||
m_completerStrings = icaos.toCompleterStrings(true, true, true);
|
||||
m_completerStrings = icaos.toCompleterStrings(true, true, true, true);
|
||||
}
|
||||
return m_completerStrings;
|
||||
}
|
||||
|
||||
@@ -517,7 +517,17 @@ namespace BlackMisc
|
||||
return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
|
||||
(this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
|
||||
(this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
|
||||
this->getDbKeyAsStringInParentheses(" ");
|
||||
(this->getDbKeyAsStringInParentheses(" "));
|
||||
}
|
||||
|
||||
QString CAircraftIcaoCode::getCombinedIcaoCategoryStringWithKey() const
|
||||
{
|
||||
if (!this->hasCategory()) { return this->getCombinedIcaoStringWithKey(); }
|
||||
return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
|
||||
(this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
|
||||
(u" [" % this->getCategory().getNameDbKey() % ']') %
|
||||
(this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
|
||||
(this->getDbKeyAsStringInParentheses(" "));
|
||||
}
|
||||
|
||||
QString CAircraftIcaoCode::getCombinedIataStringWithKey() const
|
||||
@@ -527,7 +537,7 @@ namespace BlackMisc
|
||||
(this->hasDesignator() ? (u' ' % this->getDesignator()) : QString()) %
|
||||
(this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
|
||||
(this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
|
||||
this->getDbKeyAsStringInParentheses(" ");
|
||||
(this->getDbKeyAsStringInParentheses(" "));
|
||||
}
|
||||
|
||||
QString CAircraftIcaoCode::getCombinedFamilyStringWithKey() const
|
||||
@@ -537,7 +547,7 @@ namespace BlackMisc
|
||||
(this->hasDesignator() ? (u' ' % this->getDesignator()) : QString()) %
|
||||
(this->hasManufacturer() ? (u' ' % this->getManufacturer()) : QString()) %
|
||||
(this->hasModelDescription() ? (u' ' % this->getModelDescription()) : QString()) %
|
||||
this->getDbKeyAsStringInParentheses(" ");
|
||||
(this->getDbKeyAsStringInParentheses(" "));
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::hasCategory() const
|
||||
@@ -559,7 +569,7 @@ namespace BlackMisc
|
||||
{
|
||||
const int r = fuzzyShortStringComparision(this->getDesignator(), d) >= fuzzyMatch;
|
||||
if (result) { *result = r; }
|
||||
return r >= fuzzyMatch;
|
||||
return (r >= fuzzyMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -578,7 +588,7 @@ namespace BlackMisc
|
||||
{
|
||||
const int r = fuzzyShortStringComparision(this->getIataCode(), i) >= fuzzyMatch;
|
||||
if (result) { *result = r; }
|
||||
return r >= fuzzyMatch;
|
||||
return (r >= fuzzyMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -249,6 +249,9 @@ namespace BlackMisc
|
||||
//! Combined ICAO descriptive string with key
|
||||
QString getCombinedIcaoStringWithKey() const;
|
||||
|
||||
//! Combined ICAO descriptive string with category and key
|
||||
QString getCombinedIcaoCategoryStringWithKey() const;
|
||||
|
||||
//! Combined IATA descriptive string with key
|
||||
QString getCombinedIataStringWithKey() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user