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


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

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


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

示例1: dir

QVector<QString> FileUtils::getAllFiles(const QString &path)
{
    QVector<QString> result;
    QDir dir(path);
    QFileInfoList fileInfoLists = dir.entryInfoList();
    QFileInfoList::const_iterator iterator = fileInfoLists.constBegin();

    for(; iterator != fileInfoLists.constEnd(); iterator++)
    {
        QString filename = iterator->fileName();

        if (!filename.startsWith("."))
        {
            if (iterator->isDir())
            {
                result += getAllFiles(iterator->absoluteFilePath());
            }
            else if (iterator->isFile())
            {
                result.push_back(iterator->absoluteFilePath());
            }
            else
            {
                //
            }
        }
    }

    return result;
}
开发者ID:zhc921106,项目名称:TexturePacker,代码行数:30,代码来源:fileutils.cpp

示例2: update

void NowReadingEngine::update()
{
    QFileInfoList okularFiles = getOkularXMLFiles();
    QFileInfoList::const_iterator it = okularFiles.constBegin();
    uint limit = MaxDataModelSize;

    for ( ; it != okularFiles.constEnd() && limit--; ++it) {
        QString okularFileName = it->absoluteFilePath();
        DataModel::iterator itDm = _dataModel.find(okularFileName);

        if ((itDm != _dataModel.end()) && /* We have an entry for this element */
            (itDm.value().accessTime >= it->lastModified())) { /* And it's up to date */
                /* No need to update */
                continue;
        }

        NowReadingEntry entry;
        if (convertOkularXMLFileToEntry(okularFileName, entry)) {
            setData(entry.path, "currentPage", entry.currentPage);
            setData(entry.path, "totalPages", entry.totalPages);
            setData(entry.path, "accessTime", entry.accessTime);
            _dataModel[okularFileName] = entry;
        }
    }

    /* Cleanup */
    if (_dataModel.size() > MaxDataModelSize) {
        // Find elements to evict
        // First - what is the modification time of the last element we want to preserve?

        QDateTime oldestElementDate;
        QList<DataModel::mapped_type> values = _dataModel.values();
        nth_element(values.begin(), values.begin()+MaxDataModelSize-1, values.end());
        oldestElementDate = (values.begin()+MaxDataModelSize-1)->accessTime;

        // Now find all elements older than the oldest allowable
        DataModel::iterator it = _dataModel.begin();

        while (it != _dataModel.end()) {
            if (it.value().accessTime <  oldestElementDate) {
                removeSource(it.value().path);
                it = _dataModel.erase(it);
            }
            else {
                ++it;
            }
        }

    }

    /* Single shot timer used as in case the update takes very long
       we can get overflow of timer events to handle */
    QTimer::singleShot(PollingInterval, this, SLOT(update()));
}
开发者ID:figiel,项目名称:plasma-engine-nowreading,代码行数:54,代码来源:nowreadingengine.cpp

示例3: addDirectoryToPreview

int QgsSVGDiagramFactoryWidget::addDirectoryToPreview( const QString& path )
{
  //go through all files of a directory
  QDir directory( path );
  if ( !directory.exists() || !directory.isReadable() )
  {
    return 1; //error
  }

  QFileInfoList fileList = directory.entryInfoList( QDir::Files );
  QFileInfoList::const_iterator fileIt = fileList.constBegin();

  QProgressDialog progress( "Adding Icons...", "Abort", 0, fileList.size() - 1, this );
  //cancel button does not seem to work properly with modal dialog
  //progress.setWindowModality(Qt::WindowModal);

  int counter = 0;
  for ( ; fileIt != fileList.constEnd(); ++fileIt )
  {

    progress.setLabelText( tr( "Creating icon for file %1" ).arg( fileIt->fileName() ) );
    progress.setValue( counter );
    QCoreApplication::processEvents();
    if ( progress.wasCanceled() )
    {
      break;
    }
    QString filePath = fileIt->absoluteFilePath();

    //test if file is svg or pixel format
    bool fileIsSvg = testSvgFile( filePath );

    //exclude files that are not svg or image
    if ( !fileIsSvg )
    {
      ++counter; continue;
    }

    QListWidgetItem * listItem = new QListWidgetItem( mPreviewListWidget );

    if ( fileIsSvg )
    {
      QIcon icon( filePath );
      listItem->setIcon( icon );
    }

    listItem->setText( "" );
    //store the absolute icon file path as user data
    listItem->setData( Qt::UserRole, fileIt->absoluteFilePath() );
    ++counter;
  }

  return 0;
}
开发者ID:aaronr,项目名称:Quantum-GIS,代码行数:54,代码来源:qgssvgdiagramfactorywidget.cpp

