|
|
@ -4,6 +4,7 @@ |
|
|
|
#include "ui_mainwindow.h" |
|
|
|
#include "ui_mainwindow.h" |
|
|
|
#include "ui_statusbuttons.h" |
|
|
|
#include "ui_statusbuttons.h" |
|
|
|
#include "ui_routercommandswidget.h" |
|
|
|
#include "ui_routercommandswidget.h" |
|
|
|
|
|
|
|
#include "ui_generalsettingswidget.h" |
|
|
|
#include <sstream> |
|
|
|
#include <sstream> |
|
|
|
#include <QScrollBar> |
|
|
|
#include <QScrollBar> |
|
|
|
#include <QMessageBox> |
|
|
|
#include <QMessageBox> |
|
|
@ -38,7 +39,9 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
,ui(new Ui::MainWindow) |
|
|
|
,ui(new Ui::MainWindow) |
|
|
|
,statusButtonsUI(new Ui::StatusButtonsForm) |
|
|
|
,statusButtonsUI(new Ui::StatusButtonsForm) |
|
|
|
,routerCommandsUI(new Ui::routerCommandsWidget) |
|
|
|
,routerCommandsUI(new Ui::routerCommandsWidget) |
|
|
|
|
|
|
|
,uiSettings(new Ui::GeneralSettingsContentsForm) |
|
|
|
,routerCommandsParent(new QWidget(this)) |
|
|
|
,routerCommandsParent(new QWidget(this)) |
|
|
|
|
|
|
|
,widgetlocks() |
|
|
|
,i2pController(nullptr) |
|
|
|
,i2pController(nullptr) |
|
|
|
,configItems() |
|
|
|
,configItems() |
|
|
|
,datadir() |
|
|
|
,datadir() |
|
|
@ -50,6 +53,7 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
ui->setupUi(this); |
|
|
|
ui->setupUi(this); |
|
|
|
statusButtonsUI->setupUi(ui->statusButtonsPane); |
|
|
|
statusButtonsUI->setupUi(ui->statusButtonsPane); |
|
|
|
routerCommandsUI->setupUi(routerCommandsParent); |
|
|
|
routerCommandsUI->setupUi(routerCommandsParent); |
|
|
|
|
|
|
|
uiSettings->setupUi(ui->settingsContents); |
|
|
|
routerCommandsParent->hide(); |
|
|
|
routerCommandsParent->hide(); |
|
|
|
ui->verticalLayout_2->addWidget(routerCommandsParent); |
|
|
|
ui->verticalLayout_2->addWidget(routerCommandsParent); |
|
|
|
//,statusHtmlUI(new Ui::StatusHtmlPaneForm)
|
|
|
|
//,statusHtmlUI(new Ui::StatusHtmlPaneForm)
|
|
|
@ -66,9 +70,8 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
onResize(); |
|
|
|
onResize(); |
|
|
|
|
|
|
|
|
|
|
|
ui->stackedWidget->setCurrentIndex(0); |
|
|
|
ui->stackedWidget->setCurrentIndex(0); |
|
|
|
ui->settingsScrollArea->resize(ui->settingsContentsGridLayout->sizeHint().width()+10,380); |
|
|
|
ui->settingsScrollArea->resize(uiSettings->settingsContentsGridLayout->sizeHint().width()+10,380); |
|
|
|
QScrollBar* const barSett = ui->settingsScrollArea->verticalScrollBar(); |
|
|
|
QScrollBar* const barSett = ui->settingsScrollArea->verticalScrollBar(); |
|
|
|
//QSize szSettContents = ui->settingsContentsGridLayout->minimumSize();
|
|
|
|
|
|
|
|
int w = 683; |
|
|
|
int w = 683; |
|
|
|
int h = 3060; |
|
|
|
int h = 3060; |
|
|
|
ui->settingsContents->setFixedSize(w, h); |
|
|
|
ui->settingsContents->setFixedSize(w, h); |
|
|
@ -80,10 +83,6 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
ui->settingsContents->setPalette(pal); |
|
|
|
ui->settingsContents->setPalette(pal); |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
//ui->settingsScrollArea->adjustSize();
|
|
|
|
|
|
|
|
/*ui->tunnelsScrollAreaWidgetContents->setFixedSize(
|
|
|
|
|
|
|
|
ui->tunnelsScrollArea->width() - barSett->width(), 0);*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ANDROID |
|
|
|
#ifndef ANDROID |
|
|
|
createActions(); |
|
|
|
createActions(); |
|
|
|
createTrayIcon(); |
|
|
|
createTrayIcon(); |
|
|
@ -138,132 +137,145 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
|
|
|
|
|
|
|
|
# define OPTION(section,option,defaultValueGetter) ConfigOption(QString(section),QString(option)) |
|
|
|
# define OPTION(section,option,defaultValueGetter) ConfigOption(QString(section),QString(option)) |
|
|
|
|
|
|
|
|
|
|
|
initFileChooser( OPTION("","conf",[](){return "";}), ui->configFileLineEdit, ui->configFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("","conf",[](){return "";}), uiSettings->configFileLineEdit, uiSettings->configFileBrowsePushButton); |
|
|
|
initFolderChooser( OPTION("","datadir",[]{return "";}), ui->dataFolderLineEdit, ui->dataFolderBrowsePushButton); |
|
|
|
initFolderChooser( OPTION("","datadir",[]{return "";}), uiSettings->dataFolderLineEdit, uiSettings->dataFolderBrowsePushButton); |
|
|
|
initFileChooser( OPTION("","tunconf",[](){return "";}), ui->tunnelsConfigFileLineEdit, ui->tunnelsConfigFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("","tunconf",[](){return "";}), uiSettings->tunnelsConfigFileLineEdit, uiSettings->tunnelsConfigFileBrowsePushButton); |
|
|
|
|
|
|
|
|
|
|
|
initFileChooser( OPTION("","pidfile",[]{return "";}), ui->pidFileLineEdit, ui->pidFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("","pidfile",[]{return "";}), uiSettings->pidFileLineEdit, uiSettings->pidFileBrowsePushButton); |
|
|
|
logOption=initNonGUIOption( OPTION("","log",[]{return "";})); |
|
|
|
|
|
|
|
daemonOption=initNonGUIOption( OPTION("","daemon",[]{return "";})); |
|
|
|
daemonOption=initNonGUIOption( OPTION("","daemon",[]{return "";})); |
|
|
|
serviceOption=initNonGUIOption( OPTION("","service",[]{return "";})); |
|
|
|
serviceOption=initNonGUIOption( OPTION("","service",[]{return "";})); |
|
|
|
|
|
|
|
|
|
|
|
logFileNameOption=initFileChooser( OPTION("","logfile",[]{return "";}), ui->logFileLineEdit, ui->logFileBrowsePushButton); |
|
|
|
uiSettings->logDestinationComboBox->clear(); |
|
|
|
initLogLevelCombobox(OPTION("","loglevel",[]{return "";}), ui->logLevelComboBox); |
|
|
|
uiSettings->logDestinationComboBox->insertItems(0, QStringList() |
|
|
|
|
|
|
|
<< QApplication::translate("MainWindow", "stdout", 0) |
|
|
|
|
|
|
|
<< QApplication::translate("MainWindow", "file", 0) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
initLogDestinationCombobox( OPTION("","log",[]{return "";}), uiSettings->logDestinationComboBox); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logFileNameOption=initFileChooser( OPTION("","logfile",[]{return "";}), uiSettings->logFileLineEdit, uiSettings->logFileBrowsePushButton); |
|
|
|
|
|
|
|
initLogLevelCombobox(OPTION("","loglevel",[]{return "";}), uiSettings->logLevelComboBox); |
|
|
|
|
|
|
|
|
|
|
|
initIPAddressBox( OPTION("","host",[]{return "";}), ui->routerExternalHostLineEdit, tr("Router external address -> Host")); |
|
|
|
initIPAddressBox( OPTION("","host",[]{return "";}), uiSettings->routerExternalHostLineEdit, tr("Router external address -> Host")); |
|
|
|
initTCPPortBox( OPTION("","port",[]{return "";}), ui->routerExternalPortLineEdit, tr("Router external address -> Port")); |
|
|
|
initTCPPortBox( OPTION("","port",[]{return "";}), uiSettings->routerExternalPortLineEdit, tr("Router external address -> Port")); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("","ipv6",[]{return "false";}), ui->ipv6CheckBox); |
|
|
|
initCheckBox( OPTION("","ipv6",[]{return "false";}), uiSettings->ipv6CheckBox); |
|
|
|
initCheckBox( OPTION("","notransit",[]{return "false";}), ui->notransitCheckBox); |
|
|
|
initCheckBox( OPTION("","notransit",[]{return "false";}), uiSettings->notransitCheckBox); |
|
|
|
initCheckBox( OPTION("","floodfill",[]{return "false";}), ui->floodfillCheckBox); |
|
|
|
initCheckBox( OPTION("","floodfill",[]{return "false";}), uiSettings->floodfillCheckBox); |
|
|
|
initStringBox( OPTION("","bandwidth",[]{return "";}), ui->bandwidthLineEdit); |
|
|
|
initStringBox( OPTION("","bandwidth",[]{return "";}), uiSettings->bandwidthLineEdit); |
|
|
|
initStringBox( OPTION("","family",[]{return "";}), ui->familyLineEdit); |
|
|
|
initStringBox( OPTION("","family",[]{return "";}), uiSettings->familyLineEdit); |
|
|
|
initIntegerBox( OPTION("","netid",[]{return "2";}), ui->netIdLineEdit, tr("NetID")); |
|
|
|
initIntegerBox( OPTION("","netid",[]{return "2";}), uiSettings->netIdLineEdit, tr("NetID")); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN |
|
|
|
#ifdef Q_OS_WIN |
|
|
|
initCheckBox( OPTION("","insomnia",[]{return "";}), ui->insomniaCheckBox); |
|
|
|
initCheckBox( OPTION("","insomnia",[]{return "";}), uiSettings->insomniaCheckBox); |
|
|
|
initNonGUIOption( OPTION("","svcctl",[]{return "";})); |
|
|
|
initNonGUIOption( OPTION("","svcctl",[]{return "";})); |
|
|
|
initNonGUIOption( OPTION("","close",[]{return "";})); |
|
|
|
initNonGUIOption( OPTION("","close",[]{return "";})); |
|
|
|
#else |
|
|
|
#else |
|
|
|
ui->insomniaCheckBox->setEnabled(false); |
|
|
|
uiSettings->insomniaCheckBox->setEnabled(false); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("http","enabled",[]{return "true";}), ui->webconsoleEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("http","enabled",[]{return "true";}), uiSettings->webconsoleEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("http","address",[]{return "";}), ui->webconsoleAddrLineEdit, tr("HTTP webconsole -> IP address")); |
|
|
|
initIPAddressBox( OPTION("http","address",[]{return "";}), uiSettings->webconsoleAddrLineEdit, tr("HTTP webconsole -> IP address")); |
|
|
|
initTCPPortBox( OPTION("http","port",[]{return "7070";}), ui->webconsolePortLineEdit, tr("HTTP webconsole -> Port")); |
|
|
|
initTCPPortBox( OPTION("http","port",[]{return "7070";}), uiSettings->webconsolePortLineEdit, tr("HTTP webconsole -> Port")); |
|
|
|
initCheckBox( OPTION("http","auth",[]{return "";}), ui->webconsoleBasicAuthCheckBox); |
|
|
|
initCheckBox( OPTION("http","auth",[]{return "";}), uiSettings->webconsoleBasicAuthCheckBox); |
|
|
|
initStringBox( OPTION("http","user",[]{return "i2pd";}), ui->webconsoleUserNameLineEditBasicAuth); |
|
|
|
initStringBox( OPTION("http","user",[]{return "i2pd";}), uiSettings->webconsoleUserNameLineEditBasicAuth); |
|
|
|
initStringBox( OPTION("http","pass",[]{return "";}), ui->webconsolePasswordLineEditBasicAuth); |
|
|
|
initStringBox( OPTION("http","pass",[]{return "";}), uiSettings->webconsolePasswordLineEditBasicAuth); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("httpproxy","enabled",[]{return "";}), ui->httpProxyEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("httpproxy","enabled",[]{return "";}), uiSettings->httpProxyEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("httpproxy","address",[]{return "";}), ui->httpProxyAddressLineEdit, tr("HTTP proxy -> IP address")); |
|
|
|
initIPAddressBox( OPTION("httpproxy","address",[]{return "";}), uiSettings->httpProxyAddressLineEdit, tr("HTTP proxy -> IP address")); |
|
|
|
initTCPPortBox( OPTION("httpproxy","port",[]{return "4444";}), ui->httpProxyPortLineEdit, tr("HTTP proxy -> Port")); |
|
|
|
initTCPPortBox( OPTION("httpproxy","port",[]{return "4444";}), uiSettings->httpProxyPortLineEdit, tr("HTTP proxy -> Port")); |
|
|
|
initFileChooser( OPTION("httpproxy","keys",[]{return "";}), ui->httpProxyKeyFileLineEdit, ui->httpProxyKeyFilePushButton); |
|
|
|
initFileChooser( OPTION("httpproxy","keys",[]{return "";}), uiSettings->httpProxyKeyFileLineEdit, uiSettings->httpProxyKeyFilePushButton); |
|
|
|
|
|
|
|
|
|
|
|
initSignatureTypeCombobox(OPTION("httpproxy","signaturetype",[]{return "7";}), ui->comboBox_httpPorxySignatureType); |
|
|
|
initSignatureTypeCombobox(OPTION("httpproxy","signaturetype",[]{return "7";}), uiSettings->comboBox_httpPorxySignatureType); |
|
|
|
initStringBox( OPTION("httpproxy","inbound.length",[]{return "3";}), ui->httpProxyInboundTunnelsLenLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","inbound.length",[]{return "3";}), uiSettings->httpProxyInboundTunnelsLenLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","inbound.quantity",[]{return "5";}), ui->httpProxyInboundTunnQuantityLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","inbound.quantity",[]{return "5";}), uiSettings->httpProxyInboundTunnQuantityLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","outbound.length",[]{return "3";}), ui->httpProxyOutBoundTunnLenLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","outbound.length",[]{return "3";}), uiSettings->httpProxyOutBoundTunnLenLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","outbound.quantity",[]{return "5";}), ui->httpProxyOutboundTunnQuantityLineEdit); |
|
|
|
initStringBox( OPTION("httpproxy","outbound.quantity",[]{return "5";}), uiSettings->httpProxyOutboundTunnQuantityLineEdit); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("socksproxy","enabled",[]{return "";}), ui->socksProxyEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("socksproxy","enabled",[]{return "";}), uiSettings->socksProxyEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("socksproxy","address",[]{return "";}), ui->socksProxyAddressLineEdit, tr("Socks proxy -> IP address")); |
|
|
|
initIPAddressBox( OPTION("socksproxy","address",[]{return "";}), uiSettings->socksProxyAddressLineEdit, tr("Socks proxy -> IP address")); |
|
|
|
initTCPPortBox( OPTION("socksproxy","port",[]{return "4447";}), ui->socksProxyPortLineEdit, tr("Socks proxy -> Port")); |
|
|
|
initTCPPortBox( OPTION("socksproxy","port",[]{return "4447";}), uiSettings->socksProxyPortLineEdit, tr("Socks proxy -> Port")); |
|
|
|
initFileChooser( OPTION("socksproxy","keys",[]{return "";}), ui->socksProxyKeyFileLineEdit, ui->socksProxyKeyFilePushButton); |
|
|
|
initFileChooser( OPTION("socksproxy","keys",[]{return "";}), uiSettings->socksProxyKeyFileLineEdit, uiSettings->socksProxyKeyFilePushButton); |
|
|
|
initSignatureTypeCombobox(OPTION("socksproxy","signaturetype",[]{return "7";}), ui->comboBox_socksProxySignatureType); |
|
|
|
initSignatureTypeCombobox(OPTION("socksproxy","signaturetype",[]{return "7";}), uiSettings->comboBox_socksProxySignatureType); |
|
|
|
initStringBox( OPTION("socksproxy","inbound.length",[]{return "";}), ui->socksProxyInboundTunnelsLenLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","inbound.length",[]{return "";}), uiSettings->socksProxyInboundTunnelsLenLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","inbound.quantity",[]{return "";}), ui->socksProxyInboundTunnQuantityLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","inbound.quantity",[]{return "";}), uiSettings->socksProxyInboundTunnQuantityLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","outbound.length",[]{return "";}), ui->socksProxyOutBoundTunnLenLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","outbound.length",[]{return "";}), uiSettings->socksProxyOutBoundTunnLenLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","outbound.quantity",[]{return "";}), ui->socksProxyOutboundTunnQuantityLineEdit); |
|
|
|
initStringBox( OPTION("socksproxy","outbound.quantity",[]{return "";}), uiSettings->socksProxyOutboundTunnQuantityLineEdit); |
|
|
|
initIPAddressBox( OPTION("socksproxy","outproxy",[]{return "";}), ui->outproxyAddressLineEdit, tr("Socks proxy -> Outproxy address")); |
|
|
|
initIPAddressBox( OPTION("socksproxy","outproxy",[]{return "";}), uiSettings->outproxyAddressLineEdit, tr("Socks proxy -> Outproxy address")); |
|
|
|
initTCPPortBox( OPTION("socksproxy","outproxyport",[]{return "";}), ui->outproxyPortLineEdit, tr("Socks proxy -> Outproxy port")); |
|
|
|
initTCPPortBox( OPTION("socksproxy","outproxyport",[]{return "";}), uiSettings->outproxyPortLineEdit, tr("Socks proxy -> Outproxy port")); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("sam","enabled",[]{return "false";}), ui->samEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("sam","enabled",[]{return "false";}), uiSettings->samEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("sam","address",[]{return "";}), ui->samAddressLineEdit, tr("SAM -> IP address")); |
|
|
|
initIPAddressBox( OPTION("sam","address",[]{return "";}), uiSettings->samAddressLineEdit, tr("SAM -> IP address")); |
|
|
|
initTCPPortBox( OPTION("sam","port",[]{return "7656";}), ui->samPortLineEdit, tr("SAM -> Port")); |
|
|
|
initTCPPortBox( OPTION("sam","port",[]{return "7656";}), uiSettings->samPortLineEdit, tr("SAM -> Port")); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("bob","enabled",[]{return "false";}), ui->bobEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("bob","enabled",[]{return "false";}), uiSettings->bobEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("bob","address",[]{return "";}), ui->bobAddressLineEdit, tr("BOB -> IP address")); |
|
|
|
initIPAddressBox( OPTION("bob","address",[]{return "";}), uiSettings->bobAddressLineEdit, tr("BOB -> IP address")); |
|
|
|
initTCPPortBox( OPTION("bob","port",[]{return "2827";}), ui->bobPortLineEdit, tr("BOB -> Port")); |
|
|
|
initTCPPortBox( OPTION("bob","port",[]{return "2827";}), uiSettings->bobPortLineEdit, tr("BOB -> Port")); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("i2cp","enabled",[]{return "false";}), ui->i2cpEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("i2cp","enabled",[]{return "false";}), uiSettings->i2cpEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("i2cp","address",[]{return "";}), ui->i2cpAddressLineEdit, tr("I2CP -> IP address")); |
|
|
|
initIPAddressBox( OPTION("i2cp","address",[]{return "";}), uiSettings->i2cpAddressLineEdit, tr("I2CP -> IP address")); |
|
|
|
initTCPPortBox( OPTION("i2cp","port",[]{return "7654";}), ui->i2cpPortLineEdit, tr("I2CP -> Port")); |
|
|
|
initTCPPortBox( OPTION("i2cp","port",[]{return "7654";}), uiSettings->i2cpPortLineEdit, tr("I2CP -> Port")); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("i2pcontrol","enabled",[]{return "false";}), ui->i2pControlEnabledCheckBox); |
|
|
|
initCheckBox( OPTION("i2pcontrol","enabled",[]{return "false";}), uiSettings->i2pControlEnabledCheckBox); |
|
|
|
initIPAddressBox( OPTION("i2pcontrol","address",[]{return "";}), ui->i2pControlAddressLineEdit, tr("I2PControl -> IP address")); |
|
|
|
initIPAddressBox( OPTION("i2pcontrol","address",[]{return "";}), uiSettings->i2pControlAddressLineEdit, tr("I2PControl -> IP address")); |
|
|
|
initTCPPortBox( OPTION("i2pcontrol","port",[]{return "7650";}), ui->i2pControlPortLineEdit, tr("I2PControl -> Port")); |
|
|
|
initTCPPortBox( OPTION("i2pcontrol","port",[]{return "7650";}), uiSettings->i2pControlPortLineEdit, tr("I2PControl -> Port")); |
|
|
|
initStringBox( OPTION("i2pcontrol","password",[]{return "";}), ui->i2pControlPasswordLineEdit); |
|
|
|
initStringBox( OPTION("i2pcontrol","password",[]{return "";}), uiSettings->i2pControlPasswordLineEdit); |
|
|
|
initFileChooser( OPTION("i2pcontrol","cert",[]{return "i2pcontrol.crt.pem";}), ui->i2pControlCertFileLineEdit, ui->i2pControlCertFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("i2pcontrol","cert",[]{return "i2pcontrol.crt.pem";}), uiSettings->i2pControlCertFileLineEdit, uiSettings->i2pControlCertFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("i2pcontrol","key",[]{return "i2pcontrol.key.pem";}), ui->i2pControlKeyFileLineEdit, ui->i2pControlKeyFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("i2pcontrol","key",[]{return "i2pcontrol.key.pem";}), uiSettings->i2pControlKeyFileLineEdit, uiSettings->i2pControlKeyFileBrowsePushButton); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("upnp","enabled",[]{return "true";}), ui->enableUPnPCheckBox); |
|
|
|
initCheckBox( OPTION("upnp","enabled",[]{return "true";}), uiSettings->enableUPnPCheckBox); |
|
|
|
initStringBox( OPTION("upnp","name",[]{return "I2Pd";}), ui->upnpNameLineEdit); |
|
|
|
initStringBox( OPTION("upnp","name",[]{return "I2Pd";}), uiSettings->upnpNameLineEdit); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("precomputation","elgamal",[]{return "false";}), ui->useElGamalPrecomputedTablesCheckBox); |
|
|
|
initCheckBox( OPTION("precomputation","elgamal",[]{return "false";}), uiSettings->useElGamalPrecomputedTablesCheckBox); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("reseed","verify",[]{return "";}), ui->reseedVerifyCheckBox); |
|
|
|
initCheckBox( OPTION("reseed","verify",[]{return "";}), uiSettings->reseedVerifyCheckBox); |
|
|
|
initFileChooser( OPTION("reseed","file",[]{return "";}), ui->reseedFileLineEdit, ui->reseedFileBrowsePushButton); |
|
|
|
initFileChooser( OPTION("reseed","file",[]{return "";}), uiSettings->reseedFileLineEdit, uiSettings->reseedFileBrowsePushButton); |
|
|
|
initStringBox( OPTION("reseed","urls",[]{return "";}), ui->reseedURLsLineEdit); |
|
|
|
initStringBox( OPTION("reseed","urls",[]{return "";}), uiSettings->reseedURLsLineEdit); |
|
|
|
|
|
|
|
|
|
|
|
initStringBox( OPTION("addressbook","defaulturl",[]{return "";}), ui->addressbookDefaultURLLineEdit); |
|
|
|
initStringBox( OPTION("addressbook","defaulturl",[]{return "";}), uiSettings->addressbookDefaultURLLineEdit); |
|
|
|
initStringBox( OPTION("addressbook","subscriptions",[]{return "";}), ui->addressbookSubscriptionsURLslineEdit); |
|
|
|
initStringBox( OPTION("addressbook","subscriptions",[]{return "";}), uiSettings->addressbookSubscriptionsURLslineEdit); |
|
|
|
|
|
|
|
|
|
|
|
initUInt16Box( OPTION("limits","transittunnels",[]{return "2500";}), ui->maxNumOfTransitTunnelsLineEdit, tr("maxNumberOfTransitTunnels")); |
|
|
|
initUInt16Box( OPTION("limits","transittunnels",[]{return "2500";}), uiSettings->maxNumOfTransitTunnelsLineEdit, tr("maxNumberOfTransitTunnels")); |
|
|
|
initUInt16Box( OPTION("limits","openfiles",[]{return "0";}), ui->maxNumOfOpenFilesLineEdit, tr("maxNumberOfOpenFiles")); |
|
|
|
initUInt16Box( OPTION("limits","openfiles",[]{return "0";}), uiSettings->maxNumOfOpenFilesLineEdit, tr("maxNumberOfOpenFiles")); |
|
|
|
initUInt32Box( OPTION("limits","coresize",[]{return "0";}), ui->coreFileMaxSizeNumberLineEdit, tr("coreFileMaxSize")); |
|
|
|
initUInt32Box( OPTION("limits","coresize",[]{return "0";}), uiSettings->coreFileMaxSizeNumberLineEdit, tr("coreFileMaxSize")); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("trust","enabled",[]{return "false";}), ui->checkBoxTrustEnable); |
|
|
|
initCheckBox( OPTION("trust","enabled",[]{return "false";}), uiSettings->checkBoxTrustEnable); |
|
|
|
initStringBox( OPTION("trust","family",[]{return "";}), ui->lineEditTrustFamily); |
|
|
|
initStringBox( OPTION("trust","family",[]{return "";}), uiSettings->lineEditTrustFamily); |
|
|
|
initStringBox( OPTION("trust","routers",[]{return "";}), ui->lineEditTrustRouters); |
|
|
|
initStringBox( OPTION("trust","routers",[]{return "";}), uiSettings->lineEditTrustRouters); |
|
|
|
initCheckBox( OPTION("trust","hidden",[]{return "false";}), ui->checkBoxTrustHidden); |
|
|
|
initCheckBox( OPTION("trust","hidden",[]{return "false";}), uiSettings->checkBoxTrustHidden); |
|
|
|
|
|
|
|
|
|
|
|
initCheckBox( OPTION("websockets","enabled",[]{return "false";}), ui->checkBoxWebsocketsEnable); |
|
|
|
initCheckBox( OPTION("websockets","enabled",[]{return "false";}), uiSettings->checkBoxWebsocketsEnable); |
|
|
|
initIPAddressBox( OPTION("websockets","address",[]{return "127.0.0.1";}), ui->lineEdit_webSock_addr, tr("Websocket server -> IP address")); |
|
|
|
initIPAddressBox( OPTION("websockets","address",[]{return "127.0.0.1";}), uiSettings->lineEdit_webSock_addr, tr("Websocket server -> IP address")); |
|
|
|
initTCPPortBox( OPTION("websockets","port",[]{return "7666";}), ui->lineEdit_webSock_port, tr("Websocket server -> Port")); |
|
|
|
initTCPPortBox( OPTION("websockets","port",[]{return "7666";}), uiSettings->lineEdit_webSock_port, tr("Websocket server -> Port")); |
|
|
|
|
|
|
|
|
|
|
|
# undef OPTION |
|
|
|
# undef OPTION |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//widgetlocks.add(new widgetlock(widget,lockbtn));
|
|
|
|
|
|
|
|
widgetlocks.add(new widgetlock(uiSettings->logDestinationComboBox,uiSettings->logDestComboEditPushButton)); |
|
|
|
|
|
|
|
widgetlocks.add(new widgetlock(uiSettings->logLevelComboBox,uiSettings->logLevelComboEditPushButton)); |
|
|
|
|
|
|
|
widgetlocks.add(new widgetlock(uiSettings->comboBox_httpPorxySignatureType,uiSettings->httpProxySignTypeComboEditPushButton)); |
|
|
|
|
|
|
|
widgetlocks.add(new widgetlock(uiSettings->comboBox_socksProxySignatureType,uiSettings->socksProxySignTypeComboEditPushButton)); |
|
|
|
|
|
|
|
|
|
|
|
loadAllConfigs(); |
|
|
|
loadAllConfigs(); |
|
|
|
|
|
|
|
|
|
|
|
//tunnelsFormGridLayoutWidget = new QWidget(ui->tunnelsScrollAreaWidgetContents);
|
|
|
|
QObject::connect(uiSettings->logDestinationComboBox, SIGNAL(currentIndexChanged(const QString &)), |
|
|
|
//tunnelsFormGridLayoutWidget->setObjectName(QStringLiteral("tunnelsFormGridLayoutWidget"));
|
|
|
|
this, SLOT(logDestinationComboBoxValueChanged(const QString &))); |
|
|
|
//tunnelsFormGridLayoutWidget->setGeometry(QRect(0, 0, 621, 451));
|
|
|
|
logDestinationComboBoxValueChanged(uiSettings->logDestinationComboBox->currentText()); |
|
|
|
|
|
|
|
|
|
|
|
ui->tunnelsScrollAreaWidgetContents->setGeometry(QRect(0, 0, 621, 451)); |
|
|
|
ui->tunnelsScrollAreaWidgetContents->setGeometry(QRect(0, 0, 621, 451)); |
|
|
|
|
|
|
|
|
|
|
|
appendTunnelForms(""); |
|
|
|
appendTunnelForms(""); |
|
|
|
|
|
|
|
|
|
|
|
ui->configFileLineEdit->setEnabled(false); |
|
|
|
uiSettings->configFileLineEdit->setEnabled(false); |
|
|
|
ui->configFileBrowsePushButton->setEnabled(false); |
|
|
|
uiSettings->configFileBrowsePushButton->setEnabled(false); |
|
|
|
ui->configFileLineEdit->setText(confpath); |
|
|
|
uiSettings->configFileLineEdit->setText(confpath); |
|
|
|
ui->tunnelsConfigFileLineEdit->setText(tunconfpath); |
|
|
|
uiSettings->tunnelsConfigFileLineEdit->setText(tunconfpath); |
|
|
|
|
|
|
|
|
|
|
|
for(QList<MainWindowItem*>::iterator it = configItems.begin(); it!= configItems.end(); ++it) { |
|
|
|
for(QList<MainWindowItem*>::iterator it = configItems.begin(); it!= configItems.end(); ++it) { |
|
|
|
MainWindowItem* item = *it; |
|
|
|
MainWindowItem* item = *it; |
|
|
|
item->installListeners(this); |
|
|
|
item->installListeners(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
QObject::connect(ui->tunnelsConfigFileLineEdit, SIGNAL(textChanged(const QString &)), |
|
|
|
QObject::connect(uiSettings->tunnelsConfigFileLineEdit, SIGNAL(textChanged(const QString &)), |
|
|
|
this, SLOT(reloadTunnelsConfigAndUI())); |
|
|
|
this, SLOT(reloadTunnelsConfigAndUI())); |
|
|
|
|
|
|
|
|
|
|
|
QObject::connect(ui->addServerTunnelPushButton, SIGNAL(released()), this, SLOT(addServerTunnelPushButtonReleased())); |
|
|
|
QObject::connect(ui->addServerTunnelPushButton, SIGNAL(released()), this, SLOT(addServerTunnelPushButtonReleased())); |
|
|
@ -281,6 +293,13 @@ MainWindow::MainWindow(QWidget *parent) : |
|
|
|
//QMetaObject::connectSlotsByName(this);
|
|
|
|
//QMetaObject::connectSlotsByName(this);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::logDestinationComboBoxValueChanged(const QString & text) { |
|
|
|
|
|
|
|
bool stdout = text==QString("stdout"); |
|
|
|
|
|
|
|
uiSettings->logFileLineEdit->setEnabled(!stdout); |
|
|
|
|
|
|
|
uiSettings->logFileBrowsePushButton->setEnabled(!stdout); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::updateRouterCommandsButtons() { |
|
|
|
void MainWindow::updateRouterCommandsButtons() { |
|
|
|
bool acceptsTunnels = i2p::context.AcceptsTunnels (); |
|
|
|
bool acceptsTunnels = i2p::context.AcceptsTunnels (); |
|
|
|
routerCommandsUI->declineTransitTunnelsPushButton->setEnabled(acceptsTunnels); |
|
|
|
routerCommandsUI->declineTransitTunnelsPushButton->setEnabled(acceptsTunnels); |
|
|
@ -518,6 +537,9 @@ void MainWindow::initFolderChooser(ConfigOption option, QLineEdit* folderLineEdi |
|
|
|
configItems.append(new ComboBoxItem(option, comboBox)); |
|
|
|
configItems.append(new ComboBoxItem(option, comboBox)); |
|
|
|
QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveAllConfigs())); |
|
|
|
QObject::connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveAllConfigs())); |
|
|
|
}*/ |
|
|
|
}*/ |
|
|
|
|
|
|
|
void MainWindow::initLogDestinationCombobox(ConfigOption option, QComboBox* comboBox){ |
|
|
|
|
|
|
|
configItems.append(new LogDestinationComboBoxItem(option, comboBox)); |
|
|
|
|
|
|
|
} |
|
|
|
void MainWindow::initLogLevelCombobox(ConfigOption option, QComboBox* comboBox){ |
|
|
|
void MainWindow::initLogLevelCombobox(ConfigOption option, QComboBox* comboBox){ |
|
|
|
configItems.append(new LogLevelComboBoxItem(option, comboBox)); |
|
|
|
configItems.append(new LogLevelComboBoxItem(option, comboBox)); |
|
|
|
} |
|
|
|
} |
|
|
@ -572,10 +594,7 @@ void MainWindow::loadAllConfigs(){ |
|
|
|
LogPrint(eLogWarning, "Daemon: please rename i2p.conf to i2pd.conf here: ", config); |
|
|
|
LogPrint(eLogWarning, "Daemon: please rename i2p.conf to i2pd.conf here: ", config); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
config = i2p::fs::DataDirPath("i2pd.conf"); |
|
|
|
config = i2p::fs::DataDirPath("i2pd.conf"); |
|
|
|
if (!i2p::fs::Exists (config)) { |
|
|
|
/*if (!i2p::fs::Exists (config)) {}*/ |
|
|
|
// use i2pd.conf only if exists
|
|
|
|
|
|
|
|
config = ""; /* reset */ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -605,8 +624,8 @@ void MainWindow::loadAllConfigs(){ |
|
|
|
/** returns false iff not valid items present and save was aborted */ |
|
|
|
/** returns false iff not valid items present and save was aborted */ |
|
|
|
bool MainWindow::saveAllConfigs(){ |
|
|
|
bool MainWindow::saveAllConfigs(){ |
|
|
|
programOptionsWriterCurrentSection=""; |
|
|
|
programOptionsWriterCurrentSection=""; |
|
|
|
if(!logFileNameOption->lineEdit->text().trimmed().isEmpty())logOption->optionValue=boost::any(std::string("file")); |
|
|
|
/*if(!logFileNameOption->lineEdit->text().trimmed().isEmpty())logOption->optionValue=boost::any(std::string("file"));
|
|
|
|
else logOption->optionValue=boost::any(std::string("stdout")); |
|
|
|
else logOption->optionValue=boost::any(std::string("stdout"));*/ |
|
|
|
daemonOption->optionValue=boost::any(false); |
|
|
|
daemonOption->optionValue=boost::any(false); |
|
|
|
serviceOption->optionValue=boost::any(false); |
|
|
|
serviceOption->optionValue=boost::any(false); |
|
|
|
|
|
|
|
|
|
|
@ -623,9 +642,10 @@ bool MainWindow::saveAllConfigs(){ |
|
|
|
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
using namespace std; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString backup=confpath+"~"; |
|
|
|
QString backup=confpath+"~"; |
|
|
|
if(QFile::exists(backup)) QFile::remove(backup);//TODO handle errors
|
|
|
|
if(QFile::exists(backup)) QFile::remove(backup);//TODO handle errors
|
|
|
|
QFile::rename(confpath, backup);//TODO handle errors
|
|
|
|
if(QFile::exists(confpath)) QFile::rename(confpath, backup);//TODO handle errors
|
|
|
|
ofstream outfile; |
|
|
|
ofstream outfile; |
|
|
|
outfile.open(confpath.toStdString());//TODO handle errors
|
|
|
|
outfile.open(confpath.toStdString());//TODO handle errors
|
|
|
|
outfile << out.str().c_str(); |
|
|
|
outfile << out.str().c_str(); |
|
|
@ -740,7 +760,7 @@ void MainWindow::SaveTunnelsConfig() { |
|
|
|
|
|
|
|
|
|
|
|
QString backup=tunconfpath+"~"; |
|
|
|
QString backup=tunconfpath+"~"; |
|
|
|
if(QFile::exists(backup)) QFile::remove(backup);//TODO handle errors
|
|
|
|
if(QFile::exists(backup)) QFile::remove(backup);//TODO handle errors
|
|
|
|
QFile::rename(tunconfpath, backup);//TODO handle errors
|
|
|
|
if(QFile::exists(tunconfpath)) QFile::rename(tunconfpath, backup);//TODO handle errors
|
|
|
|
ofstream outfile; |
|
|
|
ofstream outfile; |
|
|
|
outfile.open(tunconfpath.toStdString());//TODO handle errors
|
|
|
|
outfile.open(tunconfpath.toStdString());//TODO handle errors
|
|
|
|
outfile << out.str().c_str(); |
|
|
|
outfile << out.str().c_str(); |
|
|
|