removed RTT statistics tab from VOIP plugin as it is already provided in Statistics

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8170 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-04-25 14:02:45 +00:00
parent 139d16a0e3
commit 7c4947fbfb
7 changed files with 1 additions and 530 deletions

View File

@ -42,6 +42,7 @@ E [X] PGP signatures are not transmited by discovery2.
[X] Default appearance style on Ubuntu should be GTK (to allow correct tooltips) [X] Default appearance style on Ubuntu should be GTK (to allow correct tooltips)
[X] Default layout should use toolbars. The "menu" look is inneficient [X] Default layout should use toolbars. The "menu" look is inneficient
[ ] replace sound tooltip "sound off" by "sound is on, click to turn off" [ ] replace sound tooltip "sound off" by "sound is on, click to turn off"
[X] rtt statistic is duplicated in statistics provided by VOIP, so remove it from file transfers
Messages Messages
H [X] distant messages should be made async-ed H [X] distant messages should be made async-ed

View File

@ -40,7 +40,6 @@ SOURCES = services/p3vors.cc \
gui/AudioWizard.cpp \ gui/AudioWizard.cpp \
gui/SpeexProcessor.cpp \ gui/SpeexProcessor.cpp \
gui/audiodevicehelper.cpp \ gui/audiodevicehelper.cpp \
gui/VoipStatistics.cpp \
gui/VOIPChatWidgetHolder.cpp \ gui/VOIPChatWidgetHolder.cpp \
gui/PluginGUIHandler.cpp \ gui/PluginGUIHandler.cpp \
gui/PluginNotifier.cpp \ gui/PluginNotifier.cpp \
@ -55,7 +54,6 @@ HEADERS = services/p3vors.h \
gui/AudioWizard.h \ gui/AudioWizard.h \
gui/SpeexProcessor.h \ gui/SpeexProcessor.h \
gui/audiodevicehelper.h \ gui/audiodevicehelper.h \
gui/VoipStatistics.h \
gui/VOIPChatWidgetHolder.h \ gui/VOIPChatWidgetHolder.h \
gui/PluginGUIHandler.h \ gui/PluginGUIHandler.h \
gui/PluginNotifier.h \ gui/PluginNotifier.h \
@ -66,7 +64,6 @@ HEADERS = services/p3vors.h \
FORMS = gui/AudioInputConfig.ui \ FORMS = gui/AudioInputConfig.ui \
gui/AudioStats.ui \ gui/AudioStats.ui \
gui/VoipStatistics.ui \
gui/AudioWizard.ui gui/AudioWizard.ui
TARGET = VOIP TARGET = VOIP

View File

@ -10,7 +10,6 @@
#include "VOIPPlugin.h" #include "VOIPPlugin.h"
#include "interface/rsvoip.h" #include "interface/rsvoip.h"
#include "gui/VoipStatistics.h"
#include "gui/AudioInputConfig.h" #include "gui/AudioInputConfig.h"
#include "gui/VOIPChatWidgetHolder.h" #include "gui/VOIPChatWidgetHolder.h"
#include "gui/PluginGUIHandler.h" #include "gui/PluginGUIHandler.h"
@ -126,16 +125,6 @@ ChatWidgetHolder *VOIPPlugin::qt_get_chat_widget_holder(ChatWidget *chatWidget)
return NULL; return NULL;
} }
std::string VOIPPlugin::qt_transfers_tab_name() const
{
return QObject::tr("RTT Statistics").toUtf8().constData() ;
}
RsAutoUpdatePage *VOIPPlugin::qt_transfers_tab() const
{
return new VoipStatistics ;
}
p3Service *VOIPPlugin::p3_service() const p3Service *VOIPPlugin::p3_service() const
{ {
if(mVoip == NULL) if(mVoip == NULL)

View File

@ -16,8 +16,6 @@ class VOIPPlugin: public RsPlugin
virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_VOIP_PLUGIN ; } virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_VOIP_PLUGIN ; }
virtual ConfigPage *qt_config_page() const ; virtual ConfigPage *qt_config_page() const ;
virtual QDialog *qt_about_page() const ; virtual QDialog *qt_about_page() const ;
virtual RsAutoUpdatePage *qt_transfers_tab() const ;
virtual std::string qt_transfers_tab_name() const ;
virtual ChatWidgetHolder *qt_get_chat_widget_holder(ChatWidget *chatWidget) const ; virtual ChatWidgetHolder *qt_get_chat_widget_holder(ChatWidget *chatWidget) const ;
virtual QIcon *qt_icon() const; virtual QIcon *qt_icon() const;

