Added Phenom's new Compact Mode Changes:

A new compact mode remove useless text on status bar so the main windows not growing.
It is selectable on Appearance option page, with check to hide Sound and Toaster disable buttons.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7392 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-05-29 16:15:26 +00:00
parent c9ef2a77b5
commit 3cf9d9b955
17 changed files with 245 additions and 124 deletions

View file

@ -61,11 +61,15 @@ DHTStatus::DHTStatus(QWidget *parent)
hbox->addSpacing(2);
_compactMode = false;
setLayout( hbox );
}
void DHTStatus::getDHTStatus()
{
statusDHT->setVisible(!_compactMode);
QString text = _compactMode?statusDHT->text():"";
/* now the extra bit .... switch on check boxes */
RsConfigNetStatus config;
@ -75,8 +79,8 @@ void DHTStatus::getDHTStatus()
{
// GRAY.
dhtstatusLabel->setPixmap(QPixmap(":/images/grayled.png"));
dhtstatusLabel->setToolTip(tr("DHT Off"));
dhtstatusLabel->setToolTip( text + tr("DHT Off"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);
@ -93,34 +97,34 @@ void DHTStatus::getDHTStatus()
if (config.netDhtRsNetSize < MIN_RS_NET_SIZE)
{
dhtstatusLabel->setPixmap(QPixmap(":/images/yellowled.png"));
dhtstatusLabel->setToolTip(tr("DHT Searching for RetroShare Peers"));
dhtstatusLabel->setToolTip( text + 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)") );
dhtnetworksizeLabel->setToolTip( text + tr("RetroShare users in DHT (Total DHT users)") );
}
else
{
dhtstatusLabel->setPixmap(QPixmap(":/images/greenled.png"));
dhtstatusLabel->setToolTip(tr("DHT Good"));
dhtstatusLabel->setToolTip( text + 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)") );
dhtnetworksizeLabel->setToolTip( text + tr("RetroShare users in DHT (Total DHT users)") );
}
}
else
{
// RED - some issue.
dhtstatusLabel->setPixmap(QPixmap(":/images/redled.png"));
dhtstatusLabel->setToolTip(tr("DHT Error"));
dhtstatusLabel->setToolTip( text + tr("DHT Error"));
spaceLabel->setVisible(false);
dhtnetworkLabel->setVisible(false);
dhtnetworksizeLabel->setVisible(false);

View file

@ -31,11 +31,12 @@ class DHTStatus : public QWidget
public:
DHTStatus(QWidget *parent = 0);
void getDHTStatus( );
void getDHTStatus( );
void setCompactMode(bool compact) {_compactMode = compact; }
private:
QLabel *dhtstatusLabel, *statusDHT, *dhtnetworkLabel, *dhtnetworksizeLabel, *spaceLabel;
bool _compactMode;
};
#endif

View file

@ -68,7 +68,9 @@ HashingStatus::HashingStatus(QWidget *parent)
QSpacerItem *horizontalSpacer = new QSpacerItem(3000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
hbox->addItem(horizontalSpacer);
_compactMode = false;
setLayout(hbox);
hashloader->hide();
@ -84,16 +86,22 @@ HashingStatus::~HashingStatus()
void HashingStatus::updateHashingInfo(const QString& s)
{
if(s.isEmpty()) {
statusHashing->hide();
hashloader->hide();
if (s.isEmpty()) {
statusHashing->hide() ;
hashloader->hide() ;
movie->stop();
movie->stop() ;
} else {
statusHashing->setText(s);
statusHashing->show();
hashloader->show();
hashloader->setToolTip(s) ;
movie->start();
if (_compactMode) {
statusHashing->hide() ;
} else {
statusHashing->setText(s) ;
statusHashing->show() ;
}
hashloader->show() ;
movie->start() ;
}
}

View file

@ -33,12 +33,15 @@ public:
HashingStatus(QWidget *parent = 0);
~HashingStatus();
void setCompactMode(bool compact) {_compactMode = compact; }
public slots:
void updateHashingInfo(const QString&) ;
private:
QLabel *statusHashing, *hashloader;
QMovie *movie;
bool _compactMode;
};
#endif

View file

@ -45,6 +45,8 @@ NATStatus::NATStatus(QWidget *parent)
hbox->addSpacing(2);
_compactMode = false;
setLayout(hbox);
}
@ -52,74 +54,77 @@ void NATStatus::getNATStatus()
{
uint32_t netState = rsConfig -> getNetState();
statusNAT->setVisible(!_compactMode);
QString text = _compactMode?statusNAT->text():"";
switch(netState)
{
default:
case RSNET_NETSTATE_BAD_UNKNOWN:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Network Status Unknown"));
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
iconLabel->setToolTip( text + tr("Network Status Unknown")) ;
}
break;
break ;
case RSNET_NETSTATE_BAD_OFFLINE:
{
iconLabel->setPixmap(QPixmap(":/images/grayled.png"));
iconLabel->setToolTip(tr("Offline"));
iconLabel->setPixmap(QPixmap(":/images/grayled.png")) ;
iconLabel->setToolTip( text + tr("Offline")) ;
}
break;
break ;
// BAD. (RED)
case RSNET_NETSTATE_BAD_NATSYM:
{
iconLabel->setPixmap(QPixmap(":/images/redled.png"));
iconLabel->setToolTip(tr("Nasty Firewall"));
iconLabel->setPixmap(QPixmap(":/images/redled.png")) ;
iconLabel->setToolTip( text + tr("Nasty Firewall")) ;
}
break;
break ;
case RSNET_NETSTATE_BAD_NODHT_NAT:
{
iconLabel->setPixmap(QPixmap(":/images/redled.png"));
iconLabel->setToolTip(tr("DHT Disabled and Firewalled"));
iconLabel->setPixmap(QPixmap(":/images/redled.png")) ;
iconLabel->setToolTip( text + tr("DHT Disabled and Firewalled")) ;
}
break;
break ;
// CAUTION. (ORANGE)
case RSNET_NETSTATE_WARNING_RESTART:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Network Restarting"));
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
iconLabel->setToolTip( text + tr("Network Restarting")) ;
}
break;
break ;
case RSNET_NETSTATE_WARNING_NATTED:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("Behind Firewall"));
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
iconLabel->setToolTip( text + tr("Behind Firewall")) ;
}
break;
break ;
case RSNET_NETSTATE_WARNING_NODHT:
{
iconLabel->setPixmap(QPixmap(":/images/yellowled.png"));
iconLabel->setToolTip(tr("DHT Disabled"));
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
iconLabel->setToolTip( text + tr("DHT Disabled")) ;
}
break;
break ;
// GOOD (GREEN)
case RSNET_NETSTATE_GOOD:
{
iconLabel->setPixmap(QPixmap(":/images/greenled.png"));
iconLabel->setToolTip(tr("RetroShare Server"));
iconLabel->setPixmap(QPixmap(":/images/greenled.png")) ;
iconLabel->setToolTip( text + tr("RetroShare Server")) ;
}
break ;
case RSNET_NETSTATE_ADV_FORWARD:
{
iconLabel->setPixmap(QPixmap(":/images/greenled.png"));
iconLabel->setToolTip(tr("Forwarded Port"));
iconLabel->setPixmap(QPixmap(":/images/greenled.png")) ;
iconLabel->setToolTip( text + tr("Forwarded Port")) ;
}
break;
break ;
}
}

