本文整理汇总了C++中QFileInfoList::end方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfoList::end方法的具体用法?C++ QFileInfoList::end怎么用?C++ QFileInfoList::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfoList
的用法示例。
在下文中一共展示了QFileInfoList::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initMidiInstruments
void initMidiInstruments()
{
genericMidiInstrument = new MidiInstrument(QWidget::tr("generic midi"));
midiInstruments.push_back(genericMidiInstrument);
if (MusEGlobal::debugMsg)
printf("load user instrument definitions from <%s>\n", MusEGlobal::museUserInstruments.toLatin1().constData());
QDir usrInstrumentsDir(MusEGlobal::museUserInstruments, QString("*.idf"));
if (usrInstrumentsDir.exists()) {
QFileInfoList list = usrInstrumentsDir.entryInfoList();
QFileInfoList::iterator it=list.begin(); // ddskrjo
while(it != list.end()) { // ddskrjo
loadIDF(&*it);
++it;
}
}
if (MusEGlobal::debugMsg)
printf("load instrument definitions from <%s>\n", MusEGlobal::museInstruments.toLatin1().constData());
QDir instrumentsDir(MusEGlobal::museInstruments, QString("*.idf"));
if (instrumentsDir.exists()) {
QFileInfoList list = instrumentsDir.entryInfoList();
QFileInfoList::iterator it=list.begin(); // ddskrjo
while(it!=list.end()) {
loadIDF(&*it);
++it;
}
}
else
printf("Instrument directory not found: %s\n", MusEGlobal::museInstruments.toLatin1().constData());
}
示例2: loadDir
void ThumbGenerator::loadDir(QImage& image, const QFileInfo& fi)
{
QDir dir(fi.absoluteFilePath());
dir.setFilter(QDir::Files);
QFileInfoList list = dir.entryInfoList();
QFileInfoList::const_iterator it = list.begin();
const QFileInfo *f;
bool found = false;
while (it != list.end())
{
f = &(*it);
QImageReader testread(f->absoluteFilePath());
testread.setAutoDetectImageFormat(false);
if (testread.canRead())
{
found = true;
break;
}
++it;
}
if (found)
{
loadFile(image, *f);
return;
}
else
{
// if we didn't find the image yet
// go into subdirs and keep looking
dir.setFilter(QDir::Dirs);
QFileInfoList dirlist = dir.entryInfoList();
if (dirlist.isEmpty())
return;
QFileInfoList::const_iterator it = dirlist.begin();
const QFileInfo *f;
while (it != dirlist.end() && image.isNull() )
{
f = &(*it);
++it;
if (f->fileName() == "." || f->fileName() == "..")
continue;
loadDir(image, *f);
}
}
}
示例3: getAllIncludes
void getAllIncludes(QString path, QFileInfoList h_files, QFileInfoList cpp_files, QStringList& includes)
{
for(QFileInfoList::iterator it = h_files.begin(); it != h_files.end(); it++)
{
QFile file(it->absoluteFilePath());
if(file.open(QFile::ReadOnly))
{
QTextStream textStream(&file);
while(!textStream.atEnd())
{
QString line = textStream.readLine();
if( line.indexOf("#include ") != -1 && line.indexOf("Q") != -1 )
{
addToStringList(includes, line);
}
}
file.close();
}
}
for(QFileInfoList::iterator it = cpp_files.begin(); it != cpp_files.end(); it++)
{
QFile file(it->absoluteFilePath());
if(file.open(QFile::ReadOnly))
{
QTextStream textStream(&file);
while(!textStream.atEnd())
{
QString line = textStream.readLine();
if( line.indexOf("//") == -1 &&
line.indexOf("#include ") != -1 &&
line.indexOf("Q") != -1
)
{
addToStringList(includes, line);
}
}
file.close();
}
}
}
示例4: read_dir
//*******************************************************************
// read_dir PRIVATE
//-------------------------------------------------------------------
// Rekursywne odczytywanie calej zawartosci wskazanego katalogu.
// Odczytana zawrtosc katalogu jest zapamietywania w hash-tablicy.
//*******************************************************************
void QBtCompareDirsDialog::read_dir( const QString& in_parent,
const QString& in_dir,
DirMap& out_data ) const
{
static const int sflag = QDir::AllDirs
| QDir::Files
| QDir::NoDotAndDotDot
| QDir::Readable
| QDir::Writable
| QDir::Hidden;
const QDir dir( in_dir, "*", QDir::Unsorted, QFlags<QDir::Filter>( sflag ) );
const QFileInfoList items = dir.entryInfoList();
FileMap files_map = FileMap();
QFileInfoList::const_iterator it = items.begin();
const QFileInfoList::const_iterator end = items.end();
while( continue_ && ( it != end ) ) {
if( it->isDir() ) read_dir( in_parent, it->absoluteFilePath(), out_data );
else files_map.insert( it->fileName(), *it );
++it;
}
QString path = in_dir;
out_data.insert( path.remove( in_parent ), files_map );
}
示例5: loadFromImages
void LoadVideoThread::loadFromImages()
{
qDebug() << "Start loading frames...";
QDir dirImages(filePath);
QFileInfoList listImages = dirImages.entryInfoList(QStringList() << "*.tif" << "*.tiff" << "*.jpg" << "*.png");
if (0 == listImages.count())
{
emit completeLoading(false);
}
else
{
QFileInfoList::const_iterator it = listImages.begin();
while(it != listImages.end())
{
cv::Mat frame = cv::imread(it->filePath().toStdString());
cv::Mat rgbFrame;
cv::cvtColor(frame, rgbFrame, CV_BGR2RGB);
gtv->appendFrame(rgbFrame);
it++;
}
emit completeLoading(true);
}
exit(0);
}
示例6: find_file
void SkinWidget::find_file(QString path)
{
QDir picdir(path);
QStringList filters;
filters << "*.bmp" << "*.jpg" << "*.png" << "*.gif";
picdir.setNameFilters(filters);
if (!picdir.exists()) {
return;
}
picdir.setFilter(QDir::Dirs | QDir::Files);
picdir.setSorting(QDir::DirsFirst);
QFileInfoList list = picdir.entryInfoList();
for_each(list.begin(), list.end(),
[&](QFileInfoList::value_type fileInfo) {
if (pic_list.count(fileInfo.fileName())
|| (fileInfo.fileName() == ".")
|| (fileInfo.fileName() == "..")) {
return;
} else {
pic_list.append(fileInfo.fileName());
init_skin(fileInfo.fileName());
}
});
}
示例7: LoadFonts
/**
* \brief Loads the fonts in font files within the given directory structure
*
* Recursively scans all directories under directory looking for TrueType
* (.ttf) and OpenType (.otf) font files or TrueType font collections (.ttc)
* and loads the fonts to make them available to the application.
*
* \param directory The directory to scan
* \param registeredFor The user of the font. Used with releaseFonts() to
* unload the font if no longer in use (by any users)
* \param maxDirs The maximum number of subdirectories to scan
*/
void MythFontManager::LoadFonts(const QString &directory,
const QString ®isteredFor, int *maxDirs)
{
if (directory.isEmpty() || directory == "/" || registeredFor.isEmpty())
return;
(*maxDirs)--;
if (*maxDirs < 1)
{
LOG(VB_GENERAL, LOG_WARNING, LOC +
"Reached the maximum directory depth "
"for a font directory structure. Terminating font scan.");
return;
}
// Load the font files from this directory
LoadFontsFromDirectory(directory, registeredFor);
// Recurse through subdirectories
QDir dir(directory);
QFileInfoList files = dir.entryInfoList();
QFileInfo info;
for (QFileInfoList::const_iterator it = files.begin();
((it != files.end()) && (*maxDirs > 0)); ++it)
{
info = *it;
// Skip '.' and '..' and other files starting with "." by checking
// baseName()
if (!info.baseName().isEmpty() && info.isDir())
LoadFonts(info.absoluteFilePath(), registeredFor, maxDirs);
}
}
示例8: scanDirectory
void ImportCoverArtDialog::scanDirectory()
{
QDir d(m_sourceDir);
if (!d.exists())
return;
QString nameFilter = gCoreContext->GetSetting("AlbumArtFilter",
"*.png;*.jpg;*.jpeg;*.gif;*.bmp");
QFileInfoList list = d.entryInfoList(nameFilter);
if (list.isEmpty())
return;
QFileInfoList::const_iterator it = list.begin();
const QFileInfo *fi;
while (it != list.end())
{
fi = &(*it);
++it;
if (fi->fileName() == "." || fi->fileName() == "..")
continue;
QString filename = fi->absoluteFilePath();
if (!fi->isDir())
{
m_filelist.append(filename);
}
}
m_currentFile = 0;
updateTypeSelector();
updateStatus();
}
示例9: MoveDirectory
bool GalleryUtil::MoveDirectory(const QFileInfo src, QFileInfo &dst)
{
QDir srcDir(src.absoluteFilePath());
dst = MakeUniqueDirectory(dst);
if (!dst.exists())
{
srcDir.mkdir(dst.absoluteFilePath());
dst.refresh();
}
if (!dst.exists() || !dst.isDir())
return false;
bool ok = true;
QDir dstDir(dst.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();
QFileInfo dfi(dstDir, fn);
ok &= Move(*it, dfi);
}
return ok && FileDelete(src);
}
示例10: themeDirs
QList<ThemeInfo> MythUIHelper::GetThemes(ThemeType type)
{
QFileInfoList fileList;
QList<ThemeInfo> themeList;
QDir themeDirs(GetThemesParentDir());
themeDirs.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
themeDirs.setSorting(QDir::Name | QDir::IgnoreCase);
fileList.append(themeDirs.entryInfoList());
themeDirs.setPath(d->m_userThemeDir);
fileList.append(themeDirs.entryInfoList());
for (QFileInfoList::iterator it = fileList.begin();
it != fileList.end(); ++it)
{
QFileInfo &theme = *it;
if (theme.baseName() == "default" ||
theme.baseName() == "default-wide" ||
theme.baseName() == "Slave")
continue;
ThemeInfo themeInfo(theme.absoluteFilePath());
if (themeInfo.GetType() & type)
themeList.append(themeInfo);
}
return themeList;
}
示例11: directory
void
DialogCleanup::Cleanup(
)
{
// Get size before.
unsigned int startSize = FileUtils::GetFolderSize( m_Path );
m_UI.output->appendPlainText( "Cleaning '" + m_Path + "' ..." );
// Go through files.
QDir directory( m_Path );
QFileInfoList files = directory.entryInfoList();
for ( QFileInfoList::iterator i = files.begin(); i != files.end(); i++ ) {
QFileInfo file = *i;
if ( !file.isReadable() ) continue;
if ( file.fileName() == "." || file.fileName() == ".." ) continue;
if ( std::find( m_Preserved.begin(), m_Preserved.end(), file.fileName() ) == m_Preserved.end() ) {
m_UI.output->appendPlainText( "Removing: " + file.fileName() );
if ( file.isDir() ) FileUtils::DeleteFolder( file.absoluteFilePath() );
if ( file.isFile() ) QFile::remove(file.absoluteFilePath());
}
}
// Get size after.
unsigned int endSize = FileUtils::GetFolderSize( m_Path );
m_UI.output->appendPlainText( "Cleaning complete." );
m_UI.output->appendPlainText( "Cleaned " + QString::number( startSize - endSize ) + " megabytes." );
// Change UI to reflect completion.
m_UI.btnDone->setText( "Close" );
}
示例12: dir
LADSPAPresetManager::LADSPAPresetManager()
{
m_iPresetCount = 0;
LADSPALoader * loader = new LADSPALoader();
QDir dir(WWidget::getPath(QString("../../ladspa_presets"))); // TODO
QFileInfoList files = dir.entryInfoList();
m_Presets.resize(files.count());
for (QFileInfoList::iterator fileIter = files.begin(); fileIter != files.end(); fileIter++)
{
qDebug() << "LADSPA: file " << (*fileIter).filePath();
if ((*fileIter).isDir())
{
continue;
}
QFile file((* fileIter).filePath());
QDomDocument document("Preset");
file.open(QIODevice::ReadOnly);
document.setContent(&file);
file.close();
LADSPAPreset * preset = new LADSPAPreset(document.documentElement(), loader);
m_Presets [m_iPresetCount] = preset;
m_iPresetCount++;
}
}
示例13: findZoneinfoFile
/* Helper function for getSystemTimeZoneID() that compares the
zoneinfo_file_path (regular) file with files in the zoneinfo_dir_path until
it finds a match. The matching file's name is used to determine the time
zone ID. */
static QString findZoneinfoFile(QString zoneinfo_file_path,
QString zoneinfo_dir_path)
{
QString zone_id("UNDEF");
QDir zoneinfo_dir(zoneinfo_dir_path);
QFileInfoList dirlist = zoneinfo_dir.entryInfoList();
QFileInfo info;
QString basename;
QFileInfo zoneinfo_file_info(zoneinfo_file_path);
for (QFileInfoList::const_iterator it = dirlist.begin();
it != dirlist.end(); ++it)
{
info = *it;
// Skip '.' and '..' and other files starting with "." and
// skip localtime (which is often a link to zoneinfo_file_path)
basename = info.baseName();
if (basename.isEmpty() || (basename == "localtime")) {
continue;
}
if (info.isDir())
{
zone_id = findZoneinfoFile(zoneinfo_file_path,
info.absoluteFilePath());
if (zone_id != "UNDEF")
return zone_id;
}
else if (compare_zone_files(zoneinfo_file_info, info))
{
zone_id = info.absoluteFilePath();
break;
}
}
return zone_id;
}
示例14: setDirectory
bool SimpleSearchEngine::setDirectory(const QString &path)
{
QDir dir(path);
if(!dir.exists())
{
Log().warning("SimpleSearchEngine: set directory failed: directory doesn't"
"exist '%s'",
qPrintable(path));
return false;
}
Log().debug("SimpleSearchEngine: set directory '%s'", qPrintable(path));
QFileInfoList fileInfoList = dir.entryInfoList(
QDir::Files);
mFilenames.clear();
QFileInfoList::const_iterator iter = fileInfoList.begin();
for(; iter != fileInfoList.end(); ++iter)
mFilenames.append(iter->absoluteFilePath());
updateResults();
return true;
}
示例15: CopyDirectory
bool GalleryUtil::CopyDirectory(const QFileInfo src, QFileInfo &dst)
{
QDir srcDir(src.absoluteFilePath());
dst = MakeUniqueDirectory(dst);
if (!dst.exists())
{
srcDir.mkdir(dst.absoluteFilePath());
dst.refresh();
}
if (!dst.exists() || !dst.isDir())
return false;
bool ok = true;
QDir dstDir(dst.absoluteFilePath());
QFileInfoList list = srcDir.entryInfoList();
QFileInfoList::const_iterator it = list.begin();
for (; it != list.end(); ++it)
{
const QString fn = it->fileName();
if (fn != "." && fn != "..")
{
QFileInfo dfi(dstDir, fn);
ok &= Copy(*it, dfi);
}
}
return ok;
}