View File

@ -1,393 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 20011, RetroShare Team
*
* 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 <iostream>
#include <QTimer>
#include <QObject>
#include <QPainter>
#include <QStylePainter>
#include <interface/rsvoip.h>
#include <retroshare/rspeers.h>
#include "VoipStatistics.h"
#include "time.h"
#include "gui/settings/rsharesettings.h"
#define PLOT_HEIGHT 100
#define PLOT_WIDTH 500
#define MAX_DISPLAY_PERIOD 300
double convertDtToPixels(double refTs, double minTs, double ts)
{
double dt = refTs - ts;
double maxdt = refTs - minTs;
double pix = PLOT_WIDTH - dt / maxdt * PLOT_WIDTH;
return pix;
}
double convertRttToPixels(double maxRTT, double rtt)
{
double pix = rtt / maxRTT * PLOT_HEIGHT;
return PLOT_HEIGHT - pix;
}
class VoipLagPlot
{
public:
VoipLagPlot(const std::map<RsPeerId, std::list<RsVoipPongResult> > &info,
double refTS, double maxRTT, double minTS, double maxTS)
:mInfo(info), mRefTS(refTS), mMaxRTT(maxRTT), mMinTS(minTS), mMaxTS(maxTS) {}
QColor colorScale(float f)
{
if(f == 0)
return QColor::fromHsv(0,0,192) ;
else
return QColor::fromHsv((int)((1.0-f)*280),200,255) ;
}
virtual void draw(QPainter *painter,int& ox,int& oy,const QString& title)
{
//static const int MaxTime = 61 ;
//static const int MaxDepth = 8 ;
static const int cellx = 7 ;
static const int celly = 12 ;
//int save_ox = ox ;
painter->setPen(QColor::fromRgb(0,0,0)) ;
painter->drawText(2+ox,celly+oy,title) ;
oy+=2+2*celly ;
//std::cerr << "VoipLagPlot::draw()";
//std::cerr << std::endl;
painter->drawRect(ox, oy, PLOT_WIDTH, PLOT_HEIGHT);
if(mInfo.empty())
return ;
double maxdt = mRefTS - mMinTS;
if (maxdt > MAX_DISPLAY_PERIOD)
{
mMinTS = mRefTS - MAX_DISPLAY_PERIOD;
}
/* draw a different line for each peer */
std::map<RsPeerId, std::list<RsVoipPongResult> >::const_iterator mit;
int i = 0;
int nLines = mInfo.size();
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
{
//std::cerr << "VoipLagPlot::draw() Line of " << mit->second.size();
//std::cerr << " Elements for: " << mit->first;
//std::cerr << std::endl;
QPainterPath path;
std::list<RsVoipPongResult>::const_iterator it = mit->second.begin();
if (it != mit->second.end())
{
double x = convertDtToPixels(mRefTS, mMinTS, it->mTS);
double y = convertRttToPixels(mMaxRTT, it->mRTT);
path.moveTo(ox + x, oy + y);
it++;
}
for(; it != mit->second.end(); it++)
{
/* skip old elements */
if (it->mTS < mMinTS)
{
continue;
}
double x = convertDtToPixels(mRefTS, mMinTS, it->mTS);
double y = convertRttToPixels(mMaxRTT, it->mRTT);
path.lineTo(ox + x, oy + y);
//std::cerr << "VoipLagPlot::draw() Point: (" << x << "," << y << ")";
//std::cerr << std::endl;
//painter->drawLine(ox,oy, ox + x, oy + y);
}
/* draw line */
painter->setPen(QColor::fromRgb(((255.0 * i) / (nLines-1)),0, 255 - (255.0 * i) / (nLines-1))) ;
painter->drawPath(path);
/* draw name */
}
painter->setPen(QColor::fromRgb(0,0,0)) ;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(mMaxRTT)+" "+QObject::tr("secs")) ;
oy += PLOT_HEIGHT / 2;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(mMaxRTT / 2.0)+" "+QObject::tr("secs")) ;
oy += PLOT_HEIGHT / 2;
painter->drawText(ox+PLOT_WIDTH + cellx ,oy + celly / 2, QString::number(0.0)+" "+QObject::tr("secs")) ;
oy += celly;
painter->drawText(ox ,oy, QObject::tr("Old"));
painter->drawText(ox + PLOT_WIDTH - cellx ,oy, QObject::tr("Now"));
oy += celly;
// Now do names.
i = 0;
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
{
painter->fillRect(ox,oy,cellx,celly,
QColor::fromRgb(((255.0 * i) / (nLines-1)),0, 255 - (255.0 * i) / (nLines-1))) ;
painter->setPen(QColor::fromRgb(0,0,0)) ;
painter->drawRect(ox,oy,cellx,celly) ;
painter->drawText(ox + cellx + 4,oy + celly / 2,VoipStatistics::getPeerName(mit->first));
oy += 2 * celly;
}
}
private:
const std::map<RsPeerId, std::list<RsVoipPongResult> > &mInfo;
double mRefTS;
double mMaxRTT;
double mMinTS;
double mMaxTS;
};
VoipStatistics::VoipStatistics(QWidget *parent)
: RsAutoUpdatePage(2000,parent)
{
setupUi(this) ;
m_bProcessSettings = false;
_tunnel_statistics_F->setWidget( _tst_CW = new VoipStatisticsWidget() ) ;
_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);
// load settings
processSettings(true);
}
VoipStatistics::~VoipStatistics()
{
// save settings
processSettings(false);
}
void VoipStatistics::processSettings(bool bLoad)
{
m_bProcessSettings = true;
// Settings->beginGroup(QString("VoipStatistics"));
if (bLoad) {
// load settings
// state of splitter
//splitter->restoreState(Settings->value("Splitter").toByteArray());
} else {
// save settings
// state of splitter
//Settings->setValue("Splitter", splitter->saveState());
}
// Settings->endGroup();
m_bProcessSettings = false;
}
void VoipStatistics::updateDisplay()
{
std::map<RsPeerId, std::list<RsVoipPongResult> > info;
if (!rsVoip)
{
return;
}
std::list<RsPeerId> idList;
std::list<RsPeerId>::iterator it;
rsPeers->getOnlineList(idList);
time_t now = time(NULL);
time_t minTS = now;
time_t maxTS = 0;
double maxRTT = 0;
for(it = idList.begin(); it != idList.end(); it++)
{
std::list<RsVoipPongResult> results;
std::list<RsVoipPongResult>::iterator rit;
#define MAX_RESULTS 60
rsVoip->getPongResults(*it, MAX_RESULTS, results);
for(rit = results.begin(); rit != results.end(); rit++)
{
/* only want maxRTT to include plotted bit */
double dt = now - rit->mTS;
if (dt < MAX_DISPLAY_PERIOD)
{
if (maxRTT < rit->mRTT)
{
maxRTT = rit->mRTT;
}
}
if (minTS > rit->mTS)
{
minTS = rit->mTS;
}
if (maxTS < rit->mTS)
{
maxTS = rit->mTS;
}
}
info[*it] = results;
}
_tst_CW->updateVoipStatistics(info, maxRTT, minTS, maxTS);
_tst_CW->update();
}
QString VoipStatistics::getPeerName(const RsPeerId& peer_id)
{
static std::map<RsPeerId, QString> names ;
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
if( it != names.end())
return it->second ;
else
{
RsPeerDetails detail ;
if(!rsPeers->getPeerDetails(peer_id,detail))
return "unknown peer";
return (names[peer_id] = QString::fromUtf8(detail.name.c_str())) ;
}
}
VoipStatisticsWidget::VoipStatisticsWidget(QWidget *parent)
: QWidget(parent)
{
maxWidth = 200 ;
maxHeight = 0 ;
}
void VoipStatisticsWidget::updateVoipStatistics(const std::map<RsPeerId, std::list<RsVoipPongResult> >& info,
double maxRTT, double minTS, double maxTS)
{
//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 ;
double refTS = time(NULL);
//painter.setPen(QColor::fromRgb(70,70,70)) ;
//painter.drawLine(0,oy,maxWidth,oy) ;
//oy += celly ;
//painter.setPen(QColor::fromRgb(0,0,0)) ;
// round up RTT to nearest
double roundedRTT = maxRTT;
if (maxRTT < 0.15)
{
roundedRTT = 0.2;
}
else if (maxRTT < 0.4)
{
roundedRTT = 0.5;
}
else if (maxRTT < 0.8)
{
roundedRTT = 1.0;
}
else if (maxRTT < 1.8)
{
roundedRTT = 2.0;
}
else if (maxRTT < 4.5)
{
roundedRTT = 5.0;
}
VoipLagPlot(info, refTS, roundedRTT, minTS, maxTS).draw(&painter,ox,oy,QObject::tr("Round Trip Time:")) ;
// update the pixmap
pixmap = tmppixmap;
maxHeight = oy; // + PLOT_HEIGHT * 2;
}
QString VoipStatisticsWidget::speedString(float f)
{
if(f < 1.0f)
return QString("0 B/s") ;
if(f < 1024.0f)
return QString::number((int)f)+" B/s" ;
return QString::number(f/1024.0,'f',2) + " KB/s";
}
void VoipStatisticsWidget::paintEvent(QPaintEvent */*event*/)
{
QStylePainter(this).drawPixmap(0, 0, pixmap);
}
void VoipStatisticsWidget::resizeEvent(QResizeEvent *event)
{
QRect TaskGraphRect = geometry();
maxWidth = TaskGraphRect.width();
maxHeight = TaskGraphRect.height() ;
QWidget::resizeEvent(event);
update();
}