示例4: parseFile

void parseFile(const QFileInfo& file, bool force_update=false)
{
    if(!file.exists())return;
    if(file.isSymLink())return;
    //skip files in skiplist
    if(skip_paths.contains(file.fileName()))return;
    //force update on our files
    if(!force_update)force_update=our_paths.contains(file.filePath());

    if(file.isDir())
    {
        QString name=file.baseName();
        //ignore system dirs
        if(name.length()==0 || name.at(0)==QChar('.'))return;

        QDir dir(file.absoluteFilePath());
        QFileInfoList list = dir.entryInfoList(
            QDir::NoDotAndDotDot|QDir::Readable|QDir::Dirs|QDir::Files,
            QDir::DirsFirst|QDir::Name);
        QFileInfoList::const_iterator iter=list.constBegin();
        for(;iter!=list.constEnd(); ++iter)
        {
            qDebug()<<"... "<<iter->filePath();

            parseFile(*iter,force_update);
        }
        return;
    }
    if(file.isFile())
    {
        filereported=false;//reset flag
        QStringList exts;
        exts<<"cpp"<<"c"<<"hpp"<<"h"<<"java"<<"qml";
        QString ext=file.completeSuffix().toLower();
        if(exts.contains(ext))
        {
            qDebug()<<"Parsing "<<file.baseName();
            processCXXFile(file.absoluteFilePath(),force_update);
            removeExtraLines(file.absoluteFilePath());

        }
        else if(file.baseName().toLower()=="makefile")
        {
            qDebug()<<"Parsing "<<file.baseName();
            processMakeFile(file.absoluteFilePath(),force_update);
            removeExtraLines(file.absoluteFilePath());
        }

    }

}
开发者ID:babenkoav78,项目名称:iviLink,代码行数:51,代码来源:main.cpp

示例5: checkTestSuiteResult

void tst_SuiteTest::checkTestSuiteResult() const
{
    if(m_abortRun)
        QSKIP("This test takes too long time to run on the majority of platforms.", SkipAll);

    typedef QList<QFileInfo> QFileInfoList;

    const QFileInfo baseline(m_existingBaseline);
    const QFileInfo result(m_candidateBaseline);
    QFileInfoList list;
    list.append(baseline);
    list.append(result);

    const QFileInfoList::const_iterator end(list.constEnd());

    QEventLoop eventLoop;
    const QPatternist::AutoPtr<Worker> worker(new Worker(eventLoop, m_existingBaseline, result));

    /* Passed to ResultThreader so it knows what kind of file it is handling. */
    ResultThreader::Type type = ResultThreader::Baseline;

    QProcess::execute(QLatin1String("p4 edit ") + m_existingBaseline);

    for(QFileInfoList::const_iterator it(list.constBegin()); it != end; ++it)
    {
        QFileInfo i(*it);
        i.makeAbsolute();

        QVERIFY2(i.exists(), qPrintable(QString::fromLatin1("File %1 does not exist.")
                                        .arg(i.fileName())));

        QFile *const file = new QFile(i.absoluteFilePath(), worker.data());

        QVERIFY2(file->open(QIODevice::ReadOnly), qPrintable(QString::fromLatin1("Could not open file %1 for reading.")
                 .arg(i.fileName())));

        ResultThreader *handler = new ResultThreader(eventLoop, file, type, worker.data());

        QObject::connect(handler, SIGNAL(finished()), worker.data(), SLOT(threadFinished()));

        handler->start(); /* Start the thread. It now parses the file
                             and emits threadFinished() when done. */
        type = ResultThreader::Result;
    }

    const int exitCode = eventLoop.exec();

    QProcess::execute(QLatin1String("p4 revert -a ") + m_existingBaseline);

    QCOMPARE(exitCode, 0);
}
开发者ID:selebro,项目名称:qt,代码行数:51,代码来源:tst_suitetest.cpp

示例6: dir

// find default skins (resources)
static const Skins &defaultSkins() {
    static Skins rc;
    if (rc.empty()) {
        const QString skinPath = QLatin1String(skinResourcePathC);
        QString pattern = QLatin1String("*.");
        pattern += QLatin1String(skinExtensionC);
        const QDir dir(skinPath, pattern);
        const QFileInfoList list = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name);
        if (list.empty())
            return rc;
        const QFileInfoList::const_iterator lcend = list.constEnd();
        for (QFileInfoList::const_iterator it = list.constBegin(); it != lcend; ++it)
            rc.push_back(SkinNamePath(it->baseName(), it->filePath()));
    }
    return rc;
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:17,代码来源:previewconfigurationwidget.cpp

