Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a few warnings #1870

Merged
merged 8 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (const QFileInfo &dirFileInfo : directory.entryInfoList(QDir::Filter::Files)) {
for (const QFileInfo& dirFileInfo : qAsConst(directory.entryInfoList(QDir::Filter::Files))) { {

By adding const here, you'll get an additional warning saying 'Might detach container', as such we use qAsConst(...).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding it like that fails:
image

adding it just around directory doesn't make the warning go away:
image

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
Loading