Merge pull request #911 from hypnosis-i2p/openssl

qt ui fixes
This commit is contained in:
orignal 2017-07-28 06:27:12 -04:00 committed by GitHub
commit 0ec9defc6e
9 changed files with 74 additions and 40 deletions

View File

@ -91,6 +91,7 @@ protected:
ctc->setdestinationPort(dportInt);
ctc->setsigType(readSigTypeComboboxUI(sigTypeComboBox));
return true;
}
};

View File

@ -161,6 +161,7 @@ namespace qt
{
i2p::qt::Controller daemonQtController(daemon);
w.setI2PController(&daemonQtController);
qDebug("Starting the daemon...");
emit daemonQtController.startDaemon();
//daemon.start ();

View File

@ -155,6 +155,7 @@ protected:
stc->setisUniqueLocal(isUniqueLocalCheckBox->isChecked());
stc->setsigType(readSigTypeComboboxUI(sigTypeComboBox));
return true;
}
};

View File

@ -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;
}
};

View File

@ -196,7 +196,8 @@ public:
gzip(gzip_),
sigType(sigType_),
maxConns(maxConns_),
address(address_) {}
address(address_),
isUniqueLocal(isUniqueLocal_) {}
std::string& gethost(){return host;}
int getport(){return port;}
std::string& getkeys(){return keys;}

View File

