mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixes for visState -> vs_disc & vs_dht.
Added RTT Gui. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6775 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
90aa57a0f0
commit
ba157e4891
@ -50,15 +50,15 @@ AboutDialog::AboutDialog(QWidget* parent)
|
|||||||
tWidget = NULL;
|
tWidget = NULL;
|
||||||
installAWidget();
|
installAWidget();
|
||||||
|
|
||||||
|
QString title = tr("About RetroShare ");
|
||||||
|
|
||||||
/* get libretroshare version */
|
/* get libretroshare version */
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string version;
|
||||||
std::map<std::string, std::string> versions;
|
if (rsDisc->getPeerVersion(rsPeers->getOwnId(), version))
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
|
||||||
if (retv && versions.end() != (vit = versions.find(rsPeers->getOwnId())))
|
|
||||||
{
|
{
|
||||||
QString version = QString::fromStdString(vit->second);
|
title += QString::fromStdString(version);
|
||||||
setWindowTitle(tr("About RetroShare %1").arg(version));
|
|
||||||
}
|
}
|
||||||
|
setWindowTitle(title);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint);
|
setWindowFlags(windowFlags() | Qt::MSWindowsFixedSizeDialogHint);
|
||||||
@ -134,20 +134,20 @@ void AboutDialog::sl_levelChanged(int level) {
|
|||||||
|
|
||||||
|
|
||||||
void AboutDialog::updateTitle() {
|
void AboutDialog::updateTitle() {
|
||||||
if (tWidget == NULL) {
|
if (tWidget == NULL)
|
||||||
|
{
|
||||||
|
QString title = tr("About RetroShare ");
|
||||||
|
|
||||||
/* get libretroshare version */
|
/* get libretroshare version */
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string version;
|
||||||
std::map<std::string, std::string> versions;
|
if (rsDisc->getPeerVersion(rsPeers->getOwnId(), version))
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
|
||||||
if (retv && versions.end() != (vit = versions.find(rsPeers->getOwnId())))
|
|
||||||
{
|
{
|
||||||
|
title += QString::fromStdString(version);
|
||||||
QString version = QString::fromStdString(vit->second);
|
|
||||||
setWindowTitle(tr("About RetroShare %1").arg(version));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
setWindowTitle(title);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
setWindowTitle(tr("Have fun ;-)"));
|
setWindowTitle(tr("Have fun ;-)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,14 +183,14 @@ AWidget::AWidget() {
|
|||||||
QPainter p(&image);
|
QPainter p(&image);
|
||||||
p.setPen(Qt::lightGray);
|
p.setPen(Qt::lightGray);
|
||||||
|
|
||||||
|
QString title = tr("About RetroShare ");
|
||||||
|
|
||||||
/* get libretroshare version */
|
/* get libretroshare version */
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string version;
|
||||||
std::map<std::string, std::string> versions;
|
if (rsDisc->getPeerVersion(rsPeers->getOwnId(), version))
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
|
||||||
if (retv && versions.end() != (vit = versions.find(rsPeers->getOwnId())))
|
|
||||||
{
|
{
|
||||||
QString version = QString::fromStdString("RetroShare version : \n") + QString::fromStdString(vit->second);
|
QString versionq = QString::fromStdString("RetroShare version : \n") + QString::fromStdString(version);
|
||||||
p.drawText(QRect(10, 10, width()-10, 60), version);
|
p.drawText(QRect(10, 10, width()-10, 60), versionq);
|
||||||
|
|
||||||
}
|
}
|
||||||
p.end();
|
p.end();
|
||||||
|
@ -62,9 +62,10 @@
|
|||||||
/****
|
/****
|
||||||
* #define SHOW_RTT_STATISTICS 1
|
* #define SHOW_RTT_STATISTICS 1
|
||||||
****/
|
****/
|
||||||
|
#define SHOW_RTT_STATISTICS 1
|
||||||
|
|
||||||
#ifdef SHOW_RTT_STATISTICS
|
#ifdef SHOW_RTT_STATISTICS
|
||||||
#include "VoipStatistics.h"
|
#include "RttStatistics.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Images for context menu icons */
|
/* Images for context menu icons */
|
||||||
@ -333,6 +334,10 @@ 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")) ;
|
||||||
|
|
||||||
@ -899,7 +904,7 @@ void TransfersDialog::setDestinationDirectory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<std::string, std::string> &versions)
|
int TransfersDialog::addItem(int row, const FileInfo &fileInfo)
|
||||||
{
|
{
|
||||||
QString fileHash = QString::fromStdString(fileInfo.hash);
|
QString fileHash = QString::fromStdString(fileInfo.hash);
|
||||||
double fileDlspeed = (fileInfo.downloadStatus == FT_STATE_DOWNLOADING) ? (fileInfo.tfRate * 1024.0) : 0.0;
|
double fileDlspeed = (fileInfo.downloadStatus == FT_STATE_DOWNLOADING) ? (fileInfo.tfRate * 1024.0) : 0.0;
|
||||||
@ -1026,8 +1031,10 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map<s
|
|||||||
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
||||||
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId);
|
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId);
|
||||||
QString version;
|
QString version;
|
||||||
if (versions.end() != (vit = versions.find(transferInfo.peerId))) {
|
std::string rsversion;
|
||||||
version = tr("version: ") + QString::fromStdString(vit->second);
|
if (rsDisc->getPeerVersion(transferInfo.peerId, rsversion))
|
||||||
|
{
|
||||||
|
version = tr("version: ") + QString::fromStdString(rsversion);
|
||||||
}
|
}
|
||||||
|
|
||||||
double peerDlspeed = 0;
|
double peerDlspeed = 0;
|
||||||
@ -1222,10 +1229,6 @@ void TransfersDialog::insertTransfers()
|
|||||||
std::list<std::string> downHashes;
|
std::list<std::string> downHashes;
|
||||||
rsFiles->FileDownloads(downHashes);
|
rsFiles->FileDownloads(downHashes);
|
||||||
|
|
||||||
/* get only once */
|
|
||||||
std::map<std::string, std::string> versions;
|
|
||||||
rsDisc->getDiscVersions(versions);
|
|
||||||
|
|
||||||
/* build set for quick search */
|
/* build set for quick search */
|
||||||
std::set<std::string> hashs;
|
std::set<std::string> hashs;
|
||||||
std::list<std::string>::iterator it;
|
std::list<std::string>::iterator it;
|
||||||
@ -1266,7 +1269,7 @@ void TransfersDialog::insertTransfers()
|
|||||||
|
|
||||||
hashs.erase(hashIt);
|
hashs.erase(hashIt);
|
||||||
|
|
||||||
if (addItem(row, fileInfo, versions) < 0) {
|
if (addItem(row, fileInfo) < 0) {
|
||||||
DLListModel->removeRow(row);
|
DLListModel->removeRow(row);
|
||||||
rowCount = DLListModel->rowCount();
|
rowCount = DLListModel->rowCount();
|
||||||
continue;
|
continue;
|
||||||
@ -1288,7 +1291,7 @@ void TransfersDialog::insertTransfers()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
addItem(-1, fileInfo, versions);
|
addItem(-1, fileInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.downloadList->setSortingEnabled(true);
|
ui.downloadList->setSortingEnabled(true);
|
||||||
|
@ -236,7 +236,7 @@ private:
|
|||||||
public slots:
|
public slots:
|
||||||
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
||||||
//
|
//
|
||||||
int addItem(int row, const FileInfo &fileInfo, const std::map<std::string, std::string> &versions);
|
int addItem(int row, const FileInfo &fileInfo);
|
||||||
int addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
int addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
||||||
|
|
||||||
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining);
|
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining);
|
||||||
|
@ -335,15 +335,7 @@ void GetStartedDialog::emailSupport()
|
|||||||
{
|
{
|
||||||
RsAutoUpdatePage::lockAllEvents();
|
RsAutoUpdatePage::lockAllEvents();
|
||||||
|
|
||||||
/* set retroshare version */
|
rsDisc->getPeerVersion(rsPeers->getOwnId(), versionString);
|
||||||
std::map<std::string, std::string>::iterator vit;
|
|
||||||
std::map<std::string, std::string> versions;
|
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
|
||||||
std::string id = rsPeers->getOwnId();
|
|
||||||
if (retv && versions.end() != (vit = versions.find(id)))
|
|
||||||
{
|
|
||||||
versionString = vit->second;
|
|
||||||
}
|
|
||||||
userLevel = rsConfig->getUserLevel();
|
userLevel = rsConfig->getUserLevel();
|
||||||
|
|
||||||
RsAutoUpdatePage::unlockAllEvents() ;
|
RsAutoUpdatePage::unlockAllEvents() ;
|
||||||
|
@ -121,11 +121,10 @@ NetworkDialog::NetworkDialog(QWidget *parent)
|
|||||||
ui.onlyTrustedKeys->setMinimumWidth(20);
|
ui.onlyTrustedKeys->setMinimumWidth(20);
|
||||||
|
|
||||||
QString version = "-";
|
QString version = "-";
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string rsversion;
|
||||||
std::map<std::string, std::string> versions;
|
if (rsDisc->getPeerVersion(rsPeers->getOwnId(), rsversion))
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
{
|
||||||
if (retv && versions.end() != (vit = versions.find(rsPeers->getOwnId()))) {
|
version = QString::fromStdString(rsversion);
|
||||||
version = QString::fromStdString(vit->second);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *menu = new QMenu();
|
QMenu *menu = new QMenu();
|
||||||
|
@ -176,7 +176,7 @@ void NetworkView::updateDisplay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> friendList;
|
std::list<std::string> friendList;
|
||||||
rsDisc->getDiscGPGFriends(info.gpg_id, friendList);
|
rsDisc->getDiscPgpFriends(info.gpg_id, friendList);
|
||||||
|
|
||||||
#ifdef DEBUG_NETWORKVIEW
|
#ifdef DEBUG_NETWORKVIEW
|
||||||
std::cerr << " Got a list of " << friendList.size() << " friends for this peer." << std::endl ;
|
std::cerr << " Got a list of " << friendList.size() << " friends for this peer." << std::endl ;
|
||||||
@ -204,7 +204,7 @@ void NetworkView::updateDisplay()
|
|||||||
{
|
{
|
||||||
std::list<std::string> friendList ;
|
std::list<std::string> friendList ;
|
||||||
|
|
||||||
if(rsDisc->getDiscGPGFriends(it->first,friendList))
|
if(rsDisc->getDiscPgpFriends(it->first,friendList))
|
||||||
for(std::list<std::string>::const_iterator sit(friendList.begin()); sit != friendList.end(); sit++)
|
for(std::list<std::string>::const_iterator sit(friendList.begin()); sit != friendList.end(); sit++)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_NETWORKVIEW
|
#ifdef DEBUG_NETWORKVIEW
|
||||||
|
@ -123,32 +123,40 @@ void QuickStartWizard::on_pushButtonConnectionNext_clicked()
|
|||||||
rsPeers->setNetworkMode(rsPeers->getOwnId(), netMode);
|
rsPeers->setNetworkMode(rsPeers->getOwnId(), netMode);
|
||||||
|
|
||||||
/* Check if vis has changed */
|
/* Check if vis has changed */
|
||||||
uint32_t visState = 0;
|
uint16_t vs_disc = 0;
|
||||||
|
uint16_t vs_dht = 0;
|
||||||
switch(ui.discoveryComboBox->currentIndex())
|
switch(ui.discoveryComboBox->currentIndex())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
visState |= (RS_VS_DISC_ON | RS_VS_DHT_ON);
|
vs_disc = RS_VS_DISC_FULL;
|
||||||
|
vs_dht = RS_VS_DHT_FULL;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
visState |= RS_VS_DISC_ON;
|
vs_disc = RS_VS_DISC_FULL;
|
||||||
|
vs_dht = RS_VS_DHT_OFF;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
visState |= RS_VS_DHT_ON;
|
vs_disc = RS_VS_DISC_OFF;
|
||||||
|
vs_dht = RS_VS_DHT_FULL;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
default:
|
default:
|
||||||
|
vs_disc = RS_VS_DISC_OFF;
|
||||||
|
vs_dht = RS_VS_DHT_OFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (visState != detail.visState)
|
if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht))
|
||||||
{
|
{
|
||||||
rsPeers->setVisState(rsPeers->getOwnId(), visState);
|
rsPeers->setVisState(rsPeers->getOwnId(), vs_disc, vs_dht);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsConfig->SetMaxDataRates( ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value() );
|
rsConfig->SetMaxDataRates( ui.doubleSpinBoxDownloadSpeed->value(), ui.doubleSpinBoxUploadSpeed->value() );
|
||||||
|
|
||||||
ui.pagesWizard->setCurrentIndex(2);
|
ui.pagesWizard->setCurrentIndex(2);
|
||||||
@ -425,9 +433,9 @@ void QuickStartWizard::loadNetwork()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
netIndex = 3; // NONE.
|
netIndex = 3; // NONE.
|
||||||
if (detail.visState & RS_VS_DHT_ON)
|
if (detail.vs_dht != RS_VS_DISC_OFF)
|
||||||
{
|
{
|
||||||
if (detail.visState & RS_VS_DISC_ON)
|
if (detail.vs_disc != RS_VS_DISC_OFF)
|
||||||
{
|
{
|
||||||
netIndex = 0; // PUBLIC
|
netIndex = 0; // PUBLIC
|
||||||
}
|
}
|
||||||
@ -438,7 +446,7 @@ void QuickStartWizard::loadNetwork()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (detail.visState & RS_VS_DISC_ON)
|
if (detail.vs_disc != RS_VS_DISC_OFF)
|
||||||
{
|
{
|
||||||
netIndex = 1; // PRIVATE
|
netIndex = 1; // PRIVATE
|
||||||
}
|
}
|
||||||
@ -494,27 +502,33 @@ void QuickStartWizard::saveChanges()
|
|||||||
|
|
||||||
rsPeers->setNetworkMode(ownId, netMode);
|
rsPeers->setNetworkMode(ownId, netMode);
|
||||||
|
|
||||||
uint32_t visState = 0;
|
|
||||||
/* Check if vis has changed */
|
/* Check if vis has changed */
|
||||||
|
uint16_t vs_disc = 0;
|
||||||
|
uint16_t vs_dht = 0;
|
||||||
switch(ui.discoveryComboBox->currentIndex())
|
switch(ui.discoveryComboBox->currentIndex())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
visState |= (RS_VS_DISC_ON | RS_VS_DHT_ON);
|
vs_disc = RS_VS_DISC_FULL;
|
||||||
|
vs_dht = RS_VS_DHT_FULL;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
visState |= RS_VS_DISC_ON;
|
vs_disc = RS_VS_DISC_FULL;
|
||||||
|
vs_dht = RS_VS_DHT_OFF;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
visState |= RS_VS_DHT_ON;
|
vs_disc = RS_VS_DISC_OFF;
|
||||||
|
vs_dht = RS_VS_DHT_FULL;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
default:
|
default:
|
||||||
|
vs_disc = RS_VS_DISC_OFF;
|
||||||
|
vs_dht = RS_VS_DHT_OFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visState != detail.visState)
|
if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht))
|
||||||
{
|
{
|
||||||
rsPeers->setVisState(ownId, visState);
|
rsPeers->setVisState(ownId, vs_disc, vs_dht);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (0 != netIndex)
|
/*if (0 != netIndex)
|
||||||
|
379
retroshare-gui/src/gui/RttStatistics.cpp
Normal file
379
retroshare-gui/src/gui/RttStatistics.cpp
Normal file
@ -0,0 +1,379 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* 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 <retroshare/rsrtt.h>
|
||||||
|
#include <retroshare/rspeers.h>
|
||||||
|
#include "RttStatistics.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 RttPlot
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RttPlot(const std::map<std::string, std::list<RsRttPongResult> > &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 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 ;
|
||||||
|
|
||||||
|
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<std::string, std::list<RsRttPongResult> >::const_iterator mit;
|
||||||
|
int i = 0;
|
||||||
|
int nLines = mInfo.size();
|
||||||
|
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
|
||||||
|
{
|
||||||
|
QPainterPath path;
|
||||||
|
std::list<RsRttPongResult>::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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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,RttStatistics::getPeerName(mit->first));
|
||||||
|
|
||||||
|
oy += 2 * celly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::map<std::string, std::list<RsRttPongResult> > &mInfo;
|
||||||
|
double mRefTS;
|
||||||
|
double mMaxRTT;
|
||||||
|
double mMinTS;
|
||||||
|
double mMaxTS;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
RttStatistics::RttStatistics(QWidget *parent)
|
||||||
|
: RsAutoUpdatePage(2000,parent)
|
||||||
|
{
|
||||||
|
setupUi(this) ;
|
||||||
|
|
||||||
|
m_bProcessSettings = false;
|
||||||
|
|
||||||
|
_tunnel_statistics_F->setWidget( _tst_CW = new RttStatisticsWidget() ) ;
|
||||||
|
_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);
|
||||||
|
}
|
||||||
|
|
||||||
|
RttStatistics::~RttStatistics()
|
||||||
|
{
|
||||||
|
|
||||||
|
// save settings
|
||||||
|
processSettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RttStatistics::processSettings(bool bLoad)
|
||||||
|
{
|
||||||
|
m_bProcessSettings = true;
|
||||||
|
|
||||||
|
Settings->beginGroup(QString("RttStatistics"));
|
||||||
|
|
||||||
|
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 RttStatistics::updateDisplay()
|
||||||
|
{
|
||||||
|
std::map<std::string, std::list<RsRttPongResult> > info;
|
||||||
|
|
||||||
|
if (!rsRtt)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<std::string> idList;
|
||||||
|
std::list<std::string>::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<RsRttPongResult> results;
|
||||||
|
std::list<RsRttPongResult>::iterator rit;
|
||||||
|
|
||||||
|
#define MAX_RESULTS 60
|
||||||
|
rsRtt->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->updateRttStatistics(info, maxRTT, minTS, maxTS);
|
||||||
|
_tst_CW->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RttStatistics::getPeerName(const std::string& peer_id)
|
||||||
|
{
|
||||||
|
static std::map<std::string, QString> names ;
|
||||||
|
|
||||||
|
std::map<std::string,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())) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RttStatisticsWidget::RttStatisticsWidget(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
maxWidth = 200 ;
|
||||||
|
maxHeight = 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RttStatisticsWidget::updateRttStatistics(const std::map<std::string, std::list<RsRttPongResult> >& 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
RttPlot(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 RttStatisticsWidget::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 RttStatisticsWidget::paintEvent(QPaintEvent */*event*/)
|
||||||
|
{
|
||||||
|
QStylePainter(this).drawPixmap(0, 0, pixmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RttStatisticsWidget::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
QRect TaskGraphRect = geometry();
|
||||||
|
maxWidth = TaskGraphRect.width();
|
||||||
|
maxHeight = TaskGraphRect.height() ;
|
||||||
|
|
||||||
|
QWidget::resizeEvent(event);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
68
retroshare-gui/src/gui/RttStatistics.h
Normal file
68
retroshare-gui/src/gui/RttStatistics.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* 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 <retroshare/rsrtt.h>
|
||||||
|
#include "ui_RttStatistics.h"
|
||||||
|
#include "RsAutoUpdatePage.h"
|
||||||
|
|
||||||
|
class RttStatisticsWidget ;
|
||||||
|
|
||||||
|
class RttStatistics: public RsAutoUpdatePage, public Ui::RttStatistics
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RttStatistics(QWidget *parent = NULL) ;
|
||||||
|
~RttStatistics();
|
||||||
|
|
||||||
|
// Cache for peer names.
|
||||||
|
static QString getPeerName(const std::string& peer_id) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void processSettings(bool bLoad);
|
||||||
|
bool m_bProcessSettings;
|
||||||
|
|
||||||
|
virtual void updateDisplay() ;
|
||||||
|
|
||||||
|
RttStatisticsWidget *_tst_CW ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
class RttStatisticsWidget: public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RttStatisticsWidget(QWidget *parent = NULL) ;
|
||||||
|
|
||||||
|
virtual void paintEvent(QPaintEvent *event) ;
|
||||||
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
|
|
||||||
|
void updateRttStatistics(const std::map<std::string, std::list<RsRttPongResult> >& info,
|
||||||
|
double maxRTT, double minTS, double maxTS);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static QString speedString(float f) ;
|
||||||
|
|
||||||
|
QPixmap pixmap ;
|
||||||
|
int maxWidth,maxHeight ;
|
||||||
|
};
|
||||||
|
|
55
retroshare-gui/src/gui/RttStatistics.ui
Normal file
55
retroshare-gui/src/gui/RttStatistics.ui
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>RttStatistics</class>
|
||||||
|
<widget class="QWidget" name="RttStatistics">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>611</width>
|
||||||
|
<height>408</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>RTT Statistics</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="images.qrc">
|
||||||
|
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
|
||||||
|
</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>
|
||||||
|
<include location="images.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -195,11 +195,9 @@ void ConfCertDialog::load()
|
|||||||
ui.lastcontact->setText(DateTime::formatLongDateTime(detail.lastConnect));
|
ui.lastcontact->setText(DateTime::formatLongDateTime(detail.lastConnect));
|
||||||
|
|
||||||
/* set retroshare version */
|
/* set retroshare version */
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string version;
|
||||||
std::map<std::string, std::string> versions;
|
rsDisc->getPeerVersion(detail.id, version);
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
ui.version->setText(QString::fromStdString(version));
|
||||||
if (retv && versions.end() != (vit = versions.find(detail.id)))
|
|
||||||
ui.version->setText(QString::fromStdString(vit->second));
|
|
||||||
|
|
||||||
RsPeerCryptoParams cdet ;
|
RsPeerCryptoParams cdet ;
|
||||||
if(rsicontrol->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
|
if(rsicontrol->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
|
||||||
|
@ -59,13 +59,9 @@ void ProfileWidget::showEvent ( QShowEvent * /*event*/ )
|
|||||||
ui.peerid->setText(QString::fromStdString(detail.id));
|
ui.peerid->setText(QString::fromStdString(detail.id));
|
||||||
|
|
||||||
/* set retroshare version */
|
/* set retroshare version */
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string version;
|
||||||
std::map<std::string, std::string> versions;
|
rsDisc->getPeerVersion(detail.id, version);
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
ui.version->setText(QString::fromStdString(version));
|
||||||
if (retv && versions.end() != (vit = versions.find(detail.id)))
|
|
||||||
{
|
|
||||||
ui.version->setText(QString::fromStdString(vit->second));
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.ipAddressList->clear();
|
ui.ipAddressList->clear();
|
||||||
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
for(std::list<std::string>::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
|
||||||
|
@ -78,13 +78,9 @@ void CryptoPage::showEvent ( QShowEvent * /*event*/ )
|
|||||||
ui.pgpid->setText(QString::fromStdString(detail.gpg_id));
|
ui.pgpid->setText(QString::fromStdString(detail.gpg_id));
|
||||||
|
|
||||||
/* set retroshare version */
|
/* set retroshare version */
|
||||||
std::map<std::string, std::string>::iterator vit;
|
std::string version;
|
||||||
std::map<std::string, std::string> versions;
|
rsDisc->getPeerVersion(detail.id, version);
|
||||||
bool retv = rsDisc->getDiscVersions(versions);
|
ui.version->setText(QString::fromStdString(version));
|
||||||
if (retv && versions.end() != (vit = versions.find(detail.id)))
|
|
||||||
{
|
|
||||||
ui.version->setText(QString::fromStdString(vit->second));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<std::string> ids;
|
std::list<std::string> ids;
|
||||||
ids.clear();
|
ids.clear();
|
||||||
|
@ -171,9 +171,9 @@ void ServerPage::load()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
netIndex = 3; // NONE.
|
netIndex = 3; // NONE.
|
||||||
if (detail.visState & RS_VS_DHT_ON)
|
if (detail.vs_dht != RS_VS_DISC_OFF)
|
||||||
{
|
{
|
||||||
if (detail.visState & RS_VS_DISC_ON)
|
if (detail.vs_disc != RS_VS_DISC_OFF)
|
||||||
{
|
{
|
||||||
netIndex = 0; // PUBLIC
|
netIndex = 0; // PUBLIC
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ void ServerPage::load()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (detail.visState & RS_VS_DISC_ON)
|
if (detail.vs_disc != RS_VS_DISC_OFF)
|
||||||
{
|
{
|
||||||
netIndex = 1; // PRIVATE
|
netIndex = 1; // PRIVATE
|
||||||
}
|
}
|
||||||
@ -342,26 +342,32 @@ void ServerPage::saveAddresses()
|
|||||||
if (detail.netMode != netMode)
|
if (detail.netMode != netMode)
|
||||||
rsPeers->setNetworkMode(ownId, netMode);
|
rsPeers->setNetworkMode(ownId, netMode);
|
||||||
|
|
||||||
uint32_t visState = 0;
|
uint16_t vs_disc = 0;
|
||||||
|
uint16_t vs_dht = 0;
|
||||||
/* Check if vis has changed */
|
/* Check if vis has changed */
|
||||||
switch(ui.discComboBox->currentIndex())
|
switch(ui.discComboBox->currentIndex())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
visState |= (RS_VS_DISC_ON | RS_VS_DHT_ON);
|
vs_disc = RS_VS_DISC_FULL;
|
||||||
|
vs_dht = RS_VS_DHT_FULL;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
visState |= RS_VS_DISC_ON;
|
vs_disc = RS_VS_DISC_FULL;
|
||||||
|
vs_dht = RS_VS_DHT_OFF;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
visState |= RS_VS_DHT_ON;
|
vs_disc = RS_VS_DISC_OFF;
|
||||||
|
vs_dht = RS_VS_DHT_FULL;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
default:
|
default:
|
||||||
|
vs_disc = RS_VS_DISC_OFF;
|
||||||
|
vs_dht = RS_VS_DHT_OFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visState != detail.visState)
|
if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht))
|
||||||
rsPeers->setVisState(ownId, visState);
|
rsPeers->setVisState(ownId, vs_disc, vs_dht);
|
||||||
|
|
||||||
if (0 != netIndex)
|
if (0 != netIndex)
|
||||||
saveAddr = true;
|
saveAddr = true;
|
||||||
|
@ -193,7 +193,8 @@ macx {
|
|||||||
|
|
||||||
gxs {
|
gxs {
|
||||||
LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
|
LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
|
||||||
LIBS += -lsqlite3
|
LIBS += ../../../lib/libsqlcipher.a
|
||||||
|
#LIBS += -lsqlite3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -479,7 +480,8 @@ HEADERS += rshare.h \
|
|||||||
gui/dht/DhtWindow.h \
|
gui/dht/DhtWindow.h \
|
||||||
gui/bwctrl/BwCtrlWindow.h \
|
gui/bwctrl/BwCtrlWindow.h \
|
||||||
gui/channels/ShareKey.h \
|
gui/channels/ShareKey.h \
|
||||||
gui/GetStartedDialog.h
|
gui/GetStartedDialog.h \
|
||||||
|
gui/RttStatistics.h \
|
||||||
|
|
||||||
# gui/ForumsDialog.h \
|
# gui/ForumsDialog.h \
|
||||||
# gui/forums/ForumDetails.h \
|
# gui/forums/ForumDetails.h \
|
||||||
@ -585,7 +587,8 @@ FORMS += gui/StartDialog.ui \
|
|||||||
gui/dht/DhtWindow.ui \
|
gui/dht/DhtWindow.ui \
|
||||||
gui/bwctrl/BwCtrlWindow.ui \
|
gui/bwctrl/BwCtrlWindow.ui \
|
||||||
gui/channels/ShareKey.ui \
|
gui/channels/ShareKey.ui \
|
||||||
gui/GetStartedDialog.ui
|
gui/GetStartedDialog.ui \
|
||||||
|
gui/RttStatistics.ui \
|
||||||
|
|
||||||
# gui/ForumsDialog.ui \
|
# gui/ForumsDialog.ui \
|
||||||
# gui/forums/CreateForum.ui \
|
# gui/forums/CreateForum.ui \
|
||||||
@ -787,7 +790,8 @@ SOURCES += main.cpp \
|
|||||||
gui/dht/DhtWindow.cpp \
|
gui/dht/DhtWindow.cpp \
|
||||||
gui/bwctrl/BwCtrlWindow.cpp \
|
gui/bwctrl/BwCtrlWindow.cpp \
|
||||||
gui/channels/ShareKey.cpp \
|
gui/channels/ShareKey.cpp \
|
||||||
gui/GetStartedDialog.cpp
|
gui/GetStartedDialog.cpp \
|
||||||
|
gui/RttStatistics.cpp \
|
||||||
|
|
||||||
# gui/ForumsDialog.cpp \
|
# gui/ForumsDialog.cpp \
|
||||||
# gui/forums/ForumDetails.cpp \
|
# gui/forums/ForumDetails.cpp \
|
||||||
|
Loading…
Reference in New Issue
Block a user