mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
Added nickname column to pending packets & context menu action to view details
Fixed ui layout.
This commit is contained in:
parent
2e76cc6267
commit
c89ff9f059
@ -6,14 +6,17 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1597</width>
|
||||
<height>811</height>
|
||||
<width>812</width>
|
||||
<height>349</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BWGraph" name="bwgraph_BW">
|
||||
<property name="frameShape">
|
||||
@ -44,7 +47,17 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="friend_CB"/>
|
||||
<widget class="QComboBox" name="friend_CB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
@ -75,7 +88,17 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="service_CB"/>
|
||||
<widget class="QComboBox" name="service_CB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
@ -94,7 +117,7 @@
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>726</width>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1447</width>
|
||||
<height>911</height>
|
||||
<height>471</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -89,7 +89,14 @@
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="BandwidthStatsWidget" name="widget" native="true"/>
|
||||
<widget class="BandwidthStatsWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QFontMetrics>
|
||||
#include <time.h>
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include <QLayout>
|
||||
@ -36,10 +37,22 @@
|
||||
|
||||
#include "GlobalRouterStatistics.h"
|
||||
|
||||
#include "gui/Identity/IdDetailsDialog.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "util/QtVersion.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
#define COL_ID 0
|
||||
#define COL_NICKNAME 1
|
||||
#define COL_DESTINATION 2
|
||||
#define COL_DATASTATUS 3
|
||||
#define COL_TUNNELSTATUS 4
|
||||
#define COL_DATASIZE 5
|
||||
#define COL_DATAHASH 6
|
||||
#define COL_RECEIVED 7
|
||||
#define COL_SEND 8
|
||||
|
||||
|
||||
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ;
|
||||
|
||||
static QColor colorScale(float f)
|
||||
@ -61,6 +74,9 @@ GlobalRouterStatistics::GlobalRouterStatistics(QWidget *parent)
|
||||
|
||||
/* Set header resize modes and initial section sizes Uploads TreeView*/
|
||||
QHeaderView_setSectionResizeMode(treeWidget->header(), QHeaderView::ResizeToContents);
|
||||
|
||||
connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint)));
|
||||
|
||||
|
||||
// load settings
|
||||
processSettings(true);
|
||||
@ -97,6 +113,19 @@ void GlobalRouterStatistics::processSettings(bool bLoad)
|
||||
m_bProcessSettings = false;
|
||||
}
|
||||
|
||||
void GlobalRouterStatistics::CustomPopupMenu( QPoint )
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QTreeWidgetItem *item = treeWidget->currentItem();
|
||||
if (item) {
|
||||
contextMnu.addAction(QIcon(":/images/info16.png"), tr("Details"), this, SLOT(personDetails()));
|
||||
|
||||
}
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void GlobalRouterStatistics::updateDisplay()
|
||||
{
|
||||
_tst_CW->updateContent() ;
|
||||
@ -148,17 +177,32 @@ void GlobalRouterStatistics::updateContent()
|
||||
if(nicknames.isEmpty())
|
||||
nicknames = tr("Unknown");
|
||||
|
||||
item -> setData(0, Qt::DisplayRole, QString::number(cache_infos[i].mid,16).rightJustified(16,'0'));
|
||||
item -> setData(1, Qt::DisplayRole, nicknames + "@" + QString::fromStdString(cache_infos[i].destination.toStdString()));
|
||||
item -> setData(2, Qt::DisplayRole, data_status_string[cache_infos[i].data_status % 6]);
|
||||
item -> setData(3, Qt::DisplayRole, tunnel_status_string[cache_infos[i].tunnel_status % 3]);
|
||||
item -> setData(4, Qt::DisplayRole, misc::friendlyUnit(cache_infos[i].data_size));
|
||||
item -> setData(5, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString()));
|
||||
item -> setData(6, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time));
|
||||
item -> setData(7, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time));
|
||||
item -> setData(COL_ID, Qt::DisplayRole, QString::number(cache_infos[i].mid,16).rightJustified(16,'0'));
|
||||
item -> setData(COL_NICKNAME, Qt::DisplayRole, nicknames ) ;
|
||||
item -> setData(COL_DESTINATION, Qt::DisplayRole, QString::fromStdString(cache_infos[i].destination.toStdString()));
|
||||
item -> setData(COL_DATASTATUS, Qt::DisplayRole, data_status_string[cache_infos[i].data_status % 6]);
|
||||
item -> setData(COL_TUNNELSTATUS, Qt::DisplayRole, tunnel_status_string[cache_infos[i].tunnel_status % 3]);
|
||||
item -> setData(COL_DATASIZE, Qt::DisplayRole, misc::friendlyUnit(cache_infos[i].data_size));
|
||||
item -> setData(COL_DATAHASH, Qt::DisplayRole, QString::fromStdString(cache_infos[i].item_hash.toStdString()));
|
||||
item -> setData(COL_RECEIVED, Qt::DisplayRole, QString::number(now - cache_infos[i].routing_time));
|
||||
item -> setData(COL_SEND, Qt::DisplayRole, QString::number(now - cache_infos[i].last_sent_time));
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalRouterStatistics::personDetails()
|
||||
{
|
||||
QTreeWidgetItem *item = treeWidget->currentItem();
|
||||
std::string id = item->text(COL_DESTINATION).toStdString();
|
||||
|
||||
if (id.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
IdDetailsDialog *dialog = new IdDetailsDialog(RsGxsGroupId(id));
|
||||
dialog->show();
|
||||
|
||||
}
|
||||
|
||||
GlobalRouterStatisticsWidget::GlobalRouterStatisticsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
|
@ -42,7 +42,12 @@ class GlobalRouterStatistics: public RsAutoUpdatePage, public Ui::GlobalRouterSt
|
||||
static QString getPeerName(const RsPeerId& peer_id) ;
|
||||
|
||||
void updateContent() ;
|
||||
|
||||
|
||||
private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void CustomPopupMenu( QPoint point );
|
||||
void personDetails();
|
||||
|
||||
private:
|
||||
|
||||
void processSettings(bool bLoad);
|
||||
@ -50,6 +55,7 @@ class GlobalRouterStatistics: public RsAutoUpdatePage, public Ui::GlobalRouterSt
|
||||
|
||||
virtual void updateDisplay() ;
|
||||
|
||||
|
||||
GlobalRouterStatisticsWidget *_tst_CW ;
|
||||
} ;
|
||||
|
||||
|
@ -50,6 +50,9 @@
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -58,6 +61,11 @@
|
||||
<string>ID</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Identity Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Destinaton</string>
|
||||
|
Loading…
Reference in New Issue
Block a user