mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-31 18:29:02 -04:00
generated for statusRates own class to clean more MainWindow
clean up some namings git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1157 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e3a5372597
commit
69914204db
13 changed files with 184 additions and 45 deletions
|
@ -221,6 +221,7 @@ HEADERS += rshare.h \
|
||||||
gui/statusbar/peerstatus.h \
|
gui/statusbar/peerstatus.h \
|
||||||
gui/statusbar/dhtstatus.h \
|
gui/statusbar/dhtstatus.h \
|
||||||
gui/statusbar/natstatus.h \
|
gui/statusbar/natstatus.h \
|
||||||
|
gui/statusbar/ratesstatus.h \
|
||||||
gui/advsearch/advancedsearchdialog.h \
|
gui/advsearch/advancedsearchdialog.h \
|
||||||
gui/advsearch/expressionwidget.h \
|
gui/advsearch/expressionwidget.h \
|
||||||
gui/advsearch/guiexprelement.h \
|
gui/advsearch/guiexprelement.h \
|
||||||
|
@ -439,6 +440,7 @@ SOURCES += main.cpp \
|
||||||
gui/statusbar/peerstatus.cpp \
|
gui/statusbar/peerstatus.cpp \
|
||||||
gui/statusbar/dhtstatus.cpp \
|
gui/statusbar/dhtstatus.cpp \
|
||||||
gui/statusbar/natstatus.cpp \
|
gui/statusbar/natstatus.cpp \
|
||||||
|
gui/statusbar/ratesstatus.cpp \
|
||||||
gui/toaster/ChatToaster.cpp \
|
gui/toaster/ChatToaster.cpp \
|
||||||
gui/toaster/MessageToaster.cpp \
|
gui/toaster/MessageToaster.cpp \
|
||||||
gui/toaster/CallToaster.cpp \
|
gui/toaster/CallToaster.cpp \
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
|
|
||||||
#include "NetworkView.h"
|
#include "NetworkView.h"
|
||||||
#include "LinksDialog.h"
|
#include "LinksDialog.h"
|
||||||
#include "PhotoDialog.h"
|
#include "PhotoDialog.h"
|
||||||
|
@ -39,7 +38,6 @@
|
||||||
#include "ChannelFeed.h"
|
#include "ChannelFeed.h"
|
||||||
#include "ShareManager.h"
|
#include "ShareManager.h"
|
||||||
|
|
||||||
|
|
||||||
#include <rshare.h>
|
#include <rshare.h>
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "MessengerWindow.h"
|
#include "MessengerWindow.h"
|
||||||
|
@ -55,6 +53,7 @@
|
||||||
#include "statusbar/peerstatus.h"
|
#include "statusbar/peerstatus.h"
|
||||||
#include "statusbar/dhtstatus.h"
|
#include "statusbar/dhtstatus.h"
|
||||||
#include "statusbar/natstatus.h"
|
#include "statusbar/natstatus.h"
|
||||||
|
#include "statusbar/ratesstatus.h"
|
||||||
|
|
||||||
#include "Preferences/PreferencesWindow.h"
|
#include "Preferences/PreferencesWindow.h"
|
||||||
#include "Settings/gsettingswin.h"
|
#include "Settings/gsettingswin.h"
|
||||||
|
@ -279,7 +278,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
statusBar()->addPermanentWidget(widget);
|
statusBar()->addPermanentWidget(widget);
|
||||||
_hashing_info_label->hide() ;
|
_hashing_info_label->hide() ;
|
||||||
|
|
||||||
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) ")));
|
ratesstatus = new RatesStatus();
|
||||||
|
statusBar()->addPermanentWidget(ratesstatus);
|
||||||
/******* Status Bar end ******/
|
/******* Status Bar end ******/
|
||||||
|
|
||||||
/* Create the actions that will go in the tray menu */
|
/* Create the actions that will go in the tray menu */
|
||||||
|
@ -337,20 +337,12 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
|
|
||||||
void MainWindow::updateStatus()
|
void MainWindow::updateStatus()
|
||||||
{
|
{
|
||||||
/* set users/friends/network */
|
|
||||||
float downKb = 0;
|
|
||||||
float upKb = 0;
|
|
||||||
rsicontrol -> ConfigGetDataRates(downKb, upKb);
|
|
||||||
|
|
||||||
std::ostringstream out;
|
if (ratesstatus)
|
||||||
out << "<strong>Down:</strong> " << std::setprecision(2) << std::fixed << downKb << " (kB/s) | <strong>Up:</strong> " << std::setprecision(2) << std::fixed << upKb << " (kB/s) ";
|
ratesstatus->getRatesStatus();
|
||||||
|
|
||||||
/* set uploads/download rates */
|
|
||||||
if (statusRates)
|
|
||||||
statusRates -> setText(QString::fromStdString(out.str()));
|
|
||||||
|
|
||||||
if (peerstatus)
|
if (peerstatus)
|
||||||
peerstatus->setPeerStatus();
|
peerstatus->getPeerStatus();
|
||||||
|
|
||||||
if (dhtstatus)
|
if (dhtstatus)
|
||||||
dhtstatus->getDHTStatus();
|
dhtstatus->getDHTStatus();
|
||||||
|
|
|
@ -63,6 +63,7 @@ class SMPlayer;
|
||||||
class PeerStatus;
|
class PeerStatus;
|
||||||
class DHTStatus;
|
class DHTStatus;
|
||||||
class NATStatus;
|
class NATStatus;
|
||||||
|
class RatesStatus;
|
||||||
|
|
||||||
void openFile(std::string path);
|
void openFile(std::string path);
|
||||||
|
|
||||||
|
@ -202,11 +203,11 @@ private:
|
||||||
QAction *toggleVisibilityAction, *toolAct;
|
QAction *toggleVisibilityAction, *toolAct;
|
||||||
QMenu *menu;
|
QMenu *menu;
|
||||||
|
|
||||||
QLabel *statusRates;
|
//QLabel *statusRates;
|
||||||
PeerStatus *peerstatus;
|
PeerStatus *peerstatus;
|
||||||
DHTStatus *dhtstatus;
|
DHTStatus *dhtstatus;
|
||||||
NATStatus *natstatus;
|
NATStatus *natstatus;
|
||||||
|
RatesStatus *ratesstatus;
|
||||||
|
|
||||||
QLabel *_hashing_info_label ;
|
QLabel *_hashing_info_label ;
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,6 @@ void NetworkDialog::getNetworkStatus()
|
||||||
/* now the extra bit .... switch on check boxes */
|
/* now the extra bit .... switch on check boxes */
|
||||||
const RsConfig &config = rsiface->getConfig();
|
const RsConfig &config = rsiface->getConfig();
|
||||||
|
|
||||||
//ui.check_net->setChecked(config.netOk);
|
|
||||||
if(config.netUpnpOk)
|
if(config.netUpnpOk)
|
||||||
{
|
{
|
||||||
setLogInfo(tr("UPNP is active."), QString::fromUtf8("blue"));
|
setLogInfo(tr("UPNP is active."), QString::fromUtf8("blue"));
|
||||||
|
|
|
@ -324,6 +324,10 @@
|
||||||
<file>images/user/personal64.png</file>
|
<file>images/user/personal64.png</file>
|
||||||
<file>images/user/kuser24.png</file>
|
<file>images/user/kuser24.png</file>
|
||||||
<file>images/up.png</file>
|
<file>images/up.png</file>
|
||||||
|
<file>images/up0down0.png</file>
|
||||||
|
<file>images/up0down1.png</file>
|
||||||
|
<file>images/up1down1.png</file>
|
||||||
|
<file>images/up1down0.png</file>
|
||||||
<file>images/underconstruction.png</file>
|
<file>images/underconstruction.png</file>
|
||||||
<file>images/user.png</file>
|
<file>images/user.png</file>
|
||||||
<file>images/view_calendar_day.png</file>
|
<file>images/view_calendar_day.png</file>
|
||||||
|
|
BIN
retroshare-gui/src/gui/images/up0down0.png
Normal file
BIN
retroshare-gui/src/gui/images/up0down0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 B |
BIN
retroshare-gui/src/gui/images/up0down1.png
Normal file
BIN
retroshare-gui/src/gui/images/up0down1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 237 B |
BIN
retroshare-gui/src/gui/images/up1down0.png
Normal file
BIN
retroshare-gui/src/gui/images/up1down0.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 B |
BIN
retroshare-gui/src/gui/images/up1down1.png
Normal file
BIN
retroshare-gui/src/gui/images/up1down1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 B |
|
@ -59,7 +59,7 @@ PeerStatus::~PeerStatus()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerStatus::setPeerStatus()
|
void PeerStatus::getPeerStatus()
|
||||||
{
|
{
|
||||||
/* set users/friends/network */
|
/* set users/friends/network */
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
~PeerStatus();
|
~PeerStatus();
|
||||||
|
|
||||||
void setPeerStatus( );
|
void getPeerStatus( );
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
96
retroshare-gui/src/gui/statusbar/ratesstatus.cpp
Normal file
96
retroshare-gui/src/gui/statusbar/ratesstatus.cpp
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 RetroShare Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
#include "ratesstatus.h"
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
|
#include "rsiface/rsiface.h"
|
||||||
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
RatesStatus::RatesStatus(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
|
hbox->setMargin(0);
|
||||||
|
hbox->setSpacing(6);
|
||||||
|
|
||||||
|
iconLabel = new QLabel( this );
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/up0down0.png"));
|
||||||
|
// iconLabel doesn't change over time, so we didn't need a minimum size
|
||||||
|
hbox->addWidget(iconLabel);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
setLayout( hbox );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
RatesStatus::~RatesStatus()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void RatesStatus::getRatesStatus()
|
||||||
|
{
|
||||||
|
/* set users/friends/network */
|
||||||
|
float downKb = 0;
|
||||||
|
float upKb = 0;
|
||||||
|
rsicontrol -> ConfigGetDataRates(downKb, upKb);
|
||||||
|
|
||||||
|
std::ostringstream out;
|
||||||
|
out << "<strong>Down:</strong> " << std::setprecision(2) << std::fixed << downKb << " (kB/s) | <strong>Up:</strong> " << std::setprecision(2) << std::fixed << upKb << " (kB/s) ";
|
||||||
|
|
||||||
|
|
||||||
|
if (statusRates)
|
||||||
|
statusRates -> setText(QString::fromStdString(out.str()));
|
||||||
|
|
||||||
|
if( upKb > 0 || downKb < 0 )
|
||||||
|
{
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/up1down0.png"));
|
||||||
|
}
|
||||||
|
else if( upKb = 0 || downKb > 0 )
|
||||||
|
{
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/up0down1.png"));
|
||||||
|
}
|
||||||
|
else if( upKb > 0 || downKb > 0 )
|
||||||
|
{
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/up1down1.png"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/up0down0.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
45
retroshare-gui/src/gui/statusbar/ratesstatus.h
Normal file
45
retroshare-gui/src/gui/statusbar/ratesstatus.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 RetroShare Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
#ifndef RATESSTATUS_H
|
||||||
|
#define RATESSTATUS_H
|
||||||
|
#include "gui/MainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
class RatesStatus : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
RatesStatus(QWidget *parent = 0);
|
||||||
|
|
||||||
|
~RatesStatus();
|
||||||
|
|
||||||
|
void getRatesStatus( );
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
class QLabel *iconLabel, *statusRates;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue