mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #526, forms
* fixed read only * in read only mode no warnings (then we just do mapping and warnings do not help)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "blackgui/guiutility.h"
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
#include "aircrafticaoform.h"
|
||||
#include "blackmisc/datastore.h"
|
||||
#include "ui_aircrafticaoform.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -63,6 +64,22 @@ namespace BlackGui
|
||||
CAircraftIcaoCode CAircraftIcaoForm::getValue() const
|
||||
{
|
||||
CAircraftIcaoCode icao(this->ui->aircraft_Selector->getAircraftIcao());
|
||||
if (!icao.hasValidDbKey())
|
||||
{
|
||||
// not based on DB yet, do we have a DB key
|
||||
int k = this->getDbKeyFromGui();
|
||||
if (k >= 0)
|
||||
{
|
||||
// we got an id, we get the DB object for it
|
||||
CAircraftIcaoCode fromDb(this->getAircraftIcaoCodeForDbKey(k));
|
||||
if (fromDb.getDesignator() == icao.getDesignator())
|
||||
{
|
||||
// we replace by DB object
|
||||
icao = fromDb;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString manufacturer(this->ui->le_Manufacturer->text().trimmed().toUpper());
|
||||
QString modelDescription(this->ui->le_ModelDescription->text());
|
||||
QString wtc(ui->cb_Wtc->currentText().left(1));
|
||||
@@ -149,5 +166,10 @@ namespace BlackGui
|
||||
this->setValue(icao);
|
||||
}
|
||||
|
||||
int CAircraftIcaoForm::getDbKeyFromGui() const
|
||||
{
|
||||
QString key(this->ui->le_Id->text().trimmed());
|
||||
return IDatastoreObjectWithIntegerKey::stringToDbKey(key);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -74,8 +74,10 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CAircraftIcaoForm> ui;
|
||||
};
|
||||
|
||||
//! Key from GUI
|
||||
int getDbKeyFromGui() const;
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ namespace BlackGui
|
||||
{
|
||||
CAirlineIcaoCode code(getValue());
|
||||
CStatusMessageList msgs(code.validate());
|
||||
if (this->isReadOnly())
|
||||
{
|
||||
// in readonly I cannot change the data anyway, so skip warnings
|
||||
msgs.removeWarningsAndBelow();
|
||||
}
|
||||
|
||||
this->ui->val_Indicator->setState(msgs);
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,11 @@ namespace BlackGui
|
||||
// optional distributor
|
||||
msgs = distributor.validate();
|
||||
}
|
||||
if (this->isReadOnly())
|
||||
{
|
||||
// in readonly I cannot change the data anyway, so skip warnings
|
||||
msgs.removeWarningsAndBelow();
|
||||
}
|
||||
this->ui->val_Indicator->setState(msgs);
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,11 @@ namespace BlackGui
|
||||
{
|
||||
msgs.push_back(this->ui->editor_AirlineIcao->validate());
|
||||
}
|
||||
if (this->isReadOnly())
|
||||
{
|
||||
// in readonly I cannot change the data anyway, so skip warnings
|
||||
msgs.removeWarningsAndBelow();
|
||||
}
|
||||
this->ui->val_Indicator->setState(msgs);
|
||||
return msgs;
|
||||
}
|
||||
@@ -91,6 +96,8 @@ namespace BlackGui
|
||||
this->m_readOnly = readOnly;
|
||||
this->ui->le_Code->setReadOnly(readOnly);
|
||||
this->ui->le_Description->setReadOnly(readOnly);
|
||||
this->ui->color_Fuselage->setReadOnly(readOnly);
|
||||
this->ui->color_Tail->setReadOnly(readOnly);
|
||||
}
|
||||
|
||||
void CLiveryForm::setMappingMode()
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace BlackGui
|
||||
ui->le_LastUpdated->setReadOnly(true);
|
||||
ui->le_Id->setReadOnly(true);
|
||||
ui->lai_Id->set(CIcons::appMappings16(), "Id:");
|
||||
connect(ui->pb_Publish, &QPushButton::clicked, this, &CModelMappingForm::requestPublish);
|
||||
connect(ui->pb_Stash, &QPushButton::clicked, this, &CModelMappingForm::requestStash);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,15 +53,9 @@ namespace BlackGui
|
||||
//! Request validation
|
||||
void requestValidation();
|
||||
|
||||
//! Request to publish (DB)
|
||||
void requestPublish();
|
||||
|
||||
//! Request stashing for model
|
||||
void requestStash();
|
||||
|
||||
private slots:
|
||||
//!
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CModelMappingForm> ui;
|
||||
BlackMisc::Simulation::CAircraftModel m_originalModel;
|
||||
|
||||
@@ -78,13 +78,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QPushButton" name="pb_Publish">
|
||||
<property name="text">
|
||||
<string>Publish</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="le_Description">
|
||||
<property name="placeholderText">
|
||||
@@ -199,7 +192,6 @@
|
||||
<tabstop>le_Name</tabstop>
|
||||
<tabstop>le_Description</tabstop>
|
||||
<tabstop>pb_Stash</tabstop>
|
||||
<tabstop>pb_Publish</tabstop>
|
||||
<tabstop>le_LastUpdated</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
||||
Reference in New Issue
Block a user