mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refs #638, support for military flag in forms
* avoid rountrips with completers * new checkboxes for military
This commit is contained in:
@@ -44,6 +44,9 @@ namespace BlackGui
|
||||
|
||||
void CAircraftIcaoForm::setValue(const BlackMisc::Aviation::CAircraftIcaoCode &icao)
|
||||
{
|
||||
if (icao == this->m_originalCode) { return; }
|
||||
this->m_originalCode = icao;
|
||||
|
||||
this->ui->le_Id->setText(icao.getDbKeyAsString());
|
||||
this->ui->aircraft_Selector->setAircraftIcao(icao);
|
||||
this->ui->le_Manufacturer->setText(icao.getManufacturer());
|
||||
|
||||
@@ -69,7 +69,8 @@ namespace BlackGui
|
||||
void ps_droppedCode(const BlackMisc::CVariant &variantDropped);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftIcaoForm> ui;
|
||||
QScopedPointer<Ui::CAircraftIcaoForm> ui;
|
||||
BlackMisc::Aviation::CAircraftIcaoCode m_originalCode;
|
||||
|
||||
//! Key from GUI
|
||||
int getDbKeyFromGui() const;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
#include "blackmisc/country.h"
|
||||
#include "airlineicaoform.h"
|
||||
@@ -44,22 +45,22 @@ namespace BlackGui
|
||||
|
||||
void CAirlineIcaoForm::setValue(const BlackMisc::Aviation::CAirlineIcaoCode &icao)
|
||||
{
|
||||
if (this->m_originalCode != icao)
|
||||
{
|
||||
this->m_originalCode = icao;
|
||||
this->ui->selector_AirlineDesignator->setAirlineIcao(icao);
|
||||
this->ui->selector_AirlineName->setAirlineIcao(icao);
|
||||
this->ui->le_Id->setText(icao.getDbKeyAsString());
|
||||
this->ui->le_TelephonyDesignator->setText(icao.getTelephonyDesignator());
|
||||
this->ui->le_Updated->setText(icao.getFormattedUtcTimestampYmdhms());
|
||||
this->ui->cb_Va->setChecked(icao.isVirtualAirline());
|
||||
this->ui->country_Selector->setCountry(icao.getCountry());
|
||||
this->ui->lbl_AirlineIcon->setPixmap(icao.toPixmap());
|
||||
if (this->m_originalCode == icao) { return; }
|
||||
this->m_originalCode = icao;
|
||||
|
||||
if (this->m_originalCode.hasCompleteData())
|
||||
{
|
||||
emit airlineChanged(this->m_originalCode);
|
||||
}
|
||||
this->ui->selector_AirlineDesignator->setAirlineIcao(icao);
|
||||
this->ui->selector_AirlineName->setAirlineIcao(icao);
|
||||
this->ui->le_Id->setText(icao.getDbKeyAsString());
|
||||
this->ui->le_TelephonyDesignator->setText(icao.getTelephonyDesignator());
|
||||
this->ui->le_Updated->setText(icao.getFormattedUtcTimestampYmdhms());
|
||||
this->ui->cb_Va->setChecked(icao.isVirtualAirline());
|
||||
this->ui->cb_Military->setChecked(icao.isMilitary());
|
||||
this->ui->country_Selector->setCountry(icao.getCountry());
|
||||
this->ui->lbl_AirlineIcon->setPixmap(icao.toPixmap());
|
||||
|
||||
if (this->m_originalCode.hasCompleteData())
|
||||
{
|
||||
emit airlineChanged(this->m_originalCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +68,7 @@ namespace BlackGui
|
||||
{
|
||||
CAirlineIcaoCode code(m_originalCode);
|
||||
code.setVirtualAirline(this->ui->cb_Va->isChecked());
|
||||
code.setMilitary(this->ui->cb_Military->isChecked());
|
||||
code.setCountry(this->ui->country_Selector->getCountry());
|
||||
code.setName(this->ui->selector_AirlineName->getAirlineIcao().getName());
|
||||
code.setTelephonyDesignator(this->ui->le_TelephonyDesignator->text());
|
||||
@@ -103,7 +105,9 @@ namespace BlackGui
|
||||
this->ui->selector_AirlineName->setReadOnly(readOnly);
|
||||
this->ui->le_TelephonyDesignator->setReadOnly(readOnly);
|
||||
this->ui->country_Selector->setReadOnly(readOnly);
|
||||
this->ui->cb_Va->setEnabled(!readOnly);
|
||||
|
||||
CGuiUtility::checkBoxReadOnly(this->ui->cb_Va, readOnly);
|
||||
CGuiUtility::checkBoxReadOnly(this->ui->cb_Military, readOnly);
|
||||
}
|
||||
|
||||
void CAirlineIcaoForm::setSelectOnly()
|
||||
@@ -137,6 +141,5 @@ namespace BlackGui
|
||||
}
|
||||
this->setValue(icao);
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>232</width>
|
||||
<height>210</height>
|
||||
<width>233</width>
|
||||
<height>205</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -168,6 +168,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_Military">
|
||||
<property name="text">
|
||||
<string>Mil.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackmisc/aviation/liverylist.h"
|
||||
#include "liveryform.h"
|
||||
@@ -29,10 +30,10 @@ namespace BlackGui
|
||||
this->ui->le_Id->setReadOnly(true);
|
||||
this->ui->le_Updated->setReadOnly(true);
|
||||
this->ui->lai_Id->set(CIcons::appLiveries16(), "Id:");
|
||||
this->ui->livery_Selector->withLiveryDescription(false);
|
||||
this->ui->comp_LiverySelector->withLiveryDescription(false);
|
||||
|
||||
// selector
|
||||
connect(this->ui->livery_Selector, &CDbLiverySelectorComponent::changedLivery, this, &CLiveryForm::setValue);
|
||||
connect(this->ui->comp_LiverySelector, &CDbLiverySelectorComponent::changedLivery, this, &CLiveryForm::setValue);
|
||||
|
||||
// drag and drop
|
||||
connect(this->ui->drop_DropData, &CDropSite::droppedValueObject, this, &CLiveryForm::ps_droppedLivery);
|
||||
@@ -47,7 +48,7 @@ namespace BlackGui
|
||||
|
||||
CLivery CLiveryForm::getValue() const
|
||||
{
|
||||
CLivery livery(this->ui->livery_Selector->getLivery());
|
||||
CLivery livery(this->ui->comp_LiverySelector->getLivery());
|
||||
if (livery.hasCompleteData() && livery.hasValidDbKey())
|
||||
{
|
||||
// already complete data from selector
|
||||
@@ -57,6 +58,7 @@ namespace BlackGui
|
||||
CAirlineIcaoCode airline(this->ui->editor_AirlineIcao->getValue());
|
||||
livery.setAirlineIcaoCode(airline);
|
||||
livery.setDescription(this->ui->le_Description->text());
|
||||
livery.setMilitary(this->ui->cb_Military->isChecked());
|
||||
return livery;
|
||||
}
|
||||
|
||||
@@ -67,12 +69,16 @@ namespace BlackGui
|
||||
|
||||
void CLiveryForm::setValue(const CLivery &livery)
|
||||
{
|
||||
this->ui->livery_Selector->setLivery(livery);
|
||||
if (this->m_originalLivery == livery) { return; }
|
||||
|
||||
this->m_originalLivery = livery;
|
||||
this->ui->comp_LiverySelector->setLivery(livery);
|
||||
this->ui->le_Id->setText(livery.getDbKeyAsString());
|
||||
this->ui->le_Description->setText(livery.getDescription());
|
||||
this->ui->le_Updated->setText(livery.getFormattedUtcTimestampYmdhms());
|
||||
this->ui->color_Fuselage->setColor(livery.getColorFuselage());
|
||||
this->ui->color_Tail->setColor(livery.getColorTail());
|
||||
this->ui->cb_Military->setChecked(livery.isMilitary());
|
||||
|
||||
if (livery.isColorLivery())
|
||||
{
|
||||
@@ -122,17 +128,18 @@ namespace BlackGui
|
||||
void CLiveryForm::setReadOnly(bool readOnly)
|
||||
{
|
||||
this->m_readOnly = readOnly;
|
||||
this->ui->livery_Selector->setReadOnly(readOnly);
|
||||
this->ui->comp_LiverySelector->setReadOnly(readOnly);
|
||||
this->ui->le_Description->setReadOnly(readOnly);
|
||||
this->ui->color_Fuselage->setReadOnly(readOnly);
|
||||
this->ui->color_Tail->setReadOnly(readOnly);
|
||||
this->ui->editor_AirlineIcao->setReadOnly(readOnly);
|
||||
CGuiUtility::checkBoxReadOnly(this->ui->cb_Military, readOnly);
|
||||
}
|
||||
|
||||
void CLiveryForm::setSelectOnly()
|
||||
{
|
||||
this->setReadOnly(true);
|
||||
this->ui->livery_Selector->setReadOnly(false);
|
||||
this->ui->comp_LiverySelector->setReadOnly(false);
|
||||
this->ui->editor_AirlineIcao->setSelectOnly();
|
||||
}
|
||||
|
||||
@@ -162,8 +169,9 @@ namespace BlackGui
|
||||
{
|
||||
if (!code.hasCompleteData()) { return; }
|
||||
if (!code.hasValidDbKey()) { return; }
|
||||
// if (this->m_originalLivery.getAirlineIcaoCode() == code) { return; } // avoid redundant updates
|
||||
|
||||
CLivery stdLivery(sGui->getWebDataServices()->getLiveries().findStdLiveryByAirlineIcaoDesignator(code));
|
||||
const CLivery stdLivery(sGui->getWebDataServices()->getLiveries().findStdLiveryByAirlineIcaoDesignator(code));
|
||||
if (stdLivery.hasValidDbKey())
|
||||
{
|
||||
this->setValue(stdLivery);
|
||||
|
||||
@@ -78,6 +78,8 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CLiveryForm> ui;
|
||||
BlackMisc::Aviation::CLivery m_originalLivery; //!< object allowing to override values
|
||||
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -45,35 +45,104 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="wi_DesignatorVa" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_DesignatorRank">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CDbLiverySelectorComponent" name="livery_Selector">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="0" column="3" rowspan="7">
|
||||
<widget class="BlackGui::Editors::CValidationIndicator" name="val_Indicator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_Description">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>le_Description</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbl_Timestamp">
|
||||
<property name="text">
|
||||
<string>Last updated:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>le_Updated</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_Id">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Id</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Code">
|
||||
<property name="text">
|
||||
<string>Code:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_FuselageColor">
|
||||
<property name="text">
|
||||
<string>Fuselage/Tail:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3">
|
||||
<widget class="BlackGui::Editors::CAirlineIcaoForm" name="editor_AirlineIcao">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>225</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="BlackGui::CDropSite" name="drop_DropData">
|
||||
<property name="text">
|
||||
<string>Drop data here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="le_Updated">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="le_Description">
|
||||
<property name="placeholderText">
|
||||
<string>Livery description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="QWidget" name="wi_Colors" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_Colors">
|
||||
<property name="spacing">
|
||||
@@ -111,103 +180,47 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hs_Colors">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="BlackGui::Editors::CAirlineIcaoForm" name="editor_AirlineIcao">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>225</height>
|
||||
</size>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="BlackGui::Components::CDbLiverySelectorComponent" name="comp_LiverySelector">
|
||||
<layout class="QHBoxLayout" name="hl_DesignatorRank">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Code">
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="cb_Military">
|
||||
<property name="toolTip">
|
||||
<string>Military livery</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Code:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_Description">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>le_Description</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbl_Timestamp">
|
||||
<property name="text">
|
||||
<string>Last updated:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>le_Updated</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="le_Updated">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_Id">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Id</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_FuselageColor">
|
||||
<property name="text">
|
||||
<string>Fuselage/Tail:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="le_Description">
|
||||
<property name="placeholderText">
|
||||
<string>Livery description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="BlackGui::CDropSite" name="drop_DropData">
|
||||
<property name="text">
|
||||
<string>Drop data here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" rowspan="7">
|
||||
<widget class="BlackGui::Editors::CValidationIndicator" name="val_Indicator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<string>Mil.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user