From 019c4b3da3a4a03750f23f75f6d5d8e366f3a219 Mon Sep 17 00:00:00 2001 From: HeCorr Date: Fri, 26 Jul 2024 18:36:50 -0300 Subject: [PATCH 1/8] fix incorrect-emit warnings https://github.com/KDE/clazy/blob/1.11/docs/checks/README-incorrect-emit.md --- app/src/repositionframesdialog.cpp | 2 +- core_lib/src/interface/backupelement.cpp | 6 +++--- core_lib/src/interface/editor.cpp | 2 +- core_lib/src/interface/scribblearea.cpp | 8 ++++---- core_lib/src/managers/layermanager.cpp | 2 +- core_lib/src/structure/pegbaraligner.cpp | 2 +- core_lib/src/tool/movetool.cpp | 2 +- core_lib/src/tool/smudgetool.cpp | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/repositionframesdialog.cpp b/app/src/repositionframesdialog.cpp index 159cc66ee9..5ef54dc7fe 100644 --- a/app/src/repositionframesdialog.cpp +++ b/app/src/repositionframesdialog.cpp @@ -190,7 +190,7 @@ void RepositionFramesDialog::updateLayersBox() void RepositionFramesDialog::closeClicked() { - rejected(); + emit rejected(); } void RepositionFramesDialog::updateLayersToSelect() diff --git a/core_lib/src/interface/backupelement.cpp b/core_lib/src/interface/backupelement.cpp index c30487a267..b4718a7b5a 100644 --- a/core_lib/src/interface/backupelement.cpp +++ b/core_lib/src/interface/backupelement.cpp @@ -60,7 +60,7 @@ void BackupBitmapElement::restore(Editor* editor) selectMan->calculateSelectionTransformation(); - editor->frameModified(this->frame); + emit editor->frameModified(this->frame); } void BackupVectorElement::restore(Editor* editor) @@ -109,7 +109,7 @@ void BackupVectorElement::restore(Editor* editor) selectMan->setTranslation(translation); selectMan->calculateSelectionTransformation(); - editor->frameModified(this->frame); + emit editor->frameModified(this->frame); } @@ -122,7 +122,7 @@ void BackupSoundElement::restore(Editor* editor) if (editor->currentFrame() != this->frame) { editor->scrubTo(this->frame); } - editor->frameModified(this->frame); + emit editor->frameModified(this->frame); // TODO: soundclip won't restore if overlapping on first frame if (this->frame > 0 && layer->getKeyFrameAt(this->frame) == nullptr) diff --git a/core_lib/src/interface/editor.cpp b/core_lib/src/interface/editor.cpp index b997168995..41df9cc3f8 100644 --- a/core_lib/src/interface/editor.cpp +++ b/core_lib/src/interface/editor.cpp @@ -549,7 +549,7 @@ void Editor::copyAndCut() for (int pos : currentLayer->selectedKeyFramesPositions()) { currentLayer->removeKeyFrame(pos); } - layers()->currentLayerChanged(currentLayerIndex()); + emit layers()->currentLayerChanged(currentLayerIndex()); emit updateTimeLine(); return; } diff --git a/core_lib/src/interface/scribblearea.cpp b/core_lib/src/interface/scribblearea.cpp index dbaa429841..26046470e9 100644 --- a/core_lib/src/interface/scribblearea.cpp +++ b/core_lib/src/interface/scribblearea.cpp @@ -442,22 +442,22 @@ void ScribbleArea::keyEventForSelection(QKeyEvent* event) case Qt::Key_Right: selectMan->translate(QPointF(1, 0)); selectMan->calculateSelectionTransformation(); - mEditor->frameModified(mEditor->currentFrame()); + emit mEditor->frameModified(mEditor->currentFrame()); return; case Qt::Key_Left: selectMan->translate(QPointF(-1, 0)); selectMan->calculateSelectionTransformation(); - mEditor->frameModified(mEditor->currentFrame()); + emit mEditor->frameModified(mEditor->currentFrame()); return; case Qt::Key_Up: selectMan->translate(QPointF(0, -1)); selectMan->calculateSelectionTransformation(); - mEditor->frameModified(mEditor->currentFrame()); + emit mEditor->frameModified(mEditor->currentFrame()); return; case Qt::Key_Down: selectMan->translate(QPointF(0, 1)); selectMan->calculateSelectionTransformation(); - mEditor->frameModified(mEditor->currentFrame()); + emit mEditor->frameModified(mEditor->currentFrame()); return; case Qt::Key_Return: applyTransformedSelection(); diff --git a/core_lib/src/managers/layermanager.cpp b/core_lib/src/managers/layermanager.cpp index 927988f4b6..59bba305be 100644 --- a/core_lib/src/managers/layermanager.cpp +++ b/core_lib/src/managers/layermanager.cpp @@ -348,7 +348,7 @@ Status LayerManager::renameLayer(Layer* layer, const QString& newName) if (newName.isEmpty()) return Status::FAIL; layer->setName(newName); - currentLayerChanged(getIndex(layer)); + emit currentLayerChanged(getIndex(layer)); return Status::OK; } diff --git a/core_lib/src/structure/pegbaraligner.cpp b/core_lib/src/structure/pegbaraligner.cpp index 986bbfb7ec..359edd3fe3 100644 --- a/core_lib/src/structure/pegbaraligner.cpp +++ b/core_lib/src/structure/pegbaraligner.cpp @@ -67,7 +67,7 @@ Status PegBarAligner::align(const QStringList& layers) } img->moveTopLeft(QPoint(img->left() + (pegX - result.point.x()), img->top() + (pegY - result.point.y()))); - mEditor->frameModified(img->pos()); + emit mEditor->frameModified(img->pos()); } } diff --git a/core_lib/src/tool/movetool.cpp b/core_lib/src/tool/movetool.cpp index 8d0ce29a06..72e66315c6 100644 --- a/core_lib/src/tool/movetool.cpp +++ b/core_lib/src/tool/movetool.cpp @@ -172,7 +172,7 @@ void MoveTool::pointerReleaseEvent(PointerEvent*) return; mScribbleArea->updateToolCursor(); - mEditor->frameModified(mEditor->currentFrame()); + emit mEditor->frameModified(mEditor->currentFrame()); } void MoveTool::transformSelection(const QPointF& pos, Qt::KeyboardModifiers keyMod) diff --git a/core_lib/src/tool/smudgetool.cpp b/core_lib/src/tool/smudgetool.cpp index 9838a8f9d5..075c2a067d 100644 --- a/core_lib/src/tool/smudgetool.cpp +++ b/core_lib/src/tool/smudgetool.cpp @@ -182,7 +182,7 @@ void SmudgeTool::pointerPressEvent(PointerEvent* event) selectMan->vectorSelection.add(selectMan->closestCurves()); selectMan->vectorSelection.add(selectMan->closestVertices()); - mEditor->frameModified(mEditor->currentFrame()); + emit mEditor->frameModified(mEditor->currentFrame()); } else { From bc230520d3488e24cfc276641e13245d9f30eb13 Mon Sep 17 00:00:00 2001 From: HeCorr Date: Fri, 26 Jul 2024 18:45:29 -0300 Subject: [PATCH 2/8] remove unused parameter 'blitRect' from CameraTool::paint() --- core_lib/src/tool/cameratool.cpp | 2 +- core_lib/src/tool/cameratool.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core_lib/src/tool/cameratool.cpp b/core_lib/src/tool/cameratool.cpp index 20097a3fbb..e0d1045b89 100644 --- a/core_lib/src/tool/cameratool.cpp +++ b/core_lib/src/tool/cameratool.cpp @@ -438,7 +438,7 @@ void CameraTool::transformView(LayerCamera* layerCamera, CameraMoveType mode, co curCam->modification(); } -void CameraTool::paint(QPainter& painter, const QRect& blitRect) +void CameraTool::paint(QPainter& painter, const QRect&) { int frameIndex = mEditor->currentFrame(); LayerCamera* cameraLayerBelow = static_cast(mEditor->object()->getLayerBelow(mEditor->currentLayerIndex(), Layer::CAMERA)); diff --git a/core_lib/src/tool/cameratool.h b/core_lib/src/tool/cameratool.h index 819fc89893..62501bb1db 100644 --- a/core_lib/src/tool/cameratool.h +++ b/core_lib/src/tool/cameratool.h @@ -51,7 +51,7 @@ class CameraTool : public BaseTool QCursor cursor() override; ToolType type() override { return ToolType::CAMERA; } - void paint(QPainter& painter, const QRect& blitRect) override; + void paint(QPainter& painter, const QRect&) override; void loadSettings() override; From f4fb55bc4c95895d51eb550424428ba903bdfdb8 Mon Sep 17 00:00:00 2001 From: HeCorr Date: Fri, 26 Jul 2024 18:47:27 -0300 Subject: [PATCH 3/8] fix qstring-ref warnings https://github.com/KDE/clazy/blob/1.11/docs/checks/README-qstring-ref.md --- app/src/importimageseqdialog.cpp | 4 ++-- core_lib/src/movieexporter.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/importimageseqdialog.cpp b/app/src/importimageseqdialog.cpp index 86c4515913..b5dbd913d4 100644 --- a/app/src/importimageseqdialog.cpp +++ b/app/src/importimageseqdialog.cpp @@ -137,7 +137,7 @@ const PredefinedKeySet ImportImageSeqDialog::generatePredefinedKeySet() const for (int i = 0; i < filenames.size(); i++) { - const int& frameIndex = filenames[i].mid(setParams.dot - digits, digits).toInt(); + const int& frameIndex = filenames[i].midRef(setParams.dot - digits, digits).toInt(); const QString& absolutePath = folderPath + filenames[i]; keySet.insert(frameIndex, absolutePath); @@ -263,7 +263,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons { if (sList[i].startsWith(prefix) && sList[i].length() == validLength && - sList[i].mid(sList[i].lastIndexOf(".") - digits, digits).toInt() > 0 && + sList[i].midRef(sList[i].lastIndexOf(".") - digits, digits).toInt() > 0 && sList[i].endsWith(suffix)) { finalList.append(sList[i]); diff --git a/core_lib/src/movieexporter.cpp b/core_lib/src/movieexporter.cpp index 8be382c814..12885dba39 100644 --- a/core_lib/src/movieexporter.cpp +++ b/core_lib/src/movieexporter.cpp @@ -696,7 +696,7 @@ Status MovieExporter::executeFFMpegPipe(const QString& cmd, const QStringList& a } if(output.startsWith("frame=")) { - lastFrameProcessed = framesProcessed = output.mid(6, output.indexOf(' ')).toInt(); + lastFrameProcessed = framesProcessed = output.midRef(6, output.indexOf(' ')).toInt(); } } From 351d3894241afa4bc432e4e0e7de8498ca1e990e Mon Sep 17 00:00:00 2001 From: HeCorr Date: Fri, 26 Jul 2024 18:53:41 -0300 Subject: [PATCH 4/8] fix range-loop-reference warnings https://github.com/KDE/clazy/blob/1.11/docs/checks/README-range-loop-reference.md --- app/src/importimageseqdialog.cpp | 2 +- core_lib/src/structure/filemanager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/importimageseqdialog.cpp b/app/src/importimageseqdialog.cpp index b5dbd913d4..b04326a7ed 100644 --- a/app/src/importimageseqdialog.cpp +++ b/app/src/importimageseqdialog.cpp @@ -275,7 +275,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons dot = finalList[0].lastIndexOf("."); QStringList absolutePaths; - for (QString fileName : finalList) { + for (const QString &fileName : finalList) { absolutePaths << path + fileName; } diff --git a/core_lib/src/structure/filemanager.cpp b/core_lib/src/structure/filemanager.cpp index 4797215f61..5a696af457 100644 --- a/core_lib/src/structure/filemanager.cpp +++ b/core_lib/src/structure/filemanager.cpp @@ -562,7 +562,7 @@ int FileManager::countExistingBackups(const QString& fileName) const const QString& baseName = fileInfo.completeBaseName(); int backupCount = 0; - for (QFileInfo dirFileInfo : directory.entryInfoList(QDir::Filter::Files)) { + for (const QFileInfo &dirFileInfo : directory.entryInfoList(QDir::Filter::Files)) { QString searchFileBaseName = dirFileInfo.completeBaseName(); if (baseName.compare(searchFileBaseName) == 0 && searchFileBaseName.contains(PFF_BACKUP_IDENTIFIER)) { backupCount++; From 1bc9bcde32af64b81fa913b2349d526edc3d307c Mon Sep 17 00:00:00 2001 From: HeCorr Date: Fri, 26 Jul 2024 19:52:53 -0300 Subject: [PATCH 5/8] remove unused QStrings --- app/src/importimageseqdialog.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/src/importimageseqdialog.cpp b/app/src/importimageseqdialog.cpp index b04326a7ed..94e75aa595 100644 --- a/app/src/importimageseqdialog.cpp +++ b/app/src/importimageseqdialog.cpp @@ -187,8 +187,6 @@ void ImportImageSeqDialog::importArbitrarySequence() for (const QString& strImgFile : files) { - QString strImgFileLower = strImgFile.toLower(); - Status st = mEditor->importImage(strImgFile); if (!st.ok()) { @@ -225,7 +223,6 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons // local vars for testing file validity int dot = strFilePath.lastIndexOf("."); int slash = strFilePath.lastIndexOf("/"); - QString fName = strFilePath.mid(slash + 1); QString path = strFilePath.left(slash + 1); QString digit = strFilePath.mid(slash + 1, dot - slash - 1); @@ -338,7 +335,6 @@ QStringList ImportImageSeqDialog::getFilePaths() Status ImportImageSeqDialog::validateKeySet(const PredefinedKeySet& keySet, const QStringList& filepaths) { - QString msg = ""; QString failedPathsString; Status status = Status::OK; From 9fdf1127ea199df68927c99410c92f81a2f3b660 Mon Sep 17 00:00:00 2001 From: HeCorr Date: Fri, 26 Jul 2024 21:24:10 -0300 Subject: [PATCH 6/8] Revert "fix qstring-ref warnings" It seems that QString::midRef() was removed in Qt6 so I'm reverting commit f4fb55bc4c95895d51eb550424428ba903bdfdb8 --- app/src/importimageseqdialog.cpp | 4 ++-- core_lib/src/movieexporter.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/importimageseqdialog.cpp b/app/src/importimageseqdialog.cpp index 94e75aa595..667c5e337d 100644 --- a/app/src/importimageseqdialog.cpp +++ b/app/src/importimageseqdialog.cpp @@ -137,7 +137,7 @@ const PredefinedKeySet ImportImageSeqDialog::generatePredefinedKeySet() const for (int i = 0; i < filenames.size(); i++) { - const int& frameIndex = filenames[i].midRef(setParams.dot - digits, digits).toInt(); + const int& frameIndex = filenames[i].mid(setParams.dot - digits, digits).toInt(); const QString& absolutePath = folderPath + filenames[i]; keySet.insert(frameIndex, absolutePath); @@ -260,7 +260,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons { if (sList[i].startsWith(prefix) && sList[i].length() == validLength && - sList[i].midRef(sList[i].lastIndexOf(".") - digits, digits).toInt() > 0 && + sList[i].mid(sList[i].lastIndexOf(".") - digits, digits).toInt() > 0 && sList[i].endsWith(suffix)) { finalList.append(sList[i]); diff --git a/core_lib/src/movieexporter.cpp b/core_lib/src/movieexporter.cpp index 12885dba39..8be382c814 100644 --- a/core_lib/src/movieexporter.cpp +++ b/core_lib/src/movieexporter.cpp @@ -696,7 +696,7 @@ Status MovieExporter::executeFFMpegPipe(const QString& cmd, const QStringList& a } if(output.startsWith("frame=")) { - lastFrameProcessed = framesProcessed = output.midRef(6, output.indexOf(' ')).toInt(); + lastFrameProcessed = framesProcessed = output.mid(6, output.indexOf(' ')).toInt(); } } From b8ee44f566332fff24cdae6cf6666f7484a2c058 Mon Sep 17 00:00:00 2001 From: HeCorr Date: Sat, 27 Jul 2024 15:12:29 -0300 Subject: [PATCH 7/8] add qAsConst as requested and move & to the left --- app/src/importimageseqdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/importimageseqdialog.cpp b/app/src/importimageseqdialog.cpp index 667c5e337d..11b096de2d 100644 --- a/app/src/importimageseqdialog.cpp +++ b/app/src/importimageseqdialog.cpp @@ -272,7 +272,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons dot = finalList[0].lastIndexOf("."); QStringList absolutePaths; - for (const QString &fileName : finalList) { + for (const QString& fileName : qAsConst(finalList)) { absolutePaths << path + fileName; } From d97cb0a3efab1dd6aa07fae83a76864d62651adb Mon Sep 17 00:00:00 2001 From: HeCorr Date: Sat, 27 Jul 2024 15:33:59 -0300 Subject: [PATCH 8/8] remove qAsConst. the CI didn't like it. added in b8ee44f566332fff24cdae6cf6666f7484a2c058 --- app/src/importimageseqdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/importimageseqdialog.cpp b/app/src/importimageseqdialog.cpp index 11b096de2d..72b3152ee0 100644 --- a/app/src/importimageseqdialog.cpp +++ b/app/src/importimageseqdialog.cpp @@ -272,7 +272,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons dot = finalList[0].lastIndexOf("."); QStringList absolutePaths; - for (const QString& fileName : qAsConst(finalList)) { + for (const QString& fileName : finalList) { absolutePaths << path + fileName; }