mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #911, livery form fixed
* search buttons in select mode * id can be entered
This commit is contained in:
committed by
Mathew Sutcliffe
parent
6d97f477c9
commit
317b52a00b
@@ -7,7 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "liveryform.h"
|
||||
#include "ui_liveryform.h"
|
||||
#include "blackgui/components/colorselector.h"
|
||||
#include "blackgui/components/dbliveryselectorcomponent.h"
|
||||
#include "blackgui/dropsite.h"
|
||||
@@ -17,11 +18,10 @@
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackgui/labelandicon.h"
|
||||
#include "blackcore/webdataservices.h"
|
||||
#include "blackmisc/aviation/liverylist.h"
|
||||
#include "blackmisc/compare.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "liveryform.h"
|
||||
#include "ui_liveryform.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
@@ -41,11 +41,14 @@ namespace BlackGui
|
||||
ui(new Ui::CLiveryForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->le_Id->setReadOnly(true);
|
||||
ui->le_Updated->setReadOnly(true);
|
||||
ui->le_Id->setValidator(new QIntValidator(0, 999999, ui->le_Id));
|
||||
ui->lai_Id->set(CIcons::appLiveries16(), "Id:");
|
||||
ui->comp_LiverySelector->withLiveryDescription(false);
|
||||
|
||||
// Id
|
||||
connect(ui->le_Id, &QLineEdit::returnPressed, this, &CLiveryForm::ps_idEntered);
|
||||
|
||||
// selector
|
||||
connect(ui->comp_LiverySelector, &CDbLiverySelectorComponent::changedLivery, this, &CLiveryForm::setValue);
|
||||
|
||||
@@ -149,6 +152,7 @@ namespace BlackGui
|
||||
void CLiveryForm::setReadOnly(bool readOnly)
|
||||
{
|
||||
this->m_readOnly = readOnly;
|
||||
ui->le_Id->setReadOnly(readOnly);
|
||||
ui->comp_LiverySelector->setReadOnly(readOnly);
|
||||
ui->le_Description->setReadOnly(readOnly);
|
||||
ui->color_Fuselage->setReadOnly(readOnly);
|
||||
@@ -164,8 +168,11 @@ namespace BlackGui
|
||||
{
|
||||
this->setReadOnly(true);
|
||||
ui->comp_LiverySelector->setReadOnly(false);
|
||||
ui->le_Id->setReadOnly(false);
|
||||
ui->editor_AirlineIcao->setSelectOnly();
|
||||
ui->drop_DropData->setVisible(true);
|
||||
ui->pb_SearchColor->setVisible(true);
|
||||
ui->pb_TempLivery->setVisible(true);
|
||||
}
|
||||
|
||||
void CLiveryForm::clear()
|
||||
@@ -173,6 +180,11 @@ namespace BlackGui
|
||||
this->setValue(CLivery());
|
||||
}
|
||||
|
||||
void CLiveryForm::resetValue()
|
||||
{
|
||||
this->setValue(m_originalLivery);
|
||||
}
|
||||
|
||||
void CLiveryForm::ps_droppedLivery(const BlackMisc::CVariant &variantDropped)
|
||||
{
|
||||
CLivery livery;
|
||||
@@ -227,5 +239,23 @@ namespace BlackGui
|
||||
this->setValue(found);
|
||||
}
|
||||
}
|
||||
|
||||
void CLiveryForm::ps_idEntered()
|
||||
{
|
||||
if (!sGui || !sGui->hasWebDataServices())
|
||||
{
|
||||
ui->le_Id->undo();
|
||||
return;
|
||||
}
|
||||
|
||||
const int id = ui->le_Id->text().toInt();
|
||||
const CLivery livery = sGui->getWebDataServices()->getLiveryForDbKey(id);
|
||||
if (!livery.isLoadedFromDb())
|
||||
{
|
||||
ui->le_Id->undo();
|
||||
return;
|
||||
}
|
||||
this->setValue(livery);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace BlackGui
|
||||
explicit CLiveryForm(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CLiveryForm();
|
||||
virtual ~CLiveryForm();
|
||||
|
||||
//! Value
|
||||
BlackMisc::Aviation::CLivery getValue() const;
|
||||
@@ -69,6 +69,9 @@ namespace BlackGui
|
||||
//! Clear data
|
||||
void clear();
|
||||
|
||||
//! Reset value to current value
|
||||
void resetValue();
|
||||
|
||||
public slots:
|
||||
//! Value
|
||||
bool setValue(const BlackMisc::Aviation::CLivery &livery);
|
||||
@@ -86,6 +89,9 @@ namespace BlackGui
|
||||
//! Search for color
|
||||
void ps_searchForColor();
|
||||
|
||||
//! Id entered
|
||||
void ps_idEntered();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CLiveryForm> ui;
|
||||
BlackMisc::Aviation::CLivery m_originalLivery; //!< object allowing to override values
|
||||
|
||||
@@ -63,9 +63,6 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Id</string>
|
||||
</property>
|
||||
@@ -118,6 +115,9 @@
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="pb_TempLivery">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>set a 'no color' livery, allowing to create a<br/>temp. DB entry which will later be specified.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>temp.</string>
|
||||
</property>
|
||||
@@ -217,6 +217,9 @@
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_SearchColor">
|
||||
<property name="toolTip">
|
||||
<string>find a color livery</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>search color</string>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user