Various improvements to the GUI.

* Switched ServerPage to use netMode, rather than tryNetMode. This fixes the Network Status.
 * Added "Advanced Mode" to Settings GeneralPage.
 * Store / Set Advanced Mode via rsConfig::get/setConfigurationOptions.
 * removed %0D%0A from Linux / OSX emails - made it Windows Only.
 * updated GetStartedDialog text.
 * updated Dht and Nat Indicators to accurately reflect Network status. Roughly:
   - DHT. Off:     gray, ERROR:   red, NO RS PEERS:           yellow, GOOD: green.
   - NAT. Offline: gray, BAD NET: red, NO DHT, or FIREWALLED: yellow, GOOD: green
 * disable GetStartedDialog is AdvancedMode is set.
 


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4502 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-30 17:13:08 +00:00
parent 31ec7a074b
commit 1cb0a9dc21
8 changed files with 230 additions and 57 deletions

View file

@ -67,35 +67,72 @@ DHTStatus::DHTStatus(QWidget *parent)
void DHTStatus::getDHTStatus()
{
rsiface->lockData(); /* Lock Interface */
rsiface->lockData(); /* Lock Interface */
/* now the extra bit .... switch on check boxes */
const RsConfig &config = rsiface->getConfig();
/* now the extra bit .... switch on check boxes */
const RsConfig &config = rsiface->getConfig();
if (config.netDhtOk)
{
dhtstatusLabel->setPixmap(QPixmap(":/images/greenled.png"));
dhtstatusLabel->setToolTip(tr("DHT On"));
if (!(config.DHTActive))
{
// GRAY.
dhtstatusLabel->setPixmap(QPixmap(":/images/grayled.png"));
dhtstatusLabel->setToolTip(tr("DHT Off"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);
dhtnetworksizeLabel->setText("");
dhtnetworksizeLabel->setToolTip("");
}
else
{
if (config.netDhtOk)
{
#define MIN_RS_NET_SIZE 10
// YELLOW or GREEN.
if (config.netDhtRsNetSize < MIN_RS_NET_SIZE)
{
dhtstatusLabel->setPixmap(QPixmap(":/images/yellowled.png"));
dhtstatusLabel->setToolTip(tr("DHT Searching for Retroshare Peers"));
spaceLabel->setVisible(true);
dhtnetworkLabel->setVisible(true);
dhtnetworksizeLabel->setVisible(true);
dhtnetworksizeLabel->setText(QString("%1 (%2)").arg(misc::userFriendlyUnit(config.netDhtRsNetSize, 1)).arg(misc::userFriendlyUnit(config.netDhtNetSize, 1)));
dhtnetworksizeLabel->setToolTip(tr("RetroShare users in DHT (Total DHT users)") );
}
else
{
dhtstatusLabel->setPixmap(QPixmap(":/images/greenled.png"));
dhtstatusLabel->setToolTip(tr("DHT Good"));
spaceLabel->setVisible(true);
dhtnetworkLabel->setVisible(true);
dhtnetworksizeLabel->setVisible(true);
dhtnetworksizeLabel->setText(QString("%1 (%2)").arg(misc::userFriendlyUnit(config.netDhtRsNetSize, 1)).arg(misc::userFriendlyUnit(config.netDhtNetSize, 1)));
dhtnetworksizeLabel->setToolTip(tr("RetroShare users in DHT (Total DHT users)") );
}
spaceLabel->setVisible(true);
dhtnetworkLabel->setVisible(true);
dhtnetworksizeLabel->setVisible(true);
}
else
{
// RED - some issue.
dhtstatusLabel->setPixmap(QPixmap(":/images/redled.png"));
dhtstatusLabel->setToolTip(tr("DHT Error"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);
dhtnetworksizeLabel->setText("");
dhtnetworksizeLabel->setToolTip("");
}
}
rsiface->unlockData(); /* UnLock Interface */
dhtnetworksizeLabel->setText(QString("%1 (%2)").arg(misc::userFriendlyUnit(config.netDhtRsNetSize, 1)).arg(misc::userFriendlyUnit(config.netDhtNetSize, 1)));
dhtnetworksizeLabel->setToolTip(tr("RetroShare users in DHT (Total DHT users)") );
}
else
{
dhtstatusLabel->setPixmap(QPixmap(":/images/redled.png"));
dhtstatusLabel->setToolTip(tr("DHT Off"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);
dhtnetworksizeLabel->setText("");
dhtnetworksizeLabel->setToolTip("");
}
rsiface->unlockData(); /* UnLock Interface */
}

View file

@ -24,7 +24,8 @@
#include "natstatus.h"
#include <retroshare/rsiface.h>
#include "retroshare/rsiface.h"
#include "retroshare/rsconfig.h"
NATStatus::NATStatus(QWidget *parent)
: QWidget(parent)
@ -49,6 +50,81 @@ NATStatus::NATStatus(QWidget *parent)
void NATStatus::getNATStatus()
{
uint32_t netState = rsConfig -> getNetState();
switch(netState)
{
default:
case RSNET_NETSTATE_BAD_UNKNOWN:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Network Status Unknown"));
}
break;
case RSNET_NETSTATE_BAD_OFFLINE:
{
iconLabel->setPixmap(QPixmap(":/images/grayled.png"));
iconLabel->setToolTip(tr("Offline"));
}
break;
// BAD. (RED)
case RSNET_NETSTATE_BAD_NATSYM:
{
iconLabel->setPixmap(QPixmap(":/images/redled.png"));
iconLabel->setToolTip(tr("Nasty Firewall"));
}
break;
case RSNET_NETSTATE_BAD_NODHT_NAT:
{
iconLabel->setPixmap(QPixmap(":/images/redled.png"));
iconLabel->setToolTip(tr("DHT Disabled and Firewalled"));
}
break;
// CAUTION. (ORANGE)
case RSNET_NETSTATE_WARNING_RESTART:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Network Restarting"));
}
break;
case RSNET_NETSTATE_WARNING_NATTED:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Behind Firewall"));
}
break;
case RSNET_NETSTATE_WARNING_NODHT:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("DHT Disabled"));
}
break;
// GOOD (GREEN)
case RSNET_NETSTATE_GOOD:
{
iconLabel->setPixmap(QPixmap(":/images/greenled.png"));
iconLabel->setToolTip(tr("OK | RetroShare Server"));
}
break;
}
}
#if 0
void NATStatus::getNATStatus()
{
uint32_t netMode = rsConfig -> getNetworkMode();
uint32_t natType = rsConfig -> getNatTypeMode();
uint32_t natHole = rsConfig -> getNatHoleMode();
rsiface->lockData(); /* Lock Interface */
/* now the extra bit .... switch on check boxes */
@ -111,3 +187,5 @@ void NATStatus::getNATStatus()
rsiface->unlockData(); /* UnLock Interface */
}
#endif