Teaked the TrustView and NetworkView so that they only update when visible. Doing so, the CPU overload is only present when strictly needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.4.x@1570 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-08-29 11:20:04 +00:00
parent 47403f05fc
commit 65887cbd78
3 changed files with 13 additions and 1 deletions

View File

@ -35,6 +35,11 @@ TrustView::TrustView()
update() ;
}
void TrustView::showEvent(QShowEvent *e)
{
QWidget::showEvent(e) ;
update() ;
}
void TrustView::wheelEvent(QWheelEvent *e)
{
if(e->modifiers() & Qt::ShiftModifier)
@ -131,6 +136,9 @@ void TrustView::update()
{
// collect info.
if(!isVisible())
return ;
std::list<std::string> neighs;
if(!rsPeers->getOthersList(neighs))

View File

@ -1,6 +1,7 @@
#include "ui_TrustView.h"
class QWheelEvent ;
class QShowEvent ;
class TrustView: public QWidget, public Ui::TrustView
{
@ -11,6 +12,7 @@ class TrustView: public QWidget, public Ui::TrustView
protected:
virtual void wheelEvent(QWheelEvent *) ;
virtual void showEvent(QShowEvent *) ;
public slots:
void update() ;

View File

@ -38,6 +38,7 @@
#include "edge.h"
#include "node.h"
#include <iostream>
#include <QDebug>
#include <QGraphicsScene>
#include <QWheelEvent>
@ -202,7 +203,8 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
void GraphWidget::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event);
if(!isVisible())
return;
QList<Node *> nodes;
foreach (QGraphicsItem *item, scene()->items()) {