Most of functionality for connections in tree works now. Old list largely removed.
This commit is contained in:
parent
8840d3bcbb
commit
b3a98f6dc0
10 changed files with 399 additions and 158 deletions
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
void ConnectionConfigurationWidget::editExistingInWindow(ConnectionController *ctrl, const ConnectionConfig &cfg)
|
||||
{
|
||||
auto w = new ConnectionConfigurationWidget;
|
||||
auto w = new ConnectionConfigurationWidget(ctrl->getConnectionTreeModel());
|
||||
w->setData(cfg);
|
||||
|
||||
|
||||
|
|
@ -35,8 +35,8 @@ void ConnectionConfigurationWidget::editExistingInWindow(ConnectionController *c
|
|||
win->setLayout(vbox);
|
||||
|
||||
win->connect(btn_hbox, &QDialogButtonBox::accepted, [ctrl, w, win] () {
|
||||
auto cc = w->data();
|
||||
ctrl->getConnectionListModel()->save(cc);
|
||||
auto [grp, cc] = w->data();
|
||||
ctrl->getConnectionTreeModel()->save(grp, cc);
|
||||
win->accept();
|
||||
});
|
||||
win->connect(btn_hbox, &QDialogButtonBox::rejected, [win] () { win->reject(); });
|
||||
|
|
@ -49,9 +49,17 @@ void ConnectionConfigurationWidget::editExistingInWindow(ConnectionController *c
|
|||
win->show();
|
||||
}
|
||||
|
||||
ConnectionConfigurationWidget::ConnectionConfigurationWidget(QWidget *parent)
|
||||
ConnectionConfigurationWidget::ConnectionConfigurationWidget(ConnectionTreeModel *connection_model, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
lblGroup = new QLabel;
|
||||
cmbbxGroup = new QComboBox;
|
||||
cmbbxGroup->setModel(connection_model);
|
||||
cmbbxGroup->setModelColumn(0);
|
||||
// cmbbxGroup->setEditable(true);
|
||||
// cmbbxGroup->setInsertPolicy(QComboBox::NoInsert);
|
||||
lblGroup->setBuddy(cmbbxGroup);
|
||||
|
||||
lblName = new QLabel;
|
||||
SET_OBJECT_NAME(lblName);
|
||||
edtName = new QLineEdit ;
|
||||
|
|
@ -118,7 +126,7 @@ ConnectionConfigurationWidget::ConnectionConfigurationWidget(QWidget *parent)
|
|||
|
||||
formLayout = new QFormLayout;
|
||||
|
||||
setLayout(formLayout);
|
||||
formLayout->addRow(lblGroup, cmbbxGroup);
|
||||
formLayout->addRow(lblName, edtName);
|
||||
formLayout->addRow(lblHost, edtHost);
|
||||
formLayout->addRow(lblPort, spinPort);
|
||||
|
|
@ -129,12 +137,14 @@ ConnectionConfigurationWidget::ConnectionConfigurationWidget(QWidget *parent)
|
|||
formLayout->addRow(lblKey, edtKey);
|
||||
formLayout->addRow(lblRootCert, edtRootCert);
|
||||
formLayout->addRow(lblCrl, edtCrl);
|
||||
setLayout(formLayout);
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void ConnectionConfigurationWidget::retranslateUi()
|
||||
{
|
||||
lblGroup->setText(QApplication::translate("ConnectionConfigurationWidget", "&Group", nullptr));
|
||||
lblName->setText(QApplication::translate("ConnectionConfigurationWidget", "&Name", nullptr));
|
||||
lblHost->setText(QApplication::translate("ConnectionConfigurationWidget", "&Host", nullptr));
|
||||
lblPort->setText(QApplication::translate("ConnectionConfigurationWidget", "&Port", nullptr));
|
||||
|
|
@ -162,8 +172,11 @@ void ConnectionConfigurationWidget::setData(const ConnectionConfig &cfg)
|
|||
edtCrl->setText(stdStrToQ(cfg.sslCrl()));
|
||||
}
|
||||
|
||||
ConnectionConfig ConnectionConfigurationWidget::data() const
|
||||
std::tuple<QString, ConnectionConfig> ConnectionConfigurationWidget::data() const
|
||||
{
|
||||
QString group;
|
||||
group = cmbbxGroup->currentText();
|
||||
|
||||
ConnectionConfig cfg;
|
||||
cfg.setUuid(m_uuid);
|
||||
cfg.setName(qStrToStd(edtName->text()));
|
||||
|
|
@ -176,6 +189,6 @@ ConnectionConfig ConnectionConfigurationWidget::data() const
|
|||
cfg.setSslKey(qStrToStd(edtKey->text()));
|
||||
cfg.setSslRootCert(qStrToStd(edtRootCert->text()));
|
||||
cfg.setSslCrl(qStrToStd(edtCrl->text()));
|
||||
return cfg;
|
||||
return { group, cfg };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue