From ea8af8acb36b55cc810e7d54c2946a350a3e0dd8 Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 21 Jun 2017 17:57:14 +0200 Subject: [PATCH] Move Relay setting page to network one. --- retroshare-gui/src/gui/settings/RelayPage.cpp | 281 --------- retroshare-gui/src/gui/settings/RelayPage.h | 61 -- retroshare-gui/src/gui/settings/RelayPage.ui | 416 ------------- .../src/gui/settings/ServerPage.cpp | 230 ++++++- retroshare-gui/src/gui/settings/ServerPage.h | 10 + retroshare-gui/src/gui/settings/ServerPage.ui | 563 +++++++++++++++--- .../src/gui/settings/rsettingswin.cpp | 2 - retroshare-gui/src/retroshare-gui.pro | 3 - 8 files changed, 721 insertions(+), 845 deletions(-) delete mode 100644 retroshare-gui/src/gui/settings/RelayPage.cpp delete mode 100644 retroshare-gui/src/gui/settings/RelayPage.h delete mode 100644 retroshare-gui/src/gui/settings/RelayPage.ui diff --git a/retroshare-gui/src/gui/settings/RelayPage.cpp b/retroshare-gui/src/gui/settings/RelayPage.cpp deleted file mode 100644 index 2927d2ea5..000000000 --- a/retroshare-gui/src/gui/settings/RelayPage.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006 - 2010 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#include "RelayPage.h" - -#include "rshare.h" - -#include - -#include -#include -#include -#include -#include "util/misc.h" - -#include - -RelayPage::RelayPage(QWidget * parent, Qt::WindowFlags flags) - : ConfigPage(parent, flags) -{ - /* Invoke the Qt Designer generated object setup routine */ - ui.setupUi(this); - - QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); - QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); - QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); - QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); - QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); - QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); - - QObject::connect(ui.addPushButton,SIGNAL(clicked()),this,SLOT(addServer())); - QObject::connect(ui.removePushButton,SIGNAL(clicked()),this,SLOT(removeServer())); - QObject::connect(ui.DhtLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(checkKey())); - - QObject::connect(ui.enableCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled())); - QObject::connect(ui.serverCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled())); - - QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); - QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); - QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); - QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); - QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); - QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); - - QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode())); - QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode())); -} - -QString RelayPage::helpText() const -{ - return tr("

  Relays

\ -

By activating relays, you allow your Retroshare node to act as a bridge between Retroshare \ - users who cannot connect directly, e.g. because they're firewalled.

\ -

You may choose to act as a relay by checking enable relay connections, or simply \ - benefit from other peers acting as relay, by checking use relay servers. For the former,\ - you may specify the bandwidth allocated when acting as a relay for friends of you, for friends \ - of your friends, or anyone in the Retroshare network.

\ -

In any case, a Retroshare node acting as a relay cannot see the relayed traffic, since it \ - is encrypted and authenticated by the two relayed nodes.

