Commit e6dc4cb3 authored by Laurent Montel's avatar Laurent Montel 😁

use constFirst

parent 7f56a6f0
...@@ -176,7 +176,7 @@ bool MyTreeView::performDrag() ...@@ -176,7 +176,7 @@ bool MyTreeView::performDrag()
} }
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
drag->setMimeData(model()->mimeData(indexes)); drag->setMimeData(model()->mimeData(indexes));
QModelIndex ix = indexes.first(); QModelIndex ix = indexes.constFirst();
if (ix.isValid()) { if (ix.isValid()) {
QIcon icon = ix.data(AbstractProjectItem::DataThumbnail).value<QIcon>(); QIcon icon = ix.data(AbstractProjectItem::DataThumbnail).value<QIcon>();
QPixmap pix = icon.pixmap(iconSize()); QPixmap pix = icon.pixmap(iconSize());
...@@ -936,7 +936,7 @@ const QStringList Bin::getFolderInfo(const QModelIndex &selectedIx) ...@@ -936,7 +936,7 @@ const QStringList Bin::getFolderInfo(const QModelIndex &selectedIx)
folderInfo << QString(); folderInfo << QString();
return folderInfo; return folderInfo;
} }
QModelIndex ix = indexes.first(); QModelIndex ix = indexes.constFirst();
if (ix.isValid() && (m_proxyModel->selectionModel()->isSelected(ix) || selectedIx.isValid())) { if (ix.isValid() && (m_proxyModel->selectionModel()->isSelected(ix) || selectedIx.isValid())) {
AbstractProjectItem *currentItem = static_cast<AbstractProjectItem *>(m_proxyModel->mapToSource(ix).internalPointer()); AbstractProjectItem *currentItem = static_cast<AbstractProjectItem *>(m_proxyModel->mapToSource(ix).internalPointer());
while (currentItem->itemType() != AbstractProjectItem::FolderItem) { while (currentItem->itemType() != AbstractProjectItem::FolderItem) {
...@@ -2808,7 +2808,7 @@ void Bin::droppedUrls(const QList<QUrl> &urls, const QStringList &folderInfo) ...@@ -2808,7 +2808,7 @@ void Bin::droppedUrls(const QList<QUrl> &urls, const QStringList &folderInfo)
current = m_proxyModel->mapToSource(m_proxyModel->selectionModel()->currentIndex()); current = m_proxyModel->mapToSource(m_proxyModel->selectionModel()->currentIndex());
} else { } else {
// get index for folder // get index for folder
current = getIndexForId(folderInfo.first(), true); current = getIndexForId(folderInfo.constFirst(), true);
} }
slotItemDropped(urls, current); slotItemDropped(urls, current);
} }
...@@ -3409,7 +3409,7 @@ void Bin::slotLoadClipMarkers(const QString &id) ...@@ -3409,7 +3409,7 @@ void Bin::slotLoadClipMarkers(const QString &id)
QStringList selection = fd->selectedFiles(); QStringList selection = fd->selectedFiles();
QString url; QString url;
if (!selection.isEmpty()) { if (!selection.isEmpty()) {
url = selection.first(); url = selection.constFirst();
} }
//QUrl url = KFileDialog::getOpenUrl(QUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Load marker file")); //QUrl url = KFileDialog::getOpenUrl(QUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Load marker file"));
...@@ -3502,7 +3502,7 @@ void Bin::slotSaveClipMarkers(const QString &id) ...@@ -3502,7 +3502,7 @@ void Bin::slotSaveClipMarkers(const QString &id)
QStringList selection = fd->selectedFiles(); QStringList selection = fd->selectedFiles();
QString url; QString url;
if (!selection.isEmpty()) { if (!selection.isEmpty()) {
url = selection.first(); url = selection.constFirst();
} }
//QString url = KFileDialog::getSaveFileName(QUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save markers")); //QString url = KFileDialog::getSaveFileName(QUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save markers"));
if (url.isEmpty()) { if (url.isEmpty()) {
...@@ -4009,7 +4009,7 @@ void Bin::saveZone(const QStringList &info, const QDir &dir) ...@@ -4009,7 +4009,7 @@ void Bin::saveZone(const QStringList &info, const QDir &dir)
if (info.size() != 3) { if (info.size() != 3) {
return; return;
} }
ProjectClip *clip = getBinClip(info.first()); ProjectClip *clip = getBinClip(info.constFirst());
if (clip && clip->controller()) { if (clip && clip->controller()) {
QPoint zone(info.at(1).toInt(), info.at(2).toInt()); QPoint zone(info.at(1).toInt(), info.at(2).toInt());
clip->controller()->saveZone(zone, dir); clip->controller()->saveZone(zone, dir);
......
...@@ -170,7 +170,7 @@ QUrl Generators::getSavedClip(QString clipFolder) ...@@ -170,7 +170,7 @@ QUrl Generators::getSavedClip(QString clipFolder)
if (fd.exec() != QDialog::Accepted || fd.selectedUrls().isEmpty()) { if (fd.exec() != QDialog::Accepted || fd.selectedUrls().isEmpty()) {
return QUrl(); return QUrl();
} }
QUrl url = fd.selectedUrls().first(); QUrl url = fd.selectedUrls().constFirst();
if (url.isValid()) { if (url.isValid()) {
#if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5 #if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5
......
...@@ -550,7 +550,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QStringList ...@@ -550,7 +550,7 @@ void ClipCreationDialog::createClipsCommand(KdenliveDoc *doc, const QStringList
KdenliveSettings::setAutoimagetransparency(c->isChecked()); KdenliveSettings::setAutoimagetransparency(c->isChecked());
list = fileWidget->selectedUrls(); list = fileWidget->selectedUrls();
if (!list.isEmpty()) { if (!list.isEmpty()) {
KRecentDirs::add(QStringLiteral(":KdenliveClipFolder"), list.first().adjusted(QUrl::RemoveFilename).toLocalFile()); KRecentDirs::add(QStringLiteral(":KdenliveClipFolder"), list.constFirst().adjusted(QUrl::RemoveFilename).toLocalFile());
} }
if (b->isChecked() && list.count() == 1) { if (b->isChecked() && list.count() == 1) {
// Check for image sequence // Check for image sequence
......
...@@ -961,7 +961,7 @@ void RenderWidget::focusFirstVisibleItem(const QString &profile) ...@@ -961,7 +961,7 @@ void RenderWidget::focusFirstVisibleItem(const QString &profile)
if (!profile.isEmpty()) { if (!profile.isEmpty()) {
QList<QTreeWidgetItem *> items = m_view.formats->findItems(profile, Qt::MatchExactly | Qt::MatchRecursive); QList<QTreeWidgetItem *> items = m_view.formats->findItems(profile, Qt::MatchExactly | Qt::MatchRecursive);
if (!items.isEmpty()) { if (!items.isEmpty()) {
item = items.first(); item = items.constFirst();
} }
} }
if (!item) { if (!item) {
...@@ -1723,7 +1723,7 @@ void RenderWidget::refreshParams() ...@@ -1723,7 +1723,7 @@ void RenderWidget::refreshParams()
QStringList qs = item->data(0, BitratesRole).toStringList(); QStringList qs = item->data(0, BitratesRole).toStringList();
if (qs.count() > 1) { if (qs.count() > 1) {
quality = true; quality = true;
int qmax = qs.first().toInt(); int qmax = qs.constFirst().toInt();
int qmin = qs.last().toInt(); int qmin = qs.last().toInt();
if (qmax < qmin) { if (qmax < qmin) {
// always show best quality on right // always show best quality on right
...@@ -1749,7 +1749,7 @@ void RenderWidget::refreshParams() ...@@ -1749,7 +1749,7 @@ void RenderWidget::refreshParams()
QStringList qs = item->data(0, AudioBitratesRole).toStringList(); QStringList qs = item->data(0, AudioBitratesRole).toStringList();
if (qs.count() > 1) { if (qs.count() > 1) {
quality = true; quality = true;
int qmax = qs.first().toInt(); int qmax = qs.constFirst().toInt();
int qmin = qs.last().toInt(); int qmin = qs.last().toInt();
if (qmax < qmin) { if (qmax < qmin) {
m_view.audio->setRange(qmax, qmin); m_view.audio->setRange(qmax, qmin);
......
...@@ -221,8 +221,8 @@ void CollapsibleEffect::slotCreateRegion() ...@@ -221,8 +221,8 @@ void CollapsibleEffect::slotCreateRegion()
QPointer<QFileDialog> d = new QFileDialog(QApplication::activeWindow(), QString(), clipFolder, dialogFilter); QPointer<QFileDialog> d = new QFileDialog(QApplication::activeWindow(), QString(), clipFolder, dialogFilter);
d->setFileMode(QFileDialog::ExistingFile); d->setFileMode(QFileDialog::ExistingFile);
if (d->exec() == QDialog::Accepted && !d->selectedUrls().isEmpty()) { if (d->exec() == QDialog::Accepted && !d->selectedUrls().isEmpty()) {
KRecentDirs::add(QStringLiteral(":KdenliveClipFolder"), d->selectedUrls().first().adjusted(QUrl::RemoveFilename).toLocalFile()); KRecentDirs::add(QStringLiteral(":KdenliveClipFolder"), d->selectedUrls().constFirst().adjusted(QUrl::RemoveFilename).toLocalFile());
emit createRegion(effectIndex(), d->selectedUrls().first()); emit createRegion(effectIndex(), d->selectedUrls().constFirst());
} }
delete d; delete d;
} }
......
...@@ -375,7 +375,7 @@ void CollapsibleGroup::dropEvent(QDropEvent *event) ...@@ -375,7 +375,7 @@ void CollapsibleGroup::dropEvent(QDropEvent *event)
emit moveEffect(pastedEffectIndexes, currentEffectIndexes.last(), pasteInfo.groupIndex, pasteInfo.groupName); emit moveEffect(pastedEffectIndexes, currentEffectIndexes.last(), pasteInfo.groupIndex, pasteInfo.groupName);
} else { } else {
// Group moved before current one // Group moved before current one
emit moveEffect(pastedEffectIndexes, currentEffectIndexes.first(), pasteInfo.groupIndex, pasteInfo.groupName); emit moveEffect(pastedEffectIndexes, currentEffectIndexes.constFirst(), pasteInfo.groupIndex, pasteInfo.groupName);
} }
event->setDropAction(Qt::MoveAction); event->setDropAction(Qt::MoveAction);
event->accept(); event->accept();
......
...@@ -864,7 +864,7 @@ void EffectStackView2::slotAddEffect(const QDomElement &effect) ...@@ -864,7 +864,7 @@ void EffectStackView2::slotAddEffect(const QDomElement &effect)
void EffectStackView2::slotMoveEffectUp(const QList<int> &indexes, bool up) void EffectStackView2::slotMoveEffectUp(const QList<int> &indexes, bool up)
{ {
if (up && indexes.first() <= 1) { if (up && indexes.constFirst() <= 1) {
return; return;
} }
if (!up && indexes.last() >= m_currentEffectList.count()) { if (!up && indexes.last() >= m_currentEffectList.count()) {
...@@ -872,7 +872,7 @@ void EffectStackView2::slotMoveEffectUp(const QList<int> &indexes, bool up) ...@@ -872,7 +872,7 @@ void EffectStackView2::slotMoveEffectUp(const QList<int> &indexes, bool up)
} }
int endPos; int endPos;
if (up) { if (up) {
endPos = getPreviousIndex(indexes.first()); endPos = getPreviousIndex(indexes.constFirst());
} else { } else {
endPos = getNextIndex(indexes.last()); endPos = getNextIndex(indexes.last());
} }
......
...@@ -606,7 +606,7 @@ void GraphicsSceneRectMove::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e) ...@@ -606,7 +606,7 @@ void GraphicsSceneRectMove::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e)
} }
int ix = 1; int ix = 1;
QGraphicsItem *g = i.first(); QGraphicsItem *g = i.constFirst();
while (!(g->flags() & QGraphicsItem::ItemIsSelectable) && ix < i.count()) { while (!(g->flags() & QGraphicsItem::ItemIsSelectable) && ix < i.count()) {
g = i.at(ix); g = i.at(ix);
ix++; ix++;
...@@ -640,7 +640,7 @@ void GraphicsSceneRectMove::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) ...@@ -640,7 +640,7 @@ void GraphicsSceneRectMove::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
} }
QList<QGraphicsView*> viewlist = views(); QList<QGraphicsView*> viewlist = views();
if (!viewlist.isEmpty()) { if (!viewlist.isEmpty()) {
viewlist.first()->setDragMode(QGraphicsView::RubberBandDrag); viewlist.constFirst()->setDragMode(QGraphicsView::RubberBandDrag);
} }
emit actionFinished(); emit actionFinished();
} }
...@@ -651,7 +651,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e) ...@@ -651,7 +651,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
clearTextSelection(); clearTextSelection();
QList<QGraphicsView*> viewlist = views(); QList<QGraphicsView*> viewlist = views();
if (!viewlist.isEmpty()) { if (!viewlist.isEmpty()) {
viewlist.first()->setDragMode(QGraphicsView::ScrollHandDrag); viewlist.constFirst()->setDragMode(QGraphicsView::ScrollHandDrag);
m_pan = true; m_pan = true;
e->accept(); e->accept();
QGraphicsScene::mousePressEvent(e); QGraphicsScene::mousePressEvent(e);
...@@ -670,14 +670,14 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e) ...@@ -670,14 +670,14 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
if (e->modifiers() & Qt::ControlModifier) { if (e->modifiers() & Qt::ControlModifier) {
clearTextSelection(); clearTextSelection();
if (!viewlist.isEmpty()) { if (!viewlist.isEmpty()) {
viewlist.first()->setDragMode(QGraphicsView::ScrollHandDrag); viewlist.constFirst()->setDragMode(QGraphicsView::ScrollHandDrag);
e->ignore(); e->ignore();
//QGraphicsScene::mousePressEvent(e); //QGraphicsScene::mousePressEvent(e);
return; return;
} }
} else { } else {
if (!viewlist.isEmpty()) { if (!viewlist.isEmpty()) {
viewlist.first()->setRubberBandSelectionMode(Qt::IntersectsItemShape); viewlist.constFirst()->setRubberBandSelectionMode(Qt::IntersectsItemShape);
} }
} }
bool alreadySelected = false; bool alreadySelected = false;
...@@ -795,7 +795,7 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e) ...@@ -795,7 +795,7 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
e->ignore(); e->ignore();
return; return;
} }
QGraphicsView *view = viewlist.first(); QGraphicsView *view = viewlist.constFirst();
if (m_pan) { if (m_pan) {
QPoint diff = e->lastScreenPos() - e->screenPos(); QPoint diff = e->lastScreenPos() - e->screenPos();
view->horizontalScrollBar()->setValue(view->horizontalScrollBar()->value() + diff.x()); view->horizontalScrollBar()->setValue(view->horizontalScrollBar()->value() + diff.x());
......
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
{ {
int intervals = m_intervals = a.size() - 1; int intervals = m_intervals = a.size() - 1;
int i; int i;
m_begin = a.first().x(); m_begin = a.constFirst().x();
m_end = a.last().x(); m_end = a.last().x();
m_a.clear(); m_a.clear();
......
...@@ -1865,7 +1865,7 @@ void MainWindow::addTimelineClip(const QString &url) ...@@ -1865,7 +1865,7 @@ void MainWindow::addTimelineClip(const QString &url)
if (pCore->projectManager()->current()) { if (pCore->projectManager()->current()) {
QStringList ids = pCore->binController()->getBinIdsByResource(QFileInfo(url)); QStringList ids = pCore->binController()->getBinIdsByResource(QFileInfo(url));
if (!ids.isEmpty()) { if (!ids.isEmpty()) {
pCore->bin()->selectClipById(ids.first()); pCore->bin()->selectClipById(ids.constFirst());
slotInsertClipInsert(); slotInsertClipInsert();
} }
} }
......
...@@ -1036,7 +1036,7 @@ void Monitor::slotExtractCurrentFrame(QString frameName, bool addToProject) ...@@ -1036,7 +1036,7 @@ void Monitor::slotExtractCurrentFrame(QString frameName, bool addToProject)
fs->selectFile(frameName); fs->selectFile(frameName);
if (fs->exec()) { if (fs->exec()) {
if (!fs->selectedFiles().isEmpty()) { if (!fs->selectedFiles().isEmpty()) {
QUrl savePath = fs->selectedUrls().first(); QUrl savePath = fs->selectedUrls().constFirst();
if (QFile::exists(savePath.toLocalFile()) && KMessageBox::warningYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", savePath.toLocalFile())) == KMessageBox::No) { if (QFile::exists(savePath.toLocalFile()) && KMessageBox::warningYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", savePath.toLocalFile())) == KMessageBox::No) {
delete fs; delete fs;
slotExtractCurrentFrame(savePath.fileName(), addToProject); slotExtractCurrentFrame(savePath.fileName(), addToProject);
......
...@@ -270,7 +270,7 @@ bool OnMonitorCornersItem::getView() ...@@ -270,7 +270,7 @@ bool OnMonitorCornersItem::getView()
} }
if (scene() && !scene()->views().isEmpty()) { if (scene() && !scene()->views().isEmpty()) {
m_view = scene()->views().first(); m_view = scene()->views().constFirst();
return true; return true;
} else { } else {
return false; return false;
......
...@@ -199,7 +199,7 @@ bool OnMonitorPathItem::getView() ...@@ -199,7 +199,7 @@ bool OnMonitorPathItem::getView()
} }
if (scene() && !scene()->views().isEmpty()) { if (scene() && !scene()->views().isEmpty()) {
m_view = scene()->views().first(); m_view = scene()->views().constFirst();
return true; return true;
} else { } else {
return false; return false;
......
...@@ -290,7 +290,7 @@ bool OnMonitorRectItem::getView() ...@@ -290,7 +290,7 @@ bool OnMonitorRectItem::getView()
} }
if (scene() && !scene()->views().isEmpty()) { if (scene() && !scene()->views().isEmpty()) {
m_view = scene()->views().first(); m_view = scene()->views().constFirst();
return true; return true;
} else { } else {
return false; return false;
......
...@@ -39,7 +39,7 @@ BPointItem::BPointItem(const BPoint &point, QGraphicsItem *parent) : ...@@ -39,7 +39,7 @@ BPointItem::BPointItem(const BPoint &point, QGraphicsItem *parent) :
m_point.h2 = mapFromScene(point.h2); m_point.h2 = mapFromScene(point.h2);
m_point.handlesLinked = false; m_point.handlesLinked = false;
m_view = scene()->views().first(); m_view = scene()->views().constFirst();
} }
BPoint BPointItem::getPoint() const BPoint BPointItem::getPoint() const
......
...@@ -186,7 +186,7 @@ void SplineItem::mousePressEvent(QGraphicsSceneMouseEvent *event) ...@@ -186,7 +186,7 @@ void SplineItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (close || event->button() == Qt::RightButton) { if (close || event->button() == Qt::RightButton) {
if (items.count() > 1) { if (items.count() > 1) {
// close the spline // close the spline
BPointItem *i1 = qgraphicsitem_cast<BPointItem *>(items.first()); BPointItem *i1 = qgraphicsitem_cast<BPointItem *>(items.constFirst());
BPointItem *i2 = qgraphicsitem_cast<BPointItem *>(items.last()); BPointItem *i2 = qgraphicsitem_cast<BPointItem *>(items.last());
BPoint p1 = i1->getPoint(); BPoint p1 = i1->getPoint();
BPoint p2 = i2->getPoint(); BPoint p2 = i2->getPoint();
......
...@@ -45,14 +45,14 @@ ClipStabilize::ClipStabilize(const QStringList &urls, const QString &filterName, ...@@ -45,14 +45,14 @@ ClipStabilize::ClipStabilize(const QStringList &urls, const QString &filterName,
setStyleSheet(stylesheet); setStyleSheet(stylesheet);
if (m_urls.count() == 1) { if (m_urls.count() == 1) {
QString newFile = m_urls.first(); QString newFile = m_urls.constFirst();
newFile.append(QStringLiteral(".mlt")); newFile.append(QStringLiteral(".mlt"));
dest_url->setMode(KFile::File); dest_url->setMode(KFile::File);
dest_url->setUrl(QUrl(newFile)); dest_url->setUrl(QUrl(newFile));
} else { } else {
label_dest->setText(i18n("Destination folder")); label_dest->setText(i18n("Destination folder"));
dest_url->setMode(KFile::Directory | KFile::ExistingOnly); dest_url->setMode(KFile::Directory | KFile::ExistingOnly);
dest_url->setUrl(QUrl(m_urls.first()).adjusted(QUrl::RemoveFilename)); dest_url->setUrl(QUrl(m_urls.constFirst()).adjusted(QUrl::RemoveFilename));
} }
if (m_filtername == QLatin1String("vidstab") || m_filtername == QLatin1String("videostab2")) { if (m_filtername == QLatin1String("vidstab") || m_filtername == QLatin1String("videostab2")) {
......
...@@ -46,7 +46,7 @@ ClipTranscode::ClipTranscode(const QStringList &urls, const QString &params, con ...@@ -46,7 +46,7 @@ ClipTranscode::ClipTranscode(const QStringList &urls, const QString &params, con
auto_add->setChecked(KdenliveSettings::add_new_clip()); auto_add->setChecked(KdenliveSettings::add_new_clip());
if (m_urls.count() == 1) { if (m_urls.count() == 1) {
QString fileName = m_urls.first(); QString fileName = m_urls.constFirst();
source_url->setUrl(QUrl::fromLocalFile(fileName)); source_url->setUrl(QUrl::fromLocalFile(fileName));
dest_url->setMode(KFile::File); dest_url->setMode(KFile::File);
#if KXMLGUI_VERSION_MINOR > 32 || KXMLGUI_VERSION_MAJOR > 5 #if KXMLGUI_VERSION_MINOR > 32 || KXMLGUI_VERSION_MAJOR > 5
...@@ -64,7 +64,7 @@ ClipTranscode::ClipTranscode(const QStringList &urls, const QString &params, con ...@@ -64,7 +64,7 @@ ClipTranscode::ClipTranscode(const QStringList &urls, const QString &params, con
source_url->setHidden(true); source_url->setHidden(true);
label_dest->setText(i18n("Destination folder")); label_dest->setText(i18n("Destination folder"));
dest_url->setMode(KFile::Directory); dest_url->setMode(KFile::Directory);
dest_url->setUrl(QUrl::fromLocalFile(m_urls.first()).adjusted(QUrl::RemoveFilename)); dest_url->setUrl(QUrl::fromLocalFile(m_urls.constFirst()).adjusted(QUrl::RemoveFilename));
dest_url->setMode(KFile::Directory | KFile::ExistingOnly); dest_url->setMode(KFile::Directory | KFile::ExistingOnly);
for (int i = 0; i < m_urls.count(); ++i) { for (int i = 0; i < m_urls.count(); ++i) {
urls_list->addItem(m_urls.at(i)); urls_list->addItem(m_urls.at(i));
......
...@@ -395,7 +395,7 @@ QHash<ProjectClip *, AbstractClipJob *> CutClipJob::prepareTranscodeJob(double f ...@@ -395,7 +395,7 @@ QHash<ProjectClip *, AbstractClipJob *> CutClipJob::prepareTranscodeJob(double f
d->setWindowTitle(i18n("Transcoding")); d->setWindowTitle(i18n("Transcoding"));
ui.extra_params->setMaximumHeight(QFontMetrics(qApp->font()).lineSpacing() * 5); ui.extra_params->setMaximumHeight(QFontMetrics(qApp->font()).lineSpacing() * 5);
if (clips.count() == 1) { if (clips.count() == 1) {
ui.file_url->setUrl(QUrl(destinations.first())); ui.file_url->setUrl(QUrl(destinations.constFirst()));
} else { } else {
ui.destination_label->setVisible(false); ui.destination_label->setVisible(false);
ui.file_url->setVisible(false); ui.file_url->setVisible(false);
......
...@@ -65,7 +65,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec ...@@ -65,7 +65,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec
for (int i = 0; i < clips.count(); i++) { for (int i = 0; i < clips.count(); i++) {
sources << clips.at(i)->url(); sources << clips.at(i)->url();
} }
QString filterName = parameters.first(); QString filterName = parameters.constFirst();
if (filterName == QLatin1String("timewarp")) { if (filterName == QLatin1String("timewarp")) {
QMap<QString, QString> producerParams = QMap<QString, QString> (); QMap<QString, QString> producerParams = QMap<QString, QString> ();
QMap<QString, QString> filterParams = QMap<QString, QString> (); QMap<QString, QString> filterParams = QMap<QString, QString> ();
...@@ -77,7 +77,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec ...@@ -77,7 +77,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec
// Reverse clip using project profile since playlists can only be included with same fps // Reverse clip using project profile since playlists can only be included with same fps
// extraParams.insert(QStringLiteral("producer_profile"), QStringLiteral("1")); // extraParams.insert(QStringLiteral("producer_profile"), QStringLiteral("1"));
bool multipleSelection = clips.count() > 1; bool multipleSelection = clips.count() > 1;
QPointer<ClipSpeed> d = new ClipSpeed(clips.count() == 1 ? QUrl::fromLocalFile(sources.first() + QStringLiteral(".mlt")) : QUrl::fromLocalFile(sources.first()).adjusted(QUrl::RemoveFilename), multipleSelection, QApplication::activeWindow()); QPointer<ClipSpeed> d = new ClipSpeed(clips.count() == 1 ? QUrl::fromLocalFile(sources.constFirst() + QStringLiteral(".mlt")) : QUrl::fromLocalFile(sources.constFirst()).adjusted(QUrl::RemoveFilename), multipleSelection, QApplication::activeWindow());
if (d->exec() == QDialog::Accepted) { if (d->exec() == QDialog::Accepted) {
QLocale locale; QLocale locale;
QString speedString = QStringLiteral("timewarp:%1:").arg(locale.toString(d->speed() / 100)); QString speedString = QStringLiteral("timewarp:%1:").arg(locale.toString(d->speed() / 100));
...@@ -202,7 +202,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec ...@@ -202,7 +202,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec
// vidstab // vidstab
int out = 100000; int out = 100000;
if (clips.count() == 1) { if (clips.count() == 1) {
out = clips.first()->duration().frames(KdenliveSettings::project_fps()); out = clips.constFirst()->duration().frames(KdenliveSettings::project_fps());
} }
QPointer<ClipStabilize> d = new ClipStabilize(sources, filterName, out); QPointer<ClipStabilize> d = new ClipStabilize(sources, filterName, out);
if (d->exec() == QDialog::Accepted) { if (d->exec() == QDialog::Accepted) {
......
...@@ -264,7 +264,7 @@ void JobManager::prepareJobs(const QList<ProjectClip *> &clips, double fps, Abst ...@@ -264,7 +264,7 @@ void JobManager::prepareJobs(const QList<ProjectClip *> &clips, double fps, Abst
if (jobType == AbstractClipJob::TRANSCODEJOB) { if (jobType == AbstractClipJob::TRANSCODEJOB) {
jobs = CutClipJob::prepareTranscodeJob(fps, matching, params); jobs = CutClipJob::prepareTranscodeJob(fps, matching, params);
} else if (jobType == AbstractClipJob::CUTJOB) { } else if (jobType == AbstractClipJob::CUTJOB) {
ProjectClip *clip = matching.first(); ProjectClip *clip = matching.constFirst();
double originalFps = clip->getOriginalFps(); double originalFps = clip->getOriginalFps();
jobs = CutClipJob::prepareCutClipJob(fps, originalFps, clip); jobs = CutClipJob::prepareCutClipJob(fps, originalFps, clip);
} else if (jobType == AbstractClipJob::ANALYSECLIPJOB) { } else if (jobType == AbstractClipJob::ANALYSECLIPJOB) {
......
...@@ -160,9 +160,9 @@ AddMarkerCommand::AddMarkerCommand(ProjectClip *clip, QList<CommentedTime> &oldM ...@@ -160,9 +160,9 @@ AddMarkerCommand::AddMarkerCommand(ProjectClip *clip, QList<CommentedTime> &oldM
if (m_newMarkers.isEmpty()) { if (m_newMarkers.isEmpty()) {
return; return;
} }
if (m_newMarkers.first().markerType() < 0) { if (m_newMarkers.constFirst().markerType() < 0) {
setText(i18n("Delete marker")); setText(i18n("Delete marker"));
} else if (m_oldMarkers.first().comment().isEmpty()) { } else if (m_oldMarkers.constFirst().comment().isEmpty()) {
setText(i18n("Add marker")); setText(i18n("Add marker"));
} else { } else {
setText(i18n("Edit marker")); setText(i18n("Edit marker"));
......
...@@ -347,7 +347,7 @@ bool ProjectManager::saveFileAs() ...@@ -347,7 +347,7 @@ bool ProjectManager::saveFileAs()
if (fd.exec() != QDialog::Accepted || fd.selectedFiles().isEmpty()) { if (fd.exec() != QDialog::Accepted || fd.selectedFiles().isEmpty()) {
return false; return false;
} }
QString outputFile = fd.selectedFiles().first(); QString outputFile = fd.selectedFiles().constFirst();
#if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5 #if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5
// Since Plasma 5.7 (release at same time as KF 5.23, // Since Plasma 5.7 (release at same time as KF 5.23,
......
...@@ -1732,7 +1732,7 @@ void ClipItem::dropEvent(QGraphicsSceneDragDropEvent *event) ...@@ -1732,7 +1732,7 @@ void ClipItem::dropEvent(QGraphicsSceneDragDropEvent *event)
m_selectionTimer.stop(); m_selectionTimer.stop();
} }
event->acceptProposedAction(); event->acceptProposedAction();
CustomTrackView *view = static_cast<CustomTrackView *>(scene()->views().first()); CustomTrackView *view = static_cast<CustomTrackView *>(scene()->views().constFirst());
if (view) { if (view) {
QString geometry = QString::fromUtf8(event->mimeData()->data(QStringLiteral("kdenlive/geometry"))); QString geometry = QString::fromUtf8(event->mimeData()->data(QStringLiteral("kdenlive/geometry")));
view->dropClipGeometry(this, geometry); view->dropClipGeometry(this, geometry);
...@@ -1759,7 +1759,7 @@ void ClipItem::dropEvent(QGraphicsSceneDragDropEvent *event) ...@@ -1759,7 +1759,7 @@ void ClipItem::dropEvent(QGraphicsSceneDragDropEvent *event)
// single effect dropped // single effect dropped
e.removeAttribute(QStringLiteral("kdenlive_ix")); e.removeAttribute(QStringLiteral("kdenlive_ix"));
} }
CustomTrackView *view = static_cast<CustomTrackView *>(scene()->views().first()); CustomTrackView *view = static_cast<CustomTrackView *>(scene()->views().constFirst());
if (view) { if (view) {
if (transitionDrop) { if (transitionDrop) {
view->slotDropTransition(this, e, event->scenePos()); view->slotDropTransition(this, e, event->scenePos());
......
...@@ -682,7 +682,7 @@ QList<int> CustomRuler::addChunks(QList<int> chunks, bool add) ...@@ -682,7 +682,7 @@ QList<int> CustomRuler::addChunks(QList<int> chunks, bool add)
std::sort(m_renderingPreviews.begin(), m_renderingPreviews.end()); std::sort(m_renderingPreviews.begin(), m_renderingPreviews.end());
std::sort(m_dirtyRenderingPreviews.begin(), m_dirtyRenderingPreviews.end()); std::sort(m_dirtyRenderingPreviews.begin(), m_dirtyRenderingPreviews.end());
if (!m_hidePreview) { if (!m_hidePreview) {
update(chunks.first() * m_factor - offset(), MAX_HEIGHT, (chunks.last() - chunks.first()) * KdenliveSettings::timelinechunks() * m_factor + 1, PREVIEW_SIZE); update(chunks.constFirst() * m_factor - offset(), MAX_HEIGHT, (chunks.last() - chunks.constFirst()) * KdenliveSettings::timelinechunks() * m_factor + 1, PREVIEW_SIZE);
} }
return toProcess; return toProcess;
} }
......
...@@ -471,7 +471,7 @@ void PreviewManager::slotProcessDirtyChunks() ...@@ -471,7 +471,7 @@ void PreviewManager::slotProcessDirtyChunks()
return; return;
} }
invalidatePreviews(chunks); invalidatePreviews(chunks);
m_ruler->updatePreviewDisplay(chunks.first(), chunks.last()); m_ruler->updatePreviewDisplay(chunks.constFirst(), chunks.last());
if (KdenliveSettings::autopreview()) { if (KdenliveSettings::autopreview()) {
m_previewTimer.start(); m_previewTimer.start();
} }
...@@ -544,7 +544,7 @@ void PreviewManager::reloadChunks(const QList<int> &chunks) ...@@ -544,7 +544,7 @@ void PreviewManager::reloadChunks(const QList<int> &chunks)
} }
} }
} }
m_ruler->updatePreviewDisplay(chunks.first(), chunks.last()); m_ruler->updatePreviewDisplay(chunks.constFirst(), chunks.last());
m_previewTrack->consolidate_blanks(); m_previewTrack->consolidate_blanks();
m_tractor->unlock(); m_tractor->unlock();
} }
......