From 3213749adf263c829d41c23939d8e59425d910bc Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 13 Mar 2019 09:42:50 +1100 Subject: [PATCH] minor code improvements --- project/effectgizmo.cpp | 2 ++ project/undo.cpp | 29 ++++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/project/effectgizmo.cpp b/project/effectgizmo.cpp index f2c8eba08..9d3413708 100644 --- a/project/effectgizmo.cpp +++ b/project/effectgizmo.cpp @@ -37,6 +37,8 @@ EffectGizmo::EffectGizmo(Effect *parent, int type) : type(type), cursor(-1) { + Q_ASSERT(parent != nullptr); + int point_count = (type == GIZMO_TYPE_POLY) ? 4 : 1; world_pos.resize(point_count); screen_pos.resize(point_count); diff --git a/project/undo.cpp b/project/undo.cpp index 977494e79..34bf06794 100644 --- a/project/undo.cpp +++ b/project/undo.cpp @@ -992,11 +992,12 @@ void ReloadEffectsCommand::doRedo() { panel_effect_controls->Reload(); } -RippleAction::RippleAction(Sequence *is, long ipoint, long ilength, const QVector &iignore) { - s = is; - point = ipoint; - length = ilength; - ignore = iignore; +RippleAction::RippleAction(Sequence *is, long ipoint, long ilength, const QVector &iignore) : + s(is), + point(ipoint), + length(ilength), + ignore(iignore) +{ } void RippleAction::doUndo() { @@ -1019,10 +1020,11 @@ void RippleAction::doRedo() { ca->redo(); } -SetDouble::SetDouble(double* pointer, double old_value, double new_value) { - p = pointer; - oldval = old_value; - newval = new_value; +SetDouble::SetDouble(double* pointer, double old_value, double new_value) : + p(pointer), + oldval(old_value), + newval(new_value) +{ } void SetDouble::doUndo() { @@ -1034,10 +1036,11 @@ void SetDouble::doRedo() { *p = newval; } -SetQVariant::SetQVariant(QVariant *itarget, const QVariant &iold, const QVariant &inew) { - target = itarget; - old_val = iold; - new_val = inew; +SetQVariant::SetQVariant(QVariant *itarget, const QVariant &iold, const QVariant &inew) : + target(itarget), + old_val(iold), + new_val(inew) +{ } void SetQVariant::doUndo() {