") ; -} - -void RelayPage::updateTotals() -{ - int nFriends = ui.noFriendSpinBox->value(); - int friendBandwidth = ui.bandFriendSpinBox->value(); - - int nFOF = ui.noFOFSpinBox->value(); - int fofBandwidth = ui.bandFOFSpinBox->value(); - - int nGeneral = ui.noGeneralSpinBox->value(); - int genBandwidth = ui.bandGeneralSpinBox->value(); - - int total = nFriends + nFOF + nGeneral; - - rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_ALL, total, 0); - rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, nFriends, 1024 * friendBandwidth); - rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FOF, nFOF, 1024 * fofBandwidth); - rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth); -} - -/** Saves the changes on this page */ - -void RelayPage::updateRelayMode() -{ - uint32_t relayMode = 0; - if (ui.enableCheckBox->isChecked()) - { - relayMode |= RSDHT_RELAY_ENABLED; - - if (ui.serverCheckBox->isChecked()) - { - relayMode |= RSDHT_RELAY_MODE_ON; - } - else - { - relayMode |= RSDHT_RELAY_MODE_OFF; - } - } - else - { - relayMode |= RSDHT_RELAY_MODE_OFF; - } - - rsDht->setRelayMode(relayMode); -} - - /** Loads the settings for this page */ -void RelayPage::load() -{ - uint32_t count; - uint32_t bandwidth; - rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, count, bandwidth); - whileBlocking(ui.noFriendSpinBox)->setValue(count); - whileBlocking(ui.bandFriendSpinBox)->setValue(bandwidth / 1024); - - rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FOF, count, bandwidth); - whileBlocking(ui.noFOFSpinBox)->setValue(count); - whileBlocking(ui.bandFOFSpinBox)->setValue(bandwidth / 1024); - - rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, count, bandwidth); - whileBlocking(ui.noGeneralSpinBox)->setValue(count); - whileBlocking(ui.bandGeneralSpinBox)->setValue(bandwidth / 1024); - - updateTotals(); - - - uint32_t relayMode = rsDht->getRelayMode(); - if (relayMode & RSDHT_RELAY_ENABLED) - { - whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Checked); - if ((relayMode & RSDHT_RELAY_MODE_MASK) == RSDHT_RELAY_MODE_OFF) - { - whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked); - } - else - { - whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Checked); - } - } - else - { - whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Unchecked); - whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked); - } - - loadServers(); - updateRelayOptions(); - updateEnabled(); - checkKey(); -} - -void RelayPage::loadServers() -{ - std::list servers; - std::list::iterator it; - - rsDht->getRelayServerList(servers); - - ui.serverTreeWidget->clear(); - for(it = servers.begin(); it != servers.end(); ++it) - { - QTreeWidgetItem *item = new QTreeWidgetItem(); - item->setData(0, Qt::DisplayRole, QString::fromStdString(*it)); - ui.serverTreeWidget->addTopLevelItem(item); - } -} - - - -void RelayPage::updateRelayOptions() -{ - int nFriends = ui.noFriendSpinBox->value(); - int friendBandwidth = ui.bandFriendSpinBox->value(); - - int nFOF = ui.noFOFSpinBox->value(); - int fofBandwidth = ui.bandFOFSpinBox->value(); - - int nGeneral = ui.noGeneralSpinBox->value(); - int genBandwidth = ui.bandGeneralSpinBox->value(); - - ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2)); - ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2)); - ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2)); - ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2)); - ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral)); -} - -void RelayPage::updateEnabled() -{ - std::cerr << "RelayPage::updateEnabled()" << std::endl; - - if (ui.enableCheckBox->isChecked()) - { - ui.relayOptionGBox->setEnabled(true); - if (ui.serverCheckBox->isChecked()) - { - std::cerr << "RelayPage::updateEnabled() Both Enabled" << std::endl; - ui.serverGroupBox->setEnabled(true); - } - else - { - std::cerr << "RelayPage::updateEnabled() Options Only Enabled" << std::endl; - ui.serverGroupBox->setEnabled(false); - } - } - else - { - std::cerr << "RelayPage::updateEnabled() Both Disabled" << std::endl; - ui.relayOptionGBox->setEnabled(false); - ui.serverGroupBox->setEnabled(false); - } - -} - - -void RelayPage::checkKey() -{ - - std::string server = ui.DhtLineEdit->text().toStdString(); - std::cerr << "RelayPage::checkKey() length: " << server.length(); - std::cerr << std::endl; - if (server.length() == 40) - { - ui.keyOkBox->setChecked(Qt::Checked); - } - else - { - ui.keyOkBox->setChecked(Qt::Unchecked); - } -} - - -void RelayPage::addServer() -{ - std::cerr << "RelayPage::addServer()"; - std::cerr << std::endl; - - if (!ui.keyOkBox->isChecked()) - { - return; - } - - std::string server = ui.DhtLineEdit->text().toStdString(); - - bool ok = rsDht->addRelayServer(server); - if (ok) - { - ui.DhtLineEdit->setText(QString("")); - } - loadServers(); -} - -void RelayPage::removeServer() -{ - QTreeWidgetItem *item = ui.serverTreeWidget->currentItem(); - if (item) - { - std::string server = item->data(0, Qt::DisplayRole).toString().toStdString(); - rsDht->removeRelayServer(server); - } - - loadServers(); -} diff --git a/retroshare-gui/src/gui/settings/RelayPage.h b/retroshare-gui/src/gui/settings/RelayPage.h deleted file mode 100644 index 5c8036926..000000000 --- a/retroshare-gui/src/gui/settings/RelayPage.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************** - * RetroShare is distributed under the following license: - * - * Copyright (C) 2006 - 2010 RetroShare Team - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - ****************************************************************/ - -#ifndef RELAYPAGE_H -#define RELAYPAGE_H - -# include - -#include -#include "ui_RelayPage.h" - -class RelayPage: public ConfigPage -{ - Q_OBJECT - - public: - RelayPage(QWidget * parent = 0, Qt::WindowFlags flags = 0); - ~RelayPage() {} - - /** Loads the settings for this page */ - virtual void load(); - - virtual QPixmap iconPixmap() const { return QPixmap(":/icons/settings/server.svg") ; } - virtual QString pageName() const { return tr("Relay") ; } - virtual QString helpText() const ; - - public slots: - void updateRelayOptions(); - void updateEnabled(); - void checkKey(); - void addServer(); - void removeServer(); - void loadServers(); - void updateTotals(); - void updateRelayMode(); - - private: - - Ui::RelayPage ui; -}; - -#endif //RELAYPAGE_H - diff --git a/retroshare-gui/src/gui/settings/RelayPage.ui b/retroshare-gui/src/gui/settings/RelayPage.ui deleted file mode 100644 index d5df50626..000000000 --- a/retroshare-gui/src/gui/settings/RelayPage.ui +++ /dev/null @@ -1,416 +0,0 @@ - - - RelayPage - - - - 0 - 0 - 794 - 546 - - - - - - - - - Enable Relay Connections - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Use Relay Servers - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - true - - - Relay options - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Qt::Horizontal - - - - 110 - 20 - - - - - - - - Number - - - - - - - Qt::Horizontal - - - - 6 - 20 - - - - - - - - Bandwidth per link - - - - - - - Qt::Vertical - - - - - - - Total Bandwidth - - - - - - - Friends - - - - - - - 0 - - - 99 - - - 0 - - - - - - - x - - - - - - - kB/s - - - 1 - - - 100 - - - - - - - Qt::NoFocus - - - true - - - - - - - Friends of Friends - - - - - - - 1 - - - - - - - x - - - - - - - kB/s - - - 1 - - - 100 - - - - - - - Qt::NoFocus - - - true - - - - - - - General - - - - - - - 1 - - - - - - - x - - - - - - - kB/s - - - 1 - - - 100 - - - - - - - Qt::NoFocus - - - true - - - - - - - Qt::Horizontal - - - - - - - Total: - - - - - - - Qt::WheelFocus - - - true - - - - - - - Qt::Horizontal - - - - 123 - 20 - - - - - - - - Qt::NoFocus - - - true - - - - - - - - 0 - 0 - - - - border: 1px solid #DCDC41; - border-radius: 6px; - background: #FFFFD7; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2); - - - - Warning: This bandwidth adds up to the max bandwidth. - - - - - - - - - - Relay Server Setup - - - - - - HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH - - - - - - - - - - false - - - - - - true - - - - - - - Add Server - - - - - - - - Server DHT Key - - - - - - - - Remove Server - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index b33506c6b..7df4d2662 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -29,10 +29,11 @@ #include +#include #include +#include #include #include -#include #include #include @@ -170,6 +171,32 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) connect(ui.totalDownloadRate,SIGNAL(valueChanged(int)),this,SLOT(saveRates())); connect(ui.totalUploadRate, SIGNAL(valueChanged(int)),this,SLOT(saveRates())); + + //Relay Tab + QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); + QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); + QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); + QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); + QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); + QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateRelayOptions())); + + QObject::connect(ui.addPushButton,SIGNAL(clicked()),this,SLOT(addServer())); + QObject::connect(ui.removePushButton,SIGNAL(clicked()),this,SLOT(removeServer())); + QObject::connect(ui.DhtLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(checkKey())); + + QObject::connect(ui.enableCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled())); + QObject::connect(ui.serverCheckBox,SIGNAL(stateChanged(int)),this,SLOT(updateEnabled())); + + QObject::connect(ui.noFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); + QObject::connect(ui.bandFriendSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); + QObject::connect(ui.noFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); + QObject::connect(ui.bandFOFSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); + QObject::connect(ui.noGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); + QObject::connect(ui.bandGeneralSpinBox,SIGNAL(valueChanged(int)),this,SLOT(updateTotals())); + + QObject::connect(ui.enableCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode())); + QObject::connect(ui.serverCheckBox,SIGNAL(toggled(bool)),this,SLOT(updateRelayMode())); + } void ServerPage::saveAndTestInProxy() @@ -373,6 +400,49 @@ void ServerPage::load() updateOutProxyIndicator(); } + + //Relay Tab + uint32_t count; + uint32_t bandwidth; + rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, count, bandwidth); + whileBlocking(ui.noFriendSpinBox)->setValue(count); + whileBlocking(ui.bandFriendSpinBox)->setValue(bandwidth / 1024); + + rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_FOF, count, bandwidth); + whileBlocking(ui.noFOFSpinBox)->setValue(count); + whileBlocking(ui.bandFOFSpinBox)->setValue(bandwidth / 1024); + + rsDht->getRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, count, bandwidth); + whileBlocking(ui.noGeneralSpinBox)->setValue(count); + whileBlocking(ui.bandGeneralSpinBox)->setValue(bandwidth / 1024); + + updateTotals(); + + + uint32_t relayMode = rsDht->getRelayMode(); + if (relayMode & RSDHT_RELAY_ENABLED) + { + whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Checked); + if ((relayMode & RSDHT_RELAY_MODE_MASK) == RSDHT_RELAY_MODE_OFF) + { + whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked); + } + else + { + whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Checked); + } + } + else + { + whileBlocking(ui.enableCheckBox)->setCheckState(Qt::Unchecked); + whileBlocking(ui.serverCheckBox)->setCheckState(Qt::Unchecked); + } + + loadServers(); + updateRelayOptions(); + updateEnabled(); + checkKey(); + } void ServerPage::toggleAutoIncludeFriends(bool b) @@ -1732,3 +1802,161 @@ void ServerPage::handleNetworkReply(QNetworkReply *reply) reply->close(); } + +//##################################################################### +//## Relay Tab +//##################################################################### + +void ServerPage::updateTotals() +{ + int nFriends = ui.noFriendSpinBox->value(); + int friendBandwidth = ui.bandFriendSpinBox->value(); + + int nFOF = ui.noFOFSpinBox->value(); + int fofBandwidth = ui.bandFOFSpinBox->value(); + + int nGeneral = ui.noGeneralSpinBox->value(); + int genBandwidth = ui.bandGeneralSpinBox->value(); + + int total = nFriends + nFOF + nGeneral; + + rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_ALL, total, 0); + rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FRIENDS, nFriends, 1024 * friendBandwidth); + rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_FOF, nFOF, 1024 * fofBandwidth); + rsDht->setRelayAllowance(RSDHT_RELAY_CLASS_GENERAL, nGeneral, 1024 * genBandwidth); +} + +/** Saves the changes on this page */ + +void ServerPage::updateRelayMode() +{ + uint32_t relayMode = 0; + if (ui.enableCheckBox->isChecked()) + { + relayMode |= RSDHT_RELAY_ENABLED; + + if (ui.serverCheckBox->isChecked()) + { + relayMode |= RSDHT_RELAY_MODE_ON; + } + else + { + relayMode |= RSDHT_RELAY_MODE_OFF; + } + } + else + { + relayMode |= RSDHT_RELAY_MODE_OFF; + } + + rsDht->setRelayMode(relayMode); +} + +void ServerPage::loadServers() +{ + std::list servers; + std::list::iterator it; + + rsDht->getRelayServerList(servers); + + ui.serverTreeWidget->clear(); + for(it = servers.begin(); it != servers.end(); ++it) + { + QTreeWidgetItem *item = new QTreeWidgetItem(); + item->setData(0, Qt::DisplayRole, QString::fromStdString(*it)); + ui.serverTreeWidget->addTopLevelItem(item); + } +} + +void ServerPage::updateRelayOptions() +{ + int nFriends = ui.noFriendSpinBox->value(); + int friendBandwidth = ui.bandFriendSpinBox->value(); + + int nFOF = ui.noFOFSpinBox->value(); + int fofBandwidth = ui.bandFOFSpinBox->value(); + + int nGeneral = ui.noGeneralSpinBox->value(); + int genBandwidth = ui.bandGeneralSpinBox->value(); + + ui.totalFriendLineEdit->setText(QString::number(nFriends * friendBandwidth * 2)); + ui.totalFOFLineEdit->setText(QString::number(nFOF * fofBandwidth * 2)); + ui.totalGeneralLineEdit->setText(QString::number(nGeneral * genBandwidth * 2)); + ui.totalBandwidthLineEdit->setText(QString::number((nFriends * friendBandwidth + nFOF * fofBandwidth + nGeneral * genBandwidth) * 2)); + ui.noTotalLineEdit->setText(QString::number(nFriends + nFOF + nGeneral)); +} + +void ServerPage::updateEnabled() +{ + std::cerr << "RelayPage::updateEnabled()" << std::endl; + + if (ui.enableCheckBox->isChecked()) + { + ui.relayOptionGBox->setEnabled(true); + if (ui.serverCheckBox->isChecked()) + { + std::cerr << "RelayPage::updateEnabled() Both Enabled" << std::endl; + ui.serverGroupBox->setEnabled(true); + } + else + { + std::cerr << "RelayPage::updateEnabled() Options Only Enabled" << std::endl; + ui.serverGroupBox->setEnabled(false); + } + } + else + { + std::cerr << "RelayPage::updateEnabled() Both Disabled" << std::endl; + ui.relayOptionGBox->setEnabled(false); + ui.serverGroupBox->setEnabled(false); + } + +} + +void ServerPage::checkKey() +{ + + std::string server = ui.DhtLineEdit->text().toStdString(); + std::cerr << "RelayPage::checkKey() length: " << server.length(); + std::cerr << std::endl; + if (server.length() == 40) + { + ui.keyOkBox->setChecked(Qt::Checked); + } + else + { + ui.keyOkBox->setChecked(Qt::Unchecked); + } +} + +void ServerPage::addServer() +{ + std::cerr << "RelayPage::addServer()"; + std::cerr << std::endl; + + if (!ui.keyOkBox->isChecked()) + { + return; + } + + std::string server = ui.DhtLineEdit->text().toStdString(); + + bool ok = rsDht->addRelayServer(server); + if (ok) + { + ui.DhtLineEdit->setText(QString("")); + } + loadServers(); +} + +void ServerPage::removeServer() +{ + QTreeWidgetItem *item = ui.serverTreeWidget->currentItem(); + if (item) + { + std::string server = item->data(0, Qt::DisplayRole).toString().toStdString(); + rsDht->removeRelayServer(server); + } + + loadServers(); +} diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h index 767c45cf8..87f13400c 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.h +++ b/retroshare-gui/src/gui/settings/ServerPage.h @@ -114,6 +114,16 @@ private slots: void connectionWithoutCert(); + //Relay Tab + void updateRelayOptions(); + void updateEnabled(); + void checkKey(); + void addServer(); + void removeServer(); + void loadServers(); + void updateTotals(); + void updateRelayMode(); + // autoProxyCallback interface public: void taskFinished(taskTicket *&ticket); diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui index 59ee31a8e..2c5d31ebb 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.ui +++ b/retroshare-gui/src/gui/settings/ServerPage.ui @@ -811,7 +811,7 @@ behind a firewall or a VPN. Hidden Service Configuration - + @@ -827,7 +827,7 @@ behind a firewall or a VPN. Outgoing Manual Tor/I2P - + @@ -836,7 +836,7 @@ behind a firewall or a VPN. - + @@ -996,9 +996,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why Automatic I2P/BOB - + - + @@ -1007,7 +1007,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + Qt::Horizontal @@ -1036,9 +1036,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why I2P Basic Open Bridge - + - + 0 @@ -1046,74 +1046,70 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why 0 - + + + I2P Instance address + + + + + + + + 0 + 0 + + + + 127.0.0.1 + + + + + + + I2P proxy port + + + + + + + 10 + + + 65535 + + + + + - + - I2P Instance address + + + + :/images/ledoff1.png - - - - 0 - 0 - + + + <html><head/><body><p>This led is green when the port listen on the left is active on your computer. It does not</p><p>mean that your Retroshare traffic transits though I2P. It will do so only if </p><p>you connect to Hidden nodes, or if you are running a Hidden node yourself.</p></body></html> - - 127.0.0.1 - - - - - - I2P proxy port + BOB accessible - - - - 10 - - - 65535 - - - - - - - - - - - - :/images/ledoff1.png - - - - - - - <html><head/><body><p>This led is green when the port listen on the left is active on your computer. It does not</p><p>mean that your Retroshare traffic transits though I2P. It will do so only if </p><p>you connect to Hidden nodes, or if you are running a Hidden node yourself.</p></body></html> - - - BOB accessible - - - - - - + @@ -1161,10 +1157,10 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why true - 0 + 1 - - + + @@ -1193,14 +1189,14 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - - + + - + - + - + Tunnel length (in/out) @@ -1241,9 +1237,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + - + Tunnel quantity (in/out) @@ -1290,9 +1286,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + - + Tunnel variance (in/out) @@ -1338,11 +1334,11 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + - + - + 0 @@ -1355,7 +1351,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + Qt::Horizontal @@ -1399,9 +1395,9 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + - + Qt::Horizontal @@ -1457,7 +1453,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + Qt::Vertical @@ -1475,7 +1471,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why Incoming - + @@ -1548,7 +1544,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why - + @@ -1673,6 +1669,411 @@ If you have issues connecting over Tor check the Tor logs too. + + + Relay + + + + + + + + Enable Relay Connections + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Use Relay Servers + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + Relay options + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 110 + 20 + + + + + + + + Number + + + + + + + Qt::Horizontal + + + + 6 + 20 + + + + + + + + Bandwidth per link + + + + + + + Qt::Vertical + + + + + + + Total Bandwidth + + + + + + + Friends + + + + + + + 0 + + + 99 + + + 0 + + + + + + + x + + + + + + + kB/s + + + 1 + + + 100 + + + + + + + Qt::NoFocus + + + true + + + + + + + Friends of Friends + + + + + + + 1 + + + + + + + x + + + + + + + kB/s + + + 1 + + + 100 + + + + + + + Qt::NoFocus + + + true + + + + + + + General + + + + + + + 1 + + + + + + + x + + + + + + + kB/s + + + 1 + + + 100 + + + + + + + Qt::NoFocus + + + true + + + + + + + Qt::Horizontal + + + + + + + Total: + + + + + + + Qt::WheelFocus + + + true + + + + + + + Qt::Horizontal + + + + 123 + 20 + + + + + + + + Qt::NoFocus + + + true + + + + + + + + 0 + 0 + + + + border: 1px solid #DCDC41; + border-radius: 6px; + background: #FFFFD7; + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2); + + + + Warning: This bandwidth adds up to the max bandwidth. + + + + + + + + + + Relay Server Setup + + + + + + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH + + + + + + + + + + false + + + + + + true + + + + + + + Add Server + + + + + + + + Server DHT Key + + + + + + + + Remove Server + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 716c6777f..3a7df34c9 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -32,7 +32,6 @@ #include "FileAssociationsPage.h" #include "SoundPage.h" #include "TransferPage.h" -#include "RelayPage.h" #include "ChatPage.h" #include "ChannelPage.h" #include "PeoplePage.h" @@ -156,7 +155,6 @@ SettingsPage::initStackedWidget() addPage(new ForumPage()); // FORUMS addPage(new PostedPage()); // POSTED RENAME TO LINKS addPage(new NotifyPage()); // NOTIFY - addPage(new RelayPage() ); // RELAY SHOUD BE INSIDE NETWORK AS A TAB addPage(new PluginsPage() ); // PLUGINS addPage(new AppearancePage()); // APPEARENCE addPage(new SoundPage() ); // SOUND diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index b0280c686..7c0e24d72 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -460,7 +460,6 @@ HEADERS += rshare.h \ gui/settings/ChatPage.h \ gui/settings/ChannelPage.h \ gui/settings/PostedPage.h \ - gui/settings/RelayPage.h \ gui/settings/ServicePermissionsPage.h \ gui/settings/AddFileAssociationDialog.h \ gui/settings/GroupFrameSettingsWidget.h \ @@ -643,7 +642,6 @@ FORMS += gui/StartDialog.ui \ gui/settings/ChatPage.ui \ gui/settings/ChannelPage.ui \ gui/settings/PostedPage.ui \ - gui/settings/RelayPage.ui \ gui/settings/ServicePermissionsPage.ui \ gui/settings/PluginItem.ui \ gui/settings/GroupFrameSettingsWidget.ui \ @@ -870,7 +868,6 @@ SOURCES += main.cpp \ gui/settings/ChatPage.cpp \ gui/settings/ChannelPage.cpp \ gui/settings/PostedPage.cpp \ - gui/settings/RelayPage.cpp \ gui/settings/ServicePermissionsPage.cpp \ gui/settings/AddFileAssociationDialog.cpp \ gui/settings/GroupFrameSettingsWidget.cpp \