本文整理汇总了C++中QFileInfoList::setAutoDelete方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfoList::setAutoDelete方法的具体用法?C++ QFileInfoList::setAutoDelete怎么用?C++ QFileInfoList::setAutoDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfoList
的用法示例。
在下文中一共展示了QFileInfoList::setAutoDelete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotImport
void ImageImporter::slotImport()
{
//first save all
slotSaveSettings();
//then init the regular expression
QRegExp re(m_txtSourceFilename->text(), !m_chkIgnoreCase->isChecked());
//first find all possible files
//listdir is used as a stack containing the directories to parse
QStringList lstDirs = m_cmbSourceFolder->currentText();
//the list of files found in the directories
QFileInfoList lstFiles;
lstFiles.setAutoDelete(true);
DlgImageImporterStatus* dlgStatus = new DlgImageImporterStatus(this, "StatusDialog");
dlgStatus->enableImageArchive(m_groupArchive->isChecked());
dlgStatus->show();
dlgStatus->appendStatusMessage(i18n("Starting..."));
dlgStatus->setCurrentMode( DlgImageImporterStatus::ModeImport,
i18n("Scanning for available Images..."));
//now go thru all folders and collect all files that match the file regexp...
while (!lstDirs.isEmpty()) {
QDir d( lstDirs.front() );
lstDirs.pop_front();
dlgStatus->addFolder();
d.setMatchAllDirs(true);
const QFileInfoList* list = d.entryInfoList();
if (list) {
QFileInfoListIterator it( *list );
QFileInfo* fi;
for ( ; ( fi = it.current() ) != 0; ++it )
{
if ( fi->fileName() == "." || fi->fileName() == ".." ) {
continue;
} else if ( fi->isDir() && m_chkSrcIncludeSubfolders->isChecked()) {
lstDirs.append(fi->absFilePath());
} else if( fi->isFile() ) {
dlgStatus->addFile();
if (re.exactMatch(fi->fileName())) {
dlgStatus->addMatch();
//save a copy of all FileInfos
lstFiles.append(new QFileInfo(*fi));
}
}
// we return here and break all importing!
if (dlgStatus->wasCanceled()) {
return;
}
}
}
// we return here and break all importing!
if (dlgStatus->wasCanceled()) {
return;
}
}
//archive the images, if requested ...
if (m_groupArchive->isChecked())
{
dlgStatus->setCurrentMode(DlgImageImporterStatus::ModeArchive,
i18n("Archiving found images..."));
importFiles(&lstFiles,
m_txtArchiveBaseFolder->text(),
m_txtArchiveSubfolders->text(),
m_txtArchiveFilename->text(),
m_chkArchiveLowercase->isChecked(),
false,
dlgStatus);
if (dlgStatus->wasCanceled()) {
//either canceled by user or error
return;
}
} else {
dlgStatus->appendStatusMessage(i18n("Archiving found images... skipped"));
}
QString msg = i18n("Moving found images...");
if (!m_chkSrcRemoveFilesFromSrc->isChecked()) {
msg = i18n("Copying found images...");
}
dlgStatus->setCurrentMode(DlgImageImporterStatus::ModeDestination, msg);
// ... then copy/ move the images to their destinaion
importFiles(&lstFiles, m_cmbDestBasefolder->currentText(), m_txtDestSubfolders->text(),
m_txtDestFilename->text(), m_chkDestLowercase->isChecked(),
m_chkSrcRemoveFilesFromSrc->isChecked(), dlgStatus);
if (dlgStatus->wasCanceled()) {
//.........这里部分代码省略.........