put the tunnel info as a new tab in the transfer page.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2310 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-02-14 09:06:37 +00:00
parent 850e756fe3
commit c37679e807
8 changed files with 191 additions and 247 deletions

View File

@ -32,6 +32,7 @@
#include "DLListDelegate.h"
#include "ULListDelegate.h"
#include "FileTransferInfoWidget.h"
#include "TurtleRouterDialog.h"
#include "xprogressbar.h"
#include <QContextMenuEvent>
@ -221,6 +222,15 @@ TransfersDialog::TransfersDialog(QWidget *parent)
QObject::connect(ui.downloadList,SIGNAL(clicked(const QModelIndex&)),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);
/* Hide platform specific features */
#ifdef Q_WS_WIN

View File

@ -819,6 +819,30 @@ 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>578</width>
<height>117</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
@ -826,6 +850,7 @@ p, li { white-space: pre-wrap; }
</widget>
<resources>
<include location="images.qrc"/>
<include location="../../../../../../../.designer/backup/images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -8,17 +8,12 @@
TurtleRouterDialog *TurtleRouterDialog::_instance = NULL ;
TurtleRouterDialog::TurtleRouterDialog(QWidget *parent)
: QWidget(parent)
: RsAutoUpdatePage(2000,parent)
{
setupUi(this) ;
_timer = new QTimer ;
connect(_timer,SIGNAL(timeout()),this,SLOT(update())) ;
_timer->start(2000) ;
connect( _hashes_TW, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showCtxMenu(const QPoint&)));
_hashes_TW->setToolTip(tr("As a helper, you can manually remove hashes\nfrom there. Warning: doing so on currently\nactive transfers will block the transfer process.")) ;
}
void TurtleRouterDialog::showCtxMenu(const QPoint& point)
@ -62,26 +57,23 @@ void TurtleRouterDialog::removeFileHash()
rsTurtle->stopMonitoringFileTunnels(hash) ;
}
void TurtleRouterDialog::update()
void TurtleRouterDialog::updateDisplay()
{
if(isVisible())
{
std::cout << "updatign turtle router console."<< std::endl ;
std::cout << "updatign turtle router console."<< std::endl ;
std::vector<std::vector<std::string> > hashes_info ;
std::vector<std::vector<std::string> > tunnels_info ;
std::vector<std::vector<std::string> > search_reqs_info ;
std::vector<std::vector<std::string> > tunnel_reqs_info ;
std::vector<std::vector<std::string> > hashes_info ;
std::vector<std::vector<std::string> > tunnels_info ;
std::vector<std::vector<std::string> > search_reqs_info ;
std::vector<std::vector<std::string> > tunnel_reqs_info ;
rsTurtle->getInfo(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
rsTurtle->getInfo(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
// now display this in the QTableWidgets
// now display this in the QTableWidgets
fillTable( _hashes_TW, hashes_info) ;
fillTable( _tunnels_TW, tunnels_info) ;
fillTable( _tunnel_reqs_TW, tunnel_reqs_info) ;
fillTable( _search_reqs_TW, search_reqs_info) ;
}
fillTable( _hashes_TW, hashes_info) ;
fillTable( _tunnels_TW, tunnels_info) ;
fillTable( _tunnel_reqs_TW, tunnel_reqs_info) ;
fillTable( _search_reqs_TW, search_reqs_info) ;
}
void TurtleRouterDialog::fillTable(QTableWidget *table,const std::vector<std::vector<std::string> >& data)

View File

@ -2,24 +2,26 @@
#include <QPoint>
#include "ui_TurtleRouterDialog.h"
#include "RsAutoUpdatePage.h"
class TurtleRouterDialog: public QWidget, public Ui::TurtleRouterDialogForm
class TurtleRouterDialog: public RsAutoUpdatePage, public Ui::TurtleRouterDialogForm
{
Q_OBJECT
public:
TurtleRouterDialog(QWidget *parent = NULL) ;
static void showUp() ;
/** Default Constructor */
protected slots:
void update() ;
void showCtxMenu(const QPoint&) ;
void removeFileHash() ;
private:
void fillTable(QTableWidget *table,const std::vector<std::vector<std::string> >&) ;
TurtleRouterDialog(QWidget *parent = NULL) ;
QTimer *_timer ;
virtual void updateDisplay() ;
static TurtleRouterDialog *_instance ;
} ;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>406</height>
<width>865</width>
<height>553</height>
</rect>
</property>
<property name="windowTitle">
@ -17,171 +17,114 @@
<iconset resource="images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<widget class="QTableWidget" name="_hashes_TW">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Hashes and Tunnels</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Handled file hashes</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QTableWidget" name="_hashes_TW">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>File hash</string>
</property>
</column>
<column>
<property name="text">
<string>File Name</string>
</property>
</column>
<column>
<property name="text">
<string>Active tunnels</string>
</property>
</column>
<column>
<property name="text">
<string>Last tunnel request</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Current tunnels</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTableWidget" name="_tunnels_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Tunnel id</string>
</property>
</column>
<column>
<property name="text">
<string>Source</string>
</property>
</column>
<column>
<property name="text">
<string>Destination</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
<column>
<property name="text">
<string>Last transfer</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Tunnels / Search Requests</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Tunnel Requests</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QTableWidget" name="_tunnel_reqs_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Request id</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Search Requests</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTableWidget" name="_search_reqs_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Request id</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Handled file hash</string>
</property>
</column>
<column>
<property name="text">
<string>File Name</string>
</property>
</column>
<column>
<property name="text">
<string>Active tunnels</string>
</property>
</column>
<column>
<property name="text">
<string>Last tunnel request</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QTableWidget" name="_tunnels_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Current Tunnel id</string>
</property>
</column>
<column>
<property name="text">
<string>Source</string>
</property>
</column>
<column>
<property name="text">
<string>Destination</string>
</property>
</column>
<column>
<property name="text">
<string>Hash</string>
</property>
</column>
<column>
<property name="text">
<string>Last transfer</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QTableWidget" name="_tunnel_reqs_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Tunnel request id</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QTableWidget" name="_search_reqs_TW">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string>Search request id</string>
</property>
</column>
<column>
<property name="text">
<string>Origin</string>
</property>
</column>
<column>
<property name="text">
<string>Age</string>
</property>
</column>
</widget>
</item>
</layout>

View File

@ -20,7 +20,6 @@
****************************************************************/
#include "TransferPage.h"
#include <gui/TurtleRouterDialog.h>
#include "rshare.h"
@ -38,11 +37,9 @@ TransferPage::TransferPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
connect( ui._showTurtleDialogPB,SIGNAL(clicked()),this,SLOT( showTurtleRouterDialog() )) ;
QTimer *timer = new QTimer(this);
timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
timer->start(1000);
// QTimer *timer = new QTimer(this);
// timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
// timer->start(1000);
updateStatus();
@ -53,13 +50,7 @@ TransferPage::TransferPage(QWidget * parent, Qt::WFlags flags)
#endif
}
void TransferPage::showTurtleRouterDialog()
{
TurtleRouterDialog::showUp() ;
}
void
TransferPage::closeEvent (QCloseEvent * event)
void TransferPage::closeEvent (QCloseEvent * event)
{
QWidget::closeEvent(event);
}
@ -86,11 +77,11 @@ void TransferPage::load()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
// RsPeerDetails detail;
// if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
// {
// return;
// }
}
@ -98,15 +89,12 @@ void TransferPage::load()
/** Loads the settings for this page */
void TransferPage::updateStatus()
{
/* load up configuration from rsPeers */
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
return;
}
// RsPeerDetails detail;
// if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
// {
// return;
// }
}

View File

@ -29,30 +29,25 @@
class TransferPage: public ConfigPage
{
Q_OBJECT
Q_OBJECT
public:
TransferPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~TransferPage() {}
public:
TransferPage(QWidget * parent = 0, Qt::WFlags flags = 0);
~TransferPage() {}
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
/** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
public slots:
void updateStatus();
public slots:
void updateStatus();
private slots:
private:
void showTurtleRouterDialog();
void closeEvent (QCloseEvent * event);
private:
void closeEvent (QCloseEvent * event);
Ui::TransferPage ui;
Ui::TransferPage ui;
};
#endif // !TRANSFERPAGE_H

View File

@ -17,7 +17,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="Seite">
<attribute name="title">
@ -130,17 +130,6 @@
<string>F2F Routing</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="_showTurtleDialogPB">
<property name="text">
<string>Show router statistics</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">