i2pd/qt/i2pd_qt/ClientTunnelPane.h

98 lines
2.9 KiB
C
Raw Normal View History

2017-03-14 15:34:01 +03:00
#ifndef CLIENTTUNNELPANE_H
#define CLIENTTUNNELPANE_H
#include "QGridLayout"
2017-06-02 17:59:13 +03:00
#include "QVBoxLayout"
2017-03-14 15:34:01 +03:00
#include "TunnelPane.h"
2017-04-02 22:39:24 +03:00
class ClientTunnelConfig;
2017-03-14 15:34:01 +03:00
class ServerTunnelPane;
class TunnelPane;
class ClientTunnelPane : public TunnelPane {
2017-04-02 22:39:24 +03:00
Q_OBJECT
2017-03-14 15:34:01 +03:00
public:
2017-06-02 17:59:13 +03:00
ClientTunnelPane(TunnelsPageUpdateListener* tunnelsPageUpdateListener, ClientTunnelConfig* tunconf);
2017-04-02 22:39:24 +03:00
virtual ~ClientTunnelPane(){}
2017-03-14 15:34:01 +03:00
virtual ServerTunnelPane* asServerTunnelPane();
virtual ClientTunnelPane* asClientTunnelPane();
2017-06-02 17:59:13 +03:00
int appendClientTunnelForm(ClientTunnelConfig* tunnelConfig, QWidget *tunnelsFormGridLayoutWidget,
int tunnelsRow, int height);
void deleteClientTunnelForm();
2017-04-02 22:39:24 +03:00
private:
QGroupBox *clientTunnelNameGroupBox;
//tunnel
QWidget *gridLayoutWidget_2;
//destination
QHBoxLayout *horizontalLayout_2;
QLabel *destinationLabel;
QLineEdit *destinationLineEdit;
QSpacerItem *destinationHorizontalSpacer;
//port
QLabel * portLabel;
QLineEdit * portLineEdit;
//keys
QLabel * keysLabel;
QLineEdit * keysLineEdit;
//address
QLabel * addressLabel;
QLineEdit * addressLineEdit;
//destinationPort
QLabel * destinationPortLabel;
QLineEdit * destinationPortLineEdit;
//sigType
QLabel * sigTypeLabel;
QComboBox * sigTypeComboBox;
2017-03-14 15:34:01 +03:00
protected slots:
2017-04-02 22:39:24 +03:00
virtual void setGroupBoxTitle(const QString & title);
private:
void retranslateClientTunnelForm(ClientTunnelPane& /*ui*/) {
typeLabel->setText(QApplication::translate("cltTunForm", "Client tunnel type:", 0));
destinationLabel->setText(QApplication::translate("cltTunForm", "Destination:", 0));
portLabel->setText(QApplication::translate("cltTunForm", "Port:", 0));
keysLabel->setText(QApplication::translate("cltTunForm", "Keys:", 0));
destinationPortLabel->setText(QApplication::translate("cltTunForm", "Destination port:", 0));
addressLabel->setText(QApplication::translate("cltTunForm", "Address:", 0));
sigTypeLabel->setText(QApplication::translate("cltTunForm", "Signature type:", 0));
2017-04-02 22:39:24 +03:00
}
2017-06-02 17:59:13 +03:00
protected:
virtual bool applyDataFromUIToTunnelConfig() {
bool ok=TunnelPane::applyDataFromUIToTunnelConfig();
if(!ok)return false;
ClientTunnelConfig* ctc=tunnelConfig->asClientTunnelConfig();
assert(ctc!=nullptr);
2017-04-02 22:39:24 +03:00
2017-06-02 17:59:13 +03:00
//destination
ctc->setdest(destinationLineEdit->text().toStdString());
auto portStr=portLineEdit->text();
int portInt=portStr.toInt(&ok);
if(!ok)return false;
ctc->setport(portInt);
ctc->setkeys(keysLineEdit->text().toStdString());
ctc->setaddress(addressLineEdit->text().toStdString());
auto dportStr=portLineEdit->text();
int dportInt=dportStr.toInt(&ok);
if(!ok)return false;
ctc->setdestinationPort(dportInt);
ctc->setsigType(readSigTypeComboboxUI(sigTypeComboBox));
}
2017-03-14 15:34:01 +03:00
};
#endif // CLIENTTUNNELPANE_H