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

@ -194,7 +194,8 @@
MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
: RWindow("MainWindow", parent, flags) : RWindow("MainWindow", parent, flags)
{ {
ui = new Ui::MainWindow ; ui = new Ui::MainWindow;
trayIcon = NULL;
/* Invoke the Qt Designer generated QObject setup routine */ /* Invoke the Qt Designer generated QObject setup routine */
ui->setupUi(this); ui->setupUi(this);
@ -276,11 +277,19 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
ratesstatus = new RatesStatus(); ratesstatus = new RatesStatus();
statusBar()->addPermanentWidget(ratesstatus); statusBar()->addPermanentWidget(ratesstatus);
statusBar()->addPermanentWidget(new OpModeStatus()); opModeStatus = new OpModeStatus();
statusBar()->addPermanentWidget(opModeStatus);
statusBar()->addPermanentWidget(new SoundStatus()); soundStatus = new SoundStatus();
soundStatus->setHidden(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool());
statusBar()->addPermanentWidget(soundStatus);
toasterDisable = new ToasterDisable();
toasterDisable->setHidden(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool());
statusBar()->addPermanentWidget(toasterDisable);
setCompactStatusMode(Settings->valueFromGroup("StatusBar", "CompactMode", QVariant(false)).toBool());
statusBar()->addPermanentWidget(new ToasterDisable());
/** Status Bar end ******/ /** Status Bar end ******/
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */ /* Creates a tray icon with a context menu and adds it to the system's * notification area. */
@ -320,8 +329,12 @@ MainWindow::~MainWindow()
delete peerstatus; delete peerstatus;
delete natstatus; delete natstatus;
delete dhtstatus; delete dhtstatus;
delete ratesstatus; delete hashingstatus;
delete discstatus; delete discstatus;
delete ratesstatus;
delete opModeStatus;
delete soundStatus;
delete toasterDisable;
MessengerWindow::releaseInstance(); MessengerWindow::releaseInstance();
#ifdef UNFINISHED #ifdef UNFINISHED
delete applicationWindow; delete applicationWindow;
@ -482,7 +495,7 @@ void MainWindow::initStackedPage()
/** Add icon on Action bar */ /** Add icon on Action bar */
addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), &MainWindow::addFriend, SLOT(addFriend())); addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), &MainWindow::addFriend, SLOT(addFriend()));
addAction(new QAction(QIcon(IMAGE_NEWRSCOLLECTION), tr("New"), ui->toolBarAction), &MainWindow::newRsCollection, SLOT(newRsCollection())); //addAction(new QAction(QIcon(IMAGE_NEWRSCOLLECTION), tr("New"), ui->toolBarAction), &MainWindow::newRsCollection, SLOT(newRsCollection()));
addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), &MainWindow::showSettings, SLOT(showSettings())); addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), &MainWindow::showSettings, SLOT(showSettings()));
addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), &MainWindow::showabout, SLOT(showabout())); addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), &MainWindow::showabout, SLOT(showabout()));
addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), &MainWindow::doQuit, SLOT(doQuit())); addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), &MainWindow::doQuit, SLOT(doQuit()));
@ -801,7 +814,7 @@ void MainWindow::updateFriends()
icon = QIcon(trayIconResource); icon = QIcon(trayIconResource);
} }
trayIcon->setIcon(icon); if (trayIcon) trayIcon->setIcon(icon);
} }
void MainWindow::postModDirectories(bool update_local) void MainWindow::postModDirectories(bool update_local)
@ -1309,7 +1322,7 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect)
m_apStatusObjects.insert(m_apStatusObjects.end(), pObject); m_apStatusObjects.insert(m_apStatusObjects.end(), pObject);
std::string statusString; //std::string statusString;
QMenu *pMenu = dynamic_cast<QMenu*>(pObject); QMenu *pMenu = dynamic_cast<QMenu*>(pObject);
if (pMenu) { if (pMenu) {
@ -1481,3 +1494,27 @@ void MainWindow::servicePermission()
{ {
ServicePermissionDialog::showYourself(); ServicePermissionDialog::showYourself();
} }
SoundStatus *MainWindow::soundStatusInstance()
{
return soundStatus;
}
ToasterDisable *MainWindow::toasterDisableInstance()
{
return toasterDisable;
}
void MainWindow::setCompactStatusMode(bool compact)
{
//statusComboBox: TODO Show only icon
peerstatus->setCompactMode(compact);
updateFriends();
natstatus->setCompactMode(compact);
natstatus->getNATStatus();
dhtstatus->setCompactMode(compact);
dhtstatus->getDHTStatus();
hashingstatus->setCompactMode(compact);
ratesstatus->setCompactMode(compact);
//opModeStatus: TODO Show only ???
}

View File

@ -37,14 +37,17 @@ class QActionGroup;
class QListWidgetItem; class QListWidgetItem;
class Idle; class Idle;
class PeerStatus; class PeerStatus;
class GxsChannelDialog ;
class GxsForumsDialog ;
class NATStatus; class NATStatus;
class RatesStatus;
class DiscStatus;
class DHTStatus; class DHTStatus;
class HashingStatus; class HashingStatus;
class DiscStatus;
class RatesStatus;
class OpModeStatus;
class SoundStatus;
class ToasterDisable;
//class ForumsDialog; //class ForumsDialog;
class GxsChannelDialog ;
class GxsForumsDialog ;
class FriendsDialog; class FriendsDialog;
class ChatLobbyWidget; class ChatLobbyWidget;
class ChatDialog; class ChatDialog;
@ -161,6 +164,9 @@ public:
void removeStatusObject(QObject *pObject); void removeStatusObject(QObject *pObject);
void setStatus(QObject *pObject, int nStatus); void setStatus(QObject *pObject, int nStatus);
SoundStatus *soundStatusInstance();
ToasterDisable *toasterDisableInstance();
public slots: public slots:
void displayErrorMessage(int,int,const QString&) ; void displayErrorMessage(int,int,const QString&) ;
void postModDirectories(bool update_local); void postModDirectories(bool update_local);
@ -171,6 +177,7 @@ public slots:
void externalLinkActivated(const QUrl &url); void externalLinkActivated(const QUrl &url);
//! Go to a specific part of the control panel. //! Go to a specific part of the control panel.
void setNewPage(int page); void setNewPage(int page);
void setCompactStatusMode(bool compact);
protected: protected:
/** Default Constructor */ /** Default Constructor */
@ -249,13 +256,16 @@ private:
QAction *toggleVisibilityAction, *toolAct; QAction *toggleVisibilityAction, *toolAct;
QList<UserNotify*> userNotifyList; QList<UserNotify*> userNotifyList;
QComboBox *statusComboBox;
PeerStatus *peerstatus; PeerStatus *peerstatus;
NATStatus *natstatus; NATStatus *natstatus;
DHTStatus *dhtstatus; DHTStatus *dhtstatus;
RatesStatus *ratesstatus;
DiscStatus *discstatus;
HashingStatus *hashingstatus; HashingStatus *hashingstatus;
QComboBox *statusComboBox; DiscStatus *discstatus;
RatesStatus *ratesstatus;
OpModeStatus *opModeStatus;
SoundStatus *soundStatus;
ToasterDisable *toasterDisable;
/* Status */ /* Status */
std::set <QObject*> m_apStatusObjects; // added objects for status std::set <QObject*> m_apStatusObjects; // added objects for status

View File

@ -687,5 +687,6 @@
<file>images/library_view.png</file> <file>images/library_view.png</file>
<file>images/library_add.png</file> <file>images/library_add.png</file>
<file>images/library64.png</file> <file>images/library64.png</file>
<file>images/library16.png</file>
</qresource> </qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

View File

@ -27,6 +27,9 @@
#include <rshare.h> #include <rshare.h>
#include "AppearancePage.h" #include "AppearancePage.h"
#include "rsharesettings.h" #include "rsharesettings.h"
#include "gui/MainWindow.h"
#include "gui/statusbar/SoundStatus.h"
#include "gui/statusbar/ToasterDisable.h"
/** Constructor */ /** Constructor */
AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags) AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
@ -35,7 +38,11 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
MainWindow *pMainWindow = MainWindow::getInstance();
connect(ui.cmboStyleSheet, SIGNAL(activated(int)), this, SLOT(loadStyleSheet(int))); connect(ui.cmboStyleSheet, SIGNAL(activated(int)), this, SLOT(loadStyleSheet(int)));
connect(ui.checkBoxStatusCompactMode, SIGNAL(toggled(bool)), pMainWindow, SLOT(setCompactStatusMode(bool)));
connect(ui.checkBoxHideSoundStatus, SIGNAL(toggled(bool)), pMainWindow->soundStatusInstance(), SLOT(setHidden(bool)));
connect(ui.checkBoxHideToasterDisable, SIGNAL(toggled(bool)), pMainWindow->toasterDisableInstance(), SLOT(setHidden(bool)));
/* Populate combo boxes */ /* Populate combo boxes */
foreach (QString code, LanguageSupport::languageCodes()) { foreach (QString code, LanguageSupport::languageCodes()) {
@ -121,6 +128,10 @@ bool AppearancePage::save(QString &errmsg)
/* Set to new style */ /* Set to new style */
Rshare::setStyle(ui.cmboStyle->currentText()); Rshare::setStyle(ui.cmboStyle->currentText());
Settings->setValueToGroup("StatusBar", "CompactMode", QVariant(ui.checkBoxStatusCompactMode->isChecked()));
Settings->setValueToGroup("StatusBar", "HideSound", QVariant(ui.checkBoxHideSoundStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "HideToaster", QVariant(ui.checkBoxHideToasterDisable->isChecked()));
return true; return true;
} }
@ -189,6 +200,11 @@ void AppearancePage::load()
case 32: case 32:
ui.cmboListItemSize->setCurrentIndex(3); ui.cmboListItemSize->setCurrentIndex(3);
} }
ui.checkBoxStatusCompactMode->setChecked(Settings->valueFromGroup("StatusBar", "CompactMode", QVariant(false)).toBool());
ui.checkBoxHideSoundStatus->setChecked(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool());
ui.checkBoxHideToasterDisable->setChecked(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool());
} }
void AppearancePage::loadStyleSheet(int index) void AppearancePage::loadStyleSheet(int index)

