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