fixed display in GxsTrans stats widget

This commit is contained in:
csoler 2017-05-26 18:42:52 +02:00
parent 14b9a54773
commit 4fa6cbe6e6
3 changed files with 32 additions and 14 deletions

View File

@ -76,10 +76,12 @@ struct RsGxsTransOutgoingRecord
class RsGxsTrans: public RsGxsIfaceHelper class RsGxsTrans: public RsGxsIfaceHelper
{ {
public: public:
struct GxsTransStatistics class GxsTransStatistics
{ {
RsGxsGroupId prefered_group_id ; public:
GxsTransStatistics() {}
RsGxsGroupId prefered_group_id ;
std::vector<RsGxsTransOutgoingRecord> outgoing_records; std::vector<RsGxsTransOutgoingRecord> outgoing_records;
}; };

View File

@ -58,6 +58,7 @@
static const int PARTIAL_VIEW_SIZE = 9 ; static const int PARTIAL_VIEW_SIZE = 9 ;
static const int MAX_TUNNEL_REQUESTS_DISPLAY = 10 ; 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_META 0x01
#define GXSTRANS_GROUP_DATA 0x02 #define GXSTRANS_GROUP_DATA 0x02
@ -75,9 +76,15 @@ GxsTransportStatistics::GxsTransportStatistics(QWidget *parent)
{ {
setupUi(this) ; setupUi(this) ;
m_bProcessSettings = false; mStateHelper = new UIStateHelper(this);
mStateHelper->addWidget(GXSTRANS_GROUP_META, treeWidget);
_router_F->setWidget( _tst_CW = new GxsTransportStatisticsWidget() ) ; 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*/ /* Set header resize modes and initial section sizes Uploads TreeView*/
QHeaderView_setSectionResizeMode(treeWidget->header(), QHeaderView::ResizeToContents); QHeaderView_setSectionResizeMode(treeWidget->header(), QHeaderView::ResizeToContents);
@ -135,9 +142,17 @@ void GxsTransportStatistics::CustomPopupMenu( QPoint )
void GxsTransportStatistics::updateDisplay() void GxsTransportStatistics::updateDisplay()
{ {
_tst_CW->updateContent() ; time_t now = time(NULL) ;
updateContent();
if(mLastGroupReqTS + GXSTRANS_STATISTICS_DELAY_BETWEEN_GROUP_REQ < now)
{
requestGroupMeta();
mLastGroupReqTS = now ;
}
//_tst_CW->updateContent() ;
updateContent();
} }
QString GxsTransportStatistics::getPeerName(const RsPeerId &peer_id) QString GxsTransportStatistics::getPeerName(const RsPeerId &peer_id)

View File

@ -67,6 +67,7 @@ private slots:
GxsTransportStatisticsWidget *_tst_CW ; GxsTransportStatisticsWidget *_tst_CW ;
TokenQueue *mTransQueue ; TokenQueue *mTransQueue ;
UIStateHelper *mStateHelper; UIStateHelper *mStateHelper;
uint32_t mLastGroupReqTS ;
} ; } ;
class GxsTransportStatisticsWidget: public QWidget class GxsTransportStatisticsWidget: public QWidget