本文整理汇总了C++中qfileinfolist::const_iterator类的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了const_iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadThumbnail
void IconView::LoadThumbnail(ThumbItem *item)
{
if (!item)
return;
bool canLoadGallery = m_isGallery;
QString imagePath;
if (canLoadGallery)
{
if (item->IsDir())
{
// try to find a highlight
QDir subdir(item->GetPath(), "*.highlight.*",
QDir::Name, QDir::Files);
if (subdir.count() > 0)
{
// check if the image format is understood
QFileInfoList::const_iterator it = subdir.entryInfoList().begin();
if (it != subdir.entryInfoList().end())
{
imagePath = it->absoluteFilePath();
}
}
}
else
{
QString fn = item->GetName();
int firstDot = fn.indexOf('.');
if (firstDot > 0)
{
fn.insert(firstDot, ".thumb");
imagePath = QString("%1/%2").arg(m_currDir).arg(fn);
}
}
canLoadGallery = !(QFile(imagePath).exists());
}
if (!canLoadGallery)
imagePath = QString("%1%2.jpg")
.arg(ThumbGenerator::getThumbcacheDir(m_currDir))
.arg(item->GetName());
item->SetImageFilename(imagePath);
}
示例2: 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() ) );
}
}
示例3: DeleteDirectory
bool GalleryUtil::DeleteDirectory(const QFileInfo &dir)
{
if (!dir.exists())
return false;
QDir srcDir(dir.absoluteFilePath());
QFileInfoList list = srcDir.entryInfoList();
QFileInfoList::const_iterator it = list.begin();
for (; it != list.end(); ++it)
{
const QString fn = it->fileName();
if (fn != "." && fn != "..")
Delete(*it);
}
return FileDelete(dir);
}
示例4: DeleteDirectory
bool GalleryUtil::DeleteDirectory(const QFileInfo &dir)
{
if (!dir.exists())
return false;
QDir srcDir(dir.absoluteFilePath());
srcDir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = srcDir.entryInfoList();
QFileInfoList::const_iterator it = list.begin();
for (; it != list.end(); ++it)
{
const QString fn = it->fileName();
Delete(*it);
}
return FileDelete(dir);
}
示例5: getDataSizeByAbsolutePath
int FmDriveDetailsContent::getDataSizeByAbsolutePath( const QString &driveName,
const FmDriveDetailsDataGroup &dataGroup,
QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
{
quint64 totalSize = 0;
QStringList typeFilter = dataGroup.pathList();
for( QStringList::const_iterator it = typeFilter.begin();
it!= typeFilter.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName)));
QFileInfo fileInfo(QString(driver + (*it)));
if (fileInfo.exists()) {
if (fileInfo.isFile()) {
totalSize += fileInfo.size();
} else if (fileInfo.isDir()) {
QList<QDir> dirs;
dirs.append(QDir(fileInfo.absolutePath()));
// traverse the whole path
while (!dirs.isEmpty()) {
QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries;
QFileInfoList infoList = dirs.first().entryInfoList( filter );
for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
if ( it->isFile() ) {
totalSize += it->size();
}
else if ( it->isDir() ) {
dirs.append( QDir( it->absoluteFilePath() ) );
}
}
dirs.removeFirst();
}
}
}
}
detailsSizeList.append( new FmDriveDetailsSize( dataGroup.dataType(), totalSize ) );
return FmErrNone;
}
示例6: 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()));
}
}
示例7: 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() );
}
}
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: FilesModelUpdate
/*
* FilesModelUpdate
* extfilter_imgs_ 에 들어있는 파일들을 실제로 보여지도록 만든다.
* 조그만 아이콘으로 만들기 위한 작업
*/
void MainWindow::FilesModelUpdate() {
QFileInfoList::const_iterator iter;
file_model_->clear();
for (iter=extfilter_imgs_.begin(); iter!=extfilter_imgs_.end(); ++iter) {
qDebug() << iter->absoluteFilePath();
QImage img_buffer(iter->absoluteFilePath());
QIcon icon = GetThumnail(&img_buffer);
QStandardItem* item;
if(!icon.isNull()) {
item = new QStandardItem(icon,iter->fileName());
file_model_->appendRow(item);
}
}
extfilter_imgs_.clear();;
}
示例12: 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;
}
示例13: Search
// search local database for discID
bool Dbase::Search(Cddb::Matches& res, const Cddb::discid_t discID)
{
res.matches.clear();
res.discID = discID;
if (CacheGet(res, discID))
return true;
QFileInfoList list = QDir(GetDB()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (QFileInfoList::const_iterator it = list.begin(); it != list.end(); ++it)
{
QString genre = it->baseName();
QFileInfoList ids = QDir(it->canonicalFilePath()).entryInfoList(QDir::Files);
for (QFileInfoList::const_iterator it2 = ids.begin(); it2 != ids.end(); ++it2)
{
if (it2->baseName().toUInt(nullptr,16) == discID)
{
QFile file(it2->canonicalFilePath());
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
Cddb::Album a(QTextStream(&file).readAll());
a.discGenre = genre;
a.discID = discID;
LOG(VB_MEDIA, LOG_INFO, QString("LocalCDDB found %1 in ").
arg(discID,0,16) + genre + " : " +
a.artist + " / " + a.title);
CachePut(a);
res.matches.push_back(Cddb::Match(genre,discID,a.artist,a.title));
}
}
}
}
return res.matches.size() > 0;
}
示例14: 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;
}
示例15: fileList
bool File::fileList(const String& dir, const String& file_pattern, StringList& output, bool full_path)
{
QDir d(dir.toQString(), file_pattern.toQString(), QDir::Name, QDir::Files);
QFileInfoList list = d.entryInfoList();
//clear and check if empty
output.clear();
if (list.empty())
{
return false;
}
//resize output
output.resize(list.size());
//fill output
UInt i = 0;
for (QFileInfoList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it)
{
output[i++] = full_path ? it->filePath() : it->fileName();
}
return true;
}