6 #include <QIntValidator>
11 #include "ui_serverform.h"
16 using namespace swift::misc::network;
18 namespace swift::gui::editors
20 CServerForm::CServerForm(
QWidget *parent) :
CForm(parent), ui(new Ui::CNetworkServerForm)
24 this->initServerTypes();
36 ui->le_NetworkId->setText(user.
getId());
38 ui->le_Name->setText(server.
getName());
40 ui->cbp_Ecosystem->setCurrentEcosystem(server.
getEcosystem());
50 const CUser user(ui->le_NetworkId->text().trimmed(), ui->le_RealName->text().trimmed().simplified(),
QString(),
51 ui->le_Password->text().trimmed());
52 const CFsdSetup fsdSetup(ui->form_ServerFsd->getValue());
53 const CServer server(ui->le_Name->text().trimmed().simplified(),
54 ui->le_Description->text().trimmed().simplified(), ui->le_Address->text().trimmed(),
55 ui->le_Port->text().trimmed().toInt(), user, fsdSetup,
56 ui->cbp_Ecosystem->getSelectedEcosystem(), this->getServerType(),
true);
69 ui->form_ServerFsd->setReadOnly(readOnly);
71 ui->le_NetworkId->setReadOnly(readOnly);
72 ui->le_RealName->setReadOnly(readOnly);
73 ui->le_Name->setReadOnly(readOnly);
74 ui->le_Description->setReadOnly(readOnly);
75 ui->le_Address->setReadOnly(readOnly);
76 ui->le_Port->setReadOnly(readOnly);
77 ui->le_Password->setReadOnly(readOnly);
78 ui->cb_ServerType->setEnabled(!readOnly);
79 ui->cbp_Ecosystem->setEnabled(!readOnly);
80 ui->tb_Unhide->setVisible(!readOnly);
86 if (ui->wi_Password->isVisible() ==
show) {
return; }
87 if (m_passwordNameLabel.
isEmpty()) { m_passwordNameLabel = ui->lbl_IdPassword->text(); }
88 ui->lbl_IdPassword->setText(
show ? m_passwordNameLabel :
"Id");
89 ui->wi_Password->setVisible(
show);
92 void CServerForm::initServerTypes()
96 ui->cb_ServerType->clear();
97 for (
const int type : CServer::allServerTypes())
100 ui->cb_ServerType->insertItem(c++, CServer::serverTypeToString(st),
QVariant::fromValue(type));
104 void CServerForm::onChangedServerType(
const QString &text)
111 if (es.
isSystem(CEcosystem::NoSystem)) {
return; }
112 ui->cbp_Ecosystem->setCurrentEcosystem(es);
115 void CServerForm::onChangedEcoSystem(
const QString &text)
118 const CEcosystem es = ui->cbp_Ecosystem->getSelectedEcosystem();
120 if (dummy.hasUnspecifiedServerType()) {
return; }
121 ui->cb_ServerType->setCurrentText(dummy.getServerTypeAsString());
static void tempUnhidePassword(QLineEdit *lineEdit, int unhideMs=5000)
Temp. unhide password.
Status messages, e.g. from Core -> GUI.
Ecosystem of server belonging together.
bool isUnspecified() const
Unknown system?
bool isSystem(System s) const
Is system?
Value object for a FSD setup.
Value object encapsulating information of a server.
const QString & getDescription() const
Get description.
const QString & getServerTypeAsString() const
Get server type as string.
int getPort() const
Get port.
CStatusMessageList validate() const
Validate, provide details about issues.
const QString & getName() const
Get name.
const CFsdSetup & getFsdSetup() const
Get FSD setup.
const QString & getAddress() const
Get address.
const CEcosystem & getEcosystem() const
Get the ecosystem.
const CUser & getUser() const
Get user.
Value object encapsulating information of a user.
const QString & getPassword() const
Get password.
const QString & getRealName() const
Get full name.
const QString & getId() const
Get id.
Free functions in swift::misc.
void currentTextChanged(const QString &text)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool isEmpty() const const
QString number(double n, char format, int precision)
QVariant fromValue(T &&value)