Skip to content

Commit

Permalink
Clean up some code
Browse files Browse the repository at this point in the history
  • Loading branch information
J5lx committed Apr 13, 2024
1 parent c59511c commit c7233c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
17 changes: 6 additions & 11 deletions core_lib/src/interface/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ GNU General Public License for more details.

#include "editor.h"

#include <QApplication>
#include <QClipboard>
#include <QTimer>
#include <QImageReader>
#include <QDropEvent>
#include <QMimeData>
#include <QTemporaryDir>

#include "object.h"
Expand Down Expand Up @@ -1218,7 +1215,7 @@ KeyFrame* Editor::addNewKey()
return addKeyFrame(layers()->currentLayerIndex(), currentFrame());
}

KeyFrame* Editor::addKeyFrame(int layerNumber, int frameIndex)
KeyFrame* Editor::addKeyFrame(const int layerNumber, int frameIndex)
{
Layer* layer = mObject->getLayer(layerNumber);
Q_ASSERT(layer);
Expand All @@ -1244,13 +1241,11 @@ KeyFrame* Editor::addKeyFrame(int layerNumber, int frameIndex)
}
}

bool ok = layer->addNewKeyFrameAt(frameIndex);
if (ok)
{
scrubTo(frameIndex); // currentFrameChanged() emit inside.
emit frameModified(frameIndex);
layers()->notifyAnimationLengthChanged();
}
const bool ok = layer->addNewKeyFrameAt(frameIndex);
Q_ASSERT(ok); // We already ensured that there is no keyframe at frameIndex, so this should always succeed
scrubTo(frameIndex); // currentFrameChanged() emit inside.
emit frameModified(frameIndex);
layers()->notifyAnimationLengthChanged();
return layer->getKeyFrameAt(frameIndex);
}

Expand Down
2 changes: 0 additions & 2 deletions core_lib/src/util/pencilerror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ GNU General Public License for more details.

#include "pencilerror.h"
#include <map>
#include <QObject>
#include <QSysInfo>
#include "pencildef.h"

DebugDetails::DebugDetails()
{
Expand Down
8 changes: 4 additions & 4 deletions core_lib/src/util/pencilerror.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Status
OK = 0,
SAFE,
FAIL,
CANCELED,
CANCELED,
FILE_NOT_FOUND,
NOT_SUPPORTED,
INVALID_ARGUMENT,
Expand All @@ -65,8 +65,8 @@ class Status
// Sound
ERROR_LOAD_SOUND_FILE,

// Export
ERROR_FFMPEG_NOT_FOUND,
// Export
ERROR_FFMPEG_NOT_FOUND,

// Layer
ERROR_NEED_AT_LEAST_ONE_CAMERA_LAYER
Expand Down Expand Up @@ -100,7 +100,7 @@ class Status

#ifndef STATUS_CHECK
#define STATUS_CHECK( x )\
{ Status st = (x); if (!st.ok()) { return st; } }
{ Status st = (x); if (!st.ok()) { return st; } }
#endif

#ifndef STATUS_FAILED
Expand Down

0 comments on commit c7233c1

Please sign in to comment.