From 099a2b5c7db9753db5a67c34ef264c1be5d47190 Mon Sep 17 00:00:00 2001 From: Matt Chang Date: Fri, 3 Jul 2020 00:27:19 +1000 Subject: [PATCH] Code cleanup --- core_lib/src/interface/editor.cpp | 2 +- core_lib/src/interface/scribblearea.cpp | 14 +++----- core_lib/src/managers/layermanager.cpp | 1 - core_lib/src/structure/objectdata.cpp | 2 +- core_lib/src/structure/objectdata.h | 46 ++++++++++++------------- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/core_lib/src/interface/editor.cpp b/core_lib/src/interface/editor.cpp index ccf78cc89..72f742b4b 100644 --- a/core_lib/src/interface/editor.cpp +++ b/core_lib/src/interface/editor.cpp @@ -729,7 +729,7 @@ void Editor::updateObject() { mScribbleArea->updateAllFrames(); } - + if (mPreferenceManager) { mObject->setActiveFramePoolSize(mPreferenceManager->getInt(SETTING::FRAME_POOL_SIZE)); diff --git a/core_lib/src/interface/scribblearea.cpp b/core_lib/src/interface/scribblearea.cpp index f4b4e09a1..1fbbbb390 100644 --- a/core_lib/src/interface/scribblearea.cpp +++ b/core_lib/src/interface/scribblearea.cpp @@ -1334,10 +1334,7 @@ QPointF ScribbleArea::getCentralPoint() void ScribbleArea::paintTransformedSelection() { Layer* layer = mEditor->layers()->currentLayer(); - if (layer == nullptr) - { - return; - } + if (layer == nullptr) { return; } auto selectMan = mEditor->select(); if (selectMan->somethingSelected()) // there is something selected @@ -1388,10 +1385,7 @@ void ScribbleArea::applyTransformedSelection() mCanvasPainter.ignoreTransformedSelection(); Layer* layer = mEditor->layers()->currentLayer(); - if (layer == nullptr) - { - return; - } + if (layer == nullptr) { return; } auto selectMan = mEditor->select(); if (selectMan->somethingSelected()) @@ -1434,8 +1428,8 @@ void ScribbleArea::cancelTransformedSelection() Layer* layer = mEditor->layers()->currentLayer(); if (layer == nullptr) { return; } - if (layer->type() == Layer::VECTOR) { - + if (layer->type() == Layer::VECTOR) + { VectorImage* vectorImage = currentVectorImage(layer); if (vectorImage != nullptr) { diff --git a/core_lib/src/managers/layermanager.cpp b/core_lib/src/managers/layermanager.cpp index 8d9b61344..f106affea 100644 --- a/core_lib/src/managers/layermanager.cpp +++ b/core_lib/src/managers/layermanager.cpp @@ -41,7 +41,6 @@ bool LayerManager::init() Status LayerManager::load(Object* o) { - Q_UNUSED(o); mLastCameraLayerIdx = 0; // Do not emit layerCountChanged here because the editor has not updated to this object yet // Leave that to the caller of this function diff --git a/core_lib/src/structure/objectdata.cpp b/core_lib/src/structure/objectdata.cpp index a95d0fe2d..ffb7419ec 100644 --- a/core_lib/src/structure/objectdata.cpp +++ b/core_lib/src/structure/objectdata.cpp @@ -19,7 +19,7 @@ GNU General Public License for more details. ObjectData::ObjectData() { - QSettings settings(PENCIL2D,PENCIL2D); + QSettings settings(PENCIL2D, PENCIL2D); mFps = settings.value(SETTING_FPS).toInt(); if (mFps < 1) mFps = 12; diff --git a/core_lib/src/structure/objectdata.h b/core_lib/src/structure/objectdata.h index 731bd7066..78b161e30 100644 --- a/core_lib/src/structure/objectdata.h +++ b/core_lib/src/structure/objectdata.h @@ -29,48 +29,48 @@ class ObjectData public: ObjectData(); - void setCurrentFrame( int n ) { mCurrentFrame = n; } - int getCurrentFrame() const { return mCurrentFrame; } + void setCurrentFrame(int n) { mCurrentFrame = n; } + int getCurrentFrame() const { return mCurrentFrame; } - void setCurrentColor( QColor c ) { mCurrentColor = c; } - QColor getCurrentColor() const { return mCurrentColor; } + void setCurrentColor(QColor c) { mCurrentColor = c; } + QColor getCurrentColor() const { return mCurrentColor; } - void setCurrentLayer( int n ) { mCurrentLayer = n; } - int getCurrentLayer() const { return mCurrentLayer; } + void setCurrentLayer(int n) { mCurrentLayer = n; } + int getCurrentLayer() const { return mCurrentLayer; } - void setCurrentView( QTransform t ) { mCurrentView = t; } - QTransform getCurrentView() const { return mCurrentView; } + void setCurrentView(QTransform t) { mCurrentView = t; } + QTransform getCurrentView() const { return mCurrentView; } - void setFrameRate( int n ) { mFps = n; } - int getFrameRate() const { return mFps; } - - void setLooping( bool b ) { mIsLoop = b; } - bool isLooping() const { return mIsLoop; } + void setFrameRate(int n) { mFps = n; } + int getFrameRate() const { return mFps; } - void setRangedPlayback( bool b ) { mIsRangedPlayback = b; } - bool isRangedPlayback() const { return mIsRangedPlayback; } + void setLooping(bool b) { mIsLoop = b; } + bool isLooping() const { return mIsLoop; } - void setMarkInFrameNumber( int n ) { mMarkInFrame = n; } - int getMarkInFrameNumber() const { return mMarkInFrame; } + void setRangedPlayback(bool b) { mIsRangedPlayback = b; } + bool isRangedPlayback() const { return mIsRangedPlayback; } - void setMarkOutFrameNumber( int n ) { mMarkOutFrame = n; } - int getMarkOutFrameNumber() const { return mMarkOutFrame; } + void setMarkInFrameNumber(int n) { mMarkInFrame = n; } + int getMarkInFrameNumber() const { return mMarkInFrame; } + + void setMarkOutFrameNumber(int n) { mMarkOutFrame = n; } + int getMarkOutFrameNumber() const { return mMarkOutFrame; } private: - int mCurrentFrame = 1; + int mCurrentFrame = 1; QColor mCurrentColor{ 0, 0, 0, 255 }; - int mCurrentLayer = 2; // Layers are counted bottom up + int mCurrentLayer = 2; // Layers are counted bottom up // 0 - Camera Layer // 1 - Vector Layer // 2 - Bitmap Layer // view manager QTransform mCurrentView; - + // playback manager int mFps = 12; bool mIsLoop = false; bool mIsRangedPlayback = false; - int mMarkInFrame = 1; + int mMarkInFrame = 1; int mMarkOutFrame = 10; };