partly fixed TOR status page (patch from Sehraf)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8109 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-04-02 19:23:01 +00:00
parent 65da6090fe
commit e9c6b3da73
2 changed files with 27 additions and 28 deletions

View File

@ -234,16 +234,7 @@ void ServerPage::load()
ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr));
ui.torpage_proxyPort -> setValue(proxyport);
if(status & RS_NET_PROXY_STATUS_OK)
{
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_OK)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("TOR proxy is working correctly")) ;
}
else
{
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("TOR status unknown")) ;
}
updateTorOutProxyIndicator();
}
void ServerPage::toggleTurtleRouting(bool b)
@ -314,24 +305,7 @@ void ServerPage::updateStatus()
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
// check for TOR
QTcpSocket socket ;
socket.connectToHost(ui.torpage_proxyAddress->text(),ui.torpage_proxyPort->text().toInt());
if(socket.waitForConnected(500))
{
std::cerr << "connected !" << std::endl;
socket.disconnectFromHost();
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_OK)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("Proxy seems to work.")) ;
}
else
{
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("TOR proxy is not enabled")) ;
}
updateTorOutProxyIndicator();
}
void ServerPage::toggleUPnP()
@ -572,6 +546,8 @@ void ServerPage::loadHiddenNode()
ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr));
ui.torpage_proxyPort -> setValue(proxyport);
updateTorOutProxyIndicator();
QString expected = "HiddenServiceDir </your/path/to/hidden/directory/service>\n";
expected += "HiddenServicePort ";
expected += QString::number(detail.hiddenNodePort);
@ -636,6 +612,7 @@ void ServerPage::updateStatusHiddenNode()
#endif
updateTorOutProxyIndicator();
}
void ServerPage::saveAddressesHiddenNode()
@ -697,3 +674,24 @@ void ServerPage::saveAddressesHiddenNode()
load();
}
void ServerPage::updateTorOutProxyIndicator()
{
QTcpSocket socket ;
socket.connectToHost(ui.torpage_proxyAddress->text(),ui.torpage_proxyPort->text().toInt());
if(socket.waitForConnected(500))
{
std::cerr << "connected !" << std::endl;
socket.disconnectFromHost();
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_OK)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("Proxy seems to work.")) ;
}
else
{
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("TOR proxy is not enabled")) ;
}
}

View File

@ -61,6 +61,7 @@ private:
void loadHiddenNode();
void updateStatusHiddenNode();
void saveAddressesHiddenNode();
void updateTorOutProxyIndicator();
Ui::ServerPage ui;