2009-11-17 07:45:06 -05:00
|
|
|
#include <iostream>
|
|
|
|
#include <QTimer>
|
|
|
|
#include "RsAutoUpdatePage.h"
|
2009-11-30 11:12:13 -05:00
|
|
|
#include "MessengerWindow.h"
|
2009-11-17 07:45:06 -05:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2010-02-07 18:01:18 -05:00
|
|
|
//std::cout << "RsAutoUpdatePage::showEvent() In show event !!" << std::endl ;
|
2009-11-17 07:45:06 -05:00
|
|
|
updateDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RsAutoUpdatePage::timerUpdate()
|
|
|
|
{
|
|
|
|
// only update when the widget is visible.
|
|
|
|
//
|
|
|
|
if(!isVisible())
|
|
|
|
return ;
|
2009-11-30 11:12:13 -05:00
|
|
|
|
|
|
|
updateDisplay();
|
|
|
|
MessengerWindow::getInstance()->insertPeers();
|
2009-11-17 07:45:06 -05:00
|
|
|
update() ; // Qt flush
|
|
|
|
}
|
|
|
|
|