mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
c9ef2a77b5
commit
3cf9d9b955
@ -195,6 +195,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||
: RWindow("MainWindow", parent, flags)
|
||||
{
|
||||
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<QMenu*>(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 ???
|
||||
}
|
||||
|
@ -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<UserNotify*> 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 <QObject*> m_apStatusObjects; // added objects for status
|
||||
|
@ -687,5 +687,6 @@
|
||||
<file>images/library_view.png</file>
|
||||
<file>images/library_add.png</file>
|
||||
<file>images/library64.png</file>
|
||||
<file>images/library16.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
retroshare-gui/src/gui/images/library16.png
Normal file
BIN
retroshare-gui/src/gui/images/library16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 625 B |
@ -27,6 +27,9 @@
|
||||
#include <rshare.h>
|
||||
#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)
|
||||
|
@ -162,7 +162,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -404,6 +404,39 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
@ -11,21 +11,6 @@
|
||||
</rect>
|
||||
</property>
|
||||
<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">
|
||||
<widget class="QGroupBox" name="eventGroup">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@ -99,6 +84,21 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
@ -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,7 +79,7 @@ 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);
|
||||
@ -93,33 +97,33 @@ 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);
|
||||
|
@ -32,10 +32,11 @@ public:
|
||||
DHTStatus(QWidget *parent = 0);
|
||||
|
||||
void getDHTStatus( );
|
||||
void setCompactMode(bool compact) {_compactMode = compact; }
|
||||
|
||||
private:
|
||||
QLabel *dhtstatusLabel, *statusDHT, *dhtnetworkLabel, *dhtnetworksizeLabel, *spaceLabel;
|
||||
|
||||
bool _compactMode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -69,6 +69,8 @@ HashingStatus::HashingStatus(QWidget *parent)
|
||||
QSpacerItem *horizontalSpacer = new QSpacerItem(3000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
hbox->addItem(horizontalSpacer);
|
||||
|
||||
_compactMode = false;
|
||||
|
||||
setLayout(hbox);
|
||||
|
||||
hashloader->hide();
|
||||
@ -89,9 +91,15 @@ void HashingStatus::updateHashingInfo(const QString& s)
|
||||
hashloader->hide() ;
|
||||
|
||||
movie->stop() ;
|
||||
} else {
|
||||
hashloader->setToolTip(s) ;
|
||||
|
||||
if (_compactMode) {
|
||||
statusHashing->hide() ;
|
||||
} else {
|
||||
statusHashing->setText(s) ;
|
||||
statusHashing->show() ;
|
||||
}
|
||||
hashloader->show() ;
|
||||
|
||||
movie->start() ;
|
||||
|
@ -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
|
||||
|
@ -45,6 +45,8 @@ NATStatus::NATStatus(QWidget *parent)
|
||||
|
||||
hbox->addSpacing(2);
|
||||
|
||||
_compactMode = false;
|
||||
|
||||
setLayout(hbox);
|
||||
}
|
||||
|
||||
@ -52,20 +54,23 @@ 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->setToolTip( text + tr("Network Status Unknown")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_BAD_OFFLINE:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/grayled.png")) ;
|
||||
iconLabel->setToolTip(tr("Offline"));
|
||||
iconLabel->setToolTip( text + tr("Offline")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
@ -73,37 +78,36 @@ void NATStatus::getNATStatus()
|
||||
case RSNET_NETSTATE_BAD_NATSYM:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/redled.png")) ;
|
||||
iconLabel->setToolTip(tr("Nasty Firewall"));
|
||||
iconLabel->setToolTip( text + tr("Nasty Firewall")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_BAD_NODHT_NAT:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/redled.png")) ;
|
||||
iconLabel->setToolTip(tr("DHT Disabled and Firewalled"));
|
||||
iconLabel->setToolTip( text + tr("DHT Disabled and Firewalled")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
|
||||
// CAUTION. (ORANGE)
|
||||
case RSNET_NETSTATE_WARNING_RESTART:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
|
||||
iconLabel->setToolTip(tr("Network Restarting"));
|
||||
iconLabel->setToolTip( text + tr("Network Restarting")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_WARNING_NATTED:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
|
||||
iconLabel->setToolTip(tr("Behind Firewall"));
|
||||
iconLabel->setToolTip( text + tr("Behind Firewall")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_WARNING_NODHT:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/yellowled.png")) ;
|
||||
iconLabel->setToolTip(tr("DHT Disabled"));
|
||||
iconLabel->setToolTip( text + tr("DHT Disabled")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
@ -111,13 +115,14 @@ void NATStatus::getNATStatus()
|
||||
case RSNET_NETSTATE_GOOD:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/greenled.png")) ;
|
||||
iconLabel->setToolTip(tr("RetroShare Server"));
|
||||
iconLabel->setToolTip( text + tr("RetroShare Server")) ;
|
||||
}
|
||||
break ;
|
||||
|
||||
case RSNET_NETSTATE_ADV_FORWARD:
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/greenled.png")) ;
|
||||
iconLabel->setToolTip(tr("Forwarded Port"));
|
||||
iconLabel->setToolTip( text + tr("Forwarded Port")) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
|
@ -33,9 +33,11 @@ public:
|
||||
NATStatus(QWidget *parent = 0);
|
||||
|
||||
void getNATStatus( );
|
||||
void setCompactMode(bool compact) {_compactMode = compact; }
|
||||
|
||||
private:
|
||||
QLabel *iconLabel, *statusNAT;
|
||||
bool _compactMode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -40,6 +40,8 @@ PeerStatus::PeerStatus(QWidget *parent)
|
||||
// statusPeers->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
|
||||
hbox->addWidget(statusPeers);
|
||||
|
||||
_compactMode = false;
|
||||
|
||||
setLayout(hbox);
|
||||
|
||||
}
|
||||
@ -48,10 +50,13 @@ void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCo
|
||||
{
|
||||
/* set users/friends/network */
|
||||
|
||||
if (statusPeers){
|
||||
statusPeers->setToolTip(tr("Online Friends/Total Friends") );
|
||||
|
||||
if (statusPeers)
|
||||
statusPeers -> setText(QString("<strong>%1:</strong> %2/%3 ").arg(tr("Friends")).arg(nOnlineCount).arg(nFriendCount));
|
||||
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 (nOnlineCount > 0)
|
||||
{
|
||||
@ -61,8 +66,4 @@ void PeerStatus::getPeerStatus(unsigned int nFriendCount, unsigned int nOnlineCo
|
||||
{
|
||||
iconLabel->setPixmap(QPixmap(":/images/user/identitygray16.png"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -43,6 +43,8 @@ RatesStatus::RatesStatus(QWidget *parent)
|
||||
// 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 (statusRates) {
|
||||
statusRates->setText(_compactMode?compactText:normalText);
|
||||
statusRates->setToolTip(normalText);
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
QString up = (upKb > 0)?"1":"0";
|
||||
QString dw = (downKb > 0)?"1":"0";
|
||||
iconLabel->setPixmap(QPixmap(QString(":/images/")
|
||||
+ "up" + up
|
||||
+ "down" + dw
|
||||
+ ".png"));
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user