diff --git a/src/blackgui/components/logincomponent.cpp b/src/blackgui/components/logincomponent.cpp index fea84b6c9..763d113f6 100644 --- a/src/blackgui/components/logincomponent.cpp +++ b/src/blackgui/components/logincomponent.cpp @@ -16,7 +16,7 @@ #include "blackcore/network.h" #include "blackcore/simulator.h" #include "blackgui/components/logincomponent.h" -#include "blackgui/components/serverform.h" +#include "blackgui/editors/serverform.h" #include "blackgui/components/serverlistselector.h" #include "blackgui/guiapplication.h" #include "blackgui/loginmodebuttons.h" diff --git a/src/blackgui/components/logincomponent.ui b/src/blackgui/components/logincomponent.ui index 5824b46ac..ce9466c7e 100644 --- a/src/blackgui/components/logincomponent.ui +++ b/src/blackgui/components/logincomponent.ui @@ -501,7 +501,7 @@ 2 - + QFrame::StyledPanel @@ -572,9 +572,9 @@
blackgui/components/serverlistselector.h
- BlackGui::Components::CServerForm + BlackGui::Editors::CServerForm QFrame -
blackgui/components/serverform.h
+
blackgui/editors/serverform.h
1
diff --git a/src/blackgui/components/serverform.ui b/src/blackgui/components/serverform.ui deleted file mode 100644 index b4c70a61a..000000000 --- a/src/blackgui/components/serverform.ui +++ /dev/null @@ -1,209 +0,0 @@ - - - CNetworkServerForm - - - - 0 - 0 - 347 - 126 - - - - Frame - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 4 - - - 4 - - - 4 - - - 4 - - - 4 - - - - - Addr./ port: - - - - - - - Name: - - - - - - - Real name: - - - - - - - Description: - - - - - - - server name - - - - - - - server description - - - - - - - - - - your name if required - - - - - - - Id/Password: - - - - - - - e.g. "server.foo.com" - - - - - - - - 3 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - id - - - - - - - - - - 32 - - - QLineEdit::Password - - - password - - - - - - - - - - - 0 - 0 - - - - - 75 - 0 - - - - - 75 - 16777215 - - - - 6809 - - - 5 - - - - - - - - - le_Name - le_Description - le_Address - le_Port - le_RealName - - - - diff --git a/src/blackgui/editors/aircrafticaoform.cpp b/src/blackgui/editors/aircrafticaoform.cpp index 4df0279e2..a975deb6a 100644 --- a/src/blackgui/editors/aircrafticaoform.cpp +++ b/src/blackgui/editors/aircrafticaoform.cpp @@ -126,8 +126,9 @@ namespace BlackGui return icao; } - CStatusMessageList CAircraftIcaoForm::validate() const + CStatusMessageList CAircraftIcaoForm::validate(bool nested) const { + Q_UNUSED(nested); CAircraftIcaoCode code(getValue()); CStatusMessageList msgs(code.validate()); this->ui->val_Indicator->setState(msgs); diff --git a/src/blackgui/editors/aircrafticaoform.h b/src/blackgui/editors/aircrafticaoform.h index e740c4c68..430c7c1a8 100644 --- a/src/blackgui/editors/aircrafticaoform.h +++ b/src/blackgui/editors/aircrafticaoform.h @@ -47,20 +47,18 @@ namespace BlackGui //! Get value BlackMisc::Aviation::CAircraftIcaoCode getValue() const; - //! Validate, empty list means OK - BlackMisc::CStatusMessageList validate() const; - //! Allow to drop void allowDrop(bool allowDrop); //! Is drop allowed? bool isDropAllowed() const; - //! \copydoc CForm::setReadOnly - virtual void setReadOnly(bool readOnly) override; - - //! \copydoc CForm::setSelectOnly + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; virtual void setSelectOnly() override; + virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override; + //! @} //! Clear void clear(); diff --git a/src/blackgui/editors/airlineicaoform.cpp b/src/blackgui/editors/airlineicaoform.cpp index 941a033b2..f57f26221 100644 --- a/src/blackgui/editors/airlineicaoform.cpp +++ b/src/blackgui/editors/airlineicaoform.cpp @@ -87,8 +87,9 @@ namespace BlackGui return code; } - CStatusMessageList CAirlineIcaoForm::validate() const + CStatusMessageList CAirlineIcaoForm::validate(bool nested) const { + Q_UNUSED(nested); CAirlineIcaoCode code(getValue()); CStatusMessageList msgs(code.validate()); if (this->isReadOnly()) diff --git a/src/blackgui/editors/airlineicaoform.h b/src/blackgui/editors/airlineicaoform.h index 447662900..9612b336a 100644 --- a/src/blackgui/editors/airlineicaoform.h +++ b/src/blackgui/editors/airlineicaoform.h @@ -50,20 +50,18 @@ namespace BlackGui //! Get value BlackMisc::Aviation::CAirlineIcaoCode getValue() const; - //! Validate, empty list means OK - BlackMisc::CStatusMessageList validate() const; - //! Allow to drop void allowDrop(bool allowDrop); //! Is drop allowed? bool isDropAllowed() const; - //! \copydoc CForm::setReadOnly - virtual void setReadOnly(bool readOnly) override; - - //! \copydoc CForm::setSelectOnly + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; virtual void setSelectOnly() override; + virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override; + //! @} //! Clear void clear(); diff --git a/src/blackgui/editors/distributorform.cpp b/src/blackgui/editors/distributorform.cpp index ff47dc569..ed6ab2c52 100644 --- a/src/blackgui/editors/distributorform.cpp +++ b/src/blackgui/editors/distributorform.cpp @@ -70,8 +70,9 @@ namespace BlackGui return distributor; } - CStatusMessageList CDistributorForm::validate() const + CStatusMessageList CDistributorForm::validate(bool nested) const { + Q_UNUSED(nested); CDistributor distributor(getValue()); CStatusMessageList msgs(distributor.validate()); if (this->isReadOnly()) diff --git a/src/blackgui/editors/distributorform.h b/src/blackgui/editors/distributorform.h index a4b09e640..ec3e567f8 100644 --- a/src/blackgui/editors/distributorform.h +++ b/src/blackgui/editors/distributorform.h @@ -46,20 +46,18 @@ namespace BlackGui //! Get value BlackMisc::Simulation::CDistributor getValue() const; - //! Validate, empty list means OK - BlackMisc::CStatusMessageList validate() const; - //! Allow to drop void allowDrop(bool allowDrop); //! Is drop allowed? bool isDropAllowed() const; - //! \copydoc CForm::setReadOnly - virtual void setReadOnly(bool readOnly) override; - - //! \copydoc CForm::setSelectOnly + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; virtual void setSelectOnly() override; + virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override; + //! @} //! Clear void clear(); diff --git a/src/blackgui/editors/liveryform.h b/src/blackgui/editors/liveryform.h index de2990912..a7b1e4082 100644 --- a/src/blackgui/editors/liveryform.h +++ b/src/blackgui/editors/liveryform.h @@ -33,8 +33,7 @@ namespace BlackGui /*! * Livery form class */ - class BLACKGUI_EXPORT CLiveryForm : - public CForm + class BLACKGUI_EXPORT CLiveryForm : public CForm { Q_OBJECT @@ -51,9 +50,6 @@ namespace BlackGui //! Embedded ariline BlackMisc::Aviation::CAirlineIcaoCode getValueAirlineIcao() const; - //! Validate, empty list means OK - BlackMisc::CStatusMessageList validate(bool withNestedForms) const; - //! Validate airline ICAO code only BlackMisc::CStatusMessageList validateAirlineIcao() const; @@ -63,11 +59,12 @@ namespace BlackGui //! Is drop allowed? bool isDropAllowed() const; - //! \copydoc CForm::setReadOnly - virtual void setReadOnly(bool readOnly) override; - - //! \copydoc CForm::setSelectOnly + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; virtual void setSelectOnly() override; + virtual BlackMisc::CStatusMessageList validate(bool withNestedForms) const override; + //! @} //! Clear data void clear(); diff --git a/src/blackgui/editors/modelmappingform.h b/src/blackgui/editors/modelmappingform.h index 6ad614e31..f6884abff 100644 --- a/src/blackgui/editors/modelmappingform.h +++ b/src/blackgui/editors/modelmappingform.h @@ -46,13 +46,13 @@ namespace BlackGui BlackMisc::Simulation::CAircraftModel getValue() const; //! Validate - BlackMisc::CStatusMessageList validate(bool withNestedObjects) const; - //! \copydoc CForm::setReadOnly - virtual void setReadOnly(bool readOnly) override; - - //! \copydoc CForm::setSelectOnly + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; virtual void setSelectOnly() override; + virtual BlackMisc::CStatusMessageList validate(bool withNestedObjects) const override; + //! @} public slots: //! Set model diff --git a/src/blackgui/editors/ownmodelsetform.h b/src/blackgui/editors/ownmodelsetform.h index b9306c1f5..14a7a7a83 100644 --- a/src/blackgui/editors/ownmodelsetform.h +++ b/src/blackgui/editors/ownmodelsetform.h @@ -68,7 +68,6 @@ namespace BlackGui //! \name Form functions, here not used //! \@{ virtual void setReadOnly(bool readOnly) override { Q_UNUSED(readOnly); } - virtual void setSelectOnly() override {} //! \@} signals: diff --git a/src/blackgui/components/serverform.cpp b/src/blackgui/editors/serverform.cpp similarity index 86% rename from src/blackgui/components/serverform.cpp rename to src/blackgui/editors/serverform.cpp index ff8948e04..1f05b2bc2 100644 --- a/src/blackgui/components/serverform.cpp +++ b/src/blackgui/editors/serverform.cpp @@ -7,7 +7,7 @@ * contained in the LICENSE file. */ -#include "blackgui/components/serverform.h" +#include "blackgui/editors/serverform.h" #include "blackmisc/network/user.h" #include "ui_serverform.h" @@ -19,10 +19,10 @@ using namespace BlackMisc::Network; namespace BlackGui { - namespace Components + namespace Editors { CServerForm::CServerForm(QWidget *parent) : - QFrame(parent), + CForm(parent), ui(new Ui::CNetworkServerForm) { ui->setupUi(this); @@ -42,6 +42,7 @@ namespace BlackGui this->ui->le_Description->setText(server.getDescription()); this->ui->le_Address->setText(server.getAddress()); this->ui->le_Port->setText(QString::number(server.getPort())); + this->ui->form_ServerFsd->setValue(server.getFsdSetup()); } BlackMisc::Network::CServer CServerForm::getServer() const @@ -59,6 +60,8 @@ namespace BlackGui this->ui->le_Port->text().trimmed().toInt(), user ); + CFsdSetup setup(this->ui->form_ServerFsd->getValue()); + server.setFsdSetup(setup); return server; } @@ -71,6 +74,7 @@ namespace BlackGui this->ui->le_Address->setReadOnly(readOnly); this->ui->le_Port->setReadOnly(readOnly); this->ui->le_Password->setReadOnly(readOnly); + this->ui->form_ServerFsd->setReadOnly(readOnly); } void CServerForm::showPasswordField(bool show) @@ -88,9 +92,10 @@ namespace BlackGui this->ui->le_Password->setVisible(show); } - BlackMisc::CStatusMessageList CServerForm::validate() const + BlackMisc::CStatusMessageList CServerForm::validate(bool nested) const { - CServer server = getServer(); + Q_UNUSED(nested); + const CServer server = getServer(); return server.validate(); } } // ns diff --git a/src/blackgui/components/serverform.h b/src/blackgui/editors/serverform.h similarity index 80% rename from src/blackgui/components/serverform.h rename to src/blackgui/editors/serverform.h index c633bea44..d68ceb8ec 100644 --- a/src/blackgui/components/serverform.h +++ b/src/blackgui/editors/serverform.h @@ -13,6 +13,7 @@ #define BLACKGUI_COMPONENTS_NETWORKSERVERFORM_H #include "blackgui/blackguiexport.h" +#include "blackgui/editors/form.h" #include "blackmisc/network/server.h" #include "blackmisc/statusmessagelist.h" @@ -27,10 +28,10 @@ namespace Ui { class CNetworkServerForm; } namespace BlackGui { - namespace Components + namespace Editors { //! Server form - class BLACKGUI_EXPORT CServerForm : public QFrame + class BLACKGUI_EXPORT CServerForm : public CForm { Q_OBJECT @@ -47,15 +48,15 @@ namespace BlackGui //! Get server BlackMisc::Network::CServer getServer() const; - //! Set read only - void setReadOnly(bool readOnly); + //! \name Form class implementations + //! @{ + virtual void setReadOnly(bool readonly) override; + virtual BlackMisc::CStatusMessageList validate(bool nested = false) const override; + //! @} //! Show the password field void showPasswordField(bool show); - //! Validate and provide messages (empty means OK) - BlackMisc::CStatusMessageList validate() const; - private: QScopedPointer ui; QString m_passwordNameLabel; diff --git a/src/blackgui/editors/serverform.ui b/src/blackgui/editors/serverform.ui new file mode 100644 index 000000000..ec7c05b78 --- /dev/null +++ b/src/blackgui/editors/serverform.ui @@ -0,0 +1,225 @@ + + + CNetworkServerForm + + + + 0 + 0 + 275 + 171 + + + + Frame + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 0 + + + + General + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + 4 + + + 4 + + + 4 + + + 4 + + + 4 + + + + + e.g. "server.foo.com" + + + + + + + server description + + + + + + + + + + your name if required + + + + + + + 6809 + + + 5 + + + + + + + Real name: + + + + + + + Name: + + + + + + + Addr./ port: + + + + + + + Description: + + + + + + + server name + + + + + + + Id/Password: + + + + + + + 32 + + + QLineEdit::Password + + + password + + + + + + + + + + id + + + + + + + + + + + FSD + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + BlackGui::Editors::CFsdSetupForm + QFrame +
blackgui/editors/fsdsetupform.h
+ 1 +
+
+ + +