Commit 2e508acc authored by Nicolas Carion's avatar Nicolas Carion
Browse files

use modern for

parent 20663fcc
......@@ -59,7 +59,7 @@ void AssetListWidget::setFilterName(const QString &pattern)
m_proxyModel->setFilterName(!pattern.isEmpty(), pattern);
if (!pattern.isEmpty()) {
QVariantList mapped;
foreach (const QModelIndex &ix, m_model->getChildrenIndexes()) {
for (const QModelIndex &ix : m_model->getChildrenIndexes()) {
mapped << m_proxyModel->mapFromSource(ix);
}
QMetaObject::invokeMethod(rootObject(), "expandNodes", Qt::QueuedConnection, Q_ARG(QVariant, mapped));
......
......@@ -773,7 +773,7 @@ void Bin::abortOperations()
blockSignals(true);
abortAudioThumbs();
if (m_propertiesPanel) {
foreach (QWidget *w, m_propertiesPanel->findChildren<ClipPropertiesController *>()) {
for (QWidget *w : m_propertiesPanel->findChildren<ClipPropertiesController *>()) {
delete w;
}
}
......@@ -796,7 +796,7 @@ void Bin::abortAudioThumbs()
}
}
m_audioThumbMutex.lock();
foreach (const QString &id, m_audioThumbsList) {
for (const QString &id : m_audioThumbsList) {
ProjectClip *clip = m_itemModel->getClipByBinID(id);
if (clip) {
clip->setJobStatus(AbstractClipJob::THUMBJOB, JobDone, 0);
......@@ -1013,7 +1013,7 @@ void Bin::slotDeleteClip()
// check folders, remove child folders if there is any
QList<ProjectFolder *> topFolders;
const QModelIndexList indexes = m_proxyModel->selectionModel()->selectedIndexes();
foreach (const QModelIndex &ix, indexes) {
for (const QModelIndex &ix : indexes) {
if (!ix.isValid() || ix.column() != 0) {
continue;
}
......@@ -1042,7 +1042,7 @@ void Bin::slotDeleteClip()
}
// parse all folders to check for children
bool isChild = false;
foreach (ProjectFolder *f, topFolders) {
for (ProjectFolder *f : topFolders) {
if (f->folder(current->clipId())) {
// Current is a child, no need to take it into account
isChild = true;
......@@ -1054,26 +1054,26 @@ void Bin::slotDeleteClip()
}
QList<ProjectFolder *> childFolders;
// parse all folders to check for children
foreach (ProjectFolder *f, topFolders) {
for (ProjectFolder *f : topFolders) {
if (current->folder(f->clipId())) {
childFolders << f;
}
}
if (!childFolders.isEmpty()) {
// children are in the list, remove from
foreach (ProjectFolder *f, childFolders) {
for (ProjectFolder *f : childFolders) {
topFolders.removeAll(f);
}
}
topFolders << current;
}
foreach (const ProjectFolder *f, topFolders) {
for (const ProjectFolder *f : topFolders) {
foldersIds << f->clipId();
}
bool usedClips = false;
QList<ProjectFolder *> topClips;
// Check if clips are in already selected folders
foreach (const QModelIndex &ix, indexes) {
for (const QModelIndex &ix : indexes) {
if (!ix.isValid() || ix.column() != 0) {
continue;
}
......@@ -1083,7 +1083,7 @@ void Bin::slotDeleteClip()
}
ProjectClip *current = static_cast<ProjectClip *>(item);
bool isChild = false;
foreach (const ProjectFolder *f, topFolders) {
for (const ProjectFolder *f : topFolders) {
if (current->hasParent(f->clipId())) {
isChild = true;
break;
......@@ -1995,7 +1995,7 @@ void Bin::showClipProperties(ProjectClip *clip, bool forceRefresh)
return;
}
// Cleanup widget for new content
foreach (QWidget *w, m_propertiesPanel->findChildren<ClipPropertiesController *>()) {
for (QWidget *w : m_propertiesPanel->findChildren<ClipPropertiesController *>()) {
delete w;
}
m_propertiesPanel->setProperty("clipId", clip->AbstractProjectItem::clipId());
......@@ -2130,7 +2130,7 @@ void Bin::slotProducerReady(const requestClipInfo &info, ClipController *control
if (currentClip.isEmpty()) {
// No clip displayed in monitor, check if item is selected
QModelIndexList indexes = m_proxyModel->selectionModel()->selectedIndexes();
foreach (const QModelIndex &ix, indexes) {
for (const QModelIndex &ix : indexes) {
if (!ix.isValid() || ix.column() != 0) {
continue;
}
......@@ -2356,7 +2356,7 @@ void Bin::doDisplayMessage(const QString &text, KMessageWidget::MessageType type
}
m_infoMessage->setText(text);
m_infoMessage->setWordWrap(m_infoMessage->text().length() > 35);
foreach (QAction *action, actions) {
for (QAction *action : actions) {
m_infoMessage->addAction(action);
connect(action, &QAction::triggered, this, &Bin::slotMessageActionTriggered);
}
......@@ -2510,7 +2510,7 @@ void Bin::slotItemDropped(const QStringList &ids, const QModelIndex &parent)
auto *moveCommand = new QUndoCommand();
moveCommand->setText(i18np("Move Clip", "Move Clips", ids.count()));
QStringList folderIds;
foreach (const QString &id, ids) {
for (const QString &id : ids) {
if (id.contains(QLatin1Char('/'))) {
// trying to move clip zone, not allowed. Ignore
continue;
......@@ -2660,7 +2660,7 @@ void Bin::slotItemDropped(const QList<QUrl> &urls, const QModelIndex &parent)
// TODO: verify if urls exist
QList<QUrl> clipsToAdd = urls;
QMimeDatabase db;
foreach (const QUrl &file, clipsToAdd) {
for (const QUrl &file : clipsToAdd) {
// Check there is no folder here
QMimeType type = db.mimeTypeForUrl(file);
if (type.inherits(QStringLiteral("inode/directory"))) {
......@@ -3128,7 +3128,7 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
int cutPos = 0;
auto *command = new QUndoCommand();
command->setText(i18n("Auto Split Clip"));
foreach (const QString &pos, value) {
for (const QString &pos : value) {
if (!pos.contains(QLatin1Char('='))) {
continue;
}
......@@ -3163,7 +3163,7 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
// simple list
simpleList = true;
}
foreach (const QString &pos, value) {
for (const QString &pos : value) {
if (simpleList) {
CommentedTime m(GenTime((int)(pos.toInt() * pCore->getCurrentFps() / sourceFps), pCore->getCurrentFps()), label + pos, markersType);
markersList << m;
......@@ -3251,7 +3251,7 @@ void Bin::slotLoadClipMarkers(const QString &id)
command->setText(QStringLiteral("Load markers"));
QString markerText;
QList<CommentedTime> markersList;
foreach (const QString &line, lines) {
for (const QString &line : lines) {
markerText.clear();
values = line.split('\t', QString::SkipEmptyParts);
double time1 = values.at(0).toDouble(&ok);
......@@ -3645,7 +3645,7 @@ void Bin::refreshProxySettings()
m_doc->slotProxyCurrentItem(false, clipList, false, masterCommand);
} else {
QList<ProjectClip *> toProxy;
foreach (ProjectClip *clp, clipList) {
for (ProjectClip *clp : clipList) {
ClipType t = clp->clipType();
if (t == Playlist) {
toProxy << clp;
......@@ -3675,7 +3675,7 @@ QStringList Bin::getProxyHashList()
{
QStringList list;
QList<ProjectClip *> clipList = m_itemModel->getRootFolder()->childClips();
foreach (ProjectClip *clp, clipList) {
for (ProjectClip *clp : clipList) {
if (clp->clipType() == AV || clp->clipType() == Video || clp->clipType() == Playlist) {
list << clp->hash();
}
......@@ -3710,7 +3710,7 @@ void Bin::reloadAllProducers()
}
QList<ProjectClip *> clipList = m_itemModel->getRootFolder()->childClips();
emit openClip(nullptr);
foreach (ProjectClip *clip, clipList) {
for (ProjectClip *clip : clipList) {
QDomDocument doc;
QDomElement xml = clip->toXml(doc);
// Make sure we reload clip length
......@@ -3743,7 +3743,7 @@ void Bin::cleanup()
QList<ProjectClip *> clipList = m_itemModel->getRootFolder()->childClips();
QStringList ids;
QStringList subIds;
foreach (ProjectClip *clip, clipList) {
for (ProjectClip *clip : clipList) {
if (clip->refCount() == 0) {
ids << clip->AbstractProjectItem::clipId();
subIds << clip->subClipIds();
......@@ -3757,7 +3757,7 @@ void Bin::cleanup()
void Bin::getBinStats(uint *used, uint *unused, qint64 *usedSize, qint64 *unusedSize)
{
QList<ProjectClip *> clipList = m_itemModel->getRootFolder()->childClips();
foreach (ProjectClip *clip, clipList) {
for (ProjectClip *clip : clipList) {
if (clip->refCount() == 0) {
*unused += 1;
*unusedSize += clip->getProducerInt64Property(QStringLiteral("kdenlive:file_size"));
......@@ -3803,7 +3803,7 @@ void Bin::rebuildProxies()
{
QList<ProjectClip *> clipList = m_itemModel->getRootFolder()->childClips();
QList<ProjectClip *> toProxy;
foreach (ProjectClip *clp, clipList) {
for (ProjectClip *clp : clipList) {
if (clp->hasProxy()) {
toProxy << clp;
}
......
......@@ -77,7 +77,7 @@ QStringList ClipCreationDialog::getExtensions()
QMimeDatabase db;
QStringList allExtensions;
foreach (const QString &mimeType, mimeTypes) {
for (const QString &mimeType : mimeTypes) {
QMimeType mime = db.mimeTypeForName(mimeType);
if (mime.isValid()) {
allExtensions.append(mime.globPatterns());
......@@ -389,7 +389,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
// TODO: check files on removable volume
/*listRemovableVolumes();
foreach(const QUrl &file, urls) {
for (const QUrl &file : urls) {
if (QFile::exists(file.path())) {
//TODO check for duplicates
if (!data.contains("bypassDuplicate") && !getClipByResource(file.path()).empty()) {
......@@ -428,7 +428,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
// TODO check folders
/*QList< QList<QUrl> > foldersList;
QMimeDatabase db;
foreach(const QUrl & file, list) {
for (const QUrl & file : list) {
// Check there is no folder here
QMimeType type = db.mimeTypeForUrl(file);
if (type.inherits("inode/directory")) {
......@@ -438,7 +438,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
QStringList result = dir.entryList(QDir::Files);
QList<QUrl> folderFiles;
folderFiles << file;
foreach(const QString & path, result) {
for (const QString & path : result) {
// TODO: create folder command
folderFiles.append(QUrl::fromLocalFile(dir.absoluteFilePath(path)));
}
......@@ -446,7 +446,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QList<QUrl>
}
}*/
foreach (const QUrl &file, urls) {
for (const QUrl &file : urls) {
QDomDocument xml;
QDomElement prod = xml.createElement(QStringLiteral("producer"));
xml.appendChild(prod);
......
......@@ -438,7 +438,7 @@ void KdenliveSettingsDialog::setupJogshuttleBtns(const QString &device)
// action_names, as the sorting may depend on the user-language.
QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
QMap<QString, int> action_pos;
foreach (const QString &action_id, actions_map) {
for (const QString &action_id : actions_map) {
// This loop find out at what index is the string that would map to the action_id.
for (int i = 0; i < action_names.size(); ++i) {
if (mappable_actions[action_names.at(i)] == action_id) {
......@@ -449,7 +449,7 @@ void KdenliveSettingsDialog::setupJogshuttleBtns(const QString &device)
}
int i = 0;
foreach (KComboBox *button, m_shuttle_buttons) {
for (KComboBox *button : m_shuttle_buttons) {
button->addItems(action_names);
connect(button, SIGNAL(activated(int)), this, SLOT(slotShuttleModified()));
++i;
......@@ -686,7 +686,7 @@ void KdenliveSettingsDialog::updateWidgets()
qSort(action_names);
QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
QMap<QString, int> action_pos;
foreach (const QString &action_id, actions_map) {
for (const QString &action_id : actions_map) {
// This loop find out at what index is the string that would map to the action_id.
for (int i = 0; i < action_names.size(); ++i) {
if (m_mappable_actions[action_names[i]] == action_id) {
......@@ -696,7 +696,7 @@ void KdenliveSettingsDialog::updateWidgets()
}
}
int i = 0;
foreach (KComboBox *button, m_shuttle_buttons) {
for (KComboBox *button : m_shuttle_buttons) {
++i;
if (i < actions_map.size()) {
button->setCurrentIndex(action_pos[actions_map[i]]);
......@@ -892,7 +892,7 @@ void KdenliveSettingsDialog::updateSettings()
QStringList actions;
actions << QStringLiteral("monitor_pause"); // the Job rest position action.
foreach (KComboBox *button, m_shuttle_buttons) {
for (KComboBox *button : m_shuttle_buttons) {
actions << m_mappable_actions[button->currentText()];
}
QString maps = JogShuttleConfig::actionMap(actions);
......@@ -1081,7 +1081,7 @@ void KdenliveSettingsDialog::slotShuttleModified()
#ifdef USE_JOGSHUTTLE
QStringList actions;
actions << QStringLiteral("monitor_pause"); // the Job rest position action.
foreach (KComboBox *button, m_shuttle_buttons) {
for (KComboBox *button : m_shuttle_buttons) {
actions << m_mappable_actions[button->currentText()];
}
QString maps = JogShuttleConfig::actionMap(actions);
......
......@@ -1067,7 +1067,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
if (QFile::exists(dest)) {
if (KMessageBox::warningYesNo(this, i18n("Output file already exists. Do you want to overwrite it?")) != KMessageBox::Yes) {
foreach (const QString &playlistFilePath, playlistPaths) {
for (const QString &playlistFilePath : playlistPaths) {
QFile playlistFile(playlistFilePath);
if (playlistFile.exists()) {
playlistFile.remove();
......@@ -1822,7 +1822,7 @@ void RenderWidget::parseProfiles(const QString &selectedProfile)
// We should parse customprofiles.xml in last position, so that user profiles
// can also override profiles installed by KNewStuff
fileList.removeAll(QStringLiteral("customprofiles.xml"));
foreach (const QString &filename, fileList) {
for (const QString &filename : fileList) {
parseFile(directory.absoluteFilePath(filename), true);
}
if (QFile::exists(exportFolder + QStringLiteral("customprofiles.xml"))) {
......@@ -1895,7 +1895,7 @@ void RenderWidget::parseMltPresets()
groupItem->setExpanded(true);
}
QStringList profiles = root.entryList(QDir::Files, QDir::Name);
foreach (const QString &prof, profiles) {
for (const QString &prof : profiles) {
QTreeWidgetItem *item = loadFromMltPreset(groupName, root.absoluteFilePath(prof), prof);
if (!item) {
continue;
......
......@@ -486,7 +486,7 @@ void Wizard::checkMissingCodecs()
// can also override profiles installed by KNewStuff
QStringList requiredACodecs;
QStringList requiredVCodecs;
foreach (const QString &filename, profilesList) {
for (const QString &filename : profilesList) {
QDomDocument doc;
QFile file(filename);
doc.setContent(&file, false);
......@@ -660,7 +660,7 @@ void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs
QMimeType mime = db.mimeTypeForName(baseName);
QStringList missingGlobs;
foreach (const QString &glob, globs) {
for (const QString &glob : globs) {
QMimeType type = db.mimeTypeForFile(glob, QMimeDatabase::MatchExtension);
QString mimeName = type.name();
if (!mimeName.contains(QStringLiteral("audio")) && !mimeName.contains(QStringLiteral("video"))) {
......@@ -675,7 +675,7 @@ void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs
} else {
QStringList extensions = mime.globPatterns();
QString comment = mime.comment();
foreach (const QString &glob, missingGlobs) {
for (const QString &glob : missingGlobs) {
if (!extensions.contains(glob)) {
extensions << glob;
}
......@@ -708,7 +708,7 @@ void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs
writer.writeEndElement(); // comment
}
foreach (const QString &pattern, extensions) {
for (const QString &pattern : extensions) {
writer.writeStartElement(nsUri, QStringLiteral("glob"));
writer.writeAttribute(QStringLiteral("pattern"), pattern);
writer.writeEndElement(); // glob
......
......@@ -242,7 +242,7 @@ bool DocumentChecker::hasErrorInClips()
QMap<QString, QString> autoFixLuma;
// Check existence of luma files
foreach (const QString &lumafile, filesToCheck) {
for (const QString &lumafile : filesToCheck) {
filePath = lumafile;
if (QFileInfo(filePath).isRelative()) {
filePath.prepend(root);
......@@ -295,7 +295,7 @@ bool DocumentChecker::hasErrorInClips()
m_dialog->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
m_ui.setupUi(m_dialog);
foreach (const QString &l, missingLumas) {
for (const QString &l : missingLumas) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList() << i18n("Luma file") << l);
item->setIcon(0, KoIconUtils::themedIcon(QStringLiteral("dialog-close")));
item->setData(0, idRole, l);
......@@ -379,7 +379,7 @@ bool DocumentChecker::hasErrorInClips()
}
}
foreach (const QString &font, m_missingFonts) {
for (const QString &font : m_missingFonts) {
QString clipType = i18n("Title Font");
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList() << clipType);
item->setData(0, statusRole, CLIPPLACEHOLDER);
......@@ -999,7 +999,7 @@ void DocumentChecker::slotDeleteSelected()
QStringList deletedLumas;
QDomNodeList playlists = m_doc.elementsByTagName(QStringLiteral("playlist"));
foreach (QTreeWidgetItem *child, m_ui.treeWidget->selectedItems()) {
for (QTreeWidgetItem *child : m_ui.treeWidget->selectedItems()) {
int id = child->data(0, statusRole).toInt();
if (id == CLIPMISSING) {
deletedIds.append(child->data(0, idRole).toString());
......@@ -1013,7 +1013,7 @@ void DocumentChecker::slotDeleteSelected()
if (!deletedLumas.isEmpty()) {
QDomElement e;
QDomNodeList transitions = m_doc.elementsByTagName(QStringLiteral("transition"));
foreach (const QString &lumaPath, deletedLumas) {
for (const QString &lumaPath : deletedLumas) {
for (int i = 0; i < transitions.count(); ++i) {
e = transitions.item(i).toElement();
QString service = EffectsList::property(e, QStringLiteral("mlt_service"));
......@@ -1084,7 +1084,7 @@ void DocumentChecker::slotDeleteSelected()
void DocumentChecker::checkMissingImagesAndFonts(const QStringList &images, const QStringList &fonts, const QString &id, const QString &baseClip)
{
QDomDocument doc;
foreach (const QString &img, images) {
for (const QString &img : images) {
if (m_safeImages.contains(img)) {
continue;
}
......@@ -1099,7 +1099,7 @@ void DocumentChecker::checkMissingImagesAndFonts(const QStringList &images, cons
m_safeImages.append(img);
}
}
foreach (const QString &fontelement, fonts) {
for (const QString &fontelement : fonts) {
if (m_safeFonts.contains(fontelement)) {
continue;
}
......
......@@ -1740,7 +1740,7 @@ void DocumentValidator::updateProducerInfo(const QDomElement &prod, const QDomEl
QString zoneData = source.attribute(QStringLiteral("cutzones"));
QStringList zoneList = zoneData.split(QLatin1Char(';'));
int ct = 1;
foreach (const QString &data, zoneList) {
for (const QString &data : zoneList) {
QString zoneName = data.section(QLatin1Char('-'), 2);
if (zoneName.isEmpty()) {
zoneName = i18n("Zone %1", ct++);
......
......@@ -1407,7 +1407,7 @@ void KdenliveDoc::slotClipMissing(const QString &path)
qCDebug(KDENLIVE_LOG) << "// CLIP: " << path << " WAS MISSING";
QStringList ids = pCore->binController()->getBinIdsByResource(QFileInfo(path));
// TODO handle missing clips by replacing producer with an invalid producer
/*foreach (const QString &id, ids) {
/*for (const QString &id : ids) {
emit missingClip(id);
}*/
}
......@@ -1719,7 +1719,7 @@ void KdenliveDoc::selectPreviewProfile()
}
}
bool rateFound = false;
foreach (const QString &arg, data) {
for (const QString &arg : data) {
if (arg.startsWith(QStringLiteral("r="))) {
rateFound = true;
double fps = arg.section(QLatin1Char('='), 1).toDouble();
......
......@@ -870,7 +870,7 @@ void DvdWizardMenu::loadXml(DVDFORMAT format, const QDomElement &xml)
if (!buttons.isEmpty()) {
// Clear existing buttons
foreach (QGraphicsItem *item, m_scene->items()) {
for (QGraphicsItem *item : m_scene->items()) {
if (item->type() == DvdButtonItem) {
m_scene->removeItem(item);
delete item;
......
......@@ -274,7 +274,7 @@ void DvdWizardVob::slotAddVobList(QList<QUrl> list)
KRecentDirs::add(QStringLiteral(":KdenliveDvdFolder"), list.at(0).adjusted(QUrl::RemoveFilename).toLocalFile());
}
}
foreach (const QUrl &url, list) {
for (const QUrl &url : list) {
slotAddVobFile(url, QString(), false);
}
slotCheckVobList();
......@@ -743,7 +743,7 @@ void DvdWizardVob::processTranscoding()
bool replaceVfParams = false;
QStringList splitted = params.split(QLatin1Char(' '));
foreach (QString s, splitted) {
for (QString s : splitted) {
if (replaceVfParams) {
parameters << postParams.at(1);
replaceVfParams = false;
......
......@@ -45,16 +45,16 @@ void initEffects::refreshLumas()
fileFilters << QStringLiteral("*.png") << QStringLiteral("*.pgm");
QStringList customLumas = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("lumas"), QStandardPaths::LocateDirectory);
customLumas.append(QString(mlt_environment("MLT_DATA")) + QStringLiteral("/lumas"));
foreach (const QString &folder, customLumas) {
for (const QString &folder : customLumas) {
QDir topDir(folder);
QStringList folders = topDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach (const QString &f, folders) {
for (const QString &f : folders) {
QDir dir(topDir.absoluteFilePath(f));
QStringList filesnames = dir.entryList(fileFilters, QDir::Files);
if (MainWindow::m_lumaFiles.contains(f)) {
imagefiles = MainWindow::m_lumaFiles.value(f);
}
foreach (const QString &fname, filesnames) {
for (const QString &fname : filesnames) {
imagefiles.append(dir.absoluteFilePath(fname));
}
MainWindow::m_lumaFiles.insert(f, imagefiles);
......@@ -68,10 +68,10 @@ void initEffects::refreshLumas()
filters << QStringLiteral("*.pgm") << QStringLiteral("*.png");
QStringList customLumas = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, QStringLiteral("lumas"), QStandardPaths::LocateDirectory);
foreach(const QString & folder, customLumas) {
for (const QString & folder : customLumas) {
QDir directory(folder);
QStringList filesnames = directory.entryList(filters, QDir::Files);
foreach(const QString & fname, filesnames) {
for (const QString & fname : filesnames) {
imagenamelist.append(fname);
imagefiles.append(directory.absoluteFilePath(fname));
}
......@@ -81,7 +81,7 @@ void initEffects::refreshLumas()
QUrl folder(QString(mlt_environment("MLT_DATA")) + QDir::separator() + "lumas" + QDir::separator() + QString(mlt_environment("MLT_NORMALISATION")));
QDir lumafolder(folder.path());
QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
foreach(const QString & fname, filesnames) {
for (const QString & fname : filesnames) {
imagenamelist.append(fname);
imagefiles.append(lumafolder.absoluteFilePath(fname));
}
......@@ -197,7 +197,7 @@ bool initEffects::parseEffectFiles(std::unique_ptr<Mlt::Repository> &repository,
// Create structure holding all transitions descriptions so that if an XML file has no description, we take it from MLT
QMap<QString, QString> transDescriptions;
foreach (const QString &transname, transitionsItemList) {
for (const QString &transname : transitionsItemList) {
QDomDocument doc = createDescriptionFromMlt(repository, QStringLiteral("transitions"), transname);
if (!doc.isNull()) {
if (doc.elementsByTagName(QStringLiteral("description")).count() > 0) {
......@@ -280,14 +280,14 @@ bool initEffects::parseEffectFiles(std::unique_ptr<Mlt::Repository> &repository,
effectsMap.insert(effectInfo.firstChildElement(QStringLiteral("name")).text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::transitions.clearList();
foreach (const QDomElement &effect, effectsMap) {
for (const QDomElement &effect : effectsMap) {
MainWindow::transitions.append(effect);
}
effectsMap.clear();
// Create structure holding all effects descriptions so that if an XML effect has no description, we take it from MLT
QMap<QString, QString> effectDescriptions;
foreach (const QString &filtername, mltBlackList) {
for (const QString &filtername : mltBlackList) {
QDomDocument doc = createDescriptionFromMlt(repository, QStringLiteral("filters"), filtername);
if (!doc.isNull()) {
if (doc.elementsByTagName(QStringLiteral("description")).count() > 0) {
......@@ -305,7 +305,7 @@ bool initEffects::parseEffectFiles(std::unique_ptr<Mlt::Repository> &repository,
}
// Create effects from MLT
foreach (const QString &filtername, mltFiltersList) {
for (const QString &filtername : mltFiltersList) {
QDomDocument doc = createDescriptionFromMlt(repository, QStringLiteral("filters"), filtername);
// WARNING: TEMPORARY FIX for empty MLT effects descriptions - disable effects without parameters - jbm 09-06-2011
if (!doc.isNull() && doc.elementsByTagName(QStringLiteral("parameter")).count() > 0) {
......@@ -352,7 +352,7 @@ bool initEffects::parseEffectFiles(std::unique_ptr<Mlt::Repository> &repository,
}
}
MainWindow::customEffects.clearList();
foreach (const QDomElement &effect, effectsMap) {
for (const QDomElement &effect : effectsMap) {
MainWindow::customEffects.append(effect);
}
effectsMap.clear();
......@@ -364,7 +364,7 @@ bool initEffects::parseEffectFiles(std::unique_ptr<Mlt::Repository> &repository,
audioEffectsMap.insert(effectInfo.firstChildElement(QStringLiteral("name")).text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::audioEffects.clearList();
foreach (const QDomElement &effect, audioEffectsMap) {
for (const QDomElement &effect : audioEffectsMap) {
MainWindow::audioEffects.append(effect);
}
......@@ -375,7 +375,7 @@ bool initEffects::parseEffectFiles(std::unique_ptr<Mlt::Repository> &repository,
videoEffectsMap.insert(effectInfo.firstChildElement(QStringLiteral("name")).text().toLower().toUtf8().data(), effectInfo);
}
MainWindow::videoEffects.clearList();
foreach (const QDomElement &effect, videoEffectsMap) {
for (const QDomElement &effect : videoEffectsMap) {
MainWindow::videoEffects.append(effect);
}
......@@ -405,7 +405,7 @@ void initEffects::parseCustomEffectsFile()
QDomNodeList effects;
QDomElement e;
int unknownGroupCount = 0;
foreach (const QString &filename, fileList) {
for (const QString &filename : fileList) {
QString itemName = directory.absoluteFilePath(filename);
QFile file(itemName);