BugFix: DHT was not turning on.

also updated the ServerDialog with more info on exact network state.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@753 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-10-18 16:02:06 +00:00
parent 95d5f38222
commit bc98b9ea7d
12 changed files with 330 additions and 122 deletions

View file

@ -487,17 +487,17 @@
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" name="gridLayout" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QGroupBox" name="groupBox_5" >
<property name="title" >
<string>Library</string>
</property>
<layout class="QGridLayout" name="gridLayout_8" >
<layout class="QGridLayout" >
<item row="0" column="1" colspan="2" >
<widget class="QLabel" name="label_3" >
<property name="styleSheet" >
<string notr="true" >background-color: rgb(253, 252, 248);</string>
<string>background-color: rgb(253, 252, 248);</string>
</property>
<property name="text" >
<string>Exploring My RetroShare Library</string>
@ -543,7 +543,7 @@
<item row="2" column="1" >
<widget class="QPushButton" name="createAlbum_btn_library" >
<property name="styleSheet" >
<string notr="true" />
<string/>
</property>
<property name="text" >
<string>Create Album</string>
@ -556,7 +556,7 @@
<item row="2" column="2" >
<widget class="QPushButton" name="deleteAlbum_btn_library" >
<property name="styleSheet" >
<string notr="true" />
<string/>
</property>
<property name="text" >
<string>Delete Album</string>
@ -572,7 +572,7 @@
<item row="2" column="4" >
<widget class="QPushButton" name="find_btn_library" >
<property name="styleSheet" >
<string notr="true" >pushButton_41:hover{ color : white;}</string>
<string>pushButton_41:hover{ color : white;}</string>
</property>
<property name="text" >
<string>Find</string>
@ -591,22 +591,14 @@
<number>1</number>
</property>
<widget class="QWidget" name="tab_13" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>226</width>
<height>345</height>
</rect>
</property>
<attribute name="title" >
<string>Folder</string>
</attribute>
<layout class="QFormLayout" name="formLayout" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QComboBox" name="comboBox" >
<property name="styleSheet" >
<string notr="true" >border-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));</string>
<string>border-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));</string>
</property>
<item>
<property name="text" >
@ -628,18 +620,10 @@
</layout>
</widget>
<widget class="QWidget" name="tab_14" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>238</width>
<height>390</height>
</rect>
</property>
<attribute name="title" >
<string>Organizer</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_25" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QTreeView" name="organizertreeView" >
<property name="font" >
@ -653,7 +637,7 @@
<item row="1" column="0" >
<widget class="QPushButton" name="shareFiles_btn" >
<property name="styleSheet" >
<string notr="true" >border-color: rgb(0, 0, 0);</string>
<string>border-color: rgb(0, 0, 0);</string>
</property>
<property name="text" >
<string>Share Files..</string>

View file

@ -28,6 +28,8 @@
#include "rsiface/rsiface.h"
#include "rsiface/rspeers.h"
#include <QTimer>
/** Constructor */
@ -42,6 +44,10 @@ ServerDialog::ServerDialog(QWidget *parent)
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
/* Hide platform specific features */
#ifdef Q_WS_WIN
@ -109,15 +115,69 @@ void ServerDialog::load()
}
ui.discComboBox->setCurrentIndex(netIndex);
rsiface->lockData(); /* Lock Interface */
/* set the addresses */
ui.totalRate->setValue(rsiface->getConfig().maxDataRate);
ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate);
rsiface->unlockData(); /* UnLock Interface */
toggleUPnP();
//ui.check_net->setCheckable(true);
ui.check_upnp->setCheckable(true);
ui.check_dht->setCheckable(true);
ui.check_ext->setCheckable(true);
ui.check_udp->setCheckable(true);
ui.check_tcp->setCheckable(true);
//ui.check_net->setEnabled(false);
ui.check_upnp->setEnabled(false);
ui.check_dht->setEnabled(false);
ui.check_ext->setEnabled(false);
ui.check_udp->setEnabled(false);
ui.check_tcp->setEnabled(false);
ui.radio_nonet->setEnabled(false);
ui.radio_netLimited->setEnabled(false);
ui.radio_netUdp->setEnabled(false);
ui.radio_netServer->setEnabled(false);
/* Addresses must be set here - otherwise can't edit it */
/* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
ui.localPort -> setValue(detail.localPort);
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
ui.extPort -> setValue(detail.extPort);
}
/** Loads the settings for this page */
void ServerDialog::updateStatus()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
/* only update if can't edit */
if (!ui.localPort->isEnabled())
{
/* set local address */
ui.localPort -> setValue(detail.localPort);
ui.extPort -> setValue(detail.extPort);
}
/* set local address */
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
/* set the server address */
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
#if 0
/* set status */
std::ostringstream out;
out << "Attempted Network Mode: ";
@ -131,6 +191,7 @@ void ServerDialog::load()
break;
default:
case RS_NETMODE_UPNP:
out << "Automatic: UPnP Forwarded Port";
break;
}
@ -178,7 +239,6 @@ void ServerDialog::load()
out << std::endl;
if (detail.netMode == RS_NETMODE_UNREACHABLE)
{
ui.netStatusBox->setTextColor( Qt::red );
@ -190,17 +250,47 @@ void ServerDialog::load()
ui.netStatusBox->setText(QString::fromStdString(out.str()));
ui.netStatusBox ->setReadOnly(true);
#endif
rsiface->lockData(); /* Lock Interface */
ui.totalRate->setValue(rsiface->getConfig().maxDataRate);
ui.indivRate->setValue(rsiface->getConfig().maxIndivDataRate);
/* now the extra bit .... switch on check boxes */
const RsConfig &config = rsiface->getConfig();
//ui.check_net->setChecked(config.netOk);
ui.check_upnp->setChecked(config.netUpnpOk);
ui.check_dht->setChecked(config.netDhtOk);
ui.check_ext->setChecked(config.netExtOk);
ui.check_udp->setChecked(config.netUdpOk);
ui.check_tcp->setChecked(config.netTcpOk);
if (config.netExtOk)
{
if (config.netUpnpOk || config.netTcpOk)
{
ui.radio_netServer->setChecked(true);
}
else
{
ui.radio_netUdp->setChecked(true);
}
}
else if (config.netOk)
{
ui.radio_netLimited->setChecked(true);
}
else
{
ui.radio_nonet->setChecked(true);
}
rsiface->unlockData(); /* UnLock Interface */
toggleUPnP();
}
void ServerDialog::toggleUPnP()
{
/* switch on the radioButton */
@ -217,9 +307,9 @@ void ServerDialog::toggleUPnP()
//ui.discComboBox->setEnabled(true);
ui.discComboBox->setEnabled(false);
ui.localAddress->setEnabled(true);
ui.localAddress->setEnabled(false);
ui.localPort -> setEnabled(true);
ui.extAddress -> setEnabled(true);
ui.extAddress -> setEnabled(false);
ui.extPort -> setEnabled(true);
}
else

