disable nat/dht indicators for hidden mode, hide irrelevant network options elements

This commit is contained in:
RetroPooh 2017-10-23 11:42:03 +03:00
parent b6f102cabb
commit 78037a66be
6 changed files with 60 additions and 14 deletions

View File

@ -141,6 +141,7 @@
#define IMAGE_BLOGS ":/images/kblogger.png"
#define IMAGE_DHT ":/images/dht16.png"
/*static*/ bool MainWindow::hiddenmode = false;
/*static*/ MainWindow *MainWindow::_instance = NULL;
@ -182,8 +183,10 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
RsPeerDetails pd;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd)) {
nameAndLocation = QString("%1 (%2)").arg(QString::fromUtf8(pd.name.c_str())).arg(QString::fromUtf8(pd.location.c_str()));
if(pd.netMode == RS_NETMODE_HIDDEN)
hiddenmode = true;
}
setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(Rshare::retroshareVersion(true)) + " - " + nameAndLocation);
connect(rApp, SIGNAL(newArgsReceived(QStringList)), this, SLOT(receiveNewArgs(QStringList)));
@ -241,13 +244,17 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
statusBar()->addWidget(peerstatus);
natstatus = new NATStatus();
natstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
if(hiddenmode) natstatus->setVisible(false);
else natstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
statusBar()->addWidget(natstatus);
natstatus->getNATStatus();
dhtstatus = new DHTStatus();
dhtstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
if(hiddenmode) dhtstatus->setVisible(false);
else dhtstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
statusBar()->addWidget(dhtstatus);
dhtstatus->getDHTStatus();
hashingstatus = new HashingStatus();
hashingstatus->setVisible(Settings->valueFromGroup("StatusBar", "ShowHashing", QVariant(true)).toBool());
statusBar()->addPermanentWidget(hashingstatus, 1);
@ -702,11 +709,14 @@ void MainWindow::updateStatus()
if (ratesstatus)
ratesstatus->getRatesStatus(downKb, upKb);
if(!hiddenmode)
{
if (natstatus)
natstatus->getNATStatus();
if (dhtstatus)
dhtstatus->getDHTStatus();
}
if (discstatus) {
discstatus->update();
@ -1576,10 +1586,13 @@ void MainWindow::setCompactStatusMode(bool compact)
//statusComboBox: TODO Show only icon
peerstatus->setCompactMode(compact);
updateFriends();
if(!hiddenmode)
{
natstatus->setCompactMode(compact);
natstatus->getNATStatus();
dhtstatus->setCompactMode(compact);
dhtstatus->getDHTStatus();
}
hashingstatus->setCompactMode(compact);
ratesstatus->setCompactMode(compact);
//opModeStatus: TODO Show only ???

View File

@ -184,6 +184,8 @@ public:
ToasterDisable *toasterDisableInstance();
SysTrayStatus *sysTrayStatusInstance();
static bool hiddenmode;
public slots:
void receiveNewArgs(QStringList args);
void displayErrorMessage(int,int,const QString&) ;

View File

@ -301,8 +301,15 @@ void AppearancePage::load()
whileBlocking(ui.checkBoxDisableSysTrayToolTip)->setChecked(Settings->valueFromGroup("StatusBar", "DisableSysTrayToolTip", QVariant(false)).toBool());
whileBlocking(ui.checkBoxShowStatusStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowStatus", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowPeerStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowPeer", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowNATStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowDHTStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
if(MainWindow::hiddenmode) {
whileBlocking(ui.checkBoxShowNATStatus)-> setChecked(0);
whileBlocking(ui.checkBoxShowDHTStatus)-> setChecked(0);
ui.checkBoxShowNATStatus->setVisible(false);
ui.checkBoxShowDHTStatus->setVisible(false);
} else {
whileBlocking(ui.checkBoxShowNATStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowDHTStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
}
whileBlocking(ui.checkBoxShowHashingStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowHashing", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowDiscStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDisc", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowRateStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowRate", QVariant(true)).toBool());

View File

@ -303,7 +303,8 @@ void ServerPage::load()
if (mIsHiddenNode)
{
mHiddenType = detail.hiddenType;
ui.tabWidget->setTabEnabled(1,false) ;
ui.tabWidget->setTabEnabled(1,false) ; // ip filter
ui.tabWidget->setTabEnabled(3,false) ; // relay
loadHiddenNode();
return;
}
@ -1004,10 +1005,24 @@ void ServerPage::loadHiddenNode()
ui.iconlabel_upnp->hide();
ui.label_nat->hide();
ui.label_warningBandwidth->hide();
ui.iconlabel_netLimited->hide();
ui.textlabel_netLimited->hide();
ui.iconlabel_ext->hide();
ui.textlabel_ext->hide();
ui.extPortLabel->hide();
ui.ipAddressLabel->hide();
ui.cleanKnownIPs_PB->hide();
ui.ipAddressList->hide();
ui.allowIpDeterminationCB->hide();
ui.IPServersLV->hide();
ui.textlabel_hiddenMode->show();
ui.iconlabel_hiddenMode->show() ;
ui.iconlabel_hiddenMode->setPixmap(QPixmap(":/images/ledon1.png"));
// CHANGE OPTIONS ON
whileBlocking(ui.discComboBox)->removeItem(3);
whileBlocking(ui.discComboBox)->removeItem(2);

View File

@ -831,7 +831,7 @@ behind a firewall or a VPN.</string>
<item>
<widget class="QLabel" name="hiddenpage_outHeader">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Outgoing Connctions&lt;/p&gt;&lt;p&gt;Configure your Tor and I2P SOCKS proxy here. &lt;br/&gt;If you prefer to use BOB to automatically manage I2P check the other tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Configure your Tor and I2P SOCKS proxy here. &lt;br/&gt;If you prefer to use BOB to automatically manage I2P check the other tab.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -1475,7 +1475,7 @@ You can connect to Hidden Nodes, even if you are running a standard Node, so why
<item>
<widget class="QLabel" name="hiddenpage_inHeader">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Incoming Connection&lt;/p&gt;&lt;p&gt;Setup your hidden address (and port if needed)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Setup your hidden address (and port if needed)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@ -98,7 +98,6 @@ StatisticsWindow::StatisticsWindow(QWidget *parent) :
initStackedPage();
connect(ui->stackPages, SIGNAL(currentChanged(int)), this, SLOT(setNewPage(int)));
ui->stackPages->setCurrentIndex(0);
int toolSize = Settings->getToolButtonSize();
ui->toolBar->setToolButtonStyle(Settings->getToolButtonStyle());
ui->toolBar->setIconSize(QSize(toolSize,toolSize));
@ -147,9 +146,19 @@ void StatisticsWindow::initStackedPage()
ui->stackPages->add(rttdlg = new RttStatistics(ui->stackPages),
action = createPageAction(QIcon(IMAGE_RTT), tr("RTT Statistics"), grp));
ui->stackPages->add(dhtw = new DhtWindow(ui->stackPages),
bool showdht = true;
RsPeerDetails detail;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
if(detail.netMode == RS_NETMODE_HIDDEN)
showdht = false;
}
if(showdht)
{
ui->stackPages->add(dhtw = new DhtWindow(ui->stackPages),
action = createPageAction(QIcon(IMAGE_DHT), tr("DHT"), grp));
}
/*std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
for(int i = 0;i<rsPlugins->nbPlugins();++i)
{