当前位置: 首页>>代码示例>>C++>>正文


C++ QFileInfoList::push_back方法代码示例

本文整理汇总了C++中QFileInfoList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfoList::push_back方法的具体用法?C++ QFileInfoList::push_back怎么用?C++ QFileInfoList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QFileInfoList的用法示例。


在下文中一共展示了QFileInfoList::push_back方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: casesFiles

/**
  * Returns list of files of problems and results.
  */
QFileInfoList ProjectBase::casesFiles()
{
    QFileInfoList result;

    for(int i=0;i<_problems->size();i++)
        result.push_back(_problems->at(i)->entireSavePath());

    for(int i=0;i<_results->size();i++)
        result.push_back(_results->at(i)->entireSavePath());

    return result;
}
开发者ID:OpenModelica,项目名称:OMOptim,代码行数:15,代码来源:ProjectBase.cpp

示例2: resolvedFiles

QFileInfoList SignEncryptWizard::resolvedFiles() const {
    const QStringList files = d->objectsPage->files();
    QFileInfoList infos;
    foreach ( const QString& i, files )
        infos.push_back( QFileInfo( i ) );
    return infos;
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:7,代码来源:signencryptwizard.cpp

示例3: readHistoryFile

QFileInfoList SettingApp::readHistoryFile()
{
    m_setting->beginGroup("historyFile");
        int size = m_setting->beginReadArray("pathFile");
        QFileInfoList list;
        for(int i = 0; i < size; i++)
        {
            m_setting->setArrayIndex(i);
            list.push_back(m_setting->value("file").toString());
        }
        m_setting->endArray();
    m_setting->endGroup();
    return qMove(list);
}
开发者ID:kissofblood,项目名称:September,代码行数:14,代码来源:settingapp.cpp

示例4: dropEvent

/**
@brief dragEnterEventの直後に呼ばれるイベント
*/
void HIST::dropEvent(QDropEvent *e)
{
	// toLocal8Bitで渡すとパスに日本語含んでるファイルも読み込める
	std::string url = e->mimeData()->urls().first().toLocalFile().toLocal8Bit();
	QFileInfo fileInfo =  QFileInfo(e->mimeData()->urls().first().toLocalFile());

	// ディレクトリを入れたらそのディレクトリの中をカレントディレクトリとして使う
	std::string currentDir;
	if(fileInfo.isDir()){
		currentDir = url;
		currentDir.append("/");
	}
	// ファイルを入れたらそのファイルのある場所をカレントディレクトリとして使う
	else{
		currentDir = url.substr(0, url.rfind('/')+1);
	}

	// リストを作成
	QFileInfoList list;
	if (e->mimeData()->hasUrls()){
		for (int i = 0; i < e->mimeData()->urls().size(); i++){
			QFileInfo info = e->mimeData()->urls()[i].toLocalFile();
			list.push_back(info);
		}
	}

	// 入力前の個数(現在の行数)
	int prev = item.size();
	// 入力ファイルをすべてitemにpush
	for ( int i = 0; i < list.size(); i++ ){
		item.push_back( new QTableWidgetItem(list[i].absoluteFilePath()) );
	}
	// 行数を個数に合わせる
	ui.tableWidget->setRowCount(item.size());
	// テーブルにset
	for ( int i = 0; i < list.size(); i++ ){
		ui.tableWidget->setItem(prev+i, 0, item.at(prev+i) );
	}
	ui.tableWidget->resizeColumnsToContents();

	std::string nowItem = url;
	cv::Mat nowImg = cv::imread(nowItem, 1);

	calcHistgram(nowImg);
	calcHistgramHue(nowImg);
	drawForQtLabel(nowImg, ui.label);
}
开发者ID:sensq,项目名称:home,代码行数:50,代码来源:hist.cpp

示例5: compile

bool ModPlusDymolaCtrl::compile(const QFileInfoList & moDependencies)
{
    InfoSender::sendCurrentTask("Dymola : Compiling model "+_modModelPlus->modModelName());

    //QString logFilePath = _mmoFolder+QDir::separator()+"log.html";
    QString logFilePath = _modModelPlus->mmoFolder().absoluteFilePath("buildlog.txt");

    //********************
    // update dependencies
    //********************
    QFileInfoList moDeps = moDependencies;
    // 1- add project loaded mo files
    QFileInfoList projectMoFiles = _project->moFiles();
    for(int i=0;i<projectMoFiles.size();i++)
        if(!moDeps.contains(projectMoFiles.at(i)))
            moDeps.push_back(projectMoFiles.at(i));

    // 2 - remove modelica library from moDependencies since Dymola
    // automatically loads it
    moDeps.removeAll(_project->moomc()->getFileOfClass("Modelica"));

    // compile
    bool success = Dymola::firstRun(_modModelPlus->moFilePath(),_modModelPlus->modModelName(),
                                    _modModelPlus->mmoFolder(),logFilePath,moDeps,_modModelPlus->neededFiles());

    // Inform
    ListInfo::InfoNum iMsg;
    if(success)
        iMsg = ListInfo::MODELCOMPILATIONSUCCESS;
    else
        iMsg = ListInfo::MODELCOMPILATIONFAIL;

    // Infos
    InfoSender::instance()->send(Info(iMsg,_modModelPlus->modModelName(),logFilePath));
    InfoSender::instance()->eraseCurrentTask();

    return success;
}
开发者ID:SemiSQ,项目名称:OpenModelica,代码行数:38,代码来源:ModPlusDymolaCtrl.cpp

示例6: main

int main(int argc, char *argv[])
{
	QString workDir;
#ifdef Q_OS_MAC
    if (QDir(QString()).absolutePath() == "/") {
		QString first = argc ? QString::fromLocal8Bit(argv[0]) : QString();
		if (!first.isEmpty()) {
			QFileInfo info(first);
			if (info.exists()) {
				QDir result(info.absolutePath() + "/../../..");
				workDir = result.absolutePath() + '/';
			}
		}
	}
#endif

	QString remove;
	int version = 0;
	QFileInfoList files;
	for (int i = 0; i < argc; ++i) {
		if (string("-path") == argv[i] && i + 1 < argc) {
			QString path = workDir + QString(argv[i + 1]);
			QFileInfo info(path);
			files.push_back(info);
			if (remove.isEmpty()) remove = info.canonicalPath() + "/";
		} else if (string("-version") == argv[i] && i + 1 < argc) {
			version = QString(argv[i + 1]).toInt();
		} else if (string("-dev") == argv[i]) {
			DevChannel = true;
		} else if (string("-beta") == argv[i] && i + 1 < argc) {
			BetaVersion = QString(argv[i + 1]).toULongLong();
			if (BetaVersion > version * 1000ULL && BetaVersion < (version + 1) * 1000ULL) {
				DevChannel = false;
				BetaSignature = countBetaVersionSignature(BetaVersion);
				if (BetaSignature.isEmpty()) {
					return -1;
				}
			} else {
				cout << "Bad -beta param value passed, should be for the same version: " << version << ", beta: " << BetaVersion << "\n";
				return -1;
			}
		}
	}

	if (files.isEmpty() || remove.isEmpty() || version <= 1016 || version > 999999999) {
#ifdef Q_OS_WIN
		cout << "Usage: Packer.exe -path {file} -version {version} OR Packer.exe -path {dir} -version {version}\n";
#elif defined Q_OS_MAC
		cout << "Usage: Packer.app -path {file} -version {version} OR Packer.app -path {dir} -version {version}\n";
#else
		cout << "Usage: Packer -path {file} -version {version} OR Packer -path {dir} -version {version}\n";
#endif
		return -1;
	}

	bool hasDirs = true;
	while (hasDirs) {
		hasDirs = false;
		for (QFileInfoList::iterator i = files.begin(); i != files.end(); ++i) {
			QFileInfo info(*i);
			QString fullPath = info.canonicalFilePath();
			if (info.isDir()) {
				hasDirs = true;
				files.erase(i);
				QDir d = QDir(info.absoluteFilePath());
				QString fullDir = d.canonicalPath();
				QStringList entries = d.entryList(QDir::Files | QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot);
				files.append(d.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot));
				break;
			} else if (!info.isReadable()) {
				cout << "Can't read: " << info.absoluteFilePath().toUtf8().constData() << "\n";
				return -1;
			} else if (info.isHidden()) {
				hasDirs = true;
				files.erase(i);
				break;
			}
		}
	}
	for (QFileInfoList::iterator i = files.begin(); i != files.end(); ++i) {
		QFileInfo info(*i);
		if (!info.canonicalFilePath().startsWith(remove)) {
			cout << "Can't find '" << remove.toUtf8().constData() << "' in file '" << info.canonicalFilePath().toUtf8().constData() << "' :(\n";
			return -1;
		}
	}

	QByteArray result;
	{
		QBuffer buffer(&result);
		buffer.open(QIODevice::WriteOnly);
		QDataStream stream(&buffer);
		stream.setVersion(QDataStream::Qt_5_1);

		if (BetaVersion) {
			stream << quint32(0x7FFFFFFF);
			stream << quint64(BetaVersion);
		} else {
			stream << quint32(version);
		}
//.........这里部分代码省略.........
开发者ID:MobinRanjbar,项目名称:tdesktop,代码行数:101,代码来源:packer.cpp

示例7: compile

bool Dymola::compile(QFileInfo moPath,QString modelToConsider,QDir storeFolder,QFileInfo logFile,
                      const QFileInfoList & moDeps, QFileInfoList neededFiles)
{
    // Create Dymola script
    QString filePath = storeFolder.absoluteFilePath("MOFirstRun.mos");
    QFile file(filePath);
    if(file.exists())
    {
        file.remove();
    }
    file.open(QIODevice::WriteOnly);

    QString scriptText;
    QString curPath;

    // load dependencies and model
    QFileInfoList moToLoad;
    moToLoad.append(moDeps);
    moToLoad.push_back(moPath);
    LowTools::removeDuplicates(moToLoad);

    for(int i=0;i<moToLoad.size();i++)
    {
        curPath = QDir::fromNativeSeparators(moToLoad.at(i).absoluteFilePath());
        scriptText.append("openModel(\""+curPath+"\",false)\n");
    }


    QString strFolder = QDir::fromNativeSeparators(storeFolder.absolutePath());
    QString logFilePath = QDir::fromNativeSeparators(logFile.absoluteFilePath());

    scriptText.append("cd "+strFolder+"\n");
    scriptText.append("experimentSetupOutput(textual=true)\n");
    scriptText.append("Advanced.StoreProtectedVariables:=true;\n");
    //scriptText.append("checkModel(\""+modelToConsider+"\",simulate=true)\n");
    scriptText.append("translateModel(\""+modelToConsider+"\")\n");
    scriptText.append("compile()\n");
    scriptText.append("savelog(\""+logFilePath+"\")\n");
    scriptText.append("exit\n");

    QTextStream ts( &file );
    ts << scriptText;
    file.close();

    // Copy needed files
    LowTools::copyFilesInFolder(neededFiles,storeFolder);

    // Run script
    QString dymolaPath = MOSettings::value("dymolaExe").toString();
    QFileInfo dymolaBin(dymolaPath);
    if(!dymolaBin.exists())
    {
        InfoSender::instance()->send(Info("Dymola executable not found. Please verify path in Settings",ListInfo::ERROR2));
        return false;
    }
    else
    {
        // delete previous dymosim.exe
        QFile dymoFile(storeFolder.absoluteFilePath("dymosim.exe"));
        if(dymoFile.exists())
            dymoFile.remove();

        // delete previous dsin file
        QFile dsinFile(storeFolder.absoluteFilePath("dsin.txt"));
        if(dsinFile.exists())
            dsinFile.remove();

        // launch script
        QProcess scriptProcess;
        QStringList args;
        args.push_back(filePath);

        //start process
        InfoSender::sendCurrentTask("Launching Dymola...");
        scriptProcess.start(dymolaPath,args);
        bool ok = scriptProcess.waitForFinished(-1);
        if(!ok)
        {
            QString msg("CreateProcess failed");
            InfoSender::instance()->debug(msg);
            return false;
        }

        //look if it succeed
        bool success = dymoFile.exists();
        InfoSender::eraseCurrentTask();
        return success;
    }
}
开发者ID:cephdon,项目名称:OMOptim,代码行数:89,代码来源:Dymola.cpp

示例8: createDsin

bool Dymola::createDsin(QFileInfo moFile,QString modelToConsider,QDir folder,
                        const QFileInfoList & moDeps,QFileInfoList neededFiles)
{
    // Create Dymola script
    QFile file(folder.absoluteFilePath("MOFirstRun.mos"));
    if(file.exists())
    {
        file.remove();
    }
    file.open(QIODevice::WriteOnly);

    QString strFolder = QDir::fromNativeSeparators(folder.absolutePath());

    QString scriptText;
    QString curPath;

    // load dependencies and model
    QFileInfoList moToLoad;
    moToLoad.append(moDeps);
    moToLoad.push_back(moFile);
    LowTools::removeDuplicates(moToLoad);

    for(int i=0;i<moToLoad.size();i++)
    {
        curPath = QDir::fromNativeSeparators(moToLoad.at(i).absoluteFilePath());
        scriptText.append("openModel(\""+curPath+"\")\n");
    }


    scriptText.append("cd "+strFolder+"\n");
    scriptText.append("translateModel(\""+modelToConsider+"\")\n");
    scriptText.append("exportInitialDsin(\"dsin.txt\")\n");
    scriptText.append("savelog(\"buildlog.txt\")\n");
    scriptText.append("exit\n");

    QTextStream ts( &file );
    ts << scriptText;
    file.close();

    // Copy needed files
    LowTools::copyFilesInFolder(neededFiles,folder);

    // Run script
    QString dymolaPath = MOSettings::value("dymolaExe").toString();


    QProcess simProcess;
    QStringList args;
    args.push_back(QFileInfo(file).absoluteFilePath());


    // delete previous dsin file
    QFile dsinFile(folder.absoluteFilePath("dsin.txt"));
    if(dsinFile.exists())
        dsinFile.remove();

    // launch script
    InfoSender::instance()->send(Info("Launching Dymola..."));
    simProcess.start(dymolaPath, args);
    bool ok = simProcess.waitForFinished(-1);
    if(!ok)
    {
        QString msg("CreateProcess failed");
        InfoSender::instance()->debug(msg);
        return false;
    }

    //look if it succeed
    bool success = dsinFile.exists();
    return success;
}
开发者ID:cephdon,项目名称:OMOptim,代码行数:71,代码来源:Dymola.cpp

示例9: scopedLock

void OsmAnd::ObfsCollection_P::refreshSources()
{
    QMutexLocker scopedLock(&_sourcesMutex);

    // Find all files that are present in watched entries
    QFileInfoList obfs;
    {
        QMutexLocker scopedLock(&_watchedCollectionMutex);

        for(auto itEntry = _watchedCollection.begin(); itEntry != _watchedCollection.end(); ++itEntry)
        {
            const auto& entry = *itEntry;

            if(entry->type == WatchEntry::WatchedDirectory)
            {
                auto watchedDirEntry = static_cast<WatchedDirectoryEntry*>(entry.get());

                Utilities::findFiles(watchedDirEntry->dir, QStringList() << "*.obf", obfs, watchedDirEntry->recursive);
            }
            else if(entry->type == WatchEntry::ExplicitFile)
            {
                auto explicitFileEntry = static_cast<ExplicitFileEntry*>(entry.get());

                if(explicitFileEntry->fileInfo.exists())
                    obfs.push_back(explicitFileEntry->fileInfo);
            }
        }
    }

    // For each file in registry, ...
    {
        QMutableHashIterator< QString, std::shared_ptr<ObfFile> > itObfFileEntry(_sources);
        while(itObfFileEntry.hasNext())
        {
            // ... which does not exist, ...
            if(QFile::exists(itObfFileEntry.key()))
            {
                itObfFileEntry.next();
                continue;
            }

            // ... remove entry
            itObfFileEntry.remove();
        }
    }

    // For each file, ...
    for(auto itObfFileInfo = obfs.begin(); itObfFileInfo != obfs.end(); ++itObfFileInfo)
    {
        const auto& obfFileInfo = *itObfFileInfo;

        const auto& obfFilePath = obfFileInfo.canonicalFilePath();
        auto itObfFileEntry = _sources.find(obfFilePath);

        // ... which is not yet present in registry, ...
        if(itObfFileEntry == _sources.end())
        {
            // ... create ObfFile
            auto obfFile = new ObfFile(obfFilePath);
            itObfFileEntry = _sources.insert(obfFilePath, std::shared_ptr<ObfFile>(obfFile));
        }
    }

    // Mark that sources were refreshed at least once
    _sourcesRefreshedOnce = true;
}
开发者ID:BathoryPeter,项目名称:OsmAnd-core,代码行数:66,代码来源:ObfsCollection_P.cpp

示例10: dirFiles

  LocalProcess::FileSet LocalProcess::dirFiles(const QString &dir) const
  {
    QFileInfoList fil;

    
    QDir subdirs(dir, "mergedjob-*", QDir::Name, QDir::Dirs);
    QFileInfoList mergedjobdirs = subdirs.entryInfoList();

    for (QFileInfoList::const_iterator itr = mergedjobdirs.begin();
         itr != mergedjobdirs.end();
         ++itr)
    {

      QDir mergeddir(itr->absoluteFilePath(), "", QDir::Name, QDir::Files);
      fil.append(mergeddir.entryInfoList());
    }
  

    QDir d(dir, "", QDir::Name, QDir::Files);
    fil.append(d.entryInfoList());

    QFileInfoList filtered;

    // Filter out all files that are part of the set of input files. Everything remaining should be an outputfile
    for (QFileInfoList::const_iterator itr = fil.begin();
         itr != fil.end();
         ++itr)
    {
      bool partofinput = false;
      for (std::vector<std::pair<openstudio::path, openstudio::path> >::const_iterator itr2 = m_requiredFiles.begin();
          itr2 != m_requiredFiles.end();
          ++itr2)
      {
        QString fileName = itr->fileName();
        QString fileName2 = toQString(itr2->second.filename());
        if (fileName == fileName2)
        {
          partofinput = true;
          break;
        }
      }

      if (!partofinput)
      {
        filtered.push_back(*itr);
      }
    }

    FileSet out;

    typedef FileInfo (*filetransform)(QFileInfo);

    try{
      std::transform(filtered.begin(), filtered.end(), std::inserter(out, out.end()), 
          static_cast<filetransform>(&RunManager_Util::dirFile));
    } catch(openstudio::Exception& e) {
      LOG_AND_THROW("Exception caught " << e.what());
    }

    return out;
  }
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:61,代码来源:LocalProcess.cpp


注:本文中的QFileInfoList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。