View file

@ -42,7 +42,10 @@ public:
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
public slots:
void updateStatus();
private slots:
void saveAddresses();
void toggleUPnP();

View file

@ -518,17 +518,17 @@
<widget class="QComboBox" name="netModeComboBox" >
<item>
<property name="text" >
<string>Automatic (Firewalled)</string>
<string>Automatic</string>
</property>
</item>
<item>
<property name="text" >
<string>Firewalled + No UPnP</string>
<string>Firewalled</string>
</property>
</item>
<item>
<property name="text" >
<string>External (Forwarded) Port</string>
<string>Forwarded Port</string>
</property>
</item>
</widget>
@ -579,77 +579,88 @@
</sizepolicy>
</property>
<property name="title" >
<string>Server Status And Network Settings</string>
<string>Network Configuration</string>
</property>
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item rowspan="6" row="0" column="0" >
<widget class="QTextEdit" name="netStatusBox" />
</item>
<item row="0" column="1" >
<widget class="QCheckBox" name="checkBox" >
<property name="text" >
<string>Network Okay</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QCheckBox" name="checkBox_6" >
<property name="text" >
<string>UPnP Active</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QCheckBox" name="checkBox_5" >
<property name="text" >
<string>DHT Okay</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QCheckBox" name="checkBox_2" >
<property name="text" >
<string>Found Ext IP Addr</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QCheckBox" name="checkBox_3" >
<property name="text" >
<string>UDP Connections</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1" >
<widget class="QCheckBox" name="checkBox_4" >
<property name="text" >
<string>TCP server</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QRadioButton" name="radio_nonet" >
<property name="text" >
<string>No Conectivity</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1" >
<widget class="QCheckBox" name="check_udp" >
<property name="text" >
<string>UDP Connections</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QRadioButton" name="radio_netLimited" >
<property name="text" >
<string>Limited</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QCheckBox" name="check_ext" >
<property name="text" >
<string>Stable External IP Addrress</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item rowspan="2" row="2" column="0" >
<widget class="QRadioButton" name="radio_netUdp" >
<property name="text" >
<string>Udp</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QCheckBox" name="check_dht" >
<property name="text" >
<string>DHT Okay</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="QCheckBox" name="check_upnp" >
<property name="text" >
<string>UPnP Active</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QRadioButton" name="radio_netServer" >
<property name="text" >
<string>Retroshare Server</string>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QCheckBox" name="check_tcp" >
<property name="text" >
<string>TCP server</string>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<layout class="QVBoxLayout" >
@ -671,9 +682,6 @@
</item>
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLineEdit" name="localAddress" />
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label_5" >
<property name="text" >
@ -694,9 +702,6 @@
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLineEdit" name="extAddress" />
</item>
<item row="1" column="1" >
<widget class="QLabel" name="label_4" >
<property name="text" >
@ -717,6 +722,12 @@
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLineEdit" name="extAddress" />
</item>
<item row="0" column="0" >
<widget class="QLineEdit" name="localAddress" />
</item>
</layout>
</item>
</layout>
@ -834,7 +845,6 @@
<tabstops>
<tabstop>localAddress</tabstop>
<tabstop>localPort</tabstop>
<tabstop>extAddress</tabstop>
<tabstop>extPort</tabstop>
<tabstop>totalRate</tabstop>
<tabstop>indivRate</tabstop>

View file

@ -1,4 +0,0 @@
-- Diese und die folgenden Zeilen werden ignoriert --
M NetworkDialog.cpp