Exemplo n.º 1
0
bool PrefProxy::getFirstDeviceSection(const QString &devType, 
				      const QString &devId, QString &result)
{
  QStringList sections;
  getSectionList(sections);
  char *devName, *devIdStr;
  for(ssize_t i = 0; i < sections.size(); ++i){
    devName = ltr_int_get_key(sections[i].toUtf8().constData(), "Capture-device");
    devIdStr = ltr_int_get_key(sections[i].toUtf8().constData(), "Capture-device-id");
    if((devName != NULL) && (devIdStr != NULL)){
      if((devType.compare(QString::fromUtf8(devName), Qt::CaseInsensitive) == 0) 
         && (devId.compare(QString::fromUtf8(devIdStr), Qt::CaseInsensitive) == 0)){
	result = QString(sections[i]);
	return true;
      }
    }
  }
  return false;
}
//======================>>> makefileMaker::loadProject <<<============================
  void makefileMaker::loadProject (char *n)
  {
    //loads infos contained in project file n into makefileMaker member vars

    ifstream prjf(n);
    if (!prjf)
	return;

    eraseAll();
  

    // Project Options
    if (!getSectionList(prjf, SecProjOpts, SecProjOptsEnd, projOpts))
	return;

    // extract options to useful fields
    int optlim = projOpts.size();
    for (int ixa = 0 ; ixa < optlim ; ++ixa)
      {
	if (strstr(projOpts.list[ixa],"ctags:")!= 0)
	  {
	    strcpy(ctags,&projOpts.list[ixa][6]);
	  }
      }
    projOpts.erase();		// now erase all options to avoid dups

    // Makefile
    if (!getSectionEntry(prjf, SecMakefile, makeName))
	return;

    //0) options
    if (!getSectionList(prjf, SecOptions, SecOptionsEnd, curOpts))
	return;

    // HOMEV
    if (!getSectionEntry(prjf, SecHomeV, homeV))
	return;

    //1) exe name
    if (!getSectionEntry(prjf, SecTarget, exeName))
	return;

    //2) objs
    if (!getSectionList(prjf, SecObjFiles, SecObjFilesEnd, objFiles))
	return;

    //3) compiler name
    if (!getSectionEntry(prjf, SecCompiler, cc))
	return;

    //4) include dirs
    if (!getSectionList(prjf, SecIncDirs, SecIncDirsEnd, incDirs))
	return;

    //5) lib dirs
    if (!getSectionList(prjf, SecLibDirs, SecLibDirsEnd, libDirs))
	return;

    //6) defs
    if (!getSectionList(prjf, SecDefs, SecDefsPoolEnd, defsPool))
	return;
    if (!getSectionList(prjf, "", SecDefsEnd, curDefs))
	return;

    //7) cflag
    if (!getSectionEntry(prjf, SecCFlags, cFlags))
	return;

    //8) libflag 
    if (!getSectionEntry(prjf, SecLibFlags, Libs))
	return;

    //  SRC directory
    if (!getSectionEntry(prjf, SecSrcDir, SrcDir))
	return;

    // 9) object directory
    if (!getSectionEntry(prjf, SecObjDir, ObjDir))
	return;

    //10) bin directory
    if (!getSectionEntry(prjf, SecBinDir, BinDir))
	return;

    // User targets.
    if (!getSectionList(prjf, SecUserTargets, SecUserTargetsEnd, userTargets))
	return;

  }