mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-11 15:39:36 -05:00
* Added functionality for Bandwidth Graph, it shows now down and upload speed and Recv/Sent Data in KB/MB
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1036 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c8837d5b96
commit
bcfb410ba4
@ -353,12 +353,11 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
|||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(_messengerwindowAct);
|
menu->addAction(_messengerwindowAct);
|
||||||
menu->addAction(_messagesAct);
|
menu->addAction(_messagesAct);
|
||||||
|
menu->addAction(_bandwidthAct);
|
||||||
|
|
||||||
/* bandwidth only in development version */
|
/* bandwidth only in development version */
|
||||||
#ifdef RS_RELEASE_VERSION
|
#ifdef RS_RELEASE_VERSION
|
||||||
#else
|
#else
|
||||||
menu->addAction(_bandwidthAct);
|
|
||||||
menu->addAction(_appAct);
|
menu->addAction(_appAct);
|
||||||
#endif
|
#endif
|
||||||
menu->addAction(_prefsAct);
|
menu->addAction(_prefsAct);
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
#include "bwgraph.h"
|
#include "bwgraph.h"
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define BWGRAPH_LINE_SEND (1u<<0)
|
#define BWGRAPH_LINE_SEND (1u<<0)
|
||||||
#define BWGRAPH_LINE_RECV (1u<<1)
|
#define BWGRAPH_LINE_RECV (1u<<1)
|
||||||
@ -84,6 +87,10 @@ BandwidthGraph::BandwidthGraph(QWidget *parent, Qt::WFlags flags)
|
|||||||
#if defined(Q_WS_X11)
|
#if defined(Q_WS_X11)
|
||||||
ui.frmOpacity->setVisible(false);
|
ui.frmOpacity->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updategraphstatus()));
|
||||||
|
timer->start(5113);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Custom event handler. Checks if the event is a bandwidth update event. If it
|
/** Custom event handler. Checks if the event is a bandwidth update event. If it
|
||||||
@ -99,6 +106,18 @@ BandwidthGraph::customEvent(QEvent *event)
|
|||||||
|
|
||||||
void
|
void
|
||||||
BandwidthGraph::timerEvent( QTimerEvent * )
|
BandwidthGraph::timerEvent( QTimerEvent * )
|
||||||
|
{
|
||||||
|
/* set users/friends/network */
|
||||||
|
/*float downKb = 0;
|
||||||
|
float upKb = 0;
|
||||||
|
rsicontrol -> ConfigGetDataRates(downKb, upKb);
|
||||||
|
|
||||||
|
updateGraph(downKb,upKb);*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BandwidthGraph::updategraphstatus( )
|
||||||
{
|
{
|
||||||
/* set users/friends/network */
|
/* set users/friends/network */
|
||||||
float downKb = 0;
|
float downKb = 0;
|
||||||
@ -134,7 +153,7 @@ void
|
|||||||
BandwidthGraph::updateGraph(quint64 bytesRead, quint64 bytesWritten)
|
BandwidthGraph::updateGraph(quint64 bytesRead, quint64 bytesWritten)
|
||||||
{
|
{
|
||||||
/* Graph only cares about kilobytes */
|
/* Graph only cares about kilobytes */
|
||||||
ui.frmGraph->addPoints(bytesRead/1024.0, bytesWritten/1024.0);
|
ui.frmGraph->addPoints(bytesRead/*/1024.0*/, bytesWritten/*/1024.0*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads the saved Bandwidth Graph settings. */
|
/** Loads the saved Bandwidth Graph settings. */
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <gui/Preferences/rsharesettings.h>
|
#include <gui/Preferences/rsharesettings.h>
|
||||||
#include <gui/common/rwindow.h>
|
#include <gui/common/rwindow.h>
|
||||||
@ -67,6 +68,9 @@ private slots:
|
|||||||
/** Called when the reset button is pressed */
|
/** Called when the reset button is pressed */
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
void updategraphstatus();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Create and bind actions to events **/
|
/** Create and bind actions to events **/
|
||||||
void createActions();
|
void createActions();
|
||||||
|
Loading…
Reference in New Issue
Block a user