RetroShare/retroshare-gui/src/gui/RsAutoUpdatePage.cpp
thunder2 30564fe6ad Fixed utf8 characters in the transfer tab name of plugins.
Added Q_OBJECT to the VoipStatistics classes.
Removed compiler warnings.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5002 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-02-28 18:25:57 +00:00

48 lines
1.0 KiB
C++

#include <QTimer>
#include "RsAutoUpdatePage.h"
bool RsAutoUpdatePage::_locked = false ;
RsAutoUpdatePage::RsAutoUpdatePage(int ms_update_period, QWidget *parent, Qt::WindowFlags flags)
: MainPage(parent, flags)
{
_timer = new QTimer ;
_timer->setInterval(ms_update_period);
_timer->setSingleShot(true);
QObject::connect(_timer,SIGNAL(timeout()),this,SLOT(timerUpdate())) ;
_timer->start() ;
}
RsAutoUpdatePage::~RsAutoUpdatePage()
{
if(_timer != NULL)
delete _timer ;
_timer = NULL ;
}
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 == false && isVisible()) {
updateDisplay();
update() ; // Qt flush
}
_timer->start() ;
}
void RsAutoUpdatePage::lockAllEvents() { _locked = true ; }
void RsAutoUpdatePage::unlockAllEvents() { _locked = false ; }
bool RsAutoUpdatePage::eventsLocked() { return _locked ; }