From: Michal MalĂ˝ Date: Sun, 15 Dec 2013 14:54:04 +0000 (+0100) Subject: Do not start effect when is can be just updated X-Git-Tag: 0.4a~12 X-Git-Url: https://gitweb.devoid-pointer.net/?a=commitdiff_plain;h=4ffab9bcdb9f2ddb1350355e127207c4dcb18871;p=FFBChecker.git Do not start effect when is can be just updated --- diff --git a/ffbdevice.cpp b/ffbdevice.cpp index 4116653..9f68337 100644 --- a/ffbdevice.cpp +++ b/ffbdevice.cpp @@ -223,6 +223,7 @@ bool FFBDevice::removeEffect(const int idx) bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr params) { + bool update = false; std::shared_ptr effect = FFBEffectFactory::createEffect(type); if (effect == nullptr) { qDebug() << "Unable to create effect"; @@ -247,6 +248,7 @@ bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr< qDebug() << "Recreating effect" << idx; } else { effect->setInternalIdx(m_effects[idx]->internalIdx()); + update = true; qDebug() << "Updating effect" << idx; } } @@ -267,6 +269,8 @@ bool FFBDevice::startEffect(const int idx, FFBEffectTypes type, std::shared_ptr< delete kernelEff; return false; } + if (update) + return true; m_effects[idx]->setInternalIdx(kernelEff->id); m_effects[idx]->setStatus(FFBEffect::FFBEffectStatus::STOPPED);