diff --git a/libretroshare/src/retroshare/rsgxstrans.h b/libretroshare/src/retroshare/rsgxstrans.h index afcdb18ea..445a7fef4 100644 --- a/libretroshare/src/retroshare/rsgxstrans.h +++ b/libretroshare/src/retroshare/rsgxstrans.h @@ -76,10 +76,12 @@ struct RsGxsTransOutgoingRecord class RsGxsTrans: public RsGxsIfaceHelper { public: - struct GxsTransStatistics + class GxsTransStatistics { - RsGxsGroupId prefered_group_id ; + public: + GxsTransStatistics() {} + RsGxsGroupId prefered_group_id ; std::vector outgoing_records; }; diff --git a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.cpp b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.cpp index 11a9c4a80..6b1a09db6 100644 --- a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.cpp @@ -56,8 +56,9 @@ #define COL_SEND 8 #define COL_DUPLICATION_FACTOR 9 -static const int PARTIAL_VIEW_SIZE = 9 ; -static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; +static const int PARTIAL_VIEW_SIZE = 9 ; +static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; +static const int GXSTRANS_STATISTICS_DELAY_BETWEEN_GROUP_REQ = 30 ; // never request more than every 30 secs. #define GXSTRANS_GROUP_META 0x01 #define GXSTRANS_GROUP_DATA 0x02 @@ -75,18 +76,24 @@ GxsTransportStatistics::GxsTransportStatistics(QWidget *parent) { setupUi(this) ; - m_bProcessSettings = false; + mStateHelper = new UIStateHelper(this); + mStateHelper->addWidget(GXSTRANS_GROUP_META, treeWidget); - _router_F->setWidget( _tst_CW = new GxsTransportStatisticsWidget() ) ; - - /* 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))); + mTransQueue = new TokenQueue(rsGxsTrans->getTokenService(), this); + + m_bProcessSettings = false; + mLastGroupReqTS = 0 ; + + //_router_F->setWidget( _tst_CW = new GxsTransportStatisticsWidget() ) ; + + /* 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); + processSettings(true); } GxsTransportStatistics::~GxsTransportStatistics() @@ -135,9 +142,17 @@ void GxsTransportStatistics::CustomPopupMenu( QPoint ) void GxsTransportStatistics::updateDisplay() { - _tst_CW->updateContent() ; + time_t now = time(NULL) ; + + if(mLastGroupReqTS + GXSTRANS_STATISTICS_DELAY_BETWEEN_GROUP_REQ < now) + { + requestGroupMeta(); + mLastGroupReqTS = now ; + } + + //_tst_CW->updateContent() ; + updateContent(); - } QString GxsTransportStatistics::getPeerName(const RsPeerId &peer_id) diff --git a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.h b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.h index 12383c83d..c69b796f7 100644 --- a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.h +++ b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.h @@ -67,6 +67,7 @@ private slots: GxsTransportStatisticsWidget *_tst_CW ; TokenQueue *mTransQueue ; UIStateHelper *mStateHelper; + uint32_t mLastGroupReqTS ; } ; class GxsTransportStatisticsWidget: public QWidget