From 3cf9d9b955141eccbc8f532732efdc9abadbc080 Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 29 May 2014 16:15:26 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/MainWindow.cpp | 53 ++++++++++++--- retroshare-gui/src/gui/MainWindow.h | 24 +++++-- retroshare-gui/src/gui/images.qrc | 1 + retroshare-gui/src/gui/images/library16.png | Bin 0 -> 625 bytes .../src/gui/settings/AppearancePage.cpp | 16 +++++ .../src/gui/settings/AppearancePage.ui | 35 +++++++++- retroshare-gui/src/gui/settings/SoundPage.ui | 54 ++++++++-------- .../src/gui/statusbar/dhtstatus.cpp | 28 ++++---- retroshare-gui/src/gui/statusbar/dhtstatus.h | 5 +- .../src/gui/statusbar/hashingstatus.cpp | 26 +++++--- .../src/gui/statusbar/hashingstatus.h | 3 + .../src/gui/statusbar/natstatus.cpp | 61 ++++++++++-------- retroshare-gui/src/gui/statusbar/natstatus.h | 2 + .../src/gui/statusbar/peerstatus.cpp | 19 +++--- retroshare-gui/src/gui/statusbar/peerstatus.h | 2 + .../src/gui/statusbar/ratesstatus.cpp | 38 +++++------ .../src/gui/statusbar/ratesstatus.h | 2 + 17 files changed, 245 insertions(+), 124 deletions(-) create mode 100644 retroshare-gui/src/gui/images/library16.png diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index ccd82d48c..6ff4cea09 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -194,7 +194,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) : RWindow("MainWindow", parent, flags) { - ui = new Ui::MainWindow ; + ui = new Ui::MainWindow; + trayIcon = NULL; /* Invoke the Qt Designer generated QObject setup routine */ ui->setupUi(this); @@ -276,11 +277,19 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) ratesstatus = new 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 ******/ /* 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 natstatus; delete dhtstatus; - delete ratesstatus; + delete hashingstatus; delete discstatus; + delete ratesstatus; + delete opModeStatus; + delete soundStatus; + delete toasterDisable; MessengerWindow::releaseInstance(); #ifdef UNFINISHED delete applicationWindow; @@ -482,7 +495,7 @@ void MainWindow::initStackedPage() /** Add icon on Action bar */ 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_ABOUT), tr("About"), ui->toolBarAction), &MainWindow::showabout, SLOT(showabout())); addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), &MainWindow::doQuit, SLOT(doQuit())); @@ -801,7 +814,7 @@ void MainWindow::updateFriends() icon = QIcon(trayIconResource); } - trayIcon->setIcon(icon); + if (trayIcon) trayIcon->setIcon(icon); } void MainWindow::postModDirectories(bool update_local) @@ -1309,7 +1322,7 @@ void MainWindow::initializeStatusObject(QObject *pObject, bool bConnect) m_apStatusObjects.insert(m_apStatusObjects.end(), pObject); - std::string statusString; + //std::string statusString; QMenu *pMenu = dynamic_cast(pObject); if (pMenu) { @@ -1481,3 +1494,27 @@ void MainWindow::servicePermission() { 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 ??? +} diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index 152080a45..ea65da296 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -37,14 +37,17 @@ class QActionGroup; class QListWidgetItem; class Idle; class PeerStatus; -class GxsChannelDialog ; -class GxsForumsDialog ; class NATStatus; -class RatesStatus; -class DiscStatus; class DHTStatus; class HashingStatus; +class DiscStatus; +class RatesStatus; +class OpModeStatus; +class SoundStatus; +class ToasterDisable; //class ForumsDialog; +class GxsChannelDialog ; +class GxsForumsDialog ; class FriendsDialog; class ChatLobbyWidget; class ChatDialog; @@ -161,6 +164,9 @@ public: void removeStatusObject(QObject *pObject); void setStatus(QObject *pObject, int nStatus); + SoundStatus *soundStatusInstance(); + ToasterDisable *toasterDisableInstance(); + public slots: void displayErrorMessage(int,int,const QString&) ; void postModDirectories(bool update_local); @@ -171,6 +177,7 @@ public slots: void externalLinkActivated(const QUrl &url); //! Go to a specific part of the control panel. void setNewPage(int page); + void setCompactStatusMode(bool compact); protected: /** Default Constructor */ @@ -249,13 +256,16 @@ private: QAction *toggleVisibilityAction, *toolAct; QList userNotifyList; + QComboBox *statusComboBox; PeerStatus *peerstatus; NATStatus *natstatus; DHTStatus *dhtstatus; - RatesStatus *ratesstatus; - DiscStatus *discstatus; HashingStatus *hashingstatus; - QComboBox *statusComboBox; + DiscStatus *discstatus; + RatesStatus *ratesstatus; + OpModeStatus *opModeStatus; + SoundStatus *soundStatus; + ToasterDisable *toasterDisable; /* Status */ std::set m_apStatusObjects; // added objects for status diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 54f873ae3..c67e7413b 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -687,5 +687,6 @@ images/library_view.png images/library_add.png images/library64.png + images/library16.png diff --git a/retroshare-gui/src/gui/images/library16.png b/retroshare-gui/src/gui/images/library16.png new file mode 100644 index 0000000000000000000000000000000000000000..ac24d7a748730fd1ad9b53874825583f211ff631 GIT binary patch literal 625 zcmV-%0*?KOP)9#5R(}?uv!si{Q&9W)Oru^g(0~m88{H*0T>jyFC^Jy+j3(RG>sg zLG)zwA%T?$QW9cqn_pXN(@wkT?#$eodpq-yvXBxuFLP(^IluEe_i!bw@{v{zSco?! zg3ms5FBec~uDiItXDG2OKt#$#;mi?y?Ro;HsHh3$p)s}?5UQ`jN^l3Tk|JxY2ck8A zumH;hbPa+Tkhlroz-!llojni11tg}C6CH~nCg+r3P?@~*EeIgl|0oU?85#zBgTo#m zej3OrrKL@($Snd>qGhkCx+Po_yG6YS-|$Bd(AEYl{BmbvSEmF)y0#`vJCVC@lQ~dO z3xetJzfXC9b^^?+@HIdEuhA9Ct^n6>AUOKT1sEsW;cvJHb5F_%DD#(-A{l8}syIbf zZhL|kkyA6+kh}!t?l#D8lOEtiEBrhA76EL23|27(uBl``N4j};=91-(cDfhJoodMM zycYD?R%X zH-ttLP+v6A!7~VN8uEcL%v8j{4HePcXZ#>Q#b1DSa4**G8^B!M1sH{&2q*iIeI7$_ zS|!S@H%sC=1P>Vfvt;TC7PW#$nww<1{A za(wAFPK|en$V8vBo~=EH@b;@EH+6F4l!(qgbk?cLL)f~b*V+FAgN-r83)X!z00000 LNkvXXu0mjf>qZ%f literal 0 HcmV?d00001 diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index 63f1d1dc2..63fb478f2 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -27,6 +27,9 @@ #include #include "AppearancePage.h" #include "rsharesettings.h" +#include "gui/MainWindow.h" +#include "gui/statusbar/SoundStatus.h" +#include "gui/statusbar/ToasterDisable.h" /** Constructor */ 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 */ ui.setupUi(this); + MainWindow *pMainWindow = MainWindow::getInstance(); 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 */ foreach (QString code, LanguageSupport::languageCodes()) { @@ -121,6 +128,10 @@ bool AppearancePage::save(QString &errmsg) /* Set to new style */ 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; } @@ -189,6 +200,11 @@ void AppearancePage::load() case 32: 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) diff --git a/retroshare-gui/src/gui/settings/AppearancePage.ui b/retroshare-gui/src/gui/settings/AppearancePage.ui index 5d7b1ab4a..aa23334d7 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.ui +++ b/retroshare-gui/src/gui/settings/AppearancePage.ui @@ -162,7 +162,7 @@ - + Qt::Vertical @@ -404,6 +404,39 @@ + + + + Status Bar + + + + + + Remove surplus text in status bar. + + + Compact Mode + + + + + + + Hide Sound Status + + + + + + + Hide Toaster Disable + + + + + + diff --git a/retroshare-gui/src/gui/settings/SoundPage.ui b/retroshare-gui/src/gui/settings/SoundPage.ui index e3670ac38..70ab561be 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.ui +++ b/retroshare-gui/src/gui/settings/SoundPage.ui @@ -8,27 +8,12 @@ 0 463 370 - - - - - - - QAbstractItemView::NoEditTriggers - - - true - - - - 1 - - - - - - - + + + + + + @@ -96,12 +81,27 @@ - - - - - - + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + 1 + + + + + + + LineEditClear QLineEdit diff --git a/retroshare-gui/src/gui/statusbar/dhtstatus.cpp b/retroshare-gui/src/gui/statusbar/dhtstatus.cpp index 5c6adff23..180763618 100644 --- a/retroshare-gui/src/gui/statusbar/dhtstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/dhtstatus.cpp @@ -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); diff --git a/retroshare-gui/src/gui/statusbar/dhtstatus.h b/retroshare-gui/src/gui/statusbar/dhtstatus.h index 8ea26d45c..a9a5e843f 100644 --- a/retroshare-gui/src/gui/statusbar/dhtstatus.h +++ b/retroshare-gui/src/gui/statusbar/dhtstatus.h @@ -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 diff --git a/retroshare-gui/src/gui/statusbar/hashingstatus.cpp b/retroshare-gui/src/gui/statusbar/hashingstatus.cpp index 0dfa50cd4..536be0460 100644 --- a/retroshare-gui/src/gui/statusbar/hashingstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/hashingstatus.cpp @@ -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() ; } } diff --git a/retroshare-gui/src/gui/statusbar/hashingstatus.h b/retroshare-gui/src/gui/statusbar/hashingstatus.h index c33e2dc59..e21c1dafe 100644 --- a/retroshare-gui/src/gui/statusbar/hashingstatus.h +++ b/retroshare-gui/src/gui/statusbar/hashingstatus.h @@ -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 diff --git a/retroshare-gui/src/gui/statusbar/natstatus.cpp b/retroshare-gui/src/gui/statusbar/natstatus.cpp index 7d9511da2..92d827114 100644 --- a/retroshare-gui/src/gui/statusbar/natstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/natstatus.cpp @@ -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 ; } } diff --git a/retroshare-gui/src/gui/statusbar/natstatus.h b/retroshare-gui/src/gui/statusbar/natstatus.h index 7762ee02c..cd09235ba 100644 --- a/retroshare-gui/src/gui/statusbar/natstatus.h +++ b/retroshare-gui/src/gui/statusbar/natstatus.h @@ -33,9 +33,11 @@ public: NATStatus(QWidget *parent = 0); void getNATStatus( ); + void setCompactMode(bool compact) {_compactMode = compact; } private: QLabel *iconLabel, *statusNAT; + bool _compactMode; }; #endif diff --git a/retroshare-gui/src/gui/statusbar/peerstatus.cpp b/retroshare-gui/src/gui/statusbar/peerstatus.cpp index 7101c1c15..e496ae13e 100644 --- a/retroshare-gui/src/gui/statusbar/peerstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/peerstatus.cpp @@ -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("%1: %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount); + statusPeers -> setText(text); + } - if (statusPeers) - statusPeers -> setText(QString("%1: %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")); } - - } - - diff --git a/retroshare-gui/src/gui/statusbar/peerstatus.h b/retroshare-gui/src/gui/statusbar/peerstatus.h index a8c83636c..576193512 100644 --- a/retroshare-gui/src/gui/statusbar/peerstatus.h +++ b/retroshare-gui/src/gui/statusbar/peerstatus.h @@ -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 diff --git a/retroshare-gui/src/gui/statusbar/ratesstatus.cpp b/retroshare-gui/src/gui/statusbar/ratesstatus.cpp index b0d64b0d4..ad8a98f4b 100644 --- a/retroshare-gui/src/gui/statusbar/ratesstatus.cpp +++ b/retroshare-gui/src/gui/statusbar/ratesstatus.cpp @@ -42,7 +42,9 @@ RatesStatus::RatesStatus(QWidget *parent) statusRates = new QLabel( tr("Down: 0.00 (kB/s) | Up: 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("%1: %2 (kB/s) | %3: %4 (kB/s) ").arg(tr("Down")).arg(downKb, 0, 'f', 2).arg(tr("Up")).arg(upKb, 0, 'f', 2)); + QString normalText = QString("%1: %2 (kB/s) | %3: %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")); } diff --git a/retroshare-gui/src/gui/statusbar/ratesstatus.h b/retroshare-gui/src/gui/statusbar/ratesstatus.h index 77e657932..b0bfeb710 100644 --- a/retroshare-gui/src/gui/statusbar/ratesstatus.h +++ b/retroshare-gui/src/gui/statusbar/ratesstatus.h @@ -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