RetroShare/retroshare-gui/src/gui/RsAutoUpdatePage.cpp
chrisparker126 eed3de92a9 removed MessengerWindow::insertpeer() from rsautoupdate::update()
- update of messenger window is delayed if rs window is not visible. 

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2794 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2010-04-27 12:14:57 +00:00

39 lines
905 B
C++

#include <iostream>
#include <QTimer>
#include "RsAutoUpdatePage.h"
#include "MessengerWindow.h"
bool RsAutoUpdatePage::_locked = false ;
RsAutoUpdatePage::RsAutoUpdatePage(int ms_update_period,QWidget *parent)
: MainPage(parent)
{
_timer = new QTimer ;
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(timerUpdate())) ;
_timer->start(ms_update_period) ;
}
void RsAutoUpdatePage::showEvent(QShowEvent *event)
{
//std::cout << "RsAutoUpdatePage::showEvent() In show event !!" << std::endl ;
if(!_locked)
updateDisplay();
}
void RsAutoUpdatePage::timerUpdate()
{
// only update when the widget is visible.
//
if(_locked || !isVisible())
return ;
updateDisplay();
update() ; // Qt flush
}
void RsAutoUpdatePage::lockAllEvents() { _locked = true ; }
void RsAutoUpdatePage::unlockAllEvents() { _locked = false ; }
bool RsAutoUpdatePage::eventsLocked() { return _locked ; }