Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujan committed Feb 10, 2023
1 parent f64a347 commit 05f377a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions Kvantum/style/Kvantum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2773,8 +2773,7 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element,
else
suffix = "-normal";
}
bool animate(opacityTimer_ != nullptr
&& !qstyleoption_cast<const QStyleOptionMenuItem*>(option));
bool animate(opacityTimer_ && !qstyleoption_cast<const QStyleOptionMenuItem*>(option));
if (!animate && widget != nullptr // not QML or Libreoffice's unstyled menu
&& elementExists("menu-"+ispec.element+suffix))
{
Expand Down Expand Up @@ -3826,16 +3825,16 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element,
painter->save();
painter->setOpacity(DISABLED_OPACITY);
}
bool animateSpin(opacityTimer_
bool canAnimate(/*!isLibreoffice_ &&*/ opacityTimer_ && widget && widget->isEnabled()
&& !qobject_cast<const QAbstractScrollArea*>(widget));
bool animateSpin(canAnimate
&& qobject_cast<QAbstractSpinBox*>(p)
&& ((animatedWidget_ == p
&& opacityTimer_->isActive()
&& !leStatus.startsWith(QLatin1String("normal")))
|| (animatedWidgetOut_ == p
&& opacityTimerOut_->isActive()
&& leStatus.startsWith(QLatin1String("normal")))));
bool canAnimate(/*!isLibreoffice_ &&*/ opacityTimer_ && widget && widget->isEnabled()
&& !qobject_cast<const QAbstractScrollArea*>(widget));
bool animate(canAnimate
&& ((animatedWidget_ == widget
&& opacityTimer_->isActive()
Expand Down Expand Up @@ -4670,12 +4669,13 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element,
painter->save();
painter->setOpacity(DISABLED_OPACITY);
}
bool mouseAnimation(widget && animatedWidget_ == widget
&& opacityTimer_ && opacityTimer_->isActive()
bool canAnimate(opacityTimer_ && cb && cb->isEnabled());
bool mouseAnimation(canAnimate
&& animatedWidget_ == widget
&& opacityTimer_->isActive()
&& (!status.startsWith(QLatin1String("normal"))
|| animationStartState_.startsWith(QLatin1String("focused"))));
bool animate(opacityTimer_
&& cb && cb->isEnabled()
bool animate(canAnimate
&& (mouseAnimation
|| (animatedWidgetOut_ == widget
&& opacityTimerOut_->isActive()
Expand Down Expand Up @@ -4744,7 +4744,7 @@ void Style::drawPrimitive(QStyle::PrimitiveElement element,
animationStartStateOut_ = status;
}
}
else if (cb && cb->isEnabled())
else if (canAnimate)
{
if (animatedWidget_ == widget)
{
Expand Down Expand Up @@ -11497,15 +11497,16 @@ void Style::drawComplexControl(QStyle::ComplexControl control,
leOpt.rect = o.rect.adjusted(rtl ? 0 : o.rect.width()-editWidth, 0,
rtl ? editWidth-o.rect.width() : 0, 0);
}
bool mouseAnimation(widget && animatedWidget_ == widget
&& opacityTimer_ && opacityTimer_->isActive()
bool canAnimate(opacityTimer_ && cb && cb->isEnabled());
bool mouseAnimation(canAnimate
&& animatedWidget_ == widget
&& opacityTimer_->isActive()
&& (!status.startsWith(QLatin1String("normal"))
|| ((!editable || !drwaAsLineEdit
|| (cb->view() && cb->view()->isVisible()))
&& (animationStartState_.startsWith(QLatin1String("focused"))
|| animationStartState_.startsWith(QLatin1String("c-"))))));
bool animate(opacityTimer_
&& cb && cb->isEnabled()
bool animate(canAnimate
&& (mouseAnimation
|| (animatedWidgetOut_ == widget
&& opacityTimerOut_->isActive()
Expand Down Expand Up @@ -11603,7 +11604,7 @@ void Style::drawComplexControl(QStyle::ComplexControl control,
animationStartState_ = "c-" + animationStartState_;
}
}
else if (cb && cb->isEnabled())
else if (canAnimate)
{
if (animatedWidget_ == widget)
{
Expand Down

0 comments on commit 05f377a

Please sign in to comment.