View file

@ -33,9 +33,11 @@ public:
NATStatus(QWidget *parent = 0);
void getNATStatus( );
void setCompactMode(bool compact) {_compactMode = compact; }
private:
QLabel *iconLabel, *statusNAT;
bool _compactMode;
};
#endif

View file

@ -39,7 +39,9 @@ PeerStatus::PeerStatus(QWidget *parent)
statusPeers = new QLabel( tr("Friends: 0/0"), this );
// statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
hbox->addWidget(statusPeers);
_compactMode = false;
setLayout(hbox);
}
@ -48,11 +50,14 @@ void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCo
{
/* set users/friends/network */
statusPeers->setToolTip(tr("Online Friends/Total Friends") );
if (statusPeers){
statusPeers->setToolTip(tr("Online Friends/Total Friends") );
QString text;
if (_compactMode) text = QString("%1/%2").arg(nOnlineCount).arg(nFriendCount);
else text = QString("<strong>%1:</strong> %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount);
statusPeers -> setText(text);
}
if (statusPeers)
statusPeers -> setText(QString("<strong>%1:</strong> %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount));
if (nOnlineCount > 0)
{
iconLabel->setPixmap(QPixmap(":/images/user/identity16.png"));
@ -61,8 +66,4 @@ void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCo
{
iconLabel->setPixmap(QPixmap(":/images/user/identitygray16.png"));
}
}

View file

@ -33,9 +33,11 @@ public:
PeerStatus(QWidget *parent = 0);
void getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCount);
void setCompactMode(bool compact) {_compactMode = compact; }
private:
QLabel *iconLabel, *statusPeers;
bool _compactMode;
};
#endif

View file

@ -42,7 +42,9 @@ RatesStatus::RatesStatus(QWidget *parent)
statusRates = new QLabel( tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) "), this );
// statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
hbox->addWidget(statusRates);
_compactMode = false;
setLayout(hbox);
}
@ -50,26 +52,20 @@ void RatesStatus::getRatesStatus(float downKb, float upKb)
{
/* set users/friends/network */
if (statusRates)
statusRates -> setText(QString("<strong>%1:</strong> %2 (kB/s) | <strong>%3:</strong> %4 (kB/s) ").arg(tr("Down")).arg(downKb, 0, 'f', 2).arg(tr("Up")).arg(upKb, 0, 'f', 2));
QString normalText = QString("<strong>%1:</strong> %2 (kB/s) | <strong>%3:</strong> %4 (kB/s) ")
.arg(tr("Down")).arg(downKb, 0, 'f', 2)
.arg(tr("Up")).arg(upKb, 0, 'f', 2);
QString compactText = QString("%1|%2").arg(downKb, 0, 'f', 2).arg(upKb, 0, 'f', 2);
if( upKb > 0 || downKb < 0 )
{
iconLabel->setPixmap(QPixmap(":/images/up1down0.png"));
}
if( upKb < 0 || downKb > 0 )
{
iconLabel->setPixmap(QPixmap(":/images/up0down1.png"));
}
if( upKb > 0 || downKb > 0 )
{
iconLabel->setPixmap(QPixmap(":/images/up1down1.png"));
}
else
{
iconLabel->setPixmap(QPixmap(":/images/up0down0.png"));
if (statusRates) {
statusRates->setText(_compactMode?compactText:normalText);
statusRates->setToolTip(normalText);
}
QString up = (upKb > 0)?"1":"0";
QString dw = (downKb > 0)?"1":"0";
iconLabel->setPixmap(QPixmap(QString(":/images/")
+ "up" + up
+ "down" + dw
+ ".png"));
}

View file

@ -33,9 +33,11 @@ public:
RatesStatus(QWidget *parent = 0);
void getRatesStatus(float downKb, float upKb);
void setCompactMode(bool compact) {_compactMode = compact; }
private:
QLabel *iconLabel, *statusRates;
bool _compactMode;
};
#endif