mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -220,7 +220,8 @@ HEADERS += rshare.h \
|
||||
gui/Settings/NetworkPage.h \
|
||||
gui/statusbar/peerstatus.h \
|
||||
gui/statusbar/dhtstatus.h \
|
||||
gui/statusbar/natstatus.h \
|
||||
gui/statusbar/natstatus.h \
|
||||
gui/statusbar/ratesstatus.h \
|
||||
gui/advsearch/advancedsearchdialog.h \
|
||||
gui/advsearch/expressionwidget.h \
|
||||
gui/advsearch/guiexprelement.h \
|
||||
@ -438,7 +439,8 @@ SOURCES += main.cpp \
|
||||
gui/Settings/NetworkPage.cpp \
|
||||
gui/statusbar/peerstatus.cpp \
|
||||
gui/statusbar/dhtstatus.cpp \
|
||||
gui/statusbar/natstatus.cpp \
|
||||
gui/statusbar/natstatus.cpp \
|
||||
gui/statusbar/ratesstatus.cpp \
|
||||
gui/toaster/ChatToaster.cpp \
|
||||
gui/toaster/MessageToaster.cpp \
|
||||
gui/toaster/CallToaster.cpp \
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <QIcon>
|
||||
#include <QPixmap>
|
||||
|
||||
|
||||
#include "NetworkView.h"
|
||||
#include "LinksDialog.h"
|
||||
#include "PhotoDialog.h"
|
||||
@ -39,7 +38,6 @@
|
||||
#include "ChannelFeed.h"
|
||||
#include "ShareManager.h"
|
||||
|
||||
|
||||
#include <rshare.h>
|
||||
#include "MainWindow.h"
|
||||
#include "MessengerWindow.h"
|
||||
@ -55,6 +53,7 @@
|
||||
#include "statusbar/peerstatus.h"
|
||||
#include "statusbar/dhtstatus.h"
|
||||
#include "statusbar/natstatus.h"
|
||||
#include "statusbar/ratesstatus.h"
|
||||
|
||||
#include "Preferences/PreferencesWindow.h"
|
||||
#include "Settings/gsettingswin.h"
|
||||
@ -279,7 +278,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
statusBar()->addPermanentWidget(widget);
|
||||
_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 ******/
|
||||
|
||||
/* Create the actions that will go in the tray menu */
|
||||
@ -337,20 +337,12 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
|
||||
void MainWindow::updateStatus()
|
||||
{
|
||||
/* 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) ";
|
||||
|
||||
/* set uploads/download rates */
|
||||
if (statusRates)
|
||||
statusRates -> setText(QString::fromStdString(out.str()));
|
||||
|
||||
if (ratesstatus)
|
||||
ratesstatus->getRatesStatus();
|
||||
|
||||
if (peerstatus)
|
||||
peerstatus->setPeerStatus();
|
||||
peerstatus->getPeerStatus();
|
||||
|
||||
if (dhtstatus)
|
||||
dhtstatus->getDHTStatus();
|
||||
|
@ -63,6 +63,7 @@ class SMPlayer;
|
||||
class PeerStatus;
|
||||
class DHTStatus;
|
||||
class NATStatus;
|
||||
class RatesStatus;
|
||||
|
||||
void openFile(std::string path);
|
||||
|
||||
@ -202,11 +203,11 @@ private:
|
||||
QAction *toggleVisibilityAction, *toolAct;
|
||||
QMenu *menu;
|
||||
|
||||
QLabel *statusRates;
|
||||
//QLabel *statusRates;
|
||||
PeerStatus *peerstatus;
|
||||
DHTStatus *dhtstatus;
|
||||
NATStatus *natstatus;
|
||||
|
||||
RatesStatus *ratesstatus;
|
||||
|
||||
QLabel *_hashing_info_label ;
|
||||
|
||||
|
@ -608,7 +608,6 @@ void NetworkDialog::getNetworkStatus()
|
||||
/* now the extra bit .... switch on check boxes */
|
||||
const RsConfig &config = rsiface->getConfig();
|
||||
|
||||
//ui.check_net->setChecked(config.netOk);
|
||||
if(config.netUpnpOk)
|
||||
{
|
||||
setLogInfo(tr("UPNP is active."), QString::fromUtf8("blue"));
|
||||
|
@ -324,6 +324,10 @@
|
||||
<file>images/user/personal64.png</file>
|
||||
<file>images/user/kuser24.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/user.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 */
|
||||
|
||||
|
@ -17,29 +17,29 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
#ifndef PEERSTATUS_H
|
||||
#define PEERSTATUS_H
|
||||
****************************************************************/
|
||||
#ifndef PEERSTATUS_H
|
||||
#define PEERSTATUS_H
|
||||
#include "gui/MainWindow.h"
|
||||
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class PeerStatus : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PeerStatus(QWidget *parent = 0);
|
||||
|
||||
~PeerStatus();
|
||||
|
||||
void setPeerStatus( );
|
||||
|
||||
|
||||
private:
|
||||
class QLabel *iconLabel, *statusPeers;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class PeerStatus : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PeerStatus(QWidget *parent = 0);
|
||||
|
||||
~PeerStatus();
|
||||
|
||||
void getPeerStatus( );
|
||||
|
||||
|
||||
private:
|
||||
class QLabel *iconLabel, *statusPeers;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
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…
Reference in New Issue
Block a user