View File

@ -162,7 +162,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="7" column="0"> <item row="8" column="0">
<spacer> <spacer>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -404,6 +404,39 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="7" column="0">
<widget class="QGroupBox" name="grpStatus">
<property name="title">
<string>Status Bar</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="checkBoxStatusCompactMode">
<property name="toolTip">
<string>Remove surplus text in status bar.</string>
</property>
<property name="text">
<string>Compact Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHideSoundStatus">
<property name="text">
<string>Hide Sound Status</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxHideToasterDisable">
<property name="text">
<string>Hide Toaster Disable</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>

View File

@ -11,21 +11,6 @@
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeWidget" name="eventTreeWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="eventGroup"> <widget class="QGroupBox" name="eventGroup">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -99,6 +84,21 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QTreeWidget" name="eventTreeWidget">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>

View File

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

View File

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

View File

@ -69,6 +69,8 @@ HashingStatus::HashingStatus(QWidget *parent)
QSpacerItem *horizontalSpacer = new QSpacerItem(3000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); QSpacerItem *horizontalSpacer = new QSpacerItem(3000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
hbox->addItem(horizontalSpacer); hbox->addItem(horizontalSpacer);
_compactMode = false;
setLayout(hbox); setLayout(hbox);
hashloader->hide(); hashloader->hide();
@ -84,16 +86,22 @@ HashingStatus::~HashingStatus()
void HashingStatus::updateHashingInfo(const QString& s) void HashingStatus::updateHashingInfo(const QString& s)
{ {
if(s.isEmpty()) { if (s.isEmpty()) {
statusHashing->hide(); statusHashing->hide() ;
hashloader->hide(); hashloader->hide() ;
movie->stop(); movie->stop() ;
} else { } else {
statusHashing->setText(s); hashloader->setToolTip(s) ;
statusHashing->show();
hashloader->show();
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(QWidget *parent = 0);
~HashingStatus(); ~HashingStatus();
void setCompactMode(bool compact) {_compactMode = compact; }
public slots: public slots:
void updateHashingInfo(const QString&) ; void updateHashingInfo(const QString&) ;
private: private:
QLabel *statusHashing, *hashloader; QLabel *statusHashing, *hashloader;
QMovie *movie; QMovie *movie;
bool _compactMode;
}; };
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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