diff --git a/android/gostcoin-qt-android.pro b/android/gostcoin-qt-android.pro index 74f993e..8151b06 100644 --- a/android/gostcoin-qt-android.pro +++ b/android/gostcoin-qt-android.pro @@ -287,7 +287,6 @@ HEADERS += ../src/qt/bitcoingui.h \ ../src/qt/macnotificationhandler.h \ ../src/qt/splashscreen.h \ ../src/qt/showi2paddresses.h \ - ../src/qt/i2poptionswidget.h \ ../src/qt/setupdarknet.h SOURCES += ../src/qt/gostcoin.cpp \ @@ -362,7 +361,6 @@ SOURCES += ../src/qt/gostcoin.cpp \ ../src/txdb.cpp \ ../src/qt/splashscreen.cpp \ ../src/qt/showi2paddresses.cpp \ - ../src/qt/i2poptionswidget.cpp \ ../i2psam/i2psam.cpp \ ../src/qt/setupdarknet.cpp @@ -380,8 +378,7 @@ FORMS += ../src/qt/forms/sendcoinsdialog.ui \ ../src/qt/forms/askpassphrasedialog.ui \ ../src/qt/forms/rpcconsole.ui \ ../src/qt/forms/optionsdialog.ui \ - ../src/qt/forms/showi2paddresses.ui \ - ../src/qt/forms/i2poptionswidget.ui + ../src/qt/forms/showi2paddresses.ui contains(USE_QRCODE, 1) { HEADERS += ../src/qt/qrcodedialog.h diff --git a/gostcoin-qt.pro b/gostcoin-qt.pro index 36fab1a..05ab8ec 100644 --- a/gostcoin-qt.pro +++ b/gostcoin-qt.pro @@ -211,7 +211,6 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/macnotificationhandler.h \ src/qt/splashscreen.h \ src/qt/showi2paddresses.h \ - src/qt/i2poptionswidget.h \ src/qt/setupdarknet.h SOURCES += src/qt/gostcoin.cpp \ @@ -286,7 +285,6 @@ SOURCES += src/qt/gostcoin.cpp \ src/txdb.cpp \ src/qt/splashscreen.cpp \ src/qt/showi2paddresses.cpp \ - src/qt/i2poptionswidget.cpp \ src/qt/setupdarknet.cpp \ i2psam/i2psam.cpp @@ -304,8 +302,7 @@ FORMS += src/qt/forms/sendcoinsdialog.ui \ src/qt/forms/askpassphrasedialog.ui \ src/qt/forms/rpcconsole.ui \ src/qt/forms/optionsdialog.ui \ - src/qt/forms/showi2paddresses.ui \ - src/qt/forms/i2poptionswidget.ui + src/qt/forms/showi2paddresses.ui contains(USE_QRCODE, 1) { HEADERS += src/qt/qrcodedialog.h diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 0467387..36caa90 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -495,7 +495,6 @@ void BitcoinGUI::optionsClicked() return; OptionsDialog dlg; dlg.setModel(clientModel->getOptionsModel()); - dlg.setClientModel(clientModel); dlg.exec(); } diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 2ab322d..91e034f 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -129,36 +129,14 @@ int ClientModel::getNumI2PConnections() const return nI2PNodeCount; } -QString ClientModel::getPublicI2PKey() const -{ - return QString::fromStdString(I2PSession::Instance().getMyDestination().pub); -} - -QString ClientModel::getPrivateI2PKey() const -{ - return QString::fromStdString(I2PSession::Instance().getMyDestination().priv); -} - -bool ClientModel::isI2PAddressGenerated() const -{ - return I2PSession::Instance().getMyDestination().isGenerated; -} - bool ClientModel::isI2POnly() const { return IsI2POnly(); } -QString ClientModel::getB32Address(const QString& destination) const -{ - return QString::fromStdString(I2PSession::GenerateB32AddressFromDestination(destination.toStdString())); -} - -void ClientModel::generateI2PDestination(QString& pub, QString& priv) const +bool ClientModel::isI2PAddressGenerated() const { - const SAM::FullDestination generatedDest = I2PSession::Instance().destGenerate(); - pub = QString::fromStdString(generatedDest.pub); - priv = QString::fromStdString(generatedDest.priv); + return I2PSession::Instance().getMyDestination().isGenerated; } bool ClientModel::isTestNet() const diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 17c559f..6cd803b 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -60,13 +60,8 @@ public: QString formatI2PNativeFullVersion() const; int getNumI2PConnections() const; - - QString getPublicI2PKey() const; - QString getPrivateI2PKey() const; - bool isI2PAddressGenerated() const; bool isI2POnly() const; - QString getB32Address(const QString& destination) const; - void generateI2PDestination(QString& pub, QString& priv) const; + bool isI2PAddressGenerated() const; // I2PSession& getI2PSession() const; // ?? // bool isPermanent diff --git a/src/qt/forms/i2poptionswidget.ui b/src/qt/forms/i2poptionswidget.ui deleted file mode 100644 index 5b116b8..0000000 --- a/src/qt/forms/i2poptionswidget.ui +++ /dev/null @@ -1,698 +0,0 @@ - - - I2POptionsWidget - - - - 0 - 0 - 549 - 371 - - - - Form - - - - - - - - Use I2P only (-onlynet=i2p) - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - http://www.i2p2.i2p/i2cp.html#options - - - <a href="http://www.i2p2.i2p/i2cp.html#options">Help</a> - - - Qt::RichText - - - true - - - Qt::TextBrowserInteraction - - - - - - - - - - - SAM host - - - - - - - - 0 - 0 - - - - 127.0.0.1 - - - - - - - SAM port - - - - - - - 1 - - - 65535 - - - 7656 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Tunnel name - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Gostcoin-client - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Current -I2P-address... - - - - - - - Generate -I2P-address... - - - - - - - - - - - - - I2CP options of inbound tunnels - - - - - - - - inbound.quantity - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 1 - - - 16 - - - 2 - - - - - - - - - - - inbound.length - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 0 - - - 7 - - - 2 - - - - - - - - - - - inbound.lengthVariance - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - -7 - - - 7 - - - - - - - - - - - inbound.backupQuantity - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - inbound.allowZeroHop - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - - - - - - - - - inbound.IPRestriction - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 4 - - - 2 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - I2CP options of outbound tunnels - - - - - - - - outbound.quantity - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 1 - - - 2 - - - - - - - - - - - outbound.length - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 7 - - - 2 - - - - - - - - - - - outbound.lengthVariance - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - -7 - - - 7 - - - - - - - - - - - outbound.backupQuantity - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - outbound.allowZeroHop - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - true - - - - - - - - - - - outbound.IPRestriction - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - 4 - - - 2 - - - - - - - - - - - outbound.priority - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - -25 - - - 25 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - checkBoxUseI2POnly - lineEditSAMHost - spinBoxSAMPort - lineEditTunnelName - pushButtonCurrentI2PAddress - pushButtonGenerateI2PAddress - spinBoxInboundQuantity - spinBoxInboundLength - spinBoxInboundLengthVariance - spinBoxInboundBackupQuality - checkBoxInboundAllowZeroHop - spinBoxInboundIPRestriction - spinBoxOutboundQuantity - spinBoxOutboundLength - spinBoxOutboundLengthVariance - spinBoxOutboundBackupQuantity - checkBoxAllowZeroHop - spinBoxOutboundIPRestriction - spinBoxOutboundPriority - - - - diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 15bdeb8..1006dd3 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 540 - 380 + 650 + 420 @@ -16,12 +16,15 @@ true - + QTabWidget::North + + QTabWidget::Rounded + 0 @@ -325,6 +328,9 @@ The user interface language can be set here. This setting will take effect after restarting Gostcoin. + + Qt::LeftToRight + @@ -388,6 +394,452 @@ + + + &I2P + + + + + + + + Use I2P only (-onlynet=i2p) + + + + + + + Current I2P-address... + + + + + + + Generate I2P-address... + + + + + + + + + + + SAM host + + + + + + + + 0 + 0 + + + + 127.0.0.1 + + + + + + + SAM port + + + + + + + 1 + + + 65535 + + + 7656 + + + + + + + Tunnel name + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Gostcoin-client + + + + + + + + + + + + + I2CP options of inbound tunnels + + + + + + + + quantity + + + + + + + 1 + + + 16 + + + 2 + + + + + + + + + + + length + + + + + + + 0 + + + 7 + + + 2 + + + + + + + + + + + lengthVariance + + + + + + + -7 + + + 7 + + + + + + + + + + + backupQuantity + + + + + + + + + + + + + + allowZeroHop + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + + + + + + + + + IPRestriction + + + + + + + 4 + + + 2 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + I2CP options of outbound tunnels + + + + + + + + quantity + + + + + + + 1 + + + 2 + + + + + + + + + + + length + + + + + + + 7 + + + 2 + + + + + + + + + + + lengthVariance + + + + + + + -7 + + + 7 + + + + + + + + + + + backupQuantity + + + + + + + + + + + + + + allowZeroHop + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + + + + + + + + + IPRestriction + + + + + + + 4 + + + 2 + + + + + + + + + + + priority + + + + + + + -25 + + + 25 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/src/qt/forms/showi2paddresses.ui b/src/qt/forms/showi2paddresses.ui index 0c899d3..4dfd449 100644 --- a/src/qt/forms/showi2paddresses.ui +++ b/src/qt/forms/showi2paddresses.ui @@ -23,7 +23,8 @@ - If you want to use a permanent I2P-address you have to set a 'mydestination' option in the configuration file: + If you want to use a permanent I2P-address you have to set a 'mydestination' option in the configuration file: + true diff --git a/src/qt/i2poptionswidget.cpp b/src/qt/i2poptionswidget.cpp deleted file mode 100644 index e4919d7..0000000 --- a/src/qt/i2poptionswidget.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "i2poptionswidget.h" -#include "ui_i2poptionswidget.h" - -#include "optionsmodel.h" -#include "monitoreddatamapper.h" -#include "showi2paddresses.h" -//#include "i2p.h" -#include "util.h" -#include "clientmodel.h" - - -I2POptionsWidget::I2POptionsWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::I2POptionsWidget), - clientModel(0) -{ - ui->setupUi(this); - - QObject::connect(ui->pushButtonCurrentI2PAddress, SIGNAL(clicked()), this, SLOT(ShowCurrentI2PAddress())); - QObject::connect(ui->pushButtonGenerateI2PAddress, SIGNAL(clicked()), this, SLOT(GenerateNewI2PAddress())); - - QObject::connect(ui->checkBoxAllowZeroHop , SIGNAL(stateChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->checkBoxInboundAllowZeroHop , SIGNAL(stateChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->checkBoxUseI2POnly , SIGNAL(stateChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->lineEditSAMHost , SIGNAL(textChanged(QString)), this, SIGNAL(settingsChanged())); - QObject::connect(ui->lineEditTunnelName , SIGNAL(textChanged(QString)), this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxInboundBackupQuality , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxInboundIPRestriction , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxInboundLength , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxInboundLengthVariance , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxInboundQuantity , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxOutboundBackupQuantity, SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxOutboundIPRestriction , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxOutboundLength , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxOutboundLengthVariance, SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxOutboundPriority , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxOutboundQuantity , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); - QObject::connect(ui->spinBoxSAMPort , SIGNAL(valueChanged(int)) , this, SIGNAL(settingsChanged())); -} - -I2POptionsWidget::~I2POptionsWidget() -{ - delete ui; -} - -void I2POptionsWidget::setMapper(MonitoredDataMapper& mapper) -{ - mapper.addMapping(ui->checkBoxUseI2POnly , OptionsModel::I2PUseI2POnly); - mapper.addMapping(ui->lineEditSAMHost , OptionsModel::I2PSAMHost); - mapper.addMapping(ui->spinBoxSAMPort , OptionsModel::I2PSAMPort); - mapper.addMapping(ui->lineEditTunnelName , OptionsModel::I2PSessionName); - mapper.addMapping(ui->spinBoxInboundQuantity , OptionsModel::I2PInboundQuantity); - mapper.addMapping(ui->spinBoxInboundLength , OptionsModel::I2PInboundLength); - mapper.addMapping(ui->spinBoxInboundLengthVariance , OptionsModel::I2PInboundLengthVariance); - mapper.addMapping(ui->spinBoxInboundBackupQuality , OptionsModel::I2PInboundBackupQuantity); - mapper.addMapping(ui->checkBoxInboundAllowZeroHop , OptionsModel::I2PInboundAllowZeroHop); - mapper.addMapping(ui->spinBoxInboundIPRestriction , OptionsModel::I2PInboundIPRestriction); - mapper.addMapping(ui->spinBoxOutboundQuantity , OptionsModel::I2POutboundQuantity); - mapper.addMapping(ui->spinBoxOutboundLength , OptionsModel::I2POutboundLength); - mapper.addMapping(ui->spinBoxOutboundLengthVariance, OptionsModel::I2POutboundLengthVariance); - mapper.addMapping(ui->spinBoxOutboundBackupQuantity, OptionsModel::I2POutboundBackupQuantity); - mapper.addMapping(ui->checkBoxAllowZeroHop , OptionsModel::I2POutboundAllowZeroHop); - mapper.addMapping(ui->spinBoxOutboundIPRestriction , OptionsModel::I2POutboundIPRestriction); - mapper.addMapping(ui->spinBoxOutboundPriority , OptionsModel::I2POutboundIPRestriction); -} - -void I2POptionsWidget::setModel(ClientModel* model) -{ - clientModel = model; -} - -void I2POptionsWidget::ShowCurrentI2PAddress() -{ - if (clientModel) - { - const QString pub = clientModel->getPublicI2PKey(); - const QString priv = clientModel->getPrivateI2PKey(); - const QString b32 = clientModel->getB32Address(pub); - const QString configFile = QString::fromStdString(GetConfigFile().string()); - - ShowI2PAddresses i2pCurrDialog("Your current I2P-address", pub, priv, b32, configFile, this); - i2pCurrDialog.exec(); - } -} - -void I2POptionsWidget::GenerateNewI2PAddress() -{ - if (clientModel) - { - QString pub, priv; - clientModel->generateI2PDestination(pub, priv); - const QString b32 = clientModel->getB32Address(pub); - const QString configFile = QString::fromStdString(GetConfigFile().string()); - - ShowI2PAddresses i2pCurrDialog("Generated I2P address", pub, priv, b32, configFile, this); - i2pCurrDialog.exec(); - } -} - - diff --git a/src/qt/i2poptionswidget.h b/src/qt/i2poptionswidget.h deleted file mode 100644 index 7e262a5..0000000 --- a/src/qt/i2poptionswidget.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef I2POPTIONSWIDGET_H -#define I2POPTIONSWIDGET_H - -#include - -class MonitoredDataMapper; - -namespace Ui { -class I2POptionsWidget; -} - -class ClientModel; - -class I2POptionsWidget : public QWidget -{ - Q_OBJECT - -public: - explicit I2POptionsWidget(QWidget *parent = 0); - ~I2POptionsWidget(); - - void setMapper(MonitoredDataMapper& mapper); - void setModel(ClientModel* model); - -private: - Ui::I2POptionsWidget *ui; - ClientModel* clientModel; - -private slots: - void ShowCurrentI2PAddress(); - void GenerateNewI2PAddress(); - -signals: - void settingsChanged(); -}; - -#endif // I2POPTIONSWIDGET_H diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 7fc4e6d..dec7dbc 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -6,6 +6,9 @@ #include "netbase.h" #include "optionsmodel.h" +#include "showi2paddresses.h" +#include "util.h" + #include "clientmodel.h" #include @@ -21,8 +24,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) : fRestartWarningDisplayed_Proxy(false), fRestartWarningDisplayed_Lang(false), fProxyIpValid(true), - fRestartWarningDisplayed_I2P(false), - tabI2P(new I2POptionsWidget()) + fRestartWarningDisplayed_I2P(false) { ui->setupUi(this); @@ -37,10 +39,13 @@ OptionsDialog::OptionsDialog(QWidget *parent) : ui->socksVersion->addItem("4", 4); ui->socksVersion->setCurrentIndex(0); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool))); - connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy())); + connect(ui->connectSocks , SIGNAL(toggled(bool)) , ui->proxyIp, SLOT(setEnabled(bool))); + connect(ui->connectSocks , SIGNAL(toggled(bool)) , ui->proxyPort, SLOT(setEnabled(bool))); + connect(ui->connectSocks , SIGNAL(toggled(bool)) , ui->socksVersion, SLOT(setEnabled(bool))); + connect(ui->connectSocks , SIGNAL(clicked(bool)) , this, SLOT(showRestartWarning_Proxy())); + + connect(ui->pushButtonCurrentI2PAddress , SIGNAL(clicked()) , this, SLOT(ShowCurrentI2PAddress())); + connect(ui->pushButtonGenerateI2PAddress , SIGNAL(clicked()) , this, SLOT(GenerateNewI2PAddress())); ui->proxyIp->installEventFilter(this); @@ -93,8 +98,6 @@ OptionsDialog::OptionsDialog(QWidget *parent) : connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton())); /* setup/change UI elements when proxy IP is invalid/valid */ connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool))); - - ui->tabWidget->addTab(tabI2P, QString("I2P")); } OptionsDialog::~OptionsDialog() @@ -118,22 +121,30 @@ void OptionsDialog::setModel(OptionsModel *model) /* update the display unit, to not use the default ("BTC") */ updateDisplayUnit(); - /* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */ + /* warn only when changed by user action (placed here so init via mapper doesn't trigger this) */ connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang())); - QObject::connect(tabI2P, SIGNAL(settingsChanged()), this, SLOT(showRestartWarning_I2P())); + connect(ui->checkBoxAllowZeroHop , SIGNAL(stateChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->checkBoxInboundAllowZeroHop , SIGNAL(stateChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->checkBoxUseI2POnly , SIGNAL(stateChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->lineEditSAMHost , SIGNAL(textChanged(QString)), this, SLOT(showRestartWarning_I2P())); + connect(ui->lineEditTunnelName , SIGNAL(textChanged(QString)), this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxInboundBackupQuality , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxInboundIPRestriction , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxInboundLength , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxInboundLengthVariance , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxInboundQuantity , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxOutboundBackupQuantity, SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxOutboundIPRestriction , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxOutboundLength , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxOutboundLengthVariance, SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxOutboundPriority , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxOutboundQuantity , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); + connect(ui->spinBoxSAMPort , SIGNAL(valueChanged(int)) , this, SLOT(showRestartWarning_I2P())); /* disable apply button after settings are loaded as there is nothing to save */ disableApplyButton(); } -void OptionsDialog::setClientModel(ClientModel* clientModel) -{ - if (clientModel) - { - tabI2P->setModel(clientModel); - } -} - void OptionsDialog::setMapper() { /* Main */ @@ -159,7 +170,24 @@ void OptionsDialog::setMapper() mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses); mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures); - tabI2P->setMapper(*mapper); + /* I2P */ + mapper->addMapping(ui->checkBoxUseI2POnly , OptionsModel::I2PUseI2POnly); + mapper->addMapping(ui->lineEditSAMHost , OptionsModel::I2PSAMHost); + mapper->addMapping(ui->spinBoxSAMPort , OptionsModel::I2PSAMPort); + mapper->addMapping(ui->lineEditTunnelName , OptionsModel::I2PSessionName); + mapper->addMapping(ui->spinBoxInboundQuantity , OptionsModel::I2PInboundQuantity); + mapper->addMapping(ui->spinBoxInboundLength , OptionsModel::I2PInboundLength); + mapper->addMapping(ui->spinBoxInboundLengthVariance , OptionsModel::I2PInboundLengthVariance); + mapper->addMapping(ui->spinBoxInboundBackupQuality , OptionsModel::I2PInboundBackupQuantity); + mapper->addMapping(ui->checkBoxInboundAllowZeroHop , OptionsModel::I2PInboundAllowZeroHop); + mapper->addMapping(ui->spinBoxInboundIPRestriction , OptionsModel::I2PInboundIPRestriction); + mapper->addMapping(ui->spinBoxOutboundQuantity , OptionsModel::I2POutboundQuantity); + mapper->addMapping(ui->spinBoxOutboundLength , OptionsModel::I2POutboundLength); + mapper->addMapping(ui->spinBoxOutboundLengthVariance, OptionsModel::I2POutboundLengthVariance); + mapper->addMapping(ui->spinBoxOutboundBackupQuantity, OptionsModel::I2POutboundBackupQuantity); + mapper->addMapping(ui->checkBoxAllowZeroHop , OptionsModel::I2POutboundAllowZeroHop); + mapper->addMapping(ui->spinBoxOutboundIPRestriction , OptionsModel::I2POutboundIPRestriction); + mapper->addMapping(ui->spinBoxOutboundPriority , OptionsModel::I2POutboundIPRestriction); } void OptionsDialog::enableApplyButton() @@ -263,6 +291,34 @@ void OptionsDialog::showRestartWarning_Lang() } } +void OptionsDialog::ShowCurrentI2PAddress() +{ + if (this->model) + { + const QString pub = this->model->getPublicI2PKey(); + const QString priv = this->model->getPrivateI2PKey(); + const QString b32 = this->model->getB32Address(pub); + const QString configFile = QString::fromStdString(GetConfigFile().string()); + + ShowI2PAddresses i2pCurrDialog("Your current I2P-address", pub, priv, b32, configFile, this); + i2pCurrDialog.exec(); + } +} + +void OptionsDialog::GenerateNewI2PAddress() +{ + if (this->model) + { + QString pub, priv; + this->model->generateI2PDestination(pub, priv); + const QString b32 = this->model->getB32Address(pub); + const QString configFile = QString::fromStdString(GetConfigFile().string()); + + ShowI2PAddresses i2pCurrDialog("Generated I2P address", pub, priv, b32, configFile, this); + i2pCurrDialog.exec(); + } +} + void OptionsDialog::updateDisplayUnit() { if(model) diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h index 49c5754..0cdf1c8 100644 --- a/src/qt/optionsdialog.h +++ b/src/qt/optionsdialog.h @@ -3,8 +3,6 @@ #include -#include "i2poptionswidget.h" - namespace Ui { class OptionsDialog; } @@ -51,8 +49,12 @@ private slots: void updateDisplayUnit(); void handleProxyIpValid(QValidatedLineEdit *object, bool fState); + void ShowCurrentI2PAddress(); + void GenerateNewI2PAddress(); + signals: void proxyIpValid(QValidatedLineEdit *object, bool fValid); + void settingsChanged(); private: Ui::OptionsDialog *ui; @@ -62,7 +64,6 @@ private: bool fRestartWarningDisplayed_Lang; bool fProxyIpValid; bool fRestartWarningDisplayed_I2P; - I2POptionsWidget* tabI2P; }; #endif // OPTIONSDIALOG_H diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index f8c5d48..aaa756d 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -588,3 +588,24 @@ bool OptionsModel::getCoinControlFeatures() return fCoinControlFeatures; } +QString OptionsModel::getPublicI2PKey() const +{ + return QString::fromStdString(I2PSession::Instance().getMyDestination().pub); +} + +QString OptionsModel::getPrivateI2PKey() const +{ + return QString::fromStdString(I2PSession::Instance().getMyDestination().priv); +} + +QString OptionsModel::getB32Address(const QString& destination) const +{ + return QString::fromStdString(I2PSession::GenerateB32AddressFromDestination(destination.toStdString())); +} + +void OptionsModel::generateI2PDestination(QString& pub, QString& priv) const +{ + const SAM::FullDestination generatedDest = I2PSession::Instance().destGenerate(); + pub = QString::fromStdString(generatedDest.pub); + priv = QString::fromStdString(generatedDest.priv); +} diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h index 51b6014..71eb4ad 100644 --- a/src/qt/optionsmodel.h +++ b/src/qt/optionsmodel.h @@ -72,6 +72,11 @@ public: QString getLanguage() { return language; } bool getCoinControlFeatures(); + QString getPublicI2PKey() const; + QString getPrivateI2PKey() const; + QString getB32Address(const QString& destination) const; + void generateI2PDestination(QString& pub, QString& priv) const; + private: int nDisplayUnit; bool bDisplayAddresses; diff --git a/src/qt/res/images/splash.png b/src/qt/res/images/splash.png index 0e64b41..a8ad9b2 100644 Binary files a/src/qt/res/images/splash.png and b/src/qt/res/images/splash.png differ diff --git a/src/qt/res/images/splash_testnet.png b/src/qt/res/images/splash_testnet.png index 167de10..30a5aa0 100644 Binary files a/src/qt/res/images/splash_testnet.png and b/src/qt/res/images/splash_testnet.png differ diff --git a/src/qt/showi2paddresses.cpp b/src/qt/showi2paddresses.cpp index 7ccefa3..ef12064 100644 --- a/src/qt/showi2paddresses.cpp +++ b/src/qt/showi2paddresses.cpp @@ -10,22 +10,16 @@ ShowI2PAddresses::ShowI2PAddresses(const QString& caption, const QString& pub, c ui->pubText->setPlainText(pub); ui->privText->setText("mydestination=" + priv); ui->b32Line->setText(b32); - ui->label->setText(ui->label->text() + "\n" + configFileName); + ui->label->setText(ui->label->text() + configFileName); - QObject::connect(ui->privButton, SIGNAL(clicked()), - ui->privText, SLOT(selectAll())); - QObject::connect(ui->privButton, SIGNAL(clicked()), - ui->privText, SLOT(copy())); + QObject::connect(ui->privButton, SIGNAL(clicked()), ui->privText, SLOT(selectAll())); + QObject::connect(ui->privButton, SIGNAL(clicked()), ui->privText, SLOT(copy())); - QObject::connect(ui->pubButton, SIGNAL(clicked()), - ui->pubText, SLOT(selectAll())); - QObject::connect(ui->pubButton, SIGNAL(clicked()), - ui->pubText, SLOT(copy())); + QObject::connect(ui->pubButton, SIGNAL(clicked()), ui->pubText, SLOT(selectAll())); + QObject::connect(ui->pubButton, SIGNAL(clicked()), ui->pubText, SLOT(copy())); - QObject::connect(ui->b32Button, SIGNAL(clicked()), - ui->b32Line, SLOT(selectAll())); - QObject::connect(ui->b32Button, SIGNAL(clicked()), - ui->b32Line, SLOT(copy())); + QObject::connect(ui->b32Button, SIGNAL(clicked()), ui->b32Line, SLOT(selectAll())); + QObject::connect(ui->b32Button, SIGNAL(clicked()), ui->b32Line, SLOT(copy())); } ShowI2PAddresses::~ShowI2PAddresses() diff --git a/src/util.cpp b/src/util.cpp index 988896b..17ffa83 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1070,10 +1070,10 @@ void PrintExceptionContinue(std::exception* pex, const char* pszThread) boost::filesystem::path GetDefaultDataDir() { namespace fs = boost::filesystem; - // Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin - // Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin - // Mac: ~/Library/Application Support/Bitcoin - // Unix: ~/.bitcoin + // Windows < Vista: C:\Documents and Settings\Username\Application Data\Gostcoin + // Windows >= Vista: C:\Users\Username\AppData\Roaming\Gostcoin + // Mac: ~/Library/Application Support/Gostcoin + // Unix: ~/.gostcoin #ifdef WIN32 // Windows return GetSpecialFolderPath(CSIDL_APPDATA) / "Gostcoin"; @@ -1150,10 +1150,10 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) path = GetDefaultDataDir(); } if (fNetSpecific && GetBoolArg("-testnet", false)) - { - fs::create_directory(path); + { + fs::create_directory(path); path /= "testnet3"; - } + } fs::create_directory(path);