2019-08-24 20:47:32 +02:00
|
|
|
|
#ifndef CONNECTIONCONFIGURATIONWIDGET_H
|
|
|
|
|
|
#define CONNECTIONCONFIGURATIONWIDGET_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
#include <QUuid>
|
2019-08-27 20:12:00 +02:00
|
|
|
|
#include <tuple>
|
2021-07-04 16:45:50 +02:00
|
|
|
|
#include "TestConnection.h"
|
2019-08-24 20:47:32 +02:00
|
|
|
|
|
|
|
|
|
|
class ConnectionController;
|
|
|
|
|
|
class ConnectionConfig;
|
2021-07-04 16:45:50 +02:00
|
|
|
|
class QCheckBox;
|
|
|
|
|
|
class QComboBox;
|
|
|
|
|
|
class QDataWidgetMapper;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
class QFormLayout;
|
|
|
|
|
|
class QLabel;
|
|
|
|
|
|
class QLineEdit;
|
2021-07-04 16:45:50 +02:00
|
|
|
|
class QPushButton;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
class QSpinBox;
|
|
|
|
|
|
|
2019-08-27 20:12:00 +02:00
|
|
|
|
class ConnectionTreeModel;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
|
|
|
|
|
|
class ConnectionConfigurationWidget : public QWidget
|
|
|
|
|
|
{
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
public:
|
2021-07-04 19:33:06 +02:00
|
|
|
|
static void editExistingInWindow(ConnectionController *ctrl, const ConnectionConfig &cfg,
|
|
|
|
|
|
std::function<void(ConnectionConfigurationWidget&)> save_func);
|
2019-08-24 20:47:32 +02:00
|
|
|
|
|
2022-01-16 17:59:28 +01:00
|
|
|
|
explicit ConnectionConfigurationWidget(
|
|
|
|
|
|
ConnectionController *connection_controller,
|
|
|
|
|
|
QWidget *parent = nullptr);
|
2019-08-24 20:47:32 +02:00
|
|
|
|
|
|
|
|
|
|
void retranslateUi();
|
|
|
|
|
|
void setData(const ConnectionConfig &cfg);
|
2021-07-04 16:45:50 +02:00
|
|
|
|
ConnectionConfig data() const;
|
|
|
|
|
|
QString group() const;
|
2021-07-04 19:33:06 +02:00
|
|
|
|
bool savePassword() const;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
|
2021-07-04 16:45:50 +02:00
|
|
|
|
public slots:
|
|
|
|
|
|
void testConnection();
|
|
|
|
|
|
|
2019-08-24 20:47:32 +02:00
|
|
|
|
private:
|
2021-07-04 19:33:06 +02:00
|
|
|
|
ConnectionController *m_connectionController;
|
2021-07-04 16:45:50 +02:00
|
|
|
|
ConnectionTreeModel *m_connectionModel;
|
2019-09-01 06:44:48 +02:00
|
|
|
|
|
2019-08-24 20:47:32 +02:00
|
|
|
|
QUuid m_uuid;
|
2021-07-04 19:33:06 +02:00
|
|
|
|
QByteArray encodedPassword;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
|
2019-08-27 20:12:00 +02:00
|
|
|
|
QLabel *lblGroup;
|
|
|
|
|
|
QComboBox *cmbbxGroup;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
QLabel *lblName;
|
|
|
|
|
|
QLineEdit *edtName;
|
|
|
|
|
|
QLabel *lblHost;
|
|
|
|
|
|
QLineEdit *edtHost;
|
|
|
|
|
|
QLabel *lblPort;
|
|
|
|
|
|
QSpinBox *spinPort;
|
|
|
|
|
|
QLabel *lblUser;
|
|
|
|
|
|
QLineEdit *edtUser;
|
2021-07-04 16:45:50 +02:00
|
|
|
|
QLabel *lblPassword;
|
|
|
|
|
|
QLineEdit *edtPassword;
|
|
|
|
|
|
QCheckBox *cbSavePassword;
|
|
|
|
|
|
QLabel *lblDbName;
|
|
|
|
|
|
QComboBox *cmbDbname;
|
2019-08-24 20:47:32 +02:00
|
|
|
|
QLabel *lblSsl;
|
|
|
|
|
|
QComboBox *cmbbxSsl;
|
|
|
|
|
|
QLabel *lblCert;
|
|
|
|
|
|
QLineEdit *edtCert;
|
|
|
|
|
|
QLabel *lblKey;
|
|
|
|
|
|
QLineEdit *edtKey;
|
|
|
|
|
|
QLabel *lblRootCert;
|
|
|
|
|
|
QLineEdit *edtRootCert;
|
|
|
|
|
|
QLabel *lblCrl;
|
|
|
|
|
|
QLineEdit *edtCrl;
|
|
|
|
|
|
|
2021-07-04 16:45:50 +02:00
|
|
|
|
QPushButton *btnTest;
|
|
|
|
|
|
QLabel *lblResult;
|
|
|
|
|
|
QFormLayout *formLayout;
|
|
|
|
|
|
|
2022-01-16 17:59:28 +01:00
|
|
|
|
void handleTestResult(TestConnectionResult result);
|
2019-08-24 20:47:32 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CONNECTIONCONFIGURATIONWIDGET_H
|