mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 07:59:35 -05:00
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:
parent
b2c2b7fc85
commit
2a9551a41a
@ -59,9 +59,17 @@ RSPermissionMatrixWidget::RSPermissionMatrixWidget(QWidget *parent)
|
||||
|
||||
setMouseTracking(true) ;
|
||||
|
||||
//_timer = new QTimer ;
|
||||
//QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(update())) ;
|
||||
//_timer->start(1000);
|
||||
_timer = new QTimer ;
|
||||
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(updateDisplay())) ;
|
||||
_timer->start(5000);
|
||||
}
|
||||
|
||||
void RSPermissionMatrixWidget::updateDisplay()
|
||||
{
|
||||
if(isHidden())
|
||||
return ;
|
||||
|
||||
update() ;
|
||||
}
|
||||
|
||||
void RSPermissionMatrixWidget::mousePressEvent(QMouseEvent *e)
|
||||
@ -123,6 +131,9 @@ void RSPermissionMatrixWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
/** Default destructor */
|
||||
RSPermissionMatrixWidget::~RSPermissionMatrixWidget()
|
||||
{
|
||||
_timer->stop() ;
|
||||
|
||||
delete _timer ;
|
||||
delete _painter;
|
||||
}
|
||||
|
||||
@ -167,7 +178,7 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
||||
RsPeerDetails 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)) ;
|
||||
names.push_back(name) ;
|
||||
}
|
||||
|
@ -63,13 +63,14 @@ public:
|
||||
protected slots:
|
||||
// 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()
|
||||
void updateDisplay() {}
|
||||
void updateDisplay() ;
|
||||
|
||||
void defaultPermissionSwitched(uint32_t ServiceId,bool b);
|
||||
void userPermissionSwitched(uint32_t ServiceId,const RsPeerId& friend_id,bool b);
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent *e) ;
|
||||
virtual void mouseMoveEvent(QMouseEvent *e) ;
|
||||
|
||||
protected:
|
||||
/** Overloaded QWidget::paintEvent() */
|
||||
void paintEvent(QPaintEvent *event);
|
||||
@ -89,6 +90,8 @@ private:
|
||||
|
||||
/** A QPainter object that handles drawing the various graph elements. */
|
||||
QPainter* _painter;
|
||||
QTimer *_timer ;
|
||||
|
||||
/** The current dimensions of the graph. */
|
||||
QRect _rec;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user