mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 22:49:37 -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->addAction(_messengerwindowAct);
|
||||
menu->addAction(_messagesAct);
|
||||
|
||||
menu->addAction(_bandwidthAct);
|
||||
|
||||
/* bandwidth only in development version */
|
||||
#ifdef RS_RELEASE_VERSION
|
||||
#else
|
||||
menu->addAction(_bandwidthAct);
|
||||
menu->addAction(_appAct);
|
||||
#endif
|
||||
menu->addAction(_prefsAct);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* Copyright (c) 2006, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -26,6 +26,9 @@
|
||||
#include "bwgraph.h"
|
||||
#include "rsiface/rsiface.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <unistd.h>
|
||||
|
||||
#define BWGRAPH_LINE_SEND (1u<<0)
|
||||
#define BWGRAPH_LINE_RECV (1u<<1)
|
||||
@ -84,6 +87,10 @@ BandwidthGraph::BandwidthGraph(QWidget *parent, Qt::WFlags flags)
|
||||
#if defined(Q_WS_X11)
|
||||
ui.frmOpacity->setVisible(false);
|
||||
#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
|
||||
@ -98,15 +105,27 @@ BandwidthGraph::customEvent(QEvent *event)
|
||||
}
|
||||
|
||||
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 */
|
||||
float downKb = 0;
|
||||
float upKb = 0;
|
||||
rsicontrol -> ConfigGetDataRates(downKb, upKb);
|
||||
|
||||
updateGraph(downKb,upKb);
|
||||
|
||||
|
||||
updateGraph(downKb,upKb);
|
||||
|
||||
}
|
||||
|
||||
/** Binds events to actions. */
|
||||
@ -134,7 +153,7 @@ void
|
||||
BandwidthGraph::updateGraph(quint64 bytesRead, quint64 bytesWritten)
|
||||
{
|
||||
/* 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. */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2006-2007, crypton
|
||||
* Copyright (c) 2006, Matt Edman, Justin Hipple
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QEvent>
|
||||
#include <QTimer>
|
||||
|
||||
#include <gui/Preferences/rsharesettings.h>
|
||||
#include <gui/common/rwindow.h>
|
||||
@ -66,6 +67,9 @@ private slots:
|
||||
void cancelChanges();
|
||||
/** Called when the reset button is pressed */
|
||||
void reset();
|
||||
|
||||
void updategraphstatus();
|
||||
|
||||
|
||||
private:
|
||||
/** Create and bind actions to events **/
|
||||
|
Loading…
Reference in New Issue
Block a user