@ -88,6 +88,7 @@ protected:
i2cpParams.setOutbound_length(outbound_lengthLineEdit->text());
i2cpParams.setOutbound_quantity(outbound_quantityLineEdit->text());
i2cpParams.setCrypto_tagsToSend(crypto_tagsToSendLineEdit->text());
return true;
}
void setupTunnelPane(

View File

@ -17,6 +17,9 @@
#include <fstream>
#include "DaemonQT.h"
#include "SignatureTypeComboboxFactory.h"
std::string programOptionsWriterCurrentSection;
MainWindow::MainWindow(QWidget *parent) :
@ -25,6 +28,7 @@ MainWindow::MainWindow(QWidget *parent) :
,quitting(false)
#endif
,ui(new Ui::MainWindow)
,i2pController(nullptr)
,configItems()
,datadir()
,confpath()
@ -48,8 +52,6 @@ MainWindow::MainWindow(QWidget *parent) :
int w = 683;
int h = 3060;
ui->settingsContents->setFixedSize(w, h);
//ui->settingsContents->resize(w, h);
//ui->settingsContents->adjustSize();
/*
QPalette pal(palette());
@ -77,6 +79,8 @@ MainWindow::MainWindow(QWidget *parent) :
QObject::connect(ui->fastQuitPushButton, SIGNAL(released()), this, SLOT(handleQuitButton()));
QObject::connect(ui->gracefulQuitPushButton, SIGNAL(released()), this, SLOT(handleGracefulQuitButton()));
QObject::connect(ui->doRestartI2PDPushButton, SIGNAL(released()), this, SLOT(handleDoRestartButton()));
# define OPTION(section,option,defaultValueGetter) ConfigOption(QString(section),QString(option))
initFileChooser( OPTION("","conf",[](){return "";}), ui->configFileLineEdit, ui->configFileBrowsePushButton);
@ -120,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);
@ -328,6 +333,12 @@ void MainWindow::handleGracefulQuitButton() {
, this, SLOT(handleGracefulQuitTimerEvent()));
}
void MainWindow::handleDoRestartButton() {
qDebug()<<"Do Restart pressed.";
emit i2pController->restartDaemon();
}
void MainWindow::handleGracefulQuitTimerEvent() {
qDebug("Hiding the main window");
#ifndef ANDROID
@ -616,3 +627,7 @@ void MainWindow::addServerTunnelPushButtonReleased() {
void MainWindow::addClientTunnelPushButtonReleased() {
CreateDefaultClientTunnel();
}
void MainWindow::setI2PController(i2p::qt::Controller* controller_) {
this->i2pController = controller_;
}

View File

@ -51,6 +51,9 @@
#include "TunnelsPageUpdateListener.h"
#include "DaemonQT.h"
#include "SignatureTypeComboboxFactory.h"
template<typename ValueType>
bool isType(boost::any& a) {
return
@ -216,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; }
@ -311,6 +313,10 @@ using namespace i2p::client;
class TunnelPane;
using namespace i2p::qt;
class Controller;
class MainWindow : public QMainWindow {
Q_OBJECT
@ -318,6 +324,8 @@ public:
explicit MainWindow(QWidget *parent=0);
~MainWindow();
void setI2PController(i2p::qt::Controller* controller_);
//typedef std::function<QString ()> DefaultValueGetter;
//#ifndef ANDROID
@ -327,6 +335,7 @@ public:
private slots:
void handleQuitButton();
void handleGracefulQuitButton();
void handleDoRestartButton();
void handleGracefulQuitTimerEvent();
#ifndef ANDROID
void setIcon();
@ -351,6 +360,8 @@ private:
Ui::MainWindow* ui;
i2p::qt::Controller* i2pController;
protected:
#ifndef ANDROID
void closeEvent(QCloseEvent *event);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>816</width>
<height>5000</height>
<height>516</height>
</rect>
</property>
<property name="windowTitle">
@ -37,8 +37,8 @@
<rect>
<x>10</x>
<y>10</y>
<width>801</width>
<height>518</height>
<width>796</width>
<height>496</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -126,17 +126,17 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>516</height>
<height>496</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>516</height>
<height>496</height>
</size>
</property>
<property name="currentIndex">
<number>1</number>
<number>4</number>
</property>
<widget class="QWidget" name="statusPage">
<widget class="QWidget" name="verticalLayoutWidget_5">
@ -144,8 +144,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>671</width>
<height>5000</height>
<width>686</width>
<height>496</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@ -192,8 +192,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>701</width>
<height>400</height>
<width>706</width>
<height>461</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -232,7 +232,7 @@
<x>0</x>
<y>0</y>
<width>679</width>
<height>400</height>
<height>3000</height>
</rect>
</property>
<property name="sizePolicy">
@ -245,14 +245,13 @@
<property name="geometry">
<rect>
<x>10</x>
<y>11</y>
<y>10</y>
<width>679</width>
<height>2962</height>
<height>3000</height>
</rect>
</property>
<layout class="QGridLayout" name="settingsContentsGridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0">
<item row="14" column="0">
<widget class="QGroupBox" name="samGroupBox">
<property name="minimumSize">
<size>
@ -360,9 +359,6 @@
</layout>
</widget>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="winOptLabel">
@ -2570,13 +2566,13 @@ Comma separated list of base64 identities:</string>
<property name="minimumSize">
<size>
<width>0</width>
<height>370</height>
<height>400</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>370</height>
<height>400</height>
</size>
</property>
<property name="title">
@ -2997,8 +2993,8 @@ Comma separated list of base64 identities:</string>
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>460</height>
<width>706</width>
<height>461</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
@ -3064,8 +3060,8 @@ Comma separated list of base64 identities:</string>
<rect>
<x>0</x>
<y>0</y>
<width>663</width>
<height>395</height>
<width>699</width>
<height>425</height>
</rect>
</property>
</widget>
@ -3080,8 +3076,8 @@ Comma separated list of base64 identities:</string>
<rect>
<x>0</x>
<y>0</y>
<width>681</width>
<height>451</height>
<width>686</width>
<height>496</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -3135,8 +3131,8 @@ Comma separated list of base64 identities:</string>
<rect>
<x>0</x>
<y>0</y>
<width>671</width>
<height>480</height>
<width>686</width>
<height>496</height>
</rect>
</property>
<layout class="QVBoxLayout" name="quitPageVerticalLayout">