mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 19:27:49 +02:00
various qt work
This commit is contained in:
parent
9925e2732a
commit
275da075e0
21 changed files with 13078 additions and 1648 deletions
239
qt/i2pd_qt/ServerTunnelPane.cpp
Normal file
239
qt/i2pd_qt/ServerTunnelPane.cpp
Normal file
|
@ -0,0 +1,239 @@
|
|||
#include "ServerTunnelPane.h"
|
||||
#include "../../ClientContext.h"
|
||||
|
||||
ServerTunnelPane::ServerTunnelPane(): TunnelPane() {}
|
||||
|
||||
void ServerTunnelPane::setGroupBoxTitle(const QString & title) {
|
||||
serverTunnelNameGroupBox->setTitle(title);
|
||||
}
|
||||
|
||||
void ServerTunnelPane::appendServerTunnelForm(
|
||||
ServerTunnelConfig* tunnelConfig, QWidget *tunnelsFormGridLayoutWidget, QGridLayout *tunnelsFormGridLayout) {
|
||||
|
||||
tunnelsFormGridLayoutWidget->resize(527, 452);
|
||||
|
||||
ServerTunnelPane& ui = *this;
|
||||
|
||||
serverTunnelNameGroupBox = new QGroupBox(tunnelsFormGridLayoutWidget);
|
||||
serverTunnelNameGroupBox->setObjectName(QStringLiteral("serverTunnelNameGroupBox"));
|
||||
|
||||
//tunnel
|
||||
ui.gridLayoutWidget_2 = new QWidget(serverTunnelNameGroupBox);
|
||||
|
||||
QComboBox *tunnelTypeComboBox = new QComboBox(gridLayoutWidget_2);
|
||||
tunnelTypeComboBox->setObjectName(QStringLiteral("tunnelTypeComboBox"));
|
||||
tunnelTypeComboBox->addItem("Server", i2p::client::I2P_TUNNELS_SECTION_TYPE_SERVER);
|
||||
tunnelTypeComboBox->addItem("HTTP", i2p::client::I2P_TUNNELS_SECTION_TYPE_HTTP);
|
||||
tunnelTypeComboBox->addItem("IRC", i2p::client::I2P_TUNNELS_SECTION_TYPE_IRC);
|
||||
tunnelTypeComboBox->addItem("UDP Server", i2p::client::I2P_TUNNELS_SECTION_TYPE_UDPSERVER);
|
||||
|
||||
gridLayoutWidget_2->setGeometry(QRect(0, 10, 561, 18*40+10));
|
||||
|
||||
setupTunnelPane(tunnelConfig,
|
||||
serverTunnelNameGroupBox,
|
||||
gridLayoutWidget_2, tunnelTypeComboBox,
|
||||
tunnelsFormGridLayoutWidget, tunnelsFormGridLayout);
|
||||
|
||||
{
|
||||
const QString& type = tunnelConfig->getType();
|
||||
int index=0;
|
||||
if(type==i2p::client::I2P_TUNNELS_SECTION_TYPE_SERVER)tunnelTypeComboBox->setCurrentIndex(index);
|
||||
++index;
|
||||
if(type==i2p::client::I2P_TUNNELS_SECTION_TYPE_HTTP)tunnelTypeComboBox->setCurrentIndex(index);
|
||||
++index;
|
||||
if(type==i2p::client::I2P_TUNNELS_SECTION_TYPE_IRC)tunnelTypeComboBox->setCurrentIndex(index);
|
||||
++index;
|
||||
if(type==i2p::client::I2P_TUNNELS_SECTION_TYPE_UDPSERVER)tunnelTypeComboBox->setCurrentIndex(index);
|
||||
++index;
|
||||
}
|
||||
|
||||
//host
|
||||
ui.horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.hostLabel = new QLabel(gridLayoutWidget_2);
|
||||
hostLabel->setObjectName(QStringLiteral("hostLabel"));
|
||||
horizontalLayout_2->addWidget(hostLabel);
|
||||
ui.hostLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
hostLineEdit->setObjectName(QStringLiteral("hostLineEdit"));
|
||||
hostLineEdit->setText(tunnelConfig->gethost().c_str());
|
||||
horizontalLayout_2->addWidget(hostLineEdit);
|
||||
ui.hostHorizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(hostHorizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, 2, 0, 1, 1);
|
||||
|
||||
int gridIndex = 2;
|
||||
{
|
||||
int port = tunnelConfig->getport();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.portLabel = new QLabel(gridLayoutWidget_2);
|
||||
portLabel->setObjectName(QStringLiteral("portLabel"));
|
||||
horizontalLayout_2->addWidget(portLabel);
|
||||
ui.portLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
portLineEdit->setObjectName(QStringLiteral("portLineEdit"));
|
||||
portLineEdit->setText(QString::number(port));
|
||||
portLineEdit->setMaximumWidth(80);
|
||||
horizontalLayout_2->addWidget(portLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
std::string keys = tunnelConfig->getkeys();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.keysLabel = new QLabel(gridLayoutWidget_2);
|
||||
keysLabel->setObjectName(QStringLiteral("keysLabel"));
|
||||
horizontalLayout_2->addWidget(keysLabel);
|
||||
ui.keysLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
keysLineEdit->setObjectName(QStringLiteral("keysLineEdit"));
|
||||
keysLineEdit->setText(keys.c_str());
|
||||
horizontalLayout_2->addWidget(keysLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
int inPort = tunnelConfig->getinPort();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.inPortLabel = new QLabel(gridLayoutWidget_2);
|
||||
inPortLabel->setObjectName(QStringLiteral("inPortLabel"));
|
||||
horizontalLayout_2->addWidget(inPortLabel);
|
||||
ui.inPortLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
inPortLineEdit->setObjectName(QStringLiteral("inPortLineEdit"));
|
||||
inPortLineEdit->setText(QString::number(inPort));
|
||||
inPortLineEdit->setMaximumWidth(80);
|
||||
horizontalLayout_2->addWidget(inPortLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
std::string accessList = tunnelConfig->getaccessList();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.accessListLabel = new QLabel(gridLayoutWidget_2);
|
||||
accessListLabel->setObjectName(QStringLiteral("accessListLabel"));
|
||||
horizontalLayout_2->addWidget(accessListLabel);
|
||||
ui.accessListLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
accessListLineEdit->setObjectName(QStringLiteral("accessListLineEdit"));
|
||||
accessListLineEdit->setText(accessList.c_str());
|
||||
horizontalLayout_2->addWidget(accessListLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
std::string hostOverride = tunnelConfig->gethostOverride();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.hostOverrideLabel = new QLabel(gridLayoutWidget_2);
|
||||
hostOverrideLabel->setObjectName(QStringLiteral("hostOverrideLabel"));
|
||||
horizontalLayout_2->addWidget(hostOverrideLabel);
|
||||
ui.hostOverrideLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
hostOverrideLineEdit->setObjectName(QStringLiteral("hostOverrideLineEdit"));
|
||||
hostOverrideLineEdit->setText(hostOverride.c_str());
|
||||
horizontalLayout_2->addWidget(hostOverrideLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
std::string webIRCPass = tunnelConfig->getwebircpass();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.webIRCPassLabel = new QLabel(gridLayoutWidget_2);
|
||||
webIRCPassLabel->setObjectName(QStringLiteral("webIRCPassLabel"));
|
||||
horizontalLayout_2->addWidget(webIRCPassLabel);
|
||||
ui.webIRCPassLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
webIRCPassLineEdit->setObjectName(QStringLiteral("webIRCPassLineEdit"));
|
||||
webIRCPassLineEdit->setText(webIRCPass.c_str());
|
||||
horizontalLayout_2->addWidget(webIRCPassLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
bool gzip = tunnelConfig->getgzip();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.gzipCheckBox = new QCheckBox(gridLayoutWidget_2);
|
||||
gzipCheckBox->setObjectName(QStringLiteral("gzipCheckBox"));
|
||||
gzipCheckBox->setChecked(gzip);
|
||||
horizontalLayout_2->addWidget(gzipCheckBox);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
i2p::data::SigningKeyType sigType = tunnelConfig->getsigType();
|
||||
//combo box
|
||||
//TODO sigtype
|
||||
}
|
||||
{
|
||||
uint32_t maxConns = tunnelConfig->getmaxConns();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.maxConnsLabel = new QLabel(gridLayoutWidget_2);
|
||||
maxConnsLabel->setObjectName(QStringLiteral("maxConnsLabel"));
|
||||
horizontalLayout_2->addWidget(maxConnsLabel);
|
||||
ui.maxConnsLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
maxConnsLineEdit->setObjectName(QStringLiteral("maxConnsLineEdit"));
|
||||
maxConnsLineEdit->setText(QString::number(maxConns));
|
||||
maxConnsLineEdit->setMaximumWidth(80);
|
||||
horizontalLayout_2->addWidget(maxConnsLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
std::string address = tunnelConfig->getaddress();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.addressLabel = new QLabel(gridLayoutWidget_2);
|
||||
addressLabel->setObjectName(QStringLiteral("addressLabel"));
|
||||
horizontalLayout_2->addWidget(addressLabel);
|
||||
ui.addressLineEdit = new QLineEdit(gridLayoutWidget_2);
|
||||
addressLineEdit->setObjectName(QStringLiteral("addressLineEdit"));
|
||||
addressLineEdit->setText(address.c_str());
|
||||
horizontalLayout_2->addWidget(addressLineEdit);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
bool isUniqueLocal = tunnelConfig->getisUniqueLocal();
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2"));
|
||||
ui.isUniqueLocalCheckBox = new QCheckBox(gridLayoutWidget_2);
|
||||
isUniqueLocalCheckBox->setObjectName(QStringLiteral("isUniqueLocalCheckBox"));
|
||||
isUniqueLocalCheckBox->setChecked(isUniqueLocal);
|
||||
horizontalLayout_2->addWidget(isUniqueLocalCheckBox);
|
||||
QSpacerItem * horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
horizontalLayout_2->addItem(horizontalSpacer);
|
||||
tunnelGridLayout->addLayout(horizontalLayout_2, ++gridIndex, 0, 1, 1);
|
||||
}
|
||||
{
|
||||
I2CPParameters& i2cpParameters = tunnelConfig->getI2cpParameters();
|
||||
appendControlsForI2CPParameters(i2cpParameters, gridIndex);
|
||||
}
|
||||
|
||||
tunnelsFormGridLayout->addWidget(serverTunnelNameGroupBox, 0, 0, 1, 1);
|
||||
|
||||
retranslateServerTunnelForm(ui);
|
||||
}
|
||||
|
||||
void ServerTunnelPane::deleteServerTunnelForm(QGridLayout *tunnelsFormGridLayout) {
|
||||
tunnelsFormGridLayout->removeWidget(tunnelGroupBox);
|
||||
|
||||
tunnelGroupBox->deleteLater();
|
||||
tunnelGroupBox=nullptr;
|
||||
|
||||
gridLayoutWidget_2->deleteLater();
|
||||
gridLayoutWidget_2=nullptr;
|
||||
}
|
||||
|
||||
|
||||
ServerTunnelPane* ServerTunnelPane::asServerTunnelPane(){return this;}
|
||||
ClientTunnelPane* ServerTunnelPane::asClientTunnelPane(){return nullptr;}
|
Loading…
Add table
Add a link
Reference in a new issue