示例7: addUserSchemes

void QgsColorSchemeRegistry::addUserSchemes()
{
  QString palettesDir = QgsApplication::qgisSettingsDirPath() + "/palettes";

  QDir localDir;
  if ( !localDir.mkpath( palettesDir ) )
  {
    return;
  }

  QFileInfoList fileInfoList = QDir( palettesDir ).entryInfoList( QStringList( "*.gpl" ), QDir::Files );
  QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
  for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
  {
    addColorScheme( new QgsUserColorScheme( infoIt->fileName() ) );
  }
}
开发者ID:AM7000000,项目名称:QGIS,代码行数:17,代码来源:qgscolorschemeregistry.cpp

示例8: ImageCollectionShared

KipiImageCollectionShared::KipiImageCollectionShared(const QUrl& albumPath)
    : ImageCollectionShared(),
      m_albumPath(albumPath),
      m_images()
{
    // go through the album and add its images:
    const QString albumPathString = m_albumPath.toLocalFile();

    // add only the files, because recursion through directories should be
    // handled in KipiInterface::add[Selected]Album
    // TODO: restrict the search to images!
    const QFileInfoList files     = QDir(albumPathString).entryInfoList(QDir::Files);

    for (QFileInfoList::const_iterator it = files.constBegin(); it!=files.constEnd(); ++it)
    {
            m_images.append(QUrl::fromLocalFile(it->absoluteFilePath()));
    }
}
开发者ID:KDE,项目名称:libkipi,代码行数:18,代码来源:kipiimagecollectionshared.cpp

示例9: SIGNAL

SyncTreeWidget::SyncTreeWidget(QDir master, QDir copy) :
    m_master(master),
    m_copy(copy)
{
    QFileInfoList fil = master.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot);
    
    for (QFileInfoList::const_iterator i = fil.constBegin(); i != fil.constEnd(); ++i) {
	FileTreeWidgetItem* ftw = FileTreeWidgetItem::makeTreeItem(*i, master, copy);
	ftw->loadKids(master, copy);
	addTopLevelItem(ftw);
    }

    QObject::connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)),
		     this, SLOT(onExpanded(QTreeWidgetItem*)));

    QObject::connect(this, SIGNAL(itemPressed(QTreeWidgetItem*, int)),
		     this, SLOT(onPressed(QTreeWidgetItem*, int)));
}
开发者ID:tommywalsh,项目名称:symsync,代码行数:18,代码来源:SyncTreeWidget.cpp

示例10: svgDirectory

  //list all directories in $prefix/share/qgis/svg
  foreach( QString path, QgsApplication::svgPaths() )
  {
    QDir svgDirectory( path );
    if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
    {
      continue; //error
    }

    QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
    QFileInfoList::const_iterator dirIt = directoryList.constBegin();
    for ( ; dirIt != directoryList.constEnd(); ++dirIt )
    {
      if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
      {
        mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
      }
    }
  }
开发者ID:aaronr,项目名称:Quantum-GIS,代码行数:19,代码来源:qgssvgdiagramfactorywidget.cpp

示例11: defaultTemplateDir

QMap<QString, QString> QgsComposerManager::defaultTemplates() const
{
  QMap<QString, QString> templateMap;

  //search for default templates in $pkgDataPath/composer_templates
  QDir defaultTemplateDir( QgsApplication::pkgDataPath() + "/composer_templates" );
  if ( !defaultTemplateDir.exists() )
  {
    return templateMap;
  }

  QFileInfoList fileInfoList = defaultTemplateDir.entryInfoList( QDir::Files );
  QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
  for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
  {
    templateMap.insert( infoIt->baseName(), infoIt->absoluteFilePath() );
  }
  return templateMap;
}
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:19,代码来源:qgscomposermanager.cpp

示例12: addStandardDirectoriesToPreview

