/*! * \brief MainWindow::pushButtonPreviewClicked */ void MainWindow::pushButtonPreviewClicked() { QString fileNamePattern = ui->lineEditFileNamePattern->text(); QString directoryName = ui->lineEditDirectoryName->text(); QString newFileName = ui->lineEditNewFileName->text(); QString startNumberString = ui->lineEditStartNumber->text(); QString errorMessage = getErrorMessage(fileNamePattern, directoryName, newFileName, startNumberString); if ( !errorMessage.isEmpty() ) { QMessageBox::information(NULL, tr("Message"), errorMessage); return; } ui->pushButtonPreview->setEnabled(false); int startNumber = startNumberString.toInt(); QStringList matchedFiles = getMatchedFiles(fileNamePattern, directoryName); getNewFileNames(matchedFiles, newFileName, startNumber); ui->tabWidget->setCurrentWidget(ui->tabPreview); ui->pushButtonPreview->setEnabled(true); }
void FifoReaderManager::runScanDirectory() { auto fifos = getMatchedFiles(); for (const auto& fifo : fifos) { if (fifoReaders_.find(fifo) != fifoReaders_.end()) { continue; } auto fd = ::open(fifo.c_str(), O_RDONLY | O_NONBLOCK); if (fd >= 0) { auto pipeReader = folly::AsyncPipeReader::UniquePtr( new folly::AsyncPipeReader(&evb_, fd)); auto callback = folly::make_unique<FifoReadCallback>(fifo, parserMap_); pipeReader->setReadCB(callback.get()); fifoReaders_.emplace(fifo, FifoReader(std::move(pipeReader), std::move(callback))); } else { PLOG(WARNING) << "Error opening fifo: " << fifo; } } evb_.runAfterDelay([this]() { runScanDirectory(); }, kPollDirectoryIntervalMs); }