mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
improved tunnel statistics gui
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4224 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7edcf59116
commit
429d6f2dc3
@ -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
|
||||
|
@ -656,9 +656,6 @@ p, li { white-space: pre-wrap; }
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -671,7 +668,7 @@ p, li { white-space: pre-wrap; }
|
||||
</font>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
@ -826,30 +823,6 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Tunneling</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="tunnelInfoWidget">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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<std::vector<std::string> >& hashes_info,
|
||||
@ -312,25 +321,38 @@ void TurtleRouterStatisticsWidget::updateTunnelStatistics(const std::vector<std:
|
||||
const std::vector<TurtleRequestDisplayInfo >& 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<std:
|
||||
// update the pixmap
|
||||
//
|
||||
pixmap = tmppixmap;
|
||||
maxHeight = oy ;
|
||||
}
|
||||
|
||||
QString TurtleRouterStatisticsWidget::speedString(float f)
|
||||
@ -362,10 +385,11 @@ void TurtleRouterStatisticsWidget::paintEvent(QPaintEvent *event)
|
||||
void TurtleRouterStatisticsWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QRect TaskGraphRect = geometry();
|
||||
maxWidth = 900;//TaskGraphRect.width();
|
||||
maxHeight = TaskGraphRect.height();
|
||||
maxWidth = TaskGraphRect.width();
|
||||
maxHeight = TaskGraphRect.height() ;
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,25 +33,26 @@
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QFrame" name="_tunnel_statistics_F">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>800</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="_tunnel_statistics_F">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>847</width>
|
||||
<height>283</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user