View File

@ -1,72 +0,0 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 20011, RetroShare Team
*
* 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.
****************************************************************/
#pragma once
#include <QPoint>
#include <interface/rsvoip.h>
#include "ui_VoipStatistics.h"
#include <retroshare-gui/RsAutoUpdatePage.h>
class VoipStatisticsWidget ;
class VoipStatistics: public RsAutoUpdatePage, public Ui::VoipStatistics
{
Q_OBJECT
public:
VoipStatistics(QWidget *parent = NULL) ;
~VoipStatistics();
// Cache for peer names.
static QString getPeerName(const RsPeerId &peer_id) ;
private:
void processSettings(bool bLoad);
bool m_bProcessSettings;
virtual void updateDisplay() ;
VoipStatisticsWidget *_tst_CW ;
} ;
class VoipStatisticsWidget: public QWidget
{
Q_OBJECT
public:
VoipStatisticsWidget(QWidget *parent = NULL) ;
virtual void paintEvent(QPaintEvent *event) ;
virtual void resizeEvent(QResizeEvent *event);
void updateVoipStatistics(const std::map<RsPeerId, std::list<RsVoipPongResult> >& info,
double maxRTT, double minTS, double maxTS);
private:
static QString speedString(float f) ;
QPixmap pixmap ;
int maxWidth,maxHeight ;
};

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VoipStatistics</class>
<widget class="QWidget" name="VoipStatistics">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>611</width>
<height>408</height>
</rect>
</property>
<property name="windowTitle">
<string>VoipTest Statistics</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QScrollArea" name="_tunnel_statistics_F">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<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>587</width>
<height>384</height>
</rect>
</property>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>