mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
Added a new Statistics Window
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7501 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
29a11b021e
commit
05be764186
@ -58,15 +58,6 @@
|
||||
#include <retroshare/rsdisc.h>
|
||||
#include <retroshare/rsplugin.h>
|
||||
|
||||
/****
|
||||
* #define SHOW_RTT_STATISTICS 1
|
||||
****/
|
||||
#define SHOW_RTT_STATISTICS 1
|
||||
|
||||
#ifdef SHOW_RTT_STATISTICS
|
||||
#include "gui/RttStatistics.h"
|
||||
#endif
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_INFO ":/images/fileinfo.png"
|
||||
#define IMAGE_CANCEL ":/images/delete.png"
|
||||
@ -339,10 +330,6 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
|
||||
ui.tabWidget->addTab(localSharedFiles = new LocalSharedFilesDialog(), QIcon(IMAGE_MYFILES), tr("My files")) ;
|
||||
|
||||
#ifdef SHOW_RTT_STATISTICS
|
||||
ui.tabWidget->addTab( new RttStatistics(), tr("RTT Statistics")) ;
|
||||
#endif
|
||||
|
||||
//ui.tabWidget->addTab( new TurtleRouterStatistics(), tr("Router Statistics")) ;
|
||||
//ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
|
||||
|
||||
|
@ -48,12 +48,10 @@
|
||||
#include "NewsFeed.h"
|
||||
#include "ShareManager.h"
|
||||
#include "NetworkView.h"
|
||||
//#include "ForumsDialog.h"
|
||||
#include "FriendsDialog.h"
|
||||
#include "ChatLobbyWidget.h"
|
||||
#include "HelpDialog.h"
|
||||
#include "AboutDialog.h"
|
||||
//#include "ChannelFeed.h"
|
||||
#include "bwgraph/bwgraph.h"
|
||||
#include "help/browser/helpbrowser.h"
|
||||
#include "chat/ChatDialog.h"
|
||||
@ -98,6 +96,7 @@
|
||||
#include "gui/Circles/CirclesDialog.h"
|
||||
#include "gui/WikiPoos/WikiDialog.h"
|
||||
#include "gui/Posted/PostedDialog.h"
|
||||
#include "gui/statistics/StatisticsWindow.h"
|
||||
|
||||
#include "gui/connect/ConnectFriendWizard.h"
|
||||
#include "gui/common/RsCollectionFile.h"
|
||||
@ -110,19 +109,6 @@
|
||||
#include <iomanip>
|
||||
#include <unistd.h>
|
||||
|
||||
/****
|
||||
*
|
||||
* #define USE_DHTWINDOW 1
|
||||
* #define USE_BWCTRLWINDOW 1
|
||||
*
|
||||
****/
|
||||
#define USE_DHTWINDOW 1
|
||||
|
||||
#ifdef USE_DHTWINDOW
|
||||
#include "dht/DhtWindow.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Images for toolbar icons */
|
||||
//#define IMAGE_NETWORK2 ":/images/rs1.png"
|
||||
//#define IMAGE_PEERS ":/images/groupchat.png"
|
||||
@ -613,9 +599,8 @@ void MainWindow::createTrayIcon()
|
||||
trayMenu->addAction(QIcon(IMAGE_RSM16), tr("Open Messenger"), this, SLOT(showMessengerWindow()));
|
||||
trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess()));
|
||||
trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), _bandwidthGraph, SLOT(showWindow()));
|
||||
#ifdef USE_DHTWINDOW
|
||||
trayMenu->addAction(QIcon(IMAGE_DHT), tr("Statistics"), this, SLOT(showDhtWindow()));
|
||||
#endif
|
||||
trayMenu->addAction(QIcon(IMAGE_DHT), tr("Statistics"), this, SLOT(showStatisticsWindow()));
|
||||
|
||||
|
||||
#ifdef UNFINISHED
|
||||
trayMenu->addAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this, SLOT(showApplWindow()));
|
||||
@ -1096,12 +1081,11 @@ void MainWindow::showMessengerWindow()
|
||||
MessengerWindow::showYourself();
|
||||
}
|
||||
|
||||
/** Shows Dht window */
|
||||
void MainWindow::showDhtWindow()
|
||||
/** Shows Statistics window */
|
||||
void MainWindow::showStatisticsWindow()
|
||||
{
|
||||
#ifdef USE_DHTWINDOW
|
||||
DhtWindow::showYourself();
|
||||
#endif
|
||||
StatisticsWindow::showYourself();
|
||||
|
||||
}
|
||||
|
||||
/** Shows Application window */
|
||||
|
@ -204,7 +204,7 @@ private slots:
|
||||
void addFriend();
|
||||
void newRsCollection();
|
||||
void showMessengerWindow();
|
||||
void showDhtWindow();
|
||||
void showStatisticsWindow();
|
||||
void servicePermission();
|
||||
|
||||
#ifdef UNFINISHED
|
||||
|
@ -163,84 +163,30 @@ QSize BWListDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, const QM
|
||||
return QSize(50,17);
|
||||
}
|
||||
|
||||
/**************************************************************************************************/
|
||||
/********************************************** STATIC WINDOW *************************************/
|
||||
/*BwCtrlWindow * BwCtrlWindow::mInstance = NULL;
|
||||
|
||||
void BwCtrlWindow::showYourself()
|
||||
BwCtrlWindow::BwCtrlWindow(QWidget *parent)
|
||||
: RsAutoUpdatePage(1000,parent)
|
||||
{
|
||||
if (mInstance == NULL) {
|
||||
mInstance = new BwCtrlWindow();
|
||||
}
|
||||
|
||||
mInstance->show();
|
||||
mInstance->activateWindow();
|
||||
}
|
||||
|
||||
BwCtrlWindow* BwCtrlWindow::getInstance()
|
||||
{
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void BwCtrlWindow::releaseInstance()
|
||||
{
|
||||
if (mInstance) {
|
||||
delete mInstance;
|
||||
}
|
||||
}*/
|
||||
|
||||
/********************************************** STATIC WINDOW *************************************/
|
||||
setupUi(this);
|
||||
|
||||
|
||||
BWDelegate = new BWListDelegate();
|
||||
bwTreeWidget->setItemDelegate(BWDelegate);
|
||||
|
||||
/* Set header resize modes and initial section sizes Peer TreeView*/
|
||||
QHeaderView * _header = bwTreeWidget->header () ;
|
||||
_header->resizeSection ( COLUMN_RSNAME, 170 );
|
||||
|
||||
|
||||
BwCtrlWindow::BwCtrlWindow(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::BwCtrlWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
BWDelegate = new BWListDelegate();
|
||||
ui->bwTreeWidget->setItemDelegate(BWDelegate);
|
||||
|
||||
//ui->tabWidget->addTab(dhtdetails = new DhtWindow(),QIcon(), tr("DHT"));
|
||||
|
||||
|
||||
// tick for gui update.
|
||||
QTimer *timer = new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
timer->start(1000);
|
||||
}
|
||||
|
||||
BwCtrlWindow::~BwCtrlWindow()
|
||||
{
|
||||
//delete ui;
|
||||
//mInstance = NULL;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void BwCtrlWindow::changeEvent(QEvent *e)
|
||||
void BwCtrlWindow::updateDisplay()
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
void BwCtrlWindow::update()
|
||||
{
|
||||
if (!isVisible())
|
||||
{
|
||||
#ifdef DEBUG_BWCTRLWINDOW
|
||||
//std::cerr << "BwCtrlWindow::update() !Visible" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* do nothing if locked, or not visible */
|
||||
if (RsAutoUpdatePage::eventsLocked() == true)
|
||||
@ -269,7 +215,7 @@ void BwCtrlWindow::update()
|
||||
|
||||
void BwCtrlWindow::updateBandwidth()
|
||||
{
|
||||
QTreeWidget *peerTreeWidget = ui->bwTreeWidget;
|
||||
QTreeWidget *peerTreeWidget = bwTreeWidget;
|
||||
|
||||
peerTreeWidget->clear();
|
||||
|
||||
@ -427,6 +373,6 @@ void BwCtrlWindow::updateBandwidth()
|
||||
void BwCtrlWindow::updateGraph(qreal bytesRead, qreal bytesWritten)
|
||||
{
|
||||
/* Graph only cares about kilobytes */
|
||||
ui->frmGraph->addPoints(bytesRead/*/1024.0*/, bytesWritten/*/1024.0*/);
|
||||
frmGraph->addPoints(bytesRead/*/1024.0*/, bytesWritten/*/1024.0*/);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,9 @@
|
||||
|
||||
#include <QAbstractItemDelegate>
|
||||
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_BwCtrlWindow.h"
|
||||
|
||||
// Defines for download list list columns
|
||||
#define COLUMN_RSNAME 0
|
||||
#define COLUMN_PEERID 1
|
||||
@ -63,36 +66,26 @@ public slots:
|
||||
signals:
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class BwCtrlWindow;
|
||||
}
|
||||
|
||||
class BwCtrlWindow : public QWidget {
|
||||
class BwCtrlWindow : public RsAutoUpdatePage, public Ui::BwCtrlWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
//static void showYourself ();
|
||||
//static BwCtrlWindow* getInstance();
|
||||
//static void releaseInstance();
|
||||
|
||||
|
||||
BwCtrlWindow(QWidget *parent = 0);
|
||||
~BwCtrlWindow();
|
||||
|
||||
void updateBandwidth();
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
virtual void updateDisplay() ;
|
||||
|
||||
/** Adds new data to the graph */
|
||||
void updateGraph(qreal bytesRead, qreal bytesWritten);
|
||||
void updateGraph(qreal bytesRead, qreal bytesWritten);
|
||||
|
||||
protected:
|
||||
//void changeEvent(QEvent *e);
|
||||
|
||||
|
||||
private:
|
||||
Ui::BwCtrlWindow *ui;
|
||||
|
||||
//static BwCtrlWindow *mInstance;
|
||||
|
||||
BWListDelegate *BWDelegate;
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "DhtWindow.h"
|
||||
#include "ui_DhtWindow.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
|
||||
@ -34,90 +35,20 @@
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
#include <gui/FileTransfer/TurtleRouterStatistics.h>
|
||||
#include <gui/settings/GlobalRouterStatistics.h>
|
||||
#include <gui/bwctrl/BwCtrlWindow.h>
|
||||
|
||||
/********************************************** STATIC WINDOW *************************************/
|
||||
DhtWindow * DhtWindow::mInstance = NULL;
|
||||
|
||||
void DhtWindow::showYourself()
|
||||
DhtWindow::DhtWindow(QWidget *parent)
|
||||
: RsAutoUpdatePage(1000,parent)
|
||||
{
|
||||
if (mInstance == NULL) {
|
||||
mInstance = new DhtWindow();
|
||||
}
|
||||
ui.setupUi(this);
|
||||
|
||||
mInstance->show();
|
||||
mInstance->activateWindow();
|
||||
}
|
||||
|
||||
DhtWindow* DhtWindow::getInstance()
|
||||
{
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void DhtWindow::releaseInstance()
|
||||
{
|
||||
if (mInstance) {
|
||||
delete mInstance;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************** STATIC WINDOW *************************************/
|
||||
|
||||
|
||||
|
||||
DhtWindow::DhtWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::DhtWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
BwCtrlWindow *bwdlg = new BwCtrlWindow ;
|
||||
ui->tabWidget->addTab(bwdlg, tr("Bandwidth details"));
|
||||
|
||||
TurtleRouterStatistics *trs = new TurtleRouterStatistics ;
|
||||
ui->tabWidget->addTab(trs,tr("Turtle router")) ;
|
||||
|
||||
GlobalRouterStatistics *grs = new GlobalRouterStatistics ;
|
||||
ui->tabWidget->addTab(grs,tr("Global router")) ;
|
||||
|
||||
// tick for gui update.
|
||||
QTimer *timer = new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
timer->start(1000);
|
||||
}
|
||||
|
||||
DhtWindow::~DhtWindow()
|
||||
{
|
||||
delete ui;
|
||||
mInstance = NULL;
|
||||
|
||||
}
|
||||
|
||||
void DhtWindow::changeEvent(QEvent *e)
|
||||
void DhtWindow::updateDisplay()
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DhtWindow::update()
|
||||
{
|
||||
if (!isVisible())
|
||||
{
|
||||
#ifdef DEBUG_DHTWINDOW
|
||||
//std::cerr << "DhtWindow::update() !Visible" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/* do nothing if locked, or not visible */
|
||||
if (RsAutoUpdatePage::eventsLocked() == true)
|
||||
{
|
||||
@ -155,23 +86,23 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
#if 0
|
||||
status = QString::fromStdString(mPeerNet->getPeerStatusString());
|
||||
oldstatus = ui->peerLine->text();
|
||||
oldstatus = ui.peerLine->text();
|
||||
if (oldstatus != status)
|
||||
{
|
||||
ui->peerLine->setText(status);
|
||||
ui.peerLine->setText(status);
|
||||
}
|
||||
#endif
|
||||
|
||||
status = QString::fromStdString(rsDht->getUdpAddressString());
|
||||
oldstatus = ui->peerAddressLabel->text();
|
||||
oldstatus = ui.peerAddressLabel->text();
|
||||
if (oldstatus != status)
|
||||
{
|
||||
ui->peerAddressLabel->setText(status);
|
||||
ui.peerAddressLabel->setText(status);
|
||||
}
|
||||
|
||||
uint32_t netMode = rsConfig->getNetworkMode();
|
||||
|
||||
QLabel *label = ui->networkLabel;
|
||||
QLabel *label = ui.networkLabel;
|
||||
switch(netMode)
|
||||
{
|
||||
case RSNET_NETWORK_UNKNOWN:
|
||||
@ -191,7 +122,7 @@ void DhtWindow::updateNetStatus()
|
||||
break;
|
||||
}
|
||||
|
||||
label = ui->natTypeLabel;
|
||||
label = ui.natTypeLabel;
|
||||
|
||||
uint32_t natType = rsConfig->getNatTypeMode();
|
||||
switch(natType)
|
||||
@ -221,7 +152,7 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
|
||||
|
||||
label = ui->natHoleLabel;
|
||||
label = ui.natHoleLabel;
|
||||
uint32_t natHole = rsConfig->getNatHoleMode();
|
||||
|
||||
switch(natHole)
|
||||
@ -245,7 +176,7 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
uint32_t connect = rsConfig->getConnectModes();
|
||||
|
||||
label = ui->connectLabel;
|
||||
label = ui.connectLabel;
|
||||
QString connOut;
|
||||
if (connect & RSNET_CONNECT_OUTGOING_TCP)
|
||||
{
|
||||
@ -272,7 +203,7 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
uint32_t netState = rsConfig->getNetState();
|
||||
|
||||
label = ui->netStatusLabel;
|
||||
label = ui.netStatusLabel;
|
||||
switch(netState)
|
||||
{
|
||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||
@ -310,7 +241,7 @@ void DhtWindow::updateNetStatus()
|
||||
|
||||
void DhtWindow::updateNetPeers()
|
||||
{
|
||||
QTreeWidget *peerTreeWidget = ui->peerTreeWidget;
|
||||
QTreeWidget *peerTreeWidget = ui.peerTreeWidget;
|
||||
|
||||
std::list<RsPeerId> peerIds;
|
||||
std::list<RsPeerId>::iterator it;
|
||||
@ -350,11 +281,11 @@ void DhtWindow::updateNetPeers()
|
||||
int itemCount = peerTreeWidget->topLevelItemCount();
|
||||
for (int nIndex = 0; nIndex < itemCount;)
|
||||
{
|
||||
QTreeWidgetItem *tmp_item = peerTreeWidget->topLevelItem(nIndex);
|
||||
QTreeWidgetItem *tmp_item = ui.peerTreeWidget->topLevelItem(nIndex);
|
||||
std::string tmpid = tmp_item->data(PTW_COL_PEERID, Qt::DisplayRole).toString().toStdString();
|
||||
if (peerIds.end() == std::find(peerIds.begin(), peerIds.end(), tmpid))
|
||||
{
|
||||
peerTreeWidget->removeItemWidget(tmp_item, 0);
|
||||
ui.peerTreeWidget->removeItemWidget(tmp_item, 0);
|
||||
/* remove it! */
|
||||
itemCount--;
|
||||
}
|
||||
@ -364,7 +295,7 @@ void DhtWindow::updateNetPeers()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
peerTreeWidget->clear();
|
||||
ui.peerTreeWidget->clear();
|
||||
|
||||
for(it = peerIds.begin(); it != peerIds.end(); it++)
|
||||
{
|
||||
@ -372,10 +303,10 @@ void DhtWindow::updateNetPeers()
|
||||
QTreeWidgetItem *peer_item = NULL;
|
||||
#if 0
|
||||
QString qpeerid = QString::fromStdString(*it);
|
||||
int itemCount = peerTreeWidget->topLevelItemCount();
|
||||
int itemCount = ui.peerTreeWidget->topLevelItemCount();
|
||||
for (int nIndex = 0; nIndex < itemCount; nIndex++)
|
||||
{
|
||||
QTreeWidgetItem *tmp_item = peerTreeWidget->topLevelItem(nIndex);
|
||||
QTreeWidgetItem *tmp_item = ui.peerTreeWidget->topLevelItem(nIndex);
|
||||
if (tmp_item->data(PTW_COL_PEERID, Qt::DisplayRole).toString() == qpeerid)
|
||||
{
|
||||
peer_item = tmp_item;
|
||||
@ -388,8 +319,13 @@ void DhtWindow::updateNetPeers()
|
||||
{
|
||||
/* insert */
|
||||
peer_item = new QTreeWidgetItem();
|
||||
peerTreeWidget->addTopLevelItem(peer_item);
|
||||
ui.peerTreeWidget->addTopLevelItem(peer_item);
|
||||
}
|
||||
|
||||
/* Set header resize modes and initial section sizes Peer TreeView*/
|
||||
QHeaderView * _header = ui.peerTreeWidget->header () ;
|
||||
_header->resizeSection ( PTW_COL_RSNAME, 170 );
|
||||
|
||||
|
||||
/* update the data */
|
||||
RsDhtNetPeer status;
|
||||
@ -530,17 +466,17 @@ void DhtWindow::updateNetPeers()
|
||||
connstr += tr(",#relay:") + QString::number(nRelayPeers);
|
||||
connstr += ")";*/
|
||||
|
||||
ui->label_peers->setText(QString::number(nPeers));
|
||||
ui->label_offline->setText(QString::number(nOfflinePeers));
|
||||
ui->label_unreachable->setText(QString::number(nUnreachablePeers));
|
||||
ui->label_online->setText(QString::number(nOnlinePeers));
|
||||
ui.label_peers->setText(QString::number(nPeers));
|
||||
ui.label_offline->setText(QString::number(nOfflinePeers));
|
||||
ui.label_unreachable->setText(QString::number(nUnreachablePeers));
|
||||
ui.label_online->setText(QString::number(nOnlinePeers));
|
||||
|
||||
ui->label_disconnected->setText(QString::number(nDisconnPeers));
|
||||
ui->label_direct->setText(QString::number(nDirectPeers));
|
||||
ui->label_proxy->setText(QString::number(nProxyPeers));
|
||||
ui->label_relay->setText(QString::number(nRelayPeers));
|
||||
ui.label_disconnected->setText(QString::number(nDisconnPeers));
|
||||
ui.label_direct->setText(QString::number(nDirectPeers));
|
||||
ui.label_proxy->setText(QString::number(nProxyPeers));
|
||||
ui.label_relay->setText(QString::number(nRelayPeers));
|
||||
|
||||
//ui->peerSummaryLabel->setText(connstr);
|
||||
//peerSummaryLabel->setText(connstr);
|
||||
}
|
||||
|
||||
|
||||
@ -548,7 +484,7 @@ void DhtWindow::updateNetPeers()
|
||||
void DhtWindow::updateRelays()
|
||||
{
|
||||
|
||||
QTreeWidget *relayTreeWidget = ui->relayTreeWidget;
|
||||
QTreeWidget *relayTreeWidget = ui.relayTreeWidget;
|
||||
|
||||
std::list<RsDhtRelayEnd> relayEnds;
|
||||
std::list<RsDhtRelayProxy> relayProxies;
|
||||
@ -576,7 +512,7 @@ void DhtWindow::updateRelays()
|
||||
{
|
||||
/* find the entry */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
relayTreeWidget->addTopLevelItem(item);
|
||||
ui.relayTreeWidget->addTopLevelItem(item);
|
||||
|
||||
QString typestr = tr("RELAY END");
|
||||
QString srcstr = tr("Yourself");
|
||||
@ -606,7 +542,7 @@ void DhtWindow::updateRelays()
|
||||
{
|
||||
/* find the entry */
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
relayTreeWidget->addTopLevelItem(item);
|
||||
ui.relayTreeWidget->addTopLevelItem(item);
|
||||
|
||||
QString typestr = tr("RELAY PROXY");
|
||||
QString srcstr = QString::fromStdString(rpit->mSrcAddr);
|
||||
@ -665,8 +601,8 @@ void DhtWindow::updateDhtPeers()
|
||||
{
|
||||
|
||||
/* Hackish display of all Dht peers, should be split into buckets (as children) */
|
||||
//QString status = QString::fromStdString(mPeerNet->getDhtStatusString());
|
||||
//ui->dhtLabel->setText(status);
|
||||
//QString status = QString::fromStdString(mPeerNet->getDhtStatusString());
|
||||
//dhtLabel->setText(status);
|
||||
|
||||
std::list<RsDhtPeer> allpeers;
|
||||
std::list<RsDhtPeer>::iterator it;
|
||||
@ -682,9 +618,9 @@ void DhtWindow::updateDhtPeers()
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidget *dhtTreeWidget = ui->dhtTreeWidget;
|
||||
QTreeWidget *dhtTreeWidget = ui.dhtTreeWidget;
|
||||
|
||||
dhtTreeWidget->clear();
|
||||
ui.dhtTreeWidget->clear();
|
||||
|
||||
time_t now = time(NULL);
|
||||
for(it = allpeers.begin(); it != allpeers.end(); it++)
|
||||
@ -722,7 +658,7 @@ void DhtWindow::updateDhtPeers()
|
||||
dht_item -> setData(DTW_COL_SEND, Qt::DisplayRole, lastsendstr);
|
||||
dht_item -> setData(DTW_COL_RECV, Qt::DisplayRole, lastrecvstr);
|
||||
|
||||
dhtTreeWidget->addTopLevelItem(dht_item);
|
||||
ui.dhtTreeWidget->addTopLevelItem(dht_item);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,21 +22,14 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class DhtWindow;
|
||||
}
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_DhtWindow.h"
|
||||
|
||||
class DhtWindow : public QMainWindow {
|
||||
class DhtWindow : public RsAutoUpdatePage/*, public Ui::DhtWindow*/ {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static void showYourself ();
|
||||
static DhtWindow* getInstance();
|
||||
static void releaseInstance();
|
||||
|
||||
|
||||
DhtWindow(QWidget *parent = 0);
|
||||
~DhtWindow();
|
||||
|
||||
@ -46,15 +39,15 @@ public:
|
||||
void updateRelays();
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
virtual void updateDisplay() ;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
//void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::DhtWindow *ui;
|
||||
|
||||
static DhtWindow *mInstance;
|
||||
/** Qt Designer generated object */
|
||||
Ui::DhtWindow ui;
|
||||
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,6 +53,7 @@
|
||||
<file>images/connect_creating.png</file>
|
||||
<file>images/connect_no.png</file>
|
||||
<file>images/dht16.png</file>
|
||||
<file>images/dht32.png</file>
|
||||
<file>images/edit-clear-history.png</file>
|
||||
<file>images/edit_16.png</file>
|
||||
<file>images/feedback_arrow.png</file>
|
||||
@ -379,6 +380,8 @@
|
||||
<file>images/no_avatar_70.png</file>
|
||||
<file>images/no_avatar_background.png</file>
|
||||
<file>images/openimage.png</file>
|
||||
<file>images/office-chart-area-stacked.png</file>
|
||||
<file>images/office-chart-line.png</file>
|
||||
<file>images/pasterslink.png</file>
|
||||
<file>images/package_games1.png</file>
|
||||
<file>images/pin32.png</file>
|
||||
|
BIN
retroshare-gui/src/gui/images/dht32.png
Normal file
BIN
retroshare-gui/src/gui/images/dht32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
retroshare-gui/src/gui/images/office-chart-area-stacked.png
Normal file
BIN
retroshare-gui/src/gui/images/office-chart-area-stacked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
retroshare-gui/src/gui/images/office-chart-line.png
Normal file
BIN
retroshare-gui/src/gui/images/office-chart-line.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 877 B |
198
retroshare-gui/src/gui/statistics/StatisticsWindow.cpp
Normal file
198
retroshare-gui/src/gui/statistics/StatisticsWindow.cpp
Normal file
@ -0,0 +1,198 @@
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2011 Robert Fernie
|
||||
*
|
||||
* 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 "StatisticsWindow.h"
|
||||
#include "ui_StatisticsWindow.h"
|
||||
#include <QTimer>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <time.h>
|
||||
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
#include "retroshare/rsconfig.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include <retroshare/rsplugin.h>
|
||||
|
||||
#include <gui/FileTransfer/TurtleRouterStatistics.h>
|
||||
#include <gui/settings/GlobalRouterStatistics.h>
|
||||
#include <gui/bwctrl/BwCtrlWindow.h>
|
||||
#include <gui/dht/DhtWindow.h>
|
||||
|
||||
/****
|
||||
* #define SHOW_RTT_STATISTICS 1
|
||||
****/
|
||||
#define SHOW_RTT_STATISTICS 1
|
||||
|
||||
#ifdef SHOW_RTT_STATISTICS
|
||||
#include "gui/RttStatistics.h"
|
||||
#endif
|
||||
|
||||
#define IMAGE_DHT ":/images/dht32.png"
|
||||
#define IMAGE_TURTLE ":images/turtle.png"
|
||||
#define IMAGE_BWGRAPH ":/images/ksysguard.png"
|
||||
#define IMAGE_GLOBALROUTER ":/images/network32.png"
|
||||
#define IMAGE_BANDWIDTH ":images/office-chart-area-stacked.png"
|
||||
#define IMAGE_RTT ":images/office-chart-line.png"
|
||||
|
||||
/********************************************** STATIC WINDOW *************************************/
|
||||
StatisticsWindow * StatisticsWindow::mInstance = NULL;
|
||||
|
||||
void StatisticsWindow::showYourself()
|
||||
{
|
||||
if (mInstance == NULL) {
|
||||
mInstance = new StatisticsWindow();
|
||||
}
|
||||
|
||||
mInstance->show();
|
||||
mInstance->activateWindow();
|
||||
}
|
||||
|
||||
StatisticsWindow* StatisticsWindow::getInstance()
|
||||
{
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
void StatisticsWindow::releaseInstance()
|
||||
{
|
||||
if (mInstance) {
|
||||
delete mInstance;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************** STATIC WINDOW *************************************/
|
||||
|
||||
|
||||
|
||||
StatisticsWindow::StatisticsWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::StatisticsWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
initStackedPage();
|
||||
connect(ui->stackPages, SIGNAL(currentChanged(int)), this, SLOT(setNewPage(int)));
|
||||
ui->stackPages->setCurrentIndex(0);
|
||||
|
||||
}
|
||||
|
||||
StatisticsWindow::~StatisticsWindow()
|
||||
{
|
||||
delete ui;
|
||||
mInstance = NULL;
|
||||
}
|
||||
|
||||
void StatisticsWindow::changeEvent(QEvent *e)
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** Initialyse Stacked Page*/
|
||||
void StatisticsWindow::initStackedPage()
|
||||
{
|
||||
|
||||
QList<QPair<MainPage*, QAction*> > notify;
|
||||
|
||||
/* Create the Main pages and actions */
|
||||
QActionGroup *grp = new QActionGroup(this);
|
||||
QAction *action;
|
||||
|
||||
ui->stackPages->add(dhtw = new DhtWindow(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_DHT), tr("DHT"), grp));
|
||||
|
||||
ui->stackPages->add(bwdlg = new BwCtrlWindow(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_BANDWIDTH), tr("Bandwidth"), grp));
|
||||
|
||||
ui->stackPages->add(trsdlg = new TurtleRouterStatistics(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_TURTLE), tr("Turtle Router"), grp));
|
||||
|
||||
ui->stackPages->add(grsdlg = new GlobalRouterStatistics(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_GLOBALROUTER), tr("Global Router"), grp));
|
||||
|
||||
#ifdef SHOW_RTT_STATISTICS
|
||||
|
||||
ui->stackPages->add(rttdlg = new RttStatistics(ui->stackPages),
|
||||
action = createPageAction(QIcon(IMAGE_RTT), tr("RTT Statistics"), grp));
|
||||
#endif
|
||||
|
||||
std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
|
||||
for(int i = 0;i<rsPlugins->nbPlugins();++i)
|
||||
{
|
||||
QIcon icon ;
|
||||
|
||||
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL)
|
||||
{
|
||||
if(rsPlugins->plugin(i)->qt_icon() != NULL)
|
||||
icon = *rsPlugins->plugin(i)->qt_icon() ;
|
||||
else
|
||||
icon = QIcon(":images/extension_48.png") ;
|
||||
|
||||
std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl;
|
||||
MainPage *pluginPage = rsPlugins->plugin(i)->qt_page();
|
||||
QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp);
|
||||
ui->stackPages->add(pluginPage, pluginAction);
|
||||
//notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction));
|
||||
}
|
||||
else if(rsPlugins->plugin(i) == NULL)
|
||||
std::cerr << " No plugin object !" << std::endl;
|
||||
else
|
||||
std::cerr << " No plugin page !" << std::endl;
|
||||
|
||||
}
|
||||
|
||||
/* Create the toolbar */
|
||||
ui->toolBar->addActions(grp->actions());
|
||||
|
||||
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *)));
|
||||
|
||||
}
|
||||
|
||||
/** Creates a new action associated with a main page. */
|
||||
QAction *StatisticsWindow::createPageAction(const QIcon &icon, const QString &text, QActionGroup *group)
|
||||
{
|
||||
QFont font;
|
||||
QAction *action = new QAction(icon, text, group);
|
||||
font = action->font();
|
||||
font.setPointSize(9);
|
||||
action->setCheckable(true);
|
||||
action->setFont(font);
|
||||
return action;
|
||||
}
|
||||
|
||||
/** Selection page. */
|
||||
void StatisticsWindow::setNewPage(int page)
|
||||
{
|
||||
MainPage *pagew = dynamic_cast<MainPage*>(ui->stackPages->widget(page)) ;
|
||||
|
||||
if(pagew)
|
||||
{
|
||||
ui->stackPages->setCurrentIndex(page);
|
||||
}
|
||||
}
|
78
retroshare-gui/src/gui/statistics/StatisticsWindow.h
Normal file
78
retroshare-gui/src/gui/statistics/StatisticsWindow.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef RSSTATS_WINDOW_H
|
||||
#define RSSTATS_WINDOW_H
|
||||
|
||||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2011 Robert Fernie
|
||||
*
|
||||
* 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 <QMainWindow>
|
||||
|
||||
namespace Ui {
|
||||
class StatisticsWindow;
|
||||
}
|
||||
|
||||
class MainPage;
|
||||
class QActionGroup;
|
||||
|
||||
class DhtWindow;
|
||||
class BwCtrlWindow;
|
||||
class TurtleRouterStatistics;
|
||||
class GlobalRouterStatistics;
|
||||
class RttStatistics;
|
||||
|
||||
class StatisticsWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
static void showYourself ();
|
||||
static StatisticsWindow* getInstance();
|
||||
static void releaseInstance();
|
||||
|
||||
|
||||
StatisticsWindow(QWidget *parent = 0);
|
||||
~StatisticsWindow();
|
||||
|
||||
DhtWindow *dhtw;
|
||||
GlobalRouterStatistics *grsdlg;
|
||||
BwCtrlWindow *bwdlg;
|
||||
TurtleRouterStatistics *trsdlg;
|
||||
RttStatistics *rttdlg;
|
||||
|
||||
|
||||
public slots:
|
||||
void setNewPage(int page);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
void initStackedPage();
|
||||
|
||||
Ui::StatisticsWindow *ui;
|
||||
|
||||
static StatisticsWindow *mInstance;
|
||||
|
||||
/** Creates a new action for a Main page. */
|
||||
QAction* createPageAction(const QIcon &icon, const QString &text, QActionGroup *group);
|
||||
|
||||
};
|
||||
|
||||
#endif // RSDHT_WINDOW_H
|
||||
|
151
retroshare-gui/src/gui/statistics/StatisticsWindow.ui
Normal file
151
retroshare-gui/src/gui/statistics/StatisticsWindow.ui
Normal file
@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StatisticsWindow</class>
|
||||
<widget class="QMainWindow" name="StatisticsWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>571</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">RetroShare Statistics</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="MainPageStack" name="stackPages" native="true"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<action name="actionAdd_Friend">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/user/add_user24.png</normaloff>:/images/user/add_user24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Friend</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add a Friend Wizard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAdd_Share">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/add-share24.png</normaloff>:/images/add-share24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Share</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOptions">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/kcmsystem24.png</normaloff>:/images/kcmsystem24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMessenger">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/messenger.png</normaloff>:/images/messenger.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Messenger</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/informations_24x24.png</normaloff>:/images/informations_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSMPlayer">
|
||||
<property name="text">
|
||||
<string>SMPlayer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/exit_24x24.png</normaloff>:/images/exit_24x24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuick_Start_Wizard">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/tools_wizard.png</normaloff>:/images/tools_wizard.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quick Start Wizard</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Quick Start Wizard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionServicePermissions">
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/admin-24.png</normaloff>:/images/admin-24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ServicePermissions</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Service permissions matrix</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MainPageStack</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">gui/mainpagestack.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -518,6 +518,7 @@ HEADERS += rshare.h \
|
||||
gui/connect/ConnectProgressDialog.h \
|
||||
gui/groups/CreateGroup.h \
|
||||
gui/dht/DhtWindow.h \
|
||||
gui/statistics/StatisticsWindow.h \
|
||||
gui/bwctrl/BwCtrlWindow.h \
|
||||
gui/channels/ShareKey.h \
|
||||
gui/GetStartedDialog.h \
|
||||
@ -629,6 +630,7 @@ FORMS += gui/StartDialog.ui \
|
||||
gui/common/RSFeedWidget.ui \
|
||||
gui/style/StyleDialog.ui \
|
||||
gui/dht/DhtWindow.ui \
|
||||
gui/statistics/StatisticsWindow.ui \
|
||||
gui/bwctrl/BwCtrlWindow.ui \
|
||||
gui/channels/ShareKey.ui \
|
||||
gui/GetStartedDialog.ui \
|
||||
@ -843,6 +845,7 @@ SOURCES += main.cpp \
|
||||
gui/connect/ConnectProgressDialog.cpp \
|
||||
gui/groups/CreateGroup.cpp \
|
||||
gui/dht/DhtWindow.cpp \
|
||||
gui/statistics/StatisticsWindow.cpp \
|
||||
gui/bwctrl/BwCtrlWindow.cpp \
|
||||
gui/channels/ShareKey.cpp \
|
||||
gui/GetStartedDialog.cpp \
|
||||
|
Loading…
Reference in New Issue
Block a user