コード例 #1
0
void ParameterFile::regenerate(std::string workdir, std::string prevId, uint64_t gen) 
{
  std::ofstream fh(fullFileName, std::fstream::out); 

  std::stringstream ss; 
  ss << OutputFile::getFileBaseName(workdir) << "_parameters.run-"<< runid  << "." << prevId; 
  std::ifstream prevFile(ss.str()); 
  rejectIfNonExistant(ss.str()); 

  nat genFound = 0; 
  nat lineCtr = 0; 
  while(genFound < gen && not prevFile.eof())
    {
      std::string line; 
      getline(prevFile, line); 
      
      // hack =/ 
      bool lineIsEmpty = line.compare("") == 0 ; 
      
      if(lineCtr > 1 && not lineIsEmpty)
	{
	  std::stringstream ss1; 
	  ss1.str(line); 
	  std::string part; 
	  getline( ss1 ,part, '\t'  );       
	  genFound = std::stoi(part); 
	}

      if(genFound < gen && not lineIsEmpty)
	fh << line << std::endl; 
      ++lineCtr; 
    }

  fh.close();
} 
コード例 #2
0
void OutputTableBase::openFile(QString appendix) {
    QString fileNameApp = insertAppendix(fileName, appendix);
    QString useFileName = (runNumber() == 1 || hasSummary()) ?
                          fileNameApp : insertNumber(fileNameApp, runNumber());

    QString path = FileLocations::location(FileLocationInfo::Output).absolutePath();
    QString filePath = path + "/" + useFileName;
    outputFilePaths << filePath;

    file.setFileName(filePath);
    if (!file.open(QIODevice::Text | QIODevice::WriteOnly))
        throw Exception("Could not open output file to write table:\n'" + filePath + "'");

    // If more than one file then give the first file a number too
    if (runNumber() == 2 && !hasSummary()) {
        QString filePath = path + "/" + fileNameApp;
        QFile prevFile(filePath);

        QString newName = path + "/" + insertNumber(fileNameApp, 1);
        outputFilePaths[0] = newName;

        // Delete any existing file named newName
        QFile toDelete(newName);
        toDelete.remove();
        prevFile.rename(newName);
    }
}
コード例 #3
0
ファイル: soundplayer.cpp プロジェクト: Flare183/dsorganize
bool getPrevSong()
{
	int fType = UNKNOWN;
	int tmpCur = getCursor();
	
	while(fType != SOUNDFILE)
	{
		tmpCur = prevFile(getFileName());
		
		if(tmpCur == -1)
			return false;
		
		fType = getFileType(getFileName());
	}
	
	moveCursorAbsolute(tmpCur);
	return true;
}
コード例 #4
0
ファイル: csettings.cpp プロジェクト: AhmedAMohamed/graphviz
void CFrmSettings::doPreview(QString fileName)
{
    if (getActiveWindow()->previewFrm) {
	getActiveWindow()->parentFrm->mdiArea->
	    removeSubWindow(getActiveWindow()->previewFrm->subWindowRef);
	delete getActiveWindow()->previewFrm;
	getActiveWindow()->previewFrm = NULL;
    }

    if ((fileName.isNull()) || !(getActiveWindow()->loadPreview(fileName))) {	//create preview
	QString prevFile(buildTempFile());
	gvRenderFilename(gvc, graph, "png",
			 (char *) prevFile.toUtf8().constData());
	getActiveWindow()->loadPreview(prevFile);
#if 0
	if (!this->getActiveWindow()->loadPreview(prevFile))
	    QMessageBox::information(this, tr("GVEdit"),
				     tr
				     ("Preview file can not be opened."));
#endif
    }
}
コード例 #5
0
ファイル: moc_qplayer.cpp プロジェクト: JustFFunny/WorkSpace
int QPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_MuButton_clicked(); break;
        case 1: on_RemoveButton_clicked(); break;
        case 2: on_pushButton_clicked(); break;
        case 3: on_StyleButton_clicked(); break;
        case 4: on_PrevButton_clicked(); break;
        case 5: on_NextButton_clicked(); break;
        case 6: on_PauseButton_clicked(); break;
        case 7: on_StopButton_clicked(); break;
        case 8: on_PlayButton_clicked(); break;
        case 9: on_AddButton_clicked(); break;
        case 10: addFiles(); break;
        case 11: nextFile(); break;
        case 12: prevFile(); break;
        case 13: aboutToFinish(); break;
        case 14: finished(); break;
        case 15: tick((*reinterpret_cast< qint64(*)>(_a[1]))); break;
        case 16: rndFile(); break;
        case 17: stateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
        case 18: metaStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break;
        case 19: sourceChanged((*reinterpret_cast< const Phonon::MediaSource(*)>(_a[1]))); break;
        case 20: tableClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 21: setupActions(); break;
        case 22: removeFiles(); break;
        default: ;
        }
        _id -= 23;
    }
    return _id;
}