From 429d6f2dc350ff1c9ed577db35a9564969b8da29 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 28 May 2011 22:25:42 +0000 Subject: [PATCH] improved tunnel statistics gui git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4224 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/TransfersDialog.cpp | 18 ++++---- retroshare-gui/src/gui/TransfersDialog.ui | 29 +----------- retroshare-gui/src/gui/TurtleRouterDialog.cpp | 46 ++++++++++++++----- retroshare-gui/src/gui/TurtleRouterDialog.ui | 33 ++++++------- 4 files changed, 63 insertions(+), 63 deletions(-) diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 3410092d9..1d6bb5010 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -262,14 +262,16 @@ TransfersDialog::TransfersDialog(QWidget *parent) QObject::connect(ui.downloadList->selectionModel(),SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),this,SLOT(showFileDetails())) ; - TurtleRouterDialog *trdl = new TurtleRouterDialog(); - ui.tunnelInfoWidget->setWidget(trdl); - ui.tunnelInfoWidget->setWidgetResizable(true); - ui.tunnelInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui.tunnelInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui.tunnelInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole); - ui.tunnelInfoWidget->setFrameStyle(QFrame::NoFrame); - ui.tunnelInfoWidget->setFocusPolicy(Qt::NoFocus); + ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Tunneling")) ; + +// TurtleRouterDialog *trdl = new TurtleRouterDialog(); +// ui.tunnelInfoWidget->setWidget(trdl); +// ui.tunnelInfoWidget->setWidgetResizable(true); +// ui.tunnelInfoWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +// ui.tunnelInfoWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); +// ui.tunnelInfoWidget->viewport()->setBackgroundRole(QPalette::NoRole); +// ui.tunnelInfoWidget->setFrameStyle(QFrame::NoFrame); +// ui.tunnelInfoWidget->setFocusPolicy(Qt::NoFocus); /* Hide platform specific features */ #ifdef Q_WS_WIN diff --git a/retroshare-gui/src/gui/TransfersDialog.ui b/retroshare-gui/src/gui/TransfersDialog.ui index 32dd0bd1c..89433b933 100644 --- a/retroshare-gui/src/gui/TransfersDialog.ui +++ b/retroshare-gui/src/gui/TransfersDialog.ui @@ -656,9 +656,6 @@ p, li { white-space: pre-wrap; } false - - false - @@ -671,7 +668,7 @@ p, li { white-space: pre-wrap; } - 0 + 1 @@ -826,30 +823,6 @@ p, li { white-space: pre-wrap; } - - - Tunneling - - - - - - true - - - - - 0 - 0 - 98 - 28 - - - - - - - diff --git a/retroshare-gui/src/gui/TurtleRouterDialog.cpp b/retroshare-gui/src/gui/TurtleRouterDialog.cpp index d93c40513..f42cbcd8e 100644 --- a/retroshare-gui/src/gui/TurtleRouterDialog.cpp +++ b/retroshare-gui/src/gui/TurtleRouterDialog.cpp @@ -16,7 +16,10 @@ class TRHistogram QColor colorScale(float f) { - return QColor::fromHsv((int)((1.0-f)*280),200,255) ; + if(f == 0) + return QColor::fromHsv(0,0,128) ; + else + return QColor::fromHsv((int)((1.0-f)*280),200,255) ; } virtual void draw(QPainter *painter,int& ox,int& oy,const QString& title) @@ -93,7 +96,7 @@ class TRHistogram painter->setPen(QColor::fromRgb(0,0,0)) ; painter->drawText(ox+MaxDepth*cellx+30+(MaxTime+1)*cellx,oy+(p+1)*celly,TurtleRouterDialog::getPeerName(it->first)) ; - painter->drawText(ox+MaxDepth*cellx+30+(MaxTime+1)*cellx+80,oy+(p+1)*celly,"("+QString::number(total)+")") ; + painter->drawText(ox+MaxDepth*cellx+30+(MaxTime+1)*cellx+120,oy+(p+1)*celly,"("+QString::number(total)+")") ; } painter->drawRect(ox,oy,MaxTime*cellx,p*celly) ; @@ -150,8 +153,13 @@ TurtleRouterDialog::TurtleRouterDialog(QWidget *parent) top_level_hashes.clear() ; - QVBoxLayout v(_tunnel_statistics_F) ; - v.addWidget( _tst_CW = new TurtleRouterStatisticsWidget() ) ; + _tunnel_statistics_F->setWidget( _tst_CW = new TurtleRouterStatisticsWidget() ) ; + _tunnel_statistics_F->setWidgetResizable(true); + _tunnel_statistics_F->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + _tunnel_statistics_F->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + _tunnel_statistics_F->viewport()->setBackgroundRole(QPalette::NoRole); + _tunnel_statistics_F->setFrameStyle(QFrame::NoFrame); + _tunnel_statistics_F->setFocusPolicy(Qt::NoFocus); } void TurtleRouterDialog::updateDisplay() @@ -165,6 +173,7 @@ void TurtleRouterDialog::updateDisplay() updateTunnelRequests(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ; _tst_CW->updateTunnelStatistics(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ; + _tst_CW->update(); } QString TurtleRouterDialog::getPeerName(const std::string& peer_id) @@ -303,7 +312,7 @@ TurtleRouterStatisticsWidget::TurtleRouterStatisticsWidget(QWidget *parent) : QWidget(parent) { maxWidth = 200 ; - maxHeight = 100 ; + maxHeight = 0 ; } void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector >& hashes_info, @@ -312,25 +321,38 @@ void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector& tunnel_reqs_info) { + static const int cellx = 6 ; + static const int celly = 10+4 ; + QPixmap tmppixmap(maxWidth, maxHeight); tmppixmap.fill(this, 0, 0); + setFixedHeight(maxHeight); QPainter painter(&tmppixmap); painter.initFrom(this); + maxHeight = 500 ; + // std::cerr << "Drawing into pixmap of size " << maxWidth << "x" << maxHeight << std::endl; // draw... int ox=5,oy=5 ; - TRHistogram(search_reqs_info).draw(&painter,ox,oy,QObject::tr("Evolution of search requests:")) ; - TRHistogram(tunnel_reqs_info).draw(&painter,ox,oy,QObject::tr("Evolution of tunnel requests:")) ; + + TRHistogram(search_reqs_info).draw(&painter,ox,oy,QObject::tr("Search requests repartition:")) ; + + painter.setPen(QColor::fromRgb(70,70,70)) ; + painter.drawLine(0,oy,maxWidth,oy) ; + oy += celly ; + + TRHistogram(tunnel_reqs_info).draw(&painter,ox,oy,QObject::tr("Tunnel requests repartition:")) ; // now give information about turtle traffic. // TurtleTrafficStatisticsInfo info ; rsTurtle->getTrafficStatistics(info) ; - static const int cellx = 6 ; - static const int celly = 10+4 ; + painter.setPen(QColor::fromRgb(70,70,70)) ; + painter.drawLine(0,oy,maxWidth,oy) ; + oy += celly ; painter.drawText(ox,oy+celly,tr("Turtle router traffic:")) ; oy += celly*2 ; painter.drawText(ox+2*cellx,oy+celly,tr("Tunnel requests Up")+"\t: " + speedString(info.tr_up_Bps) ) ; oy += celly ; @@ -342,6 +364,7 @@ void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector - - - - 0 - 0 - - - - - 800 - 0 - - + - QFrame::StyledPanel + QFrame::NoFrame - - QFrame::Raised + + Qt::ScrollBarAlwaysOff + + true + + + + + 0 + 0 + 847 + 283 + + +