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

@ -56,8 +56,9 @@
#define COL_SEND 8 #define COL_SEND 8
#define COL_DUPLICATION_FACTOR 9 #define COL_DUPLICATION_FACTOR 9
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,18 +76,24 @@ 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);
/* Set header resize modes and initial section sizes Uploads TreeView*/ m_bProcessSettings = false;
QHeaderView_setSectionResizeMode(treeWidget->header(), QHeaderView::ResizeToContents); mLastGroupReqTS = 0 ;
connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint))); //_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 // load settings
processSettings(true); processSettings(true);
} }
GxsTransportStatistics::~GxsTransportStatistics() GxsTransportStatistics::~GxsTransportStatistics()
@ -135,9 +142,17 @@ void GxsTransportStatistics::CustomPopupMenu( QPoint )
void GxsTransportStatistics::updateDisplay() 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(); 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