Commit bff5ba5b authored by Vincent Pinon's avatar Vincent Pinon
Browse files

clazy fixit (default checks, from qtcreator)

parent 1360538b
......@@ -114,7 +114,7 @@ void KeyframeView::slotDuplicateKeyframe()
Fun undo = []() { return true; };
Fun redo = []() { return true; };
int delta = m_position - m_currentKeyframe;
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
m_model->duplicateKeyframeWithUndo(GenTime(kf + offset, pCore->getCurrentFps()), GenTime(kf + delta + offset, pCore->getCurrentFps()), undo, redo);
}
pCore->pushUndo(undo, redo, i18n("Duplicate keyframe"));
......@@ -243,7 +243,7 @@ void KeyframeView::slotCenterKeyframe()
QVector<int>currentSelection = m_selectedKeyframes;
int sourcePosition = m_currentKeyframeOriginal;
QVector<int>updatedSelection;
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
if (kf == 0) {
// Don't allow moving first keyframe
continue;
......@@ -395,14 +395,14 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
if (!m_model->hasKeyframe(pos + offset)) {
int delta = pos - m_currentKeyframe;
// Check that the move is possible
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
int updatedPos = kf + offset + delta;
if (!m_selectedKeyframes.contains(updatedPos) && m_model->hasKeyframe(updatedPos)) {
// Don't allow moving over another keyframe
return;
}
}
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
if (kf == 0) {
// Don't allow moving first keyframe
continue;
......@@ -521,7 +521,7 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event)
} else {
std::sort(m_selectedKeyframes.begin(), m_selectedKeyframes.end(), std::greater<>());
}
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
if (kf == 0) {
// Don't allow moving first keyframe
continue;
......@@ -539,7 +539,7 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event)
} else {
std::sort(m_selectedKeyframes.begin(), m_selectedKeyframes.end());
}
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
if (kf == 0) {
// Don't allow moving first keyframe
continue;
......@@ -787,7 +787,7 @@ void KeyframeView::copyCurrentValue(QModelIndex ix, const QString paramName)
int offset = pCore->getItemIn(m_model->getOwnerId());
qDebug()<<"=== COPYING VALS: "<<val<<", PARAM NAME_ "<<paramName;
auto *parentCommand = new QUndoCommand();
for (int kf : m_selectedKeyframes) {
for (int kf : qAsConst(m_selectedKeyframes)) {
QString oldValue = m_model->getInterpolatedValue(kf, ix).toString();
QStringList oldVals = oldValue.split(QLatin1Char(' '));
if (paramName == QLatin1String("spinX")) {
......
......@@ -264,7 +264,7 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
}
paramList.clear();
QList<QCheckBox *> cbs = d.findChildren<QCheckBox *>();
for (auto c : cbs) {
for (auto c : qAsConst(cbs)) {
//qDebug()<<"=== FOUND CBS: "<<KLocalizedString::removeAcceleratorMarker(c->text());
if (c->isChecked()) {
QPersistentModelIndex ix = c->property("index").toModelIndex();
......
......@@ -4424,7 +4424,7 @@ QList<int> Bin::getUsedClipIds()
{
QList<int> timelineClipIds;
QList<std::shared_ptr<ProjectClip>> allClipIds = m_itemModel->getRootFolder()->childClips();
for(auto clip : allClipIds) {
for(auto clip : qAsConst(allClipIds)) {
if(clip->isIncludedInTimeline()) {
timelineClipIds.push_back(clip->binId().toInt());
}
......
......@@ -977,7 +977,7 @@ void SubtitleModel::jsontoSubtitle(const QString &data)
out<<styleSection<<endl;
out<<eventSection;
}
for (const auto &entry : list) {
for (const auto &entry : qAsConst(list)) {
if (!entry.isObject()) {
qDebug() << "Warning : Skipping invalid subtitle data";
continue;
......
......@@ -1114,7 +1114,7 @@ void TextBasedEdit::previewPlaylist(bool createNew)
QMap<QString, QString> properties;
properties.insert(QStringLiteral("kdenlive:baseid"), m_binId);
QStringList playZones;
for (const auto&p : zones) {
for (const auto&p : qAsConst(zones)) {
playZones << QString("%1:%2").arg(p.x()).arg(p.y());
}
properties.insert(QStringLiteral("kdenlive:cutzones"), playZones.join(QLatin1Char(';')));
......@@ -1186,7 +1186,7 @@ void TextBasedEdit::openClip(std::shared_ptr<ProjectClip> clip)
clipNameLabel->setText(refClip->clipName());
}
QStringList zones = clip->getProducerProperty("kdenlive:cutzones").split(QLatin1Char(';'));
for (const QString &z : zones) {
for (const QString &z : qAsConst(zones)) {
cutZones << QPoint(z.section(QLatin1Char(':'), 0, 0).toInt(), z.section(QLatin1Char(':'), 1, 1).toInt());
}
} else {
......
......@@ -50,7 +50,7 @@ TitleTemplateDialog::TitleTemplateDialog(const QString &folder, QWidget *parent)
titleTemplates.append(QStandardPaths::locateAll(QStandardPaths::AppLocalDataLocation, QStringLiteral("titles/"), QStandardPaths::LocateDirectory));
#endif
titleTemplates.removeDuplicates();
for (const QString &folderpath : titleTemplates) {
for (const QString &folderpath : qAsConst(titleTemplates)) {
QDir sysdir(folderpath);
const QStringList filesnames = sysdir.entryList(filter, QDir::Files);
for (const QString &fname : filesnames) {
......
......@@ -224,7 +224,7 @@ bool LayoutManagement::loadLayout(const QString &layoutId, bool selectButton)
// Activate layout button
QList<QAbstractButton *>buttons = m_containerGrp->buttons();
bool buttonFound = false;
for (auto *button : buttons) {
for (auto *button : qAsConst(buttons)) {
if (button->property("layoutid").toString() == layoutId) {
QSignalBlocker bk(m_containerGrp);
button->setChecked(true);
......@@ -299,7 +299,7 @@ void LayoutManagement::slotSaveLayout()
// Activate layout button
if(names.first != nullptr) {
QList<QAbstractButton *>buttons = m_containerGrp->buttons();
for (auto *button : buttons) {
for (auto *button : qAsConst(buttons)) {
if (button->text() == names.first) {
QSignalBlocker bk(m_containerGrp);
button->setChecked(true);
......@@ -399,7 +399,7 @@ void LayoutManagement::slotManageLayouts()
}
// Re-add missing default layouts
for (const QString &name : defaultLayoutNames) {
for (const QString &name : qAsConst(defaultLayoutNames)) {
if (!currentNames.contains(name) && translatedLayoutNames.contains(name)) {
// Insert default layout
QListWidgetItem *item = new QListWidgetItem(translatedLayoutNames.value(name));
......
......@@ -64,7 +64,7 @@ QPair<QLocale, LocaleHandling::MatchType> LocaleHandling::getQLocaleForDecimalPo
// Parse installed locales to find one matching. Check matching language first
QList<QLocale> list = QLocale::matchingLocales(QLocale().language(), QLocale().script(), QLocale::AnyCountry);
for (const QLocale &loc : list) {
for (const QLocale &loc : qAsConst(list)) {
if (loc.decimalPoint() == decimalPoint) {
locale = loc;
matchType = MatchType::Exact;
......@@ -75,7 +75,7 @@ QPair<QLocale, LocaleHandling::MatchType> LocaleHandling::getQLocaleForDecimalPo
if (matchType == MatchType::NoMatch) {
// Parse installed locales to find one matching. Check in all languages
list = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale().script(), QLocale::AnyCountry);
for (const QLocale &loc : list) {
for (const QLocale &loc : qAsConst(list)) {
if (loc.decimalPoint() == decimalPoint) {
locale = loc;
matchType = MatchType::DecimalOnly;
......
......@@ -3901,7 +3901,7 @@ bool MainWindow::isTabbedWith(QDockWidget *widget, const QString &otherWidget)
void MainWindow::updateDockTitleBars(bool isTopLevel)
{
QList<QTabBar *> tabbars = findChildren<QTabBar *>();
for (QTabBar *tab : tabbars) {
for (QTabBar *tab : qAsConst(tabbars)) {
tab->setAcceptDrops(true);
tab->setChangeCurrentOnDrag(true);
}
......
......@@ -59,7 +59,7 @@ ResourceWidget::ResourceWidget(QWidget *parent)
message_line->hide();
for (QPair<QString, QString> provider : ProvidersRepository::get()->getAllProviers()) {
for (const QPair<QString, QString> &provider : ProvidersRepository::get()->getAllProviers()) {
QIcon icon;
switch(ProvidersRepository::get()->getProvider(provider.second)->type()){
case ProviderModel::AUDIO:
......
......@@ -267,7 +267,7 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
}
}
}
for (auto compo : compositions) {
for (auto compo : qAsConst(compositions)) {
timeline->plantMix(tid, compo);
}
std::shared_ptr<Mlt::Service> serv = std::make_shared<Mlt::Service>(track.get_service());
......
......@@ -1590,7 +1590,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
audioOffsetCalculated = true;
}
for (int oldPos : singleAudioTracks) {
for (int oldPos : qAsConst(singleAudioTracks)) {
if (tracksMap.contains(oldPos)) {
continue;
}
......
......@@ -1584,7 +1584,7 @@ bool TimelineModel::requestClipInsertion(const QString &binClipId, int trackId,
// Find first possible audio target
QList <int> audioTargetTracks = m_audioTarget.keys();
trackId = -1;
for (int tid : audioTargetTracks) {
for (int tid : qAsConst(audioTargetTracks)) {
if (tid > -1 && !getTrackById_const(tid)->isLocked() && allowedTracks.contains(tid)) {
trackId = tid;
break;
......
......@@ -2169,7 +2169,7 @@ void TrackModel::syncronizeMixes(bool finalMove)
emit ptr->dataChanged(ix, ix, {TimelineModel::MixRole,TimelineModel::MixCutRole});
}
}
for (int i : toDelete) {
for (int i : qAsConst(toDelete)) {
m_sameCompositions.erase(i);
}
}
......
......@@ -685,7 +685,7 @@ void TimelineController::deleteMultipleTracks(int tid)
}
if (d->exec() == QDialog::Accepted) {
QList<int> allIds = d->toDeleteTrackIds();
for (int selectedTrackIx : allIds) {
for (int selectedTrackIx : qAsConst(allIds)) {
result = m_model->requestTrackDeletion(selectedTrackIx, undo, redo);
if (!result) {
break;
......@@ -2436,7 +2436,7 @@ int TimelineController::insertZone(const QString &binId, QPoint zone, bool overw
int vTrack = -1;
if (clip->hasAudio() && !m_model->m_audioTarget.isEmpty()) {
QList<int> audioTracks = m_model->m_audioTarget.keys();
for (int tid : audioTracks) {
for (int tid : qAsConst(audioTracks)) {
if (m_model->getTrackById_const(tid)->shouldReceiveTimelineOp()) {
aTrack = tid;
break;
......
......@@ -128,7 +128,7 @@ QByteArray PatternsModel::serialize()
QByteArray encodedData;
QDataStream stream(&encodedData, QIODevice::WriteOnly);
for (auto p : patterns) {
for (const auto &p : qAsConst(patterns)) {
stream << p;
}
modified_counter = 0;
......
......@@ -411,7 +411,7 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QGraphicsRectItem *start
m_height = height;
}
for (auto i : items) {
for (auto i : qAsConst(items)) {
m_scene->addItem(i);
}
return res;
......
......@@ -3502,7 +3502,7 @@ void TitleWidget::slotPatternBtnRemoveClicked()
QModelIndexList items = patternsList->selectionModel()->selectedIndexes();
std::sort(items.begin(), items.end());
std::reverse(items.begin(), items.end());
for (auto idx : items) {
for (auto idx : qAsConst(items)) {
m_patternsModel->removeScene(idx);
}
btn_removeAll->setEnabled(m_patternsModel->rowCount(QModelIndex()) != 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment