Exemplo n.º 1
0
void HashGenerator::spawnThread()
{
    HashThread* temp;
    qDebug() << "Spawning a thread";
    temp = new HashThread(keys);
    //Progress
    this->connect(temp,
                  SIGNAL(hashComputed()),
                  this,
                  SLOT(computeProgress()));
    //Target Found
    this->connect(temp,
                  SIGNAL(matchFound(QString,QString,QString)),
                  this,
                  SIGNAL(targetFound(QString,QString,QString)));
     //Thread Done
    this->connect(temp,
                  SIGNAL(done()),
                  this,
                  SLOT(threadDone()));
    this->threadCount++;
    this->threadPool->append( temp );
    temp->start();
    if(this->hashActive){
        this->threadsActive++;
        temp->hash();
    }
}
Exemplo n.º 2
0
//   PRIVATE
void Browser::loadItem(QString info){
  //qDebug() << "LoadItem:" << info;
  ////FileItem item;
     //itemame = info;
  QByteArray bytes;
  if(imageFormats.contains(info.section(".",-1).toLower()) ){
    QFile file(info);
    if(file.open(QIODevice::ReadOnly)){
      bytes = file.readAll();
      file.close();
    }

    /*QPixmap pix;
    if(pix.load(item.info.absoluteFilePath()) ){
      if(pix.height()>128){ pix = pix.scaled(128, 128, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); }
      item.icon.addPixmap(pix);
    }*/
  }/*else if(item.info.isDir()){
    item.icon = LXDG::findIcon("folder","inode/directory");
  }
  if(item.icon.isNull()){ item.icon = LXDG::findIcon(item.info.mimetype(), "unknown"); }*/
  //qDebug() << " - done with item:" << info;
  emit threadDone(info, bytes);
  //return item;
}
Exemplo n.º 3
0
Browser::Browser(QObject *parent) : QObject(parent){
  watcher = new QFileSystemWatcher(this);
  connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(QString)) );
  connect(watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(dirChanged(QString)) );
  showHidden = false;
  imageFormats = LUtils::imageExtensions(false); //lowercase suffixes
  connect(this, SIGNAL(threadDone(QString, QByteArray)), this, SLOT(futureFinished(QString, QByteArray)), Qt::QueuedConnection); //will always be between different threads
}
// Non Blocking code
void MainWindow::on_btNonBlocking_clicked()
{
    ui->lbCodeStatus->setText("Waiting");

    // Create the worker thread
    Worker *workThread = new Worker();

    // Connect the slot "threadDone" to our thread "done" signal
    connect(workThread, SIGNAL(done()),this, SLOT(threadDone()), Qt::QueuedConnection);

    // Start the thread
    workThread->start();
}
itkDCMTKDataImageReaderPrivate::~itkDCMTKDataImageReaderPrivate()
{
    threadDone(io);
}
Exemplo n.º 6
0
 void QuadTreeBarrier::CoreSyncData::waitForThreadReceivesRunSignal(const unsigned int m, const unsigned int threadID)
 {
   unsigned int count = MIN_MIC_BARRIER_WAIT_CYCLES;
   while(likely(threadDone(m,threadID) == true)) 
     pause(count);
 }