Ejemplo n.º 1
0
void FileReaderEditor::setFile(String file)
{

    File fileToRead(file);
    lastFilePath = fileToRead.getParentDirectory();
    fileReader->setFile(fileToRead.getFullPathName());
    fileNameLabel->setText(fileToRead.getFileName(), dontSendNotification);

    setEnabledState(true);

    repaint();
}
Ejemplo n.º 2
0
void JuliaProcessorEditor::setFile(String file)
{

    File fileToRead(file);
    lastFilePath = fileToRead.getParentDirectory();
    juliaProcessor->setFile(fileToRead.getFullPathName());
    fileNameLabel->setText(fileToRead.getFileName(), dontSendNotification);

    //setEnabledState(true);
    //icon->setOpacity(1.0f); // tie this to hasJuliaInstance instead of just setting it!

    repaint();
}
Ejemplo n.º 3
0
void funcInputData()
{
	/* Example of Input files :
	* numberofInputs (not existing now)
	* NameofRNA 
	* ProteinSequence
	* ... * numberofInputs
	*
	* CDSforA
	* 455 1000
	* (string of sequences~)
	* ... * numberofInputs
	*/
	pFONTElementRef->ToElement()->SetAttribute("face",  "consolas");
	structRna xRna[4]; // Assume there is only 4 input.
	int iNumberofInput ; // Fix variable for now, but made for If there are more inputs
	//Deal with Proteins
	std::ifstream fileToRead("data.txt");
	fileToRead >> iNumberofInput;
	{ 
		std::string tmpFlush;
		getline(fileToRead, tmpFlush);
	}
	for(int xIterator = 0 ; xIterator < iNumberofInput ; ++xIterator )
	{
		getline( fileToRead, xRna[xIterator].sName );
		getline( fileToRead, xRna[xIterator].sProteinSequence );
	}
	funcCompare(xRna, iNumberofInput);
		//Deal with Sequences
	for(int xIterator = 0 ; xIterator < iNumberofInput ; ++xIterator )
	{
		int tmpCDSstarts;
		int tmpCDSends;
		std::string tmpString;
		fileToRead >> tmpCDSstarts >> tmpCDSends;
		fileToRead >> tmpString;
		for(int xCurrentPos = tmpCDSstarts-1 ; xCurrentPos < tmpCDSends ; ++xCurrentPos){
			xRna[xIterator].sSequenceBetweenCDS.push_back(tmpString[xCurrentPos]);
		} // inner for
	} // outer for
	funcSequenceCompare(xRna, iNumberofInput);
}
Ejemplo n.º 4
0
void LinkBackupThread::processDir(QDir& currentFromDir, QDir& currentToDir)
{
  long numErrors = getLogger().errorCount();
  if (numErrors > 1000)
  {
    QString errorMessage = QString("%1 errors found, quit?");
    QMessageBox::StandardButton reply = QMessageBox::question(nullptr, "Test", errorMessage, QMessageBox::Yes|QMessageBox::No);
      if (reply == QMessageBox::Yes) {
        requestCancel();
      } else {
        getLogger().clearErrorCount();
      }
  }

  TRACE_MSG(QString("Processing directory %1").arg(currentFromDir.canonicalPath()), 1);
  // Process directories, then process files.
  QList<QFileInfo> list = currentFromDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks | QDir::Hidden | QDir::Readable);
  QFileInfo info;
  foreach (info, list) {
    if (isCancelRequested()) {
      return;
    }
    TRACE_MSG(QString("Found Dir to processes %1").arg(info.canonicalFilePath()), 2);
    if (passes(info))
    {
      DEBUG_MSG(QString("Dir Passes: %1").arg(info.canonicalFilePath()), 2);
      if (!currentToDir.mkdir(info.fileName())) {
        ERROR_MSG(QString("Failed to create directory %1/%2").arg(currentToDir.canonicalPath(), info.fileName()), 1);
      } else if (!currentToDir.cd(info.fileName())) {
        ERROR_MSG(QString("Failed to cd to directory %1/%2").arg(currentToDir.canonicalPath(), info.fileName()), 1);
      } else if (!currentFromDir.cd(info.fileName())) {
        ERROR_MSG(QString("Failed to cd to directory %1/%2").arg(currentFromDir.canonicalPath(), info.fileName()), 1);
        if (!currentToDir.cdUp()) {
          ERROR_MSG("Failed to cd up a directory for the to directory", 1);
          requestCancel();
          return;
        }
      } else {
        processDir(currentFromDir, currentToDir);
        if (!currentToDir.cdUp()) {
          ERROR_MSG("Failed to cd up a directory for the to directory", 1);
          requestCancel();
          return;
        }
        if (!currentFromDir.cdUp()) {
          ERROR_MSG("Failed to cd up a directory for the from directory", 1);
          requestCancel();
          return;
        }
      }
    }
    else
    {
      DEBUG_MSG(QString("Skipping Dir: %1").arg(info.canonicalFilePath()), 2);
    }
  }
  // Now handle files
  list = currentFromDir.entryInfoList(QDir::Files | QDir::NoSymLinks | QDir::Hidden | QDir::Readable);
  foreach (info, list) {
    if (isCancelRequested()) {
      return;
    }
    QString fullPathFileToRead = info.canonicalFilePath();
    //TRACE_MSG(QString("Found File to test %1").arg(fullPathFileToRead), 2);
    if (passes(info))
    {
      //TRACE_MSG(QString("File passes %1").arg(fullPathFileToRead), 2);
      QFile fileToRead(fullPathFileToRead);
      // Just in case someone deleted the file.
      if (fileToRead.exists())
      {
        DBFileEntry* currentEntry = new DBFileEntry(info, m_fromDirWithoutTopDirName);
        const DBFileEntry* linkEntry = m_oldEntries->findEntry(m_backupSet.getCriteria(), currentEntry, m_fromDirWithoutTopDirName);

        QString pathToLinkFile = m_previousDirRoot;

        // If not in the old backup, search the current backup.
        if (linkEntry == nullptr)
        {
          linkEntry = m_currentEntries->findEntry(m_backupSet.getCriteria(), currentEntry, m_fromDirWithoutTopDirName);
          pathToLinkFile = m_toDirRoot;
        }

        if (linkEntry == nullptr)
        {
          bool failedToCopy = false;
          QString fullFileNameToWrite = m_toDirRoot + "/" + currentEntry->getPath();
          bool needHash = (currentEntry->getHash().length() == 0);
          if (needHash)
          {
            failedToCopy = !::getCopyLinkUtil().copyFileGenerateHash(fullPathFileToRead, fullFileNameToWrite);
            if (!failedToCopy)
            {
              currentEntry->setHash(getCopyLinkUtil().getLastHash());
            }
          }
          else if (!getCopyLinkUtil().copyFile(fullPathFileToRead, fullFileNameToWrite))
          {
            failedToCopy = true;
          }

          if (failedToCopy)
          {
            ERROR_MSG(QString(tr("EC %1")).arg(currentEntry->getPath()), 1);
          }
          else
          {
            INFO_MSG(QString(tr("C  %1")).arg(currentEntry->getPath()), 1);
            currentEntry->setLinkTypeCopy();
            m_currentEntries->addEntry(currentEntry);
            currentEntry = nullptr;
          }
        }
        else
        {
          if (getCopyLinkUtil().linkFile(pathToLinkFile + "/" + linkEntry->getPath(), m_toDirRoot + "/" + currentEntry->getPath()))
          {
            currentEntry->setLinkTypeLink();
            currentEntry->setHash(linkEntry->getHash());
            m_currentEntries->addEntry(currentEntry);
            INFO_MSG(QString(tr("L %1")).arg(currentEntry->getPath()), 1);
            currentEntry = nullptr;
          }
          else
          {
            ERROR_MSG(QString(tr("EL %1")).arg(currentEntry->getPath()), 1);
            ERROR_MSG(QString(tr("(%1)(%2)(%3)")).arg(pathToLinkFile, linkEntry->getPath(), m_toDirRoot), 1);
          }
        }
        if (currentEntry != nullptr)
        {
          delete currentEntry;
          currentEntry= nullptr;
        }
      }
    }
  }
  TRACE_MSG(QString("Finished with directory %1").arg(currentFromDir.canonicalPath()), 1);
}