void QgsComposerPictureWidget::addStandardDirectoriesToPreview()
{
  mPreviewListWidget->clear();

  //list all directories in $prefix/share/qgis/svg
  QStringList svgPaths = QgsApplication::svgPaths();
  for ( int i = 0; i < svgPaths.size(); i++ )
  {
    QDir svgDirectory( svgPaths[i] );
    if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
    {
      continue;
    }

    //add directory itself
    mSearchDirectoriesComboBox->addItem( svgDirectory.absolutePath() );
    addDirectoryToPreview( svgDirectory.absolutePath() );

    //and also subdirectories
    QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
    QFileInfoList::const_iterator dirIt = directoryList.constBegin();
    for ( ; dirIt != directoryList.constEnd(); ++dirIt )
    {
      if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
      {
        mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
      }
    }
  }

  //include additional user-defined directories for images
  QSettings s;
  QStringList userDirList = s.value( "/Composer/PictureWidgetDirectories" ).toStringList();
  QStringList::const_iterator userDirIt = userDirList.constBegin();
  for ( ; userDirIt != userDirList.constEnd(); ++userDirIt )
  {
    addDirectoryToPreview( *userDirIt );
    mSearchDirectoriesComboBox->addItem( *userDirIt );
  }

  mPreviewsLoaded = true;
}
开发者ID:Br1ndavoine,项目名称:QGIS,代码行数:42,代码来源:qgscomposerpicturewidget.cpp

示例13: defaultTemplateDir

QMap<QString, QString> QgsComposerManager::defaultTemplates( bool fromUser ) const
{
  QMap<QString, QString> templateMap;

  //search for default templates in $pkgDataPath/composer_templates
  // user templates in $qgisSettingsDirPath/composer_templates
  QDir defaultTemplateDir( fromUser ? mUserTemplatesDir : mDefaultTemplatesDir );
  if ( !defaultTemplateDir.exists() )
  {
    return templateMap;
  }

  QFileInfoList fileInfoList = defaultTemplateDir.entryInfoList( QDir::Files );
  QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
  for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
  {
    templateMap.insert( infoIt->baseName(), infoIt->absoluteFilePath() );
  }
  return templateMap;
}
开发者ID:jacklibj,项目名称:readqgis,代码行数:20,代码来源:qgscomposermanager.cpp

示例14: translationDir

QMap<QString, QString> MythTranslation::getLanguages(void)
{
    QMap<QString, QString> langs;

    QDir translationDir(GetTranslationsDir());
    translationDir.setNameFilters(QStringList("mythfrontend_*.qm"));
    translationDir.setFilter(QDir::Files);
    QFileInfoList translationFiles = translationDir.entryInfoList();
    QFileInfoList::const_iterator it;
    for (it = translationFiles.constBegin(); it != translationFiles.constEnd();
         ++it)
    {
        // We write the names incorrectly as all lowercase, so fix this before
        // sending to QLocale
        QString languageCode = (*it).baseName().section('_', 1, 1);
        QString countryCode = (*it).baseName().section('_', 2, 2);
        if (!countryCode.isEmpty())
            languageCode = QString("%1_%2").arg(languageCode)
                                           .arg(countryCode.toUpper());

        MythLocale locale(languageCode);
        QString language = locale.GetNativeLanguage();
        if (language.isEmpty())
            language = locale.GetLanguage(); // Fall back to English

        if (!countryCode.isEmpty())
        {
            QString country = locale.GetNativeCountry();
            if (country.isEmpty())
                country = locale.GetCountry(); // Fall back to English

            language.append(QString(" (%1)").arg(country));
        }

        langs[languageCode] = language;
    }

    return langs;
}
开发者ID:Openivo,项目名称:mythtv,代码行数:39,代码来源:mythtranslation.cpp

示例15: dir

// find default skins (resources)
static const Skins &defaultSkins() {
    static Skins rc;
    if (rc.empty()) {
#ifdef DEFAULT_SKINS_FROM_RESOURCE
        const QString skinPath = QLatin1String(skinResourcePathC);
#else
        QString skinPath = QLibraryInfo::location(QLibraryInfo::PrefixPath);
        skinPath += QDir::separator();
        skinPath += QLatin1String("tools");
        skinPath += QDir::separator();
        skinPath += QLatin1String("qvfb");
#endif
        QString pattern = QLatin1String("*.");
        pattern += QLatin1String(skinExtensionC);
        const QDir dir(skinPath, pattern);
        const QFileInfoList list = dir.entryInfoList();
        if (list.empty())
            return rc;
        const QFileInfoList::const_iterator lcend = list.constEnd();
        for (QFileInfoList::const_iterator it = list.constBegin(); it != lcend; ++it)
            rc.push_back(SkinNamePath(it->baseName(), it->filePath()));
    }
    return rc;
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:25,代码来源:previewconfigurationwidget.cpp


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