mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-26 01:31:30 -05:00
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:
parent
47403f05fc
commit
65887cbd78
@ -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))
|
||||
|
@ -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() ;
|
||||
|
@ -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()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user