mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 07:16:11 -05:00
convert RSNET_NETSTATE to enum class
This commit is contained in:
parent
acda7b8cc4
commit
3f5dcecc4d
@ -1627,7 +1627,7 @@ void p3NetMgrIMPL::setIPServersEnabled(bool b)
|
||||
************************************** NetStateBox ******************************************
|
||||
**********************************************************************************************/
|
||||
|
||||
uint32_t p3NetMgrIMPL::getNetStateMode()
|
||||
RsNetState p3NetMgrIMPL::getNetStateMode()
|
||||
{
|
||||
RsStackMutex stack(mNetMtx); /****** STACK LOCK MUTEX *******/
|
||||
return mNetStateBox.getNetStateMode();
|
||||
|
@ -103,7 +103,7 @@ virtual bool netAssistBadPeer(const struct sockaddr_storage &addr, uint32_t reas
|
||||
virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode) = 0;
|
||||
|
||||
/* Get Network State */
|
||||
virtual uint32_t getNetStateMode() = 0;
|
||||
virtual RsNetState getNetStateMode() = 0;
|
||||
virtual RsNetworkMode getNetworkMode() = 0;
|
||||
virtual RsNatTypeMode getNatTypeMode() = 0;
|
||||
virtual RsNatHoleMode getNatHoleMode() = 0;
|
||||
@ -154,7 +154,7 @@ virtual bool netAssistBadPeer(const struct sockaddr_storage &addr, uint32_t reas
|
||||
virtual bool netAssistStatusUpdate(const RsPeerId &id, int mode);
|
||||
|
||||
/* Get Network State */
|
||||
virtual uint32_t getNetStateMode();
|
||||
virtual RsNetState getNetStateMode();
|
||||
virtual RsNetworkMode getNetworkMode();
|
||||
virtual RsNatTypeMode getNatTypeMode();
|
||||
virtual RsNatHoleMode getNatHoleMode();
|
||||
|
@ -171,7 +171,7 @@ RsConnectModes pqiNetStateBox::getConnectModes()
|
||||
}
|
||||
|
||||
|
||||
uint32_t pqiNetStateBox::getNetStateMode()
|
||||
RsNetState pqiNetStateBox::getNetStateMode()
|
||||
{
|
||||
updateNetState();
|
||||
return mNetStateMode;
|
||||
@ -196,7 +196,7 @@ void pqiNetStateBox::reset()
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::UNKNOWN;
|
||||
mConnectModes = RsConnectModes::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_UNKNOWN;
|
||||
mNetStateMode = RsNetState::BAD_UNKNOWN;
|
||||
|
||||
/* Parameters set externally */
|
||||
|
||||
@ -305,7 +305,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
// Assume these.
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_UNKNOWN;
|
||||
mNetStateMode = RsNetState::BAD_UNKNOWN;
|
||||
|
||||
//mExtAddress = .... unknown;
|
||||
//mExtAddrStable = false;
|
||||
@ -337,7 +337,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
||||
mNetStateMode = RsNetState::WARNING_NATTED;
|
||||
|
||||
}
|
||||
else if (!mStunProxyStable)
|
||||
@ -346,7 +346,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_NATSYM;
|
||||
mNetStateMode = RsNetState::BAD_NATSYM;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -368,7 +368,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::RESTRICTED_CONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
||||
mNetStateMode = RsNetState::WARNING_NATTED;
|
||||
}
|
||||
}
|
||||
else // Dht Stable.
|
||||
@ -394,7 +394,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::DETERM_SYM;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
mNetStateMode = RsNetState::GOOD;
|
||||
}
|
||||
else if (!mStunProxyStable)
|
||||
{
|
||||
@ -402,7 +402,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::SYMMETRIC;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
mNetStateMode = RsNetState::GOOD;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -410,7 +410,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::FULL_CONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NATTED;
|
||||
mNetStateMode = RsNetState::WARNING_NATTED;
|
||||
}
|
||||
|
||||
if (mUPnPActive)
|
||||
@ -420,7 +420,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
// Use Fallback Guess.
|
||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::UPNP;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
mNetStateMode = RsNetState::GOOD;
|
||||
//mExtAddress = ... from UPnP, should match StunDht.
|
||||
//mExtAddrStable = true;
|
||||
}
|
||||
@ -431,7 +431,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
// Use Fallback Guess.
|
||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::NATPMP;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
mNetStateMode = RsNetState::GOOD;
|
||||
//mExtAddress = ... from NatPMP, should match NatPMP
|
||||
//mExtAddrStable = true;
|
||||
}
|
||||
@ -444,7 +444,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::EXTERNALIP;
|
||||
mNatTypeMode = RsNatTypeMode::NONE;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_GOOD;
|
||||
mNetStateMode = RsNetState::GOOD;
|
||||
|
||||
//mExtAddrStable = true;
|
||||
}
|
||||
@ -454,7 +454,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
// Use Fallback Guess.
|
||||
//mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
mNetStateMode = RSNET_NETSTATE_ADV_FORWARD;
|
||||
mNetStateMode = RsNetState::ADV_FORWARD;
|
||||
|
||||
//mExtAddrStable = true; // Probably, makin assumption.
|
||||
}
|
||||
@ -483,7 +483,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNatHoleMode = RsNatHoleMode::UPNP;
|
||||
//mExtAddress = ... from UPnP.
|
||||
//mExtAddrStable = true;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||
}
|
||||
else if (mNatPMPActive)
|
||||
{
|
||||
@ -493,7 +493,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNatHoleMode = RsNatHoleMode::NATPMP;
|
||||
//mExtAddress = ... from NatPMP.
|
||||
//mExtAddrStable = true;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -510,7 +510,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
|
||||
//mExtAddrStable = true;
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||
}
|
||||
else if (mPortForwardSet)
|
||||
{
|
||||
@ -519,7 +519,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNatHoleMode = RsNatHoleMode::FORWARDED;
|
||||
|
||||
//mExtAddrStable = true; // Probably, makin assumption.
|
||||
mNetStateMode = RSNET_NETSTATE_WARNING_NODHT;
|
||||
mNetStateMode = RsNetState::WARNING_NODHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -530,7 +530,7 @@ void pqiNetStateBox::determineNetworkState()
|
||||
mNetworkMode = RsNetworkMode::BEHINDNAT;
|
||||
mNatTypeMode = RsNatTypeMode::UNKNOWN;
|
||||
mNatHoleMode = RsNatHoleMode::NONE;
|
||||
mNetStateMode = RSNET_NETSTATE_BAD_NODHT_NAT;
|
||||
mNetStateMode = RsNetState::BAD_NODHT_NAT;
|
||||
|
||||
//mExtAddrStable = false; // Unlikely to be stable.
|
||||
}
|
||||
@ -614,48 +614,3 @@ void pqiNetStateBox::workoutNetworkMode()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string NetStateNetStateString(uint32_t netstate)
|
||||
{
|
||||
std::string str;
|
||||
switch(netstate)
|
||||
{
|
||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||
str = "NET BAD: Unknown State";
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
||||
str = "NET BAD: Offline";
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_NATSYM:
|
||||
str = "NET BAD: Behind Symmetric NAT";
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
||||
str = "NET BAD: Behind NAT & No DHT";
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_RESTART:
|
||||
str = "NET WARNING: NET Restart";
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_NATTED:
|
||||
str = "NET WARNING: Behind NAT";
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_NODHT:
|
||||
str = "NET WARNING: No DHT";
|
||||
break;
|
||||
case RSNET_NETSTATE_GOOD:
|
||||
str = "NET STATE GOOD!";
|
||||
break;
|
||||
case RSNET_NETSTATE_ADV_FORWARD:
|
||||
str = "CAUTION: UNVERIFABLE FORWARD!";
|
||||
break;
|
||||
case RSNET_NETSTATE_ADV_DARK_FORWARD:
|
||||
str = "CAUTION: UNVERIFABLE FORWARD & NO DHT";
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ class pqiNetStateBox
|
||||
|
||||
void setDhtState(bool dhtOn, bool dhtActive);
|
||||
|
||||
uint32_t getNetStateMode();
|
||||
RsNetState getNetStateMode();
|
||||
RsNetworkMode getNetworkMode();
|
||||
RsNatTypeMode getNatTypeMode();
|
||||
RsNatHoleMode getNatHoleMode();
|
||||
@ -78,7 +78,7 @@ class pqiNetStateBox
|
||||
RsNatTypeMode mNatTypeMode;
|
||||
RsNatHoleMode mNatHoleMode;
|
||||
RsConnectModes mConnectModes;
|
||||
uint32_t mNetStateMode;
|
||||
RsNetState mNetStateMode;
|
||||
|
||||
/* Parameters set externally */
|
||||
|
||||
@ -117,8 +117,4 @@ class pqiNetStateBox
|
||||
uint16_t mPortForwarded;
|
||||
};
|
||||
|
||||
|
||||
|
||||
std::string NetStateNetStateString(uint32_t netstate);
|
||||
|
||||
#endif
|
||||
|
@ -78,27 +78,28 @@ enum class RsConnectModes : uint16_t
|
||||
};
|
||||
RS_REGISTER_ENUM_FLAGS_TYPE(RsConnectModes)
|
||||
|
||||
// net state (good, okay, bad)
|
||||
// BAD. (RED)
|
||||
#define RSNET_NETSTATE_BAD_UNKNOWN 1
|
||||
#define RSNET_NETSTATE_BAD_OFFLINE 2
|
||||
#define RSNET_NETSTATE_BAD_NATSYM 3
|
||||
#define RSNET_NETSTATE_BAD_NODHT_NAT 4
|
||||
enum class RsNetState : uint8_t
|
||||
{
|
||||
// BAD. (RED)
|
||||
BAD_UNKNOWN = 1,
|
||||
BAD_OFFLINE = 2,
|
||||
BAD_NATSYM = 3,
|
||||
BAD_NODHT_NAT = 4,
|
||||
|
||||
// CAUTION. (ORANGE)
|
||||
#define RSNET_NETSTATE_WARNING_RESTART 5
|
||||
#define RSNET_NETSTATE_WARNING_NATTED 6
|
||||
#define RSNET_NETSTATE_WARNING_NODHT 7
|
||||
// CAUTION. (ORANGE)
|
||||
WARNING_RESTART = 5,
|
||||
WARNING_NATTED = 6,
|
||||
WARNING_NODHT = 7,
|
||||
|
||||
// GOOD (GREEN)
|
||||
// NAT with forwarded port, or EXT port.
|
||||
#define RSNET_NETSTATE_GOOD 8
|
||||
|
||||
// ADVANCED MODE (BLUE)
|
||||
// If the user knows what they are doing... we cannot confirm this.
|
||||
#define RSNET_NETSTATE_ADV_FORWARD 9
|
||||
#define RSNET_NETSTATE_ADV_DARK_FORWARD 10
|
||||
// GOOD (GREEN)
|
||||
// NAT with forwarded port, or EXT port.
|
||||
GOOD = 8,
|
||||
|
||||
// ADVANCED MODE (BLUE)
|
||||
// If the user knows what they are doing... we cannot confirm this.
|
||||
ADV_FORWARD = 9,
|
||||
ADV_DARK_FORWARD= 10
|
||||
};
|
||||
|
||||
/* matched to the uPnP states */
|
||||
#define UPNP_STATE_UNINITIALISED 0
|
||||
@ -360,7 +361,7 @@ public:
|
||||
|
||||
virtual uint32_t getUserLevel() = 0;
|
||||
|
||||
virtual uint32_t getNetState() = 0;
|
||||
virtual RsNetState getNetState() = 0;
|
||||
virtual RsNetworkMode getNetworkMode() = 0;
|
||||
virtual RsNatTypeMode getNatTypeMode() = 0;
|
||||
virtual RsNatHoleMode getNatHoleMode() = 0;
|
||||
|
@ -329,7 +329,7 @@ uint32_t p3ServerConfig::getUserLevel()
|
||||
}
|
||||
|
||||
|
||||
uint32_t p3ServerConfig::getNetState()
|
||||
RsNetState p3ServerConfig::getNetState()
|
||||
{
|
||||
return mNetMgr->getNetStateMode();
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ virtual std::string getRetroshareDataDirectory();
|
||||
|
||||
virtual uint32_t getUserLevel();
|
||||
|
||||
virtual uint32_t getNetState();
|
||||
virtual RsNetState getNetState();
|
||||
virtual RsNetworkMode getNetworkMode();
|
||||
virtual RsNatTypeMode getNatTypeMode();
|
||||
virtual RsNatHoleMode getNatHoleMode();
|
||||
|
@ -281,39 +281,39 @@ void ConnectProgressDialog::stopAndClose()
|
||||
|
||||
void ConnectProgressDialog::updateNetworkStatus()
|
||||
{
|
||||
uint32_t netState = rsConfig->getNetState();
|
||||
RsNetState netState = rsConfig->getNetState();
|
||||
|
||||
QLabel *label = ui->NetResult;
|
||||
switch(netState)
|
||||
{
|
||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||
case RsNetState::BAD_UNKNOWN:
|
||||
label->setText(tr("Unknown State"));
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
||||
case RsNetState::BAD_OFFLINE:
|
||||
label->setText(tr("Offline"));
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_NATSYM:
|
||||
case RsNetState::BAD_NATSYM:
|
||||
label->setText(tr("Behind Symmetric NAT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
||||
case RsNetState::BAD_NODHT_NAT:
|
||||
label->setText(tr("Behind NAT & No DHT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_RESTART:
|
||||
case RsNetState::WARNING_RESTART:
|
||||
label->setText(tr("NET Restart"));
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_NATTED:
|
||||
case RsNetState::WARNING_NATTED:
|
||||
label->setText(tr("Behind NAT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_NODHT:
|
||||
case RsNetState::WARNING_NODHT:
|
||||
label->setText(tr("No DHT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_GOOD:
|
||||
case RsNetState::GOOD:
|
||||
label->setText(tr("NET STATE GOOD!"));
|
||||
break;
|
||||
case RSNET_NETSTATE_ADV_FORWARD:
|
||||
case RsNetState::ADV_FORWARD:
|
||||
label->setText(tr("UNVERIFIABLE FORWARD!"));
|
||||
break;
|
||||
case RSNET_NETSTATE_ADV_DARK_FORWARD:
|
||||
case RsNetState::ADV_DARK_FORWARD:
|
||||
label->setText(tr("UNVERIFIABLE FORWARD & NO DHT"));
|
||||
break;
|
||||
}
|
||||
|
@ -241,39 +241,39 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
label->setText(connOut);
|
||||
|
||||
uint32_t netState = rsConfig->getNetState();
|
||||
RsNetState netState = rsConfig->getNetState();
|
||||
|
||||
label = ui.netStatusLabel;
|
||||
switch(netState)
|
||||
{
|
||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||
case RsNetState::BAD_UNKNOWN:
|
||||
label->setText(tr("NET BAD: Unknown State"));
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
||||
case RsNetState::BAD_OFFLINE:
|
||||
label->setText(tr("NET BAD: Offline"));
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_NATSYM:
|
||||
case RsNetState::BAD_NATSYM:
|
||||
label->setText(tr("NET BAD: Behind Symmetric NAT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
||||
case RsNetState::BAD_NODHT_NAT:
|
||||
label->setText(tr("NET BAD: Behind NAT & No DHT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_RESTART:
|
||||
case RsNetState::WARNING_RESTART:
|
||||
label->setText(tr("NET WARNING: NET Restart"));
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_NATTED:
|
||||
case RsNetState::WARNING_NATTED:
|
||||
label->setText(tr("NET WARNING: Behind NAT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_WARNING_NODHT:
|
||||
case RsNetState::WARNING_NODHT:
|
||||
label->setText(tr("NET WARNING: No DHT"));
|
||||
break;
|
||||
case RSNET_NETSTATE_GOOD:
|
||||
case RsNetState::GOOD:
|
||||
label->setText(tr("NET STATE GOOD!"));
|
||||
break;
|
||||
case RSNET_NETSTATE_ADV_FORWARD:
|
||||
case RsNetState::ADV_FORWARD:
|
||||
label->setText(tr("CAUTION: UNVERIFIABLE FORWARD!"));
|
||||
break;
|
||||
case RSNET_NETSTATE_ADV_DARK_FORWARD:
|
||||
case RsNetState::ADV_DARK_FORWARD:
|
||||
label->setText(tr("CAUTION: UNVERIFIABLE FORWARD & NO DHT"));
|
||||
break;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ NATStatus::NATStatus(QWidget *parent)
|
||||
|
||||
void NATStatus::getNATStatus()
|
||||
{
|
||||
uint32_t netState = rsConfig -> getNetState();
|
||||
RsNetState netState = rsConfig -> getNetState();
|
||||
|
||||
statusNAT->setVisible(!_compactMode);
|
||||
QString text = _compactMode?statusNAT->text():"";
|
||||
@ -60,14 +60,14 @@ void NATStatus::getNATStatus()
|
||||
switch(netState)
|
||||
{
|
||||
default:
|
||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||
case RsNetState::BAD_UNKNOWN:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("Network Status Unknown")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
||||
case RsNetState::BAD_OFFLINE:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_grey_129.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("Offline")) ;
|
||||
@ -75,14 +75,14 @@ void NATStatus::getNATStatus()
|
||||
break ;
|
||||
|
||||
// BAD. (RED)
|
||||
case RSNET_NETSTATE_BAD_NATSYM:
|
||||
case RsNetState::BAD_NATSYM:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("Nasty Firewall")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
||||
case RsNetState::BAD_NODHT_NAT:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_red_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("DHT Disabled and Firewalled")) ;
|
||||
@ -90,21 +90,21 @@ void NATStatus::getNATStatus()
|
||||
break ;
|
||||
|
||||
// CAUTION. (ORANGE)
|
||||
case RSNET_NETSTATE_WARNING_RESTART:
|
||||
case RsNetState::WARNING_RESTART:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("Network Restarting")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_WARNING_NATTED:
|
||||
case RsNetState::WARNING_NATTED:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("Behind Firewall")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_WARNING_NODHT:
|
||||
case RsNetState::WARNING_NODHT:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_yellow_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("DHT Disabled")) ;
|
||||
@ -112,14 +112,14 @@ void NATStatus::getNATStatus()
|
||||
break ;
|
||||
|
||||
// GOOD (GREEN)
|
||||
case RSNET_NETSTATE_GOOD:
|
||||
case RsNetState::GOOD:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_green_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("RetroShare Server")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_ADV_FORWARD:
|
||||
case RsNetState::ADV_FORWARD:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/icons/bullet_green_128.png").scaledToHeight(S,Qt::SmoothTransformation)) ;
|
||||
iconLabel->setToolTip( text + tr("Forwarded Port")) ;
|
||||
|
@ -60,24 +60,24 @@ void TorStatus::getTorStatus()
|
||||
QString text = _compactMode?statusTor->text():"";
|
||||
|
||||
/* check local network state. We cannot make sure that Tor is running yet. */
|
||||
uint32_t netState = rsConfig -> getNetState();
|
||||
RsNetState netState = rsConfig -> getNetState();
|
||||
bool online ;
|
||||
|
||||
switch(netState)
|
||||
{
|
||||
default:
|
||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||
case RSNET_NETSTATE_BAD_OFFLINE: online = false ;
|
||||
case RsNetState::BAD_UNKNOWN:
|
||||
case RsNetState::BAD_OFFLINE: online = false ;
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_WARNING_RESTART:
|
||||
case RsNetState::WARNING_RESTART:
|
||||
|
||||
case RSNET_NETSTATE_BAD_NATSYM:
|
||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
||||
case RSNET_NETSTATE_WARNING_NATTED:
|
||||
case RSNET_NETSTATE_WARNING_NODHT:
|
||||
case RSNET_NETSTATE_GOOD:
|
||||
case RSNET_NETSTATE_ADV_FORWARD: online = true ;
|
||||
case RsNetState::BAD_NATSYM:
|
||||
case RsNetState::BAD_NODHT_NAT:
|
||||
case RsNetState::WARNING_NATTED:
|
||||
case RsNetState::WARNING_NODHT:
|
||||
case RsNetState::GOOD:
|
||||
case RsNetState::ADV_FORWARD: online = true ;
|
||||
break ;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user