mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
http proxy and socks - initialized comboboxes correctly
This commit is contained in:
parent
3118d7bede
commit
4776f11b6a
|
@ -18,8 +18,11 @@ class SignatureTypeComboBoxFactory
|
|||
}
|
||||
|
||||
public:
|
||||
static QComboBox* createSignatureTypeComboBox(QWidget* parent, uint16_t selectedSigType) {
|
||||
QComboBox* signatureTypeCombobox = new QComboBox(parent);
|
||||
static const uint16_t getSigType(const QVariant& var) {
|
||||
return (uint16_t)var.toInt();
|
||||
}
|
||||
|
||||
static void fillComboBox(QComboBox* signatureTypeCombobox, uint16_t selectedSigType) {
|
||||
/*
|
||||
<orignal> https://geti2p.net/spec/common-structures#certificate
|
||||
<orignal> все коды перечислены
|
||||
|
@ -78,7 +81,11 @@ public:
|
|||
addItem(signatureTypeCombobox, QString::number(selectedSigType), selectedSigType); //unknown sigtype
|
||||
signatureTypeCombobox->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
static QComboBox* createSignatureTypeComboBox(QWidget* parent, uint16_t selectedSigType) {
|
||||
QComboBox* signatureTypeCombobox = new QComboBox(parent);
|
||||
fillComboBox(signatureTypeCombobox, selectedSigType);
|
||||
return signatureTypeCombobox;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <fstream>
|
||||
|
||||
#include "DaemonQT.h"
|
||||
#include "SignatureTypeComboboxFactory.h"
|
||||
|
||||
std::string programOptionsWriterCurrentSection;
|
||||
|
||||
|
@ -123,6 +124,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
initIPAddressBox( OPTION("httpproxy","address",[]{return "";}), ui->httpProxyAddressLineEdit, tr("HTTP proxy -> IP address"));
|
||||
initTCPPortBox( OPTION("httpproxy","port",[]{return "4444";}), ui->httpProxyPortLineEdit, tr("HTTP proxy -> Port"));
|
||||
initFileChooser( OPTION("httpproxy","keys",[]{return "";}), ui->httpProxyKeyFileLineEdit, ui->httpProxyKeyFilePushButton);
|
||||
|
||||
initSignatureTypeCombobox(OPTION("httpproxy","signaturetype",[]{return "7";}), ui->comboBox_httpPorxySignatureType);
|
||||
initStringBox( OPTION("httpproxy","inbound.length",[]{return "3";}), ui->httpProxyInboundTunnelsLenLineEdit);
|
||||
initStringBox( OPTION("httpproxy","inbound.quantity",[]{return "5";}), ui->httpProxyInboundTunnQuantityLineEdit);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "TunnelsPageUpdateListener.h"
|
||||
|
||||
#include "DaemonQT.h"
|
||||
#include "SignatureTypeComboboxFactory.h"
|
||||
|
||||
template<typename ValueType>
|
||||
bool isType(boost::any& a) {
|
||||
|
@ -218,16 +219,15 @@ class SignatureTypeComboBoxItem : public ComboBoxItem {
|
|||
public:
|
||||
SignatureTypeComboBoxItem(ConfigOption option_, QComboBox* comboBox_) : ComboBoxItem(option_, comboBox_) {};
|
||||
virtual ~SignatureTypeComboBoxItem(){}
|
||||
virtual void loadFromConfigOption(){//TODO
|
||||
virtual void loadFromConfigOption(){
|
||||
MainWindowItem::loadFromConfigOption();
|
||||
comboBox->setCurrentText(QString::number(boost::any_cast<unsigned short>(optionValue)));
|
||||
while(comboBox->count()>0)comboBox->removeItem(0);
|
||||
uint16_t selected = (uint16_t) boost::any_cast<unsigned short>(optionValue);
|
||||
SignatureTypeComboBoxFactory::fillComboBox(comboBox, selected);
|
||||
}
|
||||
virtual void saveToStringStream(std::stringstream& out){//TODO
|
||||
QString txt = comboBox->currentText();
|
||||
if(txt.isEmpty())
|
||||
optionValue=std::string();
|
||||
else
|
||||
optionValue=(unsigned short)std::stoi(txt.toStdString());
|
||||
virtual void saveToStringStream(std::stringstream& out){
|
||||
uint16_t selected = SignatureTypeComboBoxFactory::getSigType(comboBox->currentData());
|
||||
optionValue=(unsigned short)selected;
|
||||
MainWindowItem::saveToStringStream(out);
|
||||
}
|
||||
virtual bool isValid() { return true; }
|
||||
|
|
Loading…
Reference in a new issue