Changeset 862b615


Ignore:
Timestamp:
01/22/14 09:10:15 (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
1ac7521, 6a5c6a1
Parents:
f59c238
Message:

Add a refresh timer to the life-preserver GUI that makes sure that it does not refresh more often than once per minute.

Location:
src-qt4/life-preserver/lp-gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPMain.cpp

    r0a4c18a r862b615  
    55LPMain::LPMain(QWidget *parent) : QMainWindow(parent), ui(new Ui::LPMain){ 
    66  ui->setupUi(this); //load the Qt-designer UI file 
     7  //Initialize the auto-refresh timer 
     8  timer = new QTimer(this); 
     9        timer->setSingleShot(true); 
     10        timer->setInterval(60000); // 1 minute timer 
     11        connect(timer, SIGNAL(timeout()), this, SLOT(updateTabs()) ); 
    712  //Initialize the system watcher 
    813  watcher = new QFileSystemWatcher(this); 
     
    6166  ui->tabWidget->setCurrentWidget(ui->tab_status); 
    6267  //Now connect the watcher to the update slot 
    63   connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(updateTabs()) ); 
     68  connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(autoRefresh()) ); 
    6469} 
    6570 
     
    401406    updateTabs(); 
    402407  }      
     408} 
     409 
     410void LPMain::autoRefresh(){ 
     411  //This slot makes sure that the GUI is not refreshed too frequently 
     412  if(!timer->isActive()){ 
     413    timer->start(); //start countdown to GUI refresh  
     414  }        
    403415} 
    404416 
  • src-qt4/life-preserver/lp-gui/LPMain.h

    r0a4c18a r862b615  
    4444        QMessageBox *waitBox; 
    4545        QFileSystemWatcher *watcher; 
     46        QTimer *timer; 
    4647 
    4748        void showErrorDialog(QString title, QString message, QString errors); 
     
    6061        void restoreFiles(); 
    6162        void openConfigGUI(); 
     63        void autoRefresh(); 
    6264        // -- Menu Actions -- 
    6365        //File Menu 
Note: See TracChangeset for help on using the changeset viewer.