Пример #1
0
void ScannerPage::openScanner ()
{
  Scanner *dialog = new Scanner(list->currentText(), chartIndex);
  connect(dialog, SIGNAL(exitScanner()), this, SLOT(refreshList()));
  connect(dialog, SIGNAL(message(QString)), this, SIGNAL(message(QString)));
  connect(dialog, SIGNAL(scanComplete()), this, SIGNAL(refreshGroup()));
  dialog->show();
}
Пример #2
0
void emberAfZllAbortTouchLink(void)
{
  if (touchLinkInProgress()) {
    // If the scanning portion of touch linking is already finished, we can
    // abort right away.  If not, we need to stop the scan and wait for the
    // stack to inform us when the scan is done.
    emberAfAppPrintln("%p%p%p",
                      "Error: ",
                      "Touch linking failed: ",
                      "aborted by application");
    if (scanComplete()) {
      abortTouchLink(EMBER_AF_ZLL_ABORTED_BY_APPLICATION);
    } else {
      flags |= ABORTING_TOUCH_LINK;
      emberStopScan();
    }
  }
}
Пример #3
0
//////////////////////////////////////////////////////////////////////////
/// Scans all the files in one dir
/// 
/// If the SyncSystem is in the correct state this function will scan all 
/// files in the current directory. It will emit the signalDirsScanned, 
/// signalFilesScanned and signalFileStats for each directory scanned, 
/// or emit signalError if anything went wrong.
/// It is called by the m_ScanDirTimer with 0 ms delay to allow the event
/// loop to process network traffic as well as scan.
//////////////////////////////////////////////////////////////////////////
void SyncSystem::slotScanDir()
{
  if(m_Scanner && m_Connection)
  {
    if(m_Scanner->scanStep())
    {
      //Loop over each file in this directory
      for( ScannerBase::const_iterator fileIterator = m_Scanner->allFiles().begin(); fileIterator != m_Scanner->allFiles().end(); fileIterator++ )
      {
        QString fileName(fileIterator.key());
        QFileInfo fileInfo(joinPath(m_CurrentSourcePath,fileName));
        if(!fileInfo.exists())
          continue; //File has been locally deleted since the sync was pressed

        m_UnresolvedFiles[fileName] = fileIterator.value();
        m_Connection->sendStatFileReq(fileName);
        m_FilesPendingStat++;
        //Add to the known files list, this is used to find files to delete
        m_Files.insert(fileName);
      }
      m_DirsFinished++;
      m_DirsKnown = m_Scanner->dirCount();
      m_DirsIgnored = m_Scanner->dirIgnored();
      emit signalDirsScanned(m_DirsFinished, m_DirsKnown, m_DirsIgnored);

      m_FilesKnown = m_Scanner->fileNumber();
      m_FilesIgnored = m_Scanner->fileIgnored();
      emit signalFilesScanned(m_FilesKnown, m_FilesIgnored);
      emit signalFileStats(m_FilesResolved, m_FilesPendingStat);
      m_Scanner->clearAllFiles();
    }
    else
    {
      scanComplete();
    }
  }
}
void QNativeWifiEngine::initialize()
{
    scanComplete();
}
Пример #5
0
void Scanner::scan ()
{
  if (! fileList.count() && ! allSymbols->isChecked())
  {
    QMessageBox::information(this,
                             tr("Qtstalker: Error"),
			     tr("No symbols selected."));
    return;
  }

  // open the CUS plugin
  QString iplugin("CUS");
  IndicatorPlugin *plug = config.getIndicatorPlugin(iplugin);
  if (! plug)
  {
    config.closePlugin(iplugin);
    return;
  }

  QString s;
  list->getText(s);
  QStringList l = QStringList::split("\n", s, FALSE);
  plug->setCustomFunction(l);
  
  this->setEnabled(FALSE);
  
  // clear dir for scan symbols
  QDir dir;
  config.getData(Config::GroupPath, s);
  s.append("/Scanner");
  if (! dir.exists(s, TRUE))
    dir.mkdir(s, TRUE);
  s.append("/" + scannerName);
  if (! dir.exists(s, TRUE))
    dir.mkdir(s, TRUE);
  else
  {
    int loop;
    dir.setPath(s);
    for (loop = 2; loop < (int) dir.count(); loop++)
    {
      QString s2 = dir.absPath() + "/" + dir[loop];
      if (! dir.remove(s2, TRUE))
        qDebug("%s not removed", s2.latin1());
    }
  }
  
  if (allSymbols->isChecked())
  {
    QString ts;
    if (! basePath->currentText().compare(tr("Chart")))
      config.getData(Config::DataPath, ts);
    else
      config.getData(Config::GroupPath, ts);
    Traverse trav(Traverse::File);
    trav.traverse(ts);
    trav.getList(fileList);
  }
  
  QProgressDialog prog(tr("Scanning..."),
                       tr("Cancel"),
		       fileList.count(),
		       this,
		       "progress",
		       TRUE);
  prog.show();
  
  int minBars = bars->value();
  
  emit message(QString("Scanning..."));
  
  int loop;
  for (loop = 0; loop < (int) fileList.count(); loop++)
  {
    prog.setProgress(loop);
    emit message(QString());
    if (prog.wasCancelled())
    {
      emit message(QString("Scan cancelled"));
      break;
    }

    QFileInfo fi(fileList[loop]);
    if (fi.isDir())
      continue;

    DbPlugin db;
    QDir dir;
    if (! dir.exists(fileList[loop]))
      continue;
    db.open(fileList[loop], chartIndex);

    db.setBarRange(minBars);
    db.setBarLength((BarData::BarLength) barLengthList.findIndex(period->currentText()));

    BarData *recordList = new BarData(fileList[loop]);
    QDateTime dt = QDateTime::currentDateTime();
    db.getHistory(recordList, dt);
    db.close();
    
    // load the CUS plugin and calculate
    plug->setIndicatorInput(recordList);
    Indicator *i = plug->calculate();
    if (! i->getLines())
    {
      delete recordList;
      delete i;
      continue;
    }
    
    PlotLine *line = i->getLine(0);
    if (line && line->getSize() > 0)
    {
      if (line->getData(line->getSize() - 1) > 0)
      {
        QString ts;
        config.getData(Config::GroupPath, ts);
        QString s = "ln -s \"" + fileList[loop] + "\" " + ts + "/Scanner/" + scannerName;
        system(s);
      }
    }
    
    delete recordList;
    delete i;
    
    emit message(QString());
  }
  
  if (! prog.wasCancelled())
    emit message(QString("Scan complete"));
  
  config.closePlugin(iplugin);
  
  this->setEnabled(TRUE);

  emit scanComplete();
}