mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-15 01:17:16 -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/rsdisc.h>
|
||||||
#include <retroshare/rsplugin.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 */
|
/* Images for context menu icons */
|
||||||
#define IMAGE_INFO ":/images/fileinfo.png"
|
#define IMAGE_INFO ":/images/fileinfo.png"
|
||||||
#define IMAGE_CANCEL ":/images/delete.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")) ;
|
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 TurtleRouterStatistics(), tr("Router Statistics")) ;
|
||||||
//ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
|
//ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
|
||||||
|
|
||||||
|
@ -48,12 +48,10 @@
|
|||||||
#include "NewsFeed.h"
|
#include "NewsFeed.h"
|
||||||
#include "ShareManager.h"
|
#include "ShareManager.h"
|
||||||
#include "NetworkView.h"
|
#include "NetworkView.h"
|
||||||
//#include "ForumsDialog.h"
|
|
||||||
#include "FriendsDialog.h"
|
#include "FriendsDialog.h"
|
||||||
#include "ChatLobbyWidget.h"
|
#include "ChatLobbyWidget.h"
|
||||||
#include "HelpDialog.h"
|
#include "HelpDialog.h"
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
//#include "ChannelFeed.h"
|
|
||||||
#include "bwgraph/bwgraph.h"
|
#include "bwgraph/bwgraph.h"
|
||||||
#include "help/browser/helpbrowser.h"
|
#include "help/browser/helpbrowser.h"
|
||||||
#include "chat/ChatDialog.h"
|
#include "chat/ChatDialog.h"
|
||||||
@ -98,6 +96,7 @@
|
|||||||
#include "gui/Circles/CirclesDialog.h"
|
#include "gui/Circles/CirclesDialog.h"
|
||||||
#include "gui/WikiPoos/WikiDialog.h"
|
#include "gui/WikiPoos/WikiDialog.h"
|
||||||
#include "gui/Posted/PostedDialog.h"
|
#include "gui/Posted/PostedDialog.h"
|
||||||
|
#include "gui/statistics/StatisticsWindow.h"
|
||||||
|
|
||||||
#include "gui/connect/ConnectFriendWizard.h"
|
#include "gui/connect/ConnectFriendWizard.h"
|
||||||
#include "gui/common/RsCollectionFile.h"
|
#include "gui/common/RsCollectionFile.h"
|
||||||
@ -110,19 +109,6 @@
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <unistd.h>
|
#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 */
|
/* Images for toolbar icons */
|
||||||
//#define IMAGE_NETWORK2 ":/images/rs1.png"
|
//#define IMAGE_NETWORK2 ":/images/rs1.png"
|
||||||
//#define IMAGE_PEERS ":/images/groupchat.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_RSM16), tr("Open Messenger"), this, SLOT(showMessengerWindow()));
|
||||||
trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess()));
|
trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess()));
|
||||||
trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), _bandwidthGraph, SLOT(showWindow()));
|
trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), _bandwidthGraph, SLOT(showWindow()));
|
||||||
#ifdef USE_DHTWINDOW
|
trayMenu->addAction(QIcon(IMAGE_DHT), tr("Statistics"), this, SLOT(showStatisticsWindow()));
|
||||||
trayMenu->addAction(QIcon(IMAGE_DHT), tr("Statistics"), this, SLOT(showDhtWindow()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UNFINISHED
|
#ifdef UNFINISHED
|
||||||
trayMenu->addAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this, SLOT(showApplWindow()));
|
trayMenu->addAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this, SLOT(showApplWindow()));
|
||||||
@ -1096,12 +1081,11 @@ void MainWindow::showMessengerWindow()
|
|||||||
MessengerWindow::showYourself();
|
MessengerWindow::showYourself();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Shows Dht window */
|
/** Shows Statistics window */
|
||||||
void MainWindow::showDhtWindow()
|
void MainWindow::showStatisticsWindow()
|
||||||
{
|
{
|
||||||
#ifdef USE_DHTWINDOW
|
StatisticsWindow::showYourself();
|
||||||
DhtWindow::showYourself();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Shows Application window */
|
/** Shows Application window */
|
||||||
|
@ -204,7 +204,7 @@ private slots:
|
|||||||
void addFriend();
|
void addFriend();
|
||||||
void newRsCollection();
|
void newRsCollection();
|
||||||
void showMessengerWindow();
|
void showMessengerWindow();
|
||||||
void showDhtWindow();
|
void showStatisticsWindow();
|
||||||
void servicePermission();
|
void servicePermission();
|
||||||
|
|
||||||
#ifdef UNFINISHED
|
#ifdef UNFINISHED
|
||||||
|
@ -163,84 +163,30 @@ QSize BWListDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, const QM
|
|||||||
return QSize(50,17);
|
return QSize(50,17);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************************************/
|
|
||||||
/********************************************** STATIC WINDOW *************************************/
|
|
||||||
/*BwCtrlWindow * BwCtrlWindow::mInstance = NULL;
|
|
||||||
|
|
||||||
void BwCtrlWindow::showYourself()
|
BwCtrlWindow::BwCtrlWindow(QWidget *parent)
|
||||||
|
: RsAutoUpdatePage(1000,parent)
|
||||||
{
|
{
|
||||||
if (mInstance == NULL) {
|
setupUi(this);
|
||||||
mInstance = new BwCtrlWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
mInstance->show();
|
|
||||||
mInstance->activateWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
BwCtrlWindow* BwCtrlWindow::getInstance()
|
|
||||||
{
|
|
||||||
return mInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BwCtrlWindow::releaseInstance()
|
|
||||||
{
|
|
||||||
if (mInstance) {
|
|
||||||
delete mInstance;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/********************************************** STATIC WINDOW *************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BwCtrlWindow::BwCtrlWindow(QWidget *parent) :
|
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::BwCtrlWindow)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
|
||||||
|
|
||||||
BWDelegate = new BWListDelegate();
|
BWDelegate = new BWListDelegate();
|
||||||
ui->bwTreeWidget->setItemDelegate(BWDelegate);
|
bwTreeWidget->setItemDelegate(BWDelegate);
|
||||||
|
|
||||||
//ui->tabWidget->addTab(dhtdetails = new DhtWindow(),QIcon(), tr("DHT"));
|
/* Set header resize modes and initial section sizes Peer TreeView*/
|
||||||
|
QHeaderView * _header = bwTreeWidget->header () ;
|
||||||
|
_header->resizeSection ( COLUMN_RSNAME, 170 );
|
||||||
|
|
||||||
|
|
||||||
// tick for gui update.
|
|
||||||
QTimer *timer = new QTimer(this);
|
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
|
||||||
timer->start(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BwCtrlWindow::~BwCtrlWindow()
|
BwCtrlWindow::~BwCtrlWindow()
|
||||||
{
|
{
|
||||||
//delete ui;
|
|
||||||
//mInstance = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void BwCtrlWindow::updateDisplay()
|
||||||
void BwCtrlWindow::changeEvent(QEvent *e)
|
|
||||||
{
|
{
|
||||||
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 */
|
/* do nothing if locked, or not visible */
|
||||||
if (RsAutoUpdatePage::eventsLocked() == true)
|
if (RsAutoUpdatePage::eventsLocked() == true)
|
||||||
@ -269,7 +215,7 @@ void BwCtrlWindow::update()
|
|||||||
|
|
||||||
void BwCtrlWindow::updateBandwidth()
|
void BwCtrlWindow::updateBandwidth()
|
||||||
{
|
{
|
||||||
QTreeWidget *peerTreeWidget = ui->bwTreeWidget;
|
QTreeWidget *peerTreeWidget = bwTreeWidget;
|
||||||
|
|
||||||
peerTreeWidget->clear();
|
peerTreeWidget->clear();
|
||||||
|
|
||||||
@ -427,6 +373,6 @@ void BwCtrlWindow::updateBandwidth()
|
|||||||
void BwCtrlWindow::updateGraph(qreal bytesRead, qreal bytesWritten)
|
void BwCtrlWindow::updateGraph(qreal bytesRead, qreal bytesWritten)
|
||||||
{
|
{
|
||||||
/* Graph only cares about kilobytes */
|
/* 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 <QAbstractItemDelegate>
|
||||||
|
|
||||||
|
#include "RsAutoUpdatePage.h"
|
||||||
|
#include "ui_BwCtrlWindow.h"
|
||||||
|
|
||||||
// Defines for download list list columns
|
// Defines for download list list columns
|
||||||
#define COLUMN_RSNAME 0
|
#define COLUMN_RSNAME 0
|
||||||
#define COLUMN_PEERID 1
|
#define COLUMN_PEERID 1
|
||||||
@ -63,26 +66,18 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Ui {
|
class BwCtrlWindow : public RsAutoUpdatePage, public Ui::BwCtrlWindow {
|
||||||
class BwCtrlWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
class BwCtrlWindow : public QWidget {
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//static void showYourself ();
|
|
||||||
//static BwCtrlWindow* getInstance();
|
|
||||||
//static void releaseInstance();
|
|
||||||
|
|
||||||
|
|
||||||
BwCtrlWindow(QWidget *parent = 0);
|
BwCtrlWindow(QWidget *parent = 0);
|
||||||
~BwCtrlWindow();
|
~BwCtrlWindow();
|
||||||
|
|
||||||
void updateBandwidth();
|
void updateBandwidth();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void update();
|
virtual void updateDisplay() ;
|
||||||
|
|
||||||
/** Adds new data to the graph */
|
/** Adds new data to the graph */
|
||||||
void updateGraph(qreal bytesRead, qreal bytesWritten);
|
void updateGraph(qreal bytesRead, qreal bytesWritten);
|
||||||
|
|
||||||
@ -90,9 +85,7 @@ protected:
|
|||||||
//void changeEvent(QEvent *e);
|
//void changeEvent(QEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BwCtrlWindow *ui;
|
|
||||||
|
|
||||||
//static BwCtrlWindow *mInstance;
|
|
||||||
|
|
||||||
BWListDelegate *BWDelegate;
|
BWListDelegate *BWDelegate;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "DhtWindow.h"
|
#include "DhtWindow.h"
|
||||||
#include "ui_DhtWindow.h"
|
#include "ui_DhtWindow.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
@ -34,90 +35,20 @@
|
|||||||
#include "retroshare/rsconfig.h"
|
#include "retroshare/rsconfig.h"
|
||||||
#include "retroshare/rspeers.h"
|
#include "retroshare/rspeers.h"
|
||||||
|
|
||||||
#include <gui/FileTransfer/TurtleRouterStatistics.h>
|
DhtWindow::DhtWindow(QWidget *parent)
|
||||||
#include <gui/settings/GlobalRouterStatistics.h>
|
: RsAutoUpdatePage(1000,parent)
|
||||||
#include <gui/bwctrl/BwCtrlWindow.h>
|
|
||||||
|
|
||||||
/********************************************** STATIC WINDOW *************************************/
|
|
||||||
DhtWindow * DhtWindow::mInstance = NULL;
|
|
||||||
|
|
||||||
void DhtWindow::showYourself()
|
|
||||||
{
|
{
|
||||||
if (mInstance == NULL) {
|
ui.setupUi(this);
|
||||||
mInstance = new DhtWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
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()
|
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 */
|
/* do nothing if locked, or not visible */
|
||||||
if (RsAutoUpdatePage::eventsLocked() == true)
|
if (RsAutoUpdatePage::eventsLocked() == true)
|
||||||
{
|
{
|
||||||
@ -155,23 +86,23 @@ void DhtWindow::updateNetStatus()
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
status = QString::fromStdString(mPeerNet->getPeerStatusString());
|
status = QString::fromStdString(mPeerNet->getPeerStatusString());
|
||||||
oldstatus = ui->peerLine->text();
|
oldstatus = ui.peerLine->text();
|
||||||
if (oldstatus != status)
|
if (oldstatus != status)
|
||||||
{
|
{
|
||||||
ui->peerLine->setText(status);
|
ui.peerLine->setText(status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status = QString::fromStdString(rsDht->getUdpAddressString());
|
status = QString::fromStdString(rsDht->getUdpAddressString());
|
||||||
oldstatus = ui->peerAddressLabel->text();
|
oldstatus = ui.peerAddressLabel->text();
|
||||||
if (oldstatus != status)
|
if (oldstatus != status)
|
||||||
{
|
{
|
||||||
ui->peerAddressLabel->setText(status);
|
ui.peerAddressLabel->setText(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t netMode = rsConfig->getNetworkMode();
|
uint32_t netMode = rsConfig->getNetworkMode();
|
||||||
|
|
||||||
QLabel *label = ui->networkLabel;
|
QLabel *label = ui.networkLabel;
|
||||||
switch(netMode)
|
switch(netMode)
|
||||||
{
|
{
|
||||||
case RSNET_NETWORK_UNKNOWN:
|
case RSNET_NETWORK_UNKNOWN:
|
||||||
@ -191,7 +122,7 @@ void DhtWindow::updateNetStatus()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
label = ui->natTypeLabel;
|
label = ui.natTypeLabel;
|
||||||
|
|
||||||
uint32_t natType = rsConfig->getNatTypeMode();
|
uint32_t natType = rsConfig->getNatTypeMode();
|
||||||
switch(natType)
|
switch(natType)
|
||||||
@ -221,7 +152,7 @@ void DhtWindow::updateNetStatus()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
label = ui->natHoleLabel;
|
label = ui.natHoleLabel;
|
||||||
uint32_t natHole = rsConfig->getNatHoleMode();
|
uint32_t natHole = rsConfig->getNatHoleMode();
|
||||||
|
|
||||||
switch(natHole)
|
switch(natHole)
|
||||||
@ -245,7 +176,7 @@ void DhtWindow::updateNetStatus()
|
|||||||
|
|
||||||
uint32_t connect = rsConfig->getConnectModes();
|
uint32_t connect = rsConfig->getConnectModes();
|
||||||
|
|
||||||
label = ui->connectLabel;
|
label = ui.connectLabel;
|
||||||
QString connOut;
|
QString connOut;
|
||||||
if (connect & RSNET_CONNECT_OUTGOING_TCP)
|
if (connect & RSNET_CONNECT_OUTGOING_TCP)
|
||||||
{
|
{
|
||||||
@ -272,7 +203,7 @@ void DhtWindow::updateNetStatus()
|
|||||||
|
|
||||||
uint32_t netState = rsConfig->getNetState();
|
uint32_t netState = rsConfig->getNetState();
|
||||||
|
|
||||||
label = ui->netStatusLabel;
|
label = ui.netStatusLabel;
|
||||||
switch(netState)
|
switch(netState)
|
||||||
{
|
{
|
||||||
case RSNET_NETSTATE_BAD_UNKNOWN:
|
case RSNET_NETSTATE_BAD_UNKNOWN:
|
||||||
@ -310,7 +241,7 @@ void DhtWindow::updateNetStatus()
|
|||||||
|
|
||||||
void DhtWindow::updateNetPeers()
|
void DhtWindow::updateNetPeers()
|
||||||
{
|
{
|
||||||
QTreeWidget *peerTreeWidget = ui->peerTreeWidget;
|
QTreeWidget *peerTreeWidget = ui.peerTreeWidget;
|
||||||
|
|
||||||
std::list<RsPeerId> peerIds;
|
std::list<RsPeerId> peerIds;
|
||||||
std::list<RsPeerId>::iterator it;
|
std::list<RsPeerId>::iterator it;
|
||||||
@ -350,11 +281,11 @@ void DhtWindow::updateNetPeers()
|
|||||||
int itemCount = peerTreeWidget->topLevelItemCount();
|
int itemCount = peerTreeWidget->topLevelItemCount();
|
||||||
for (int nIndex = 0; nIndex < itemCount;)
|
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();
|
std::string tmpid = tmp_item->data(PTW_COL_PEERID, Qt::DisplayRole).toString().toStdString();
|
||||||
if (peerIds.end() == std::find(peerIds.begin(), peerIds.end(), tmpid))
|
if (peerIds.end() == std::find(peerIds.begin(), peerIds.end(), tmpid))
|
||||||
{
|
{
|
||||||
peerTreeWidget->removeItemWidget(tmp_item, 0);
|
ui.peerTreeWidget->removeItemWidget(tmp_item, 0);
|
||||||
/* remove it! */
|
/* remove it! */
|
||||||
itemCount--;
|
itemCount--;
|
||||||
}
|
}
|
||||||
@ -364,7 +295,7 @@ void DhtWindow::updateNetPeers()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
peerTreeWidget->clear();
|
ui.peerTreeWidget->clear();
|
||||||
|
|
||||||
for(it = peerIds.begin(); it != peerIds.end(); it++)
|
for(it = peerIds.begin(); it != peerIds.end(); it++)
|
||||||
{
|
{
|
||||||
@ -372,10 +303,10 @@ void DhtWindow::updateNetPeers()
|
|||||||
QTreeWidgetItem *peer_item = NULL;
|
QTreeWidgetItem *peer_item = NULL;
|
||||||
#if 0
|
#if 0
|
||||||
QString qpeerid = QString::fromStdString(*it);
|
QString qpeerid = QString::fromStdString(*it);
|
||||||
int itemCount = peerTreeWidget->topLevelItemCount();
|
int itemCount = ui.peerTreeWidget->topLevelItemCount();
|
||||||
for (int nIndex = 0; nIndex < itemCount; nIndex++)
|
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)
|
if (tmp_item->data(PTW_COL_PEERID, Qt::DisplayRole).toString() == qpeerid)
|
||||||
{
|
{
|
||||||
peer_item = tmp_item;
|
peer_item = tmp_item;
|
||||||
@ -388,9 +319,14 @@ void DhtWindow::updateNetPeers()
|
|||||||
{
|
{
|
||||||
/* insert */
|
/* insert */
|
||||||
peer_item = new QTreeWidgetItem();
|
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 */
|
/* update the data */
|
||||||
RsDhtNetPeer status;
|
RsDhtNetPeer status;
|
||||||
rsDht->getNetPeerStatus(*it, status);
|
rsDht->getNetPeerStatus(*it, status);
|
||||||
@ -530,17 +466,17 @@ void DhtWindow::updateNetPeers()
|
|||||||
connstr += tr(",#relay:") + QString::number(nRelayPeers);
|
connstr += tr(",#relay:") + QString::number(nRelayPeers);
|
||||||
connstr += ")";*/
|
connstr += ")";*/
|
||||||
|
|
||||||
ui->label_peers->setText(QString::number(nPeers));
|
ui.label_peers->setText(QString::number(nPeers));
|
||||||
ui->label_offline->setText(QString::number(nOfflinePeers));
|
ui.label_offline->setText(QString::number(nOfflinePeers));
|
||||||
ui->label_unreachable->setText(QString::number(nUnreachablePeers));
|
ui.label_unreachable->setText(QString::number(nUnreachablePeers));
|
||||||
ui->label_online->setText(QString::number(nOnlinePeers));
|
ui.label_online->setText(QString::number(nOnlinePeers));
|
||||||
|
|
||||||
ui->label_disconnected->setText(QString::number(nDisconnPeers));
|
ui.label_disconnected->setText(QString::number(nDisconnPeers));
|
||||||
ui->label_direct->setText(QString::number(nDirectPeers));
|
ui.label_direct->setText(QString::number(nDirectPeers));
|
||||||
ui->label_proxy->setText(QString::number(nProxyPeers));
|
ui.label_proxy->setText(QString::number(nProxyPeers));
|
||||||
ui->label_relay->setText(QString::number(nRelayPeers));
|
ui.label_relay->setText(QString::number(nRelayPeers));
|
||||||
|
|
||||||
//ui->peerSummaryLabel->setText(connstr);
|
//peerSummaryLabel->setText(connstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -548,7 +484,7 @@ void DhtWindow::updateNetPeers()
|
|||||||
void DhtWindow::updateRelays()
|
void DhtWindow::updateRelays()
|
||||||
{
|
{
|
||||||
|
|
||||||
QTreeWidget *relayTreeWidget = ui->relayTreeWidget;
|
QTreeWidget *relayTreeWidget = ui.relayTreeWidget;
|
||||||
|
|
||||||
std::list<RsDhtRelayEnd> relayEnds;
|
std::list<RsDhtRelayEnd> relayEnds;
|
||||||
std::list<RsDhtRelayProxy> relayProxies;
|
std::list<RsDhtRelayProxy> relayProxies;
|
||||||
@ -576,7 +512,7 @@ void DhtWindow::updateRelays()
|
|||||||
{
|
{
|
||||||
/* find the entry */
|
/* find the entry */
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
relayTreeWidget->addTopLevelItem(item);
|
ui.relayTreeWidget->addTopLevelItem(item);
|
||||||
|
|
||||||
QString typestr = tr("RELAY END");
|
QString typestr = tr("RELAY END");
|
||||||
QString srcstr = tr("Yourself");
|
QString srcstr = tr("Yourself");
|
||||||
@ -606,7 +542,7 @@ void DhtWindow::updateRelays()
|
|||||||
{
|
{
|
||||||
/* find the entry */
|
/* find the entry */
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
relayTreeWidget->addTopLevelItem(item);
|
ui.relayTreeWidget->addTopLevelItem(item);
|
||||||
|
|
||||||
QString typestr = tr("RELAY PROXY");
|
QString typestr = tr("RELAY PROXY");
|
||||||
QString srcstr = QString::fromStdString(rpit->mSrcAddr);
|
QString srcstr = QString::fromStdString(rpit->mSrcAddr);
|
||||||
@ -666,7 +602,7 @@ void DhtWindow::updateDhtPeers()
|
|||||||
|
|
||||||
/* Hackish display of all Dht peers, should be split into buckets (as children) */
|
/* Hackish display of all Dht peers, should be split into buckets (as children) */
|
||||||
//QString status = QString::fromStdString(mPeerNet->getDhtStatusString());
|
//QString status = QString::fromStdString(mPeerNet->getDhtStatusString());
|
||||||
//ui->dhtLabel->setText(status);
|
//dhtLabel->setText(status);
|
||||||
|
|
||||||
std::list<RsDhtPeer> allpeers;
|
std::list<RsDhtPeer> allpeers;
|
||||||
std::list<RsDhtPeer>::iterator it;
|
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);
|
time_t now = time(NULL);
|
||||||
for(it = allpeers.begin(); it != allpeers.end(); it++)
|
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_SEND, Qt::DisplayRole, lastsendstr);
|
||||||
dht_item -> setData(DTW_COL_RECV, Qt::DisplayRole, lastrecvstr);
|
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.
|
* Boston, MA 02110-1301, USA.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
namespace Ui {
|
#include "RsAutoUpdatePage.h"
|
||||||
class DhtWindow;
|
#include "ui_DhtWindow.h"
|
||||||
}
|
|
||||||
|
|
||||||
class DhtWindow : public QMainWindow {
|
class DhtWindow : public RsAutoUpdatePage/*, public Ui::DhtWindow*/ {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void showYourself ();
|
|
||||||
static DhtWindow* getInstance();
|
|
||||||
static void releaseInstance();
|
|
||||||
|
|
||||||
|
|
||||||
DhtWindow(QWidget *parent = 0);
|
DhtWindow(QWidget *parent = 0);
|
||||||
~DhtWindow();
|
~DhtWindow();
|
||||||
|
|
||||||
@ -46,15 +39,15 @@ public:
|
|||||||
void updateRelays();
|
void updateRelays();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void update();
|
virtual void updateDisplay() ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *e);
|
//void changeEvent(QEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DhtWindow *ui;
|
|
||||||
|
|
||||||
static DhtWindow *mInstance;
|
/** Qt Designer generated object */
|
||||||
|
Ui::DhtWindow ui;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,36 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>DhtWindow</class>
|
<class>DhtWindow</class>
|
||||||
<widget class="QMainWindow" name="DhtWindow">
|
<widget class="QWidget" name="DhtWindow">
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>777</width>
|
<width>694</width>
|
||||||
<height>604</height>
|
<height>478</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Statistics</string>
|
<string>DHT</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset resource="../images.qrc">
|
|
||||||
<normaloff>:/images/dht16.png</normaloff>:/images/dht16.png</iconset>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralWidget">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>DHT Details</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||||
@ -572,7 +554,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget_2">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="dhtLabel">
|
<widget class="QLabel" name="dhtLabel">
|
||||||
@ -674,25 +656,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
<resources/>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenuBar" name="menuBar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>777</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
|
||||||
</widget>
|
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
|
||||||
<resources>
|
|
||||||
<include location="../images.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
<file>images/connect_creating.png</file>
|
<file>images/connect_creating.png</file>
|
||||||
<file>images/connect_no.png</file>
|
<file>images/connect_no.png</file>
|
||||||
<file>images/dht16.png</file>
|
<file>images/dht16.png</file>
|
||||||
|
<file>images/dht32.png</file>
|
||||||
<file>images/edit-clear-history.png</file>
|
<file>images/edit-clear-history.png</file>
|
||||||
<file>images/edit_16.png</file>
|
<file>images/edit_16.png</file>
|
||||||
<file>images/feedback_arrow.png</file>
|
<file>images/feedback_arrow.png</file>
|
||||||
@ -379,6 +380,8 @@
|
|||||||
<file>images/no_avatar_70.png</file>
|
<file>images/no_avatar_70.png</file>
|
||||||
<file>images/no_avatar_background.png</file>
|
<file>images/no_avatar_background.png</file>
|
||||||
<file>images/openimage.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/pasterslink.png</file>
|
||||||
<file>images/package_games1.png</file>
|
<file>images/package_games1.png</file>
|
||||||
<file>images/pin32.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/connect/ConnectProgressDialog.h \
|
||||||
gui/groups/CreateGroup.h \
|
gui/groups/CreateGroup.h \
|
||||||
gui/dht/DhtWindow.h \
|
gui/dht/DhtWindow.h \
|
||||||
|
gui/statistics/StatisticsWindow.h \
|
||||||
gui/bwctrl/BwCtrlWindow.h \
|
gui/bwctrl/BwCtrlWindow.h \
|
||||||
gui/channels/ShareKey.h \
|
gui/channels/ShareKey.h \
|
||||||
gui/GetStartedDialog.h \
|
gui/GetStartedDialog.h \
|
||||||
@ -629,6 +630,7 @@ FORMS += gui/StartDialog.ui \
|
|||||||
gui/common/RSFeedWidget.ui \
|
gui/common/RSFeedWidget.ui \
|
||||||
gui/style/StyleDialog.ui \
|
gui/style/StyleDialog.ui \
|
||||||
gui/dht/DhtWindow.ui \
|
gui/dht/DhtWindow.ui \
|
||||||
|
gui/statistics/StatisticsWindow.ui \
|
||||||
gui/bwctrl/BwCtrlWindow.ui \
|
gui/bwctrl/BwCtrlWindow.ui \
|
||||||
gui/channels/ShareKey.ui \
|
gui/channels/ShareKey.ui \
|
||||||
gui/GetStartedDialog.ui \
|
gui/GetStartedDialog.ui \
|
||||||
@ -843,6 +845,7 @@ SOURCES += main.cpp \
|
|||||||
gui/connect/ConnectProgressDialog.cpp \
|
gui/connect/ConnectProgressDialog.cpp \
|
||||||
gui/groups/CreateGroup.cpp \
|
gui/groups/CreateGroup.cpp \
|
||||||
gui/dht/DhtWindow.cpp \
|
gui/dht/DhtWindow.cpp \
|
||||||
|
gui/statistics/StatisticsWindow.cpp \
|
||||||
gui/bwctrl/BwCtrlWindow.cpp \
|
gui/bwctrl/BwCtrlWindow.cpp \
|
||||||
gui/channels/ShareKey.cpp \
|
gui/channels/ShareKey.cpp \
|
||||||
gui/GetStartedDialog.cpp \
|
gui/GetStartedDialog.cpp \
|
||||||
|
Loading…
Reference in New Issue
Block a user