From 9ed5f80fe003e3ea21e3710c3dafd83d1fb1e701 Mon Sep 17 00:00:00 2001 From: Spekular Date: Fri, 1 May 2020 20:03:27 +0200 Subject: [PATCH] Refactor palette update on un/mute --- include/Track.h | 4 +++- src/core/Track.cpp | 27 +++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/Track.h b/include/Track.h index 29ed1f699..07cee8ffd 100644 --- a/include/Track.h +++ b/include/Track.h @@ -745,12 +745,14 @@ private: return nullptr; } + void setIndicatorMute(FadeButton* indicator, bool muted); + friend class TrackLabelButton; private slots: void createTCOView( TrackContentObject * tco ); - void muteChanged (); + void muteChanged(); } ; diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 2711f9944..f6b109280 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -3060,20 +3060,15 @@ void TrackView::createTCOView( TrackContentObject * tco ) void TrackView::muteChanged() { - FadeButton * actind = getActivityIndicator(); - if (actind) - { - if (m_track->m_mutedModel.value()) - { - actind->setActiveColor(QApplication::palette().color( - QPalette::Active, QPalette::Highlight - )); - } - else - { - actind->setActiveColor(QApplication::palette().color( - QPalette::Active, QPalette::BrightText - )); - } - } + FadeButton * indicator = getActivityIndicator(); + if (indicator) { setIndicatorMute(indicator, m_track->m_mutedModel.value()); } +} + + + + +void TrackView::setIndicatorMute(FadeButton* indicator, bool muted) +{ + QPalette::ColorRole role = muted ? QPalette::Highlight : QPalette::BrightText; + indicator->setActiveColor(QApplication::palette().color(QPalette::Active, role)); }