Пример #1
0
SystemFlagWatcher::SystemFlagWatcher() {
    CDT = QDateTime::currentDateTime();
    watcher = new QFileSystemWatcher(this);
    connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherNotification()) );
    connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherNotification()) );
    QTimer::singleShot(1, this, SLOT(watchFlagDir()) );
}
Пример #2
0
SystemFlagWatcher::SystemFlagWatcher(QObject* parent) : QObject(parent){
  CDT = QDateTime::currentDateTime();
  watcher = new QFileSystemWatcher(this);
  chktime = new QTimer(this); //default timer in case a flag was not detected for some reason
	chktime->setInterval(5 * 60 * 1000); //5 minutes default interval
	connect(chktime, SIGNAL(timeout()), this, SLOT(watcherNotification()) );
  QTimer::singleShot(1, this, SLOT(watchFlagDir()) ); 
}
Пример #3
0
//=========
//    PRIVATE
//=========
void SystemFlagWatcher::watchFlagDir() {
    watcher->addPath(FLAGDIR);
    //Now manually run the detection routine
    watcherNotification();
    //Now check that the directory is being watched
    if(watcher->directories().isEmpty()) {
        //flag dir does not exist yet, try again in 2 minutes
        QTimer::singleShot(120000, this, SLOT(watchFlagDir()) );
    }
}
Пример #4
0
//=========
//    PRIVATE
//=========
void SystemFlagWatcher::watchFlagDir(){
  if(!QFile::exists(FLAGDIR)){ //just to silence all the warnings about missing directory
    pcbsd::Utils::runShellCommand("pc-systemflag CHECKDIR");
  }
  watcher->addPath(FLAGDIR);
  //Now manually run the detection routine
  watcherNotification();
  //Now check that the directory is being watched
  if(watcher->directories().isEmpty()){
    //flag dir does not exist yet, try again in 2 minutes
    QTimer::singleShot(60000, this, SLOT(watchFlagDir()) );
    //qDebug() << "Nothing watched: wait 1 minute";
  }else{
    connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherNotification()) );
    connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherNotification()) );	  
  }
}