added auto-update to permission matrix

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7899 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-02-01 15:08:18 +00:00
parent b2c2b7fc85
commit 2a9551a41a
2 changed files with 19 additions and 5 deletions

View File

@ -59,9 +59,17 @@ RSPermissionMatrixWidget::RSPermissionMatrixWidget(QWidget *parent)
setMouseTracking(true) ; setMouseTracking(true) ;
//_timer = new QTimer ; _timer = new QTimer ;
//QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(update())) ; QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(updateDisplay())) ;
//_timer->start(1000); _timer->start(5000);
}
void RSPermissionMatrixWidget::updateDisplay()
{
if(isHidden())
return ;
update() ;
} }
void RSPermissionMatrixWidget::mousePressEvent(QMouseEvent *e) void RSPermissionMatrixWidget::mousePressEvent(QMouseEvent *e)
@ -123,6 +131,9 @@ void RSPermissionMatrixWidget::mouseMoveEvent(QMouseEvent *e)
/** Default destructor */ /** Default destructor */
RSPermissionMatrixWidget::~RSPermissionMatrixWidget() RSPermissionMatrixWidget::~RSPermissionMatrixWidget()
{ {
_timer->stop() ;
delete _timer ;
delete _painter; delete _painter;
} }
@ -167,7 +178,7 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
RsPeerDetails details ; RsPeerDetails details ;
rsPeers->getPeerDetails(*it,details) ; rsPeers->getPeerDetails(*it,details) ;
QString name = QString::fromUtf8(details.name.c_str()); QString name = QString::fromUtf8(details.name.c_str()) + " (" + QString::fromUtf8(details.location.c_str()) + ")";
peer_name_size = std::max(peer_name_size, fm.width(name)) ; peer_name_size = std::max(peer_name_size, fm.width(name)) ;
names.push_back(name) ; names.push_back(name) ;
} }

View File

@ -63,13 +63,14 @@ public:
protected slots: protected slots:
// Calls the internal source for a new data points; called by the timer. You might want to overload this // Calls the internal source for a new data points; called by the timer. You might want to overload this
// if the collection system needs it. Otherwise, the default method will call getValues() // if the collection system needs it. Otherwise, the default method will call getValues()
void updateDisplay() {} void updateDisplay() ;
void defaultPermissionSwitched(uint32_t ServiceId,bool b); void defaultPermissionSwitched(uint32_t ServiceId,bool b);
void userPermissionSwitched(uint32_t ServiceId,const RsPeerId& friend_id,bool b); void userPermissionSwitched(uint32_t ServiceId,const RsPeerId& friend_id,bool b);
virtual void mousePressEvent(QMouseEvent *e) ; virtual void mousePressEvent(QMouseEvent *e) ;
virtual void mouseMoveEvent(QMouseEvent *e) ; virtual void mouseMoveEvent(QMouseEvent *e) ;
protected: protected:
/** Overloaded QWidget::paintEvent() */ /** Overloaded QWidget::paintEvent() */
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
@ -89,6 +90,8 @@ private:
/** A QPainter object that handles drawing the various graph elements. */ /** A QPainter object that handles drawing the various graph elements. */
QPainter* _painter; QPainter* _painter;
QTimer *_timer ;
/** The current dimensions of the graph. */ /** The current dimensions of the graph. */
QRect _rec; QRect _rec;