Skip to content

Commit

Permalink
Fixed a few warnings (#1870)
Browse files Browse the repository at this point in the history
* fix incorrect-emit warnings

https://github.com/KDE/clazy/blob/1.11/docs/checks/README-incorrect-emit.md

* remove unused parameter 'blitRect' from CameraTool::paint()

* fix qstring-ref warnings

https://github.com/KDE/clazy/blob/1.11/docs/checks/README-qstring-ref.md

* fix range-loop-reference warnings

https://github.com/KDE/clazy/blob/1.11/docs/checks/README-range-loop-reference.md

* remove unused QStrings

* Revert "fix qstring-ref warnings"

It seems that QString::midRef() was removed in Qt6 so I'm reverting commit f4fb55b

* add qAsConst as requested and move & to the left

* remove qAsConst. the CI didn't like it.

added in b8ee44f
  • Loading branch information
HeCorr authored Jul 28, 2024
1 parent e910aee commit 62a3a02
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 21 deletions.
6 changes: 1 addition & 5 deletions app/src/importimageseqdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ void ImportImageSeqDialog::importArbitrarySequence()

for (const QString& strImgFile : files)
{
QString strImgFileLower = strImgFile.toLower();

Status st = mEditor->importImage(strImgFile);
if (!st.ok())
{
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -275,7 +272,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons
dot = finalList[0].lastIndexOf(".");

QStringList absolutePaths;
for (QString fileName : finalList) {
for (const QString& fileName : finalList) {
absolutePaths << path + fileName;
}

Expand Down Expand Up @@ -338,7 +335,6 @@ QStringList ImportImageSeqDialog::getFilePaths()

Status ImportImageSeqDialog::validateKeySet(const PredefinedKeySet& keySet, const QStringList& filepaths)
{
QString msg = "";
QString failedPathsString;

Status status = Status::OK;
Expand Down
2 changes: 1 addition & 1 deletion app/src/repositionframesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void RepositionFramesDialog::updateLayersBox()

void RepositionFramesDialog::closeClicked()
{
rejected();
emit rejected();
}

void RepositionFramesDialog::updateLayersToSelect()
Expand Down
6 changes: 3 additions & 3 deletions core_lib/src/interface/backupelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -109,7 +109,7 @@ void BackupVectorElement::restore(Editor* editor)
selectMan->setTranslation(translation);
selectMan->calculateSelectionTransformation();

editor->frameModified(this->frame);
emit editor->frameModified(this->frame);

}

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/interface/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions core_lib/src/interface/scribblearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/managers/layermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/structure/filemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/structure/pegbaraligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/tool/cameratool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LayerCamera*>(mEditor->object()->getLayerBelow(mEditor->currentLayerIndex(), Layer::CAMERA));
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/tool/cameratool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/tool/movetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion core_lib/src/tool/smudgetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 62a3a02

Please sign in to comment.