From 63d11f763c6f9712e4ee527b28b04bedccdd21fd Mon Sep 17 00:00:00 2001 From: Hussam al-Homsi Date: Sun, 12 Jan 2020 20:42:54 -0500 Subject: [PATCH] Simplify FadeButton update (#5311) --- include/FadeButton.h | 2 -- include/custom_events.h | 46 ---------------------------------- include/update_event.h | 44 -------------------------------- src/gui/widgets/FadeButton.cpp | 18 +------------ 4 files changed, 1 insertion(+), 109 deletions(-) delete mode 100644 include/custom_events.h delete mode 100644 include/update_event.h diff --git a/include/FadeButton.h b/include/FadeButton.h index 09a4c6457..57d8ba1e6 100644 --- a/include/FadeButton.h +++ b/include/FadeButton.h @@ -50,7 +50,6 @@ public slots: protected: - void customEvent( QEvent * ) override; void paintEvent( QPaintEvent * _pe ) override; @@ -66,7 +65,6 @@ private: QColor m_holdColor; int activeNotes; - void signalUpdate(); QColor fadeToColor(QColor, QColor, QTime, float); } ; diff --git a/include/custom_events.h b/include/custom_events.h deleted file mode 100644 index 955521490..000000000 --- a/include/custom_events.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * custom_events.h - custom event types list - * - * Copyright (c) 2007 Javier Serrano Polo - * - * This file is part of LMMS - https://lmms.io - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - - -#ifndef CUSTOM_EVENTS_H -#define CUSTOM_EVENTS_H - - -#include - - -namespace customEvents -{ - - enum Type - { - GUI_UPDATE = QEvent::User - } ; - -} - - - - -#endif diff --git a/include/update_event.h b/include/update_event.h deleted file mode 100644 index c37732630..000000000 --- a/include/update_event.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * update_event.h - signal GUI updates - * - * Copyright (c) 2007 Javier Serrano Polo - * - * This file is part of LMMS - https://lmms.io - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program (see COPYING); if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - */ - - -#ifndef UPDATE_EVENT_H -#define UPDATE_EVENT_H - -#include "custom_events.h" - - - -class updateEvent : public QEvent -{ -public: - updateEvent() : - QEvent( (QEvent::Type)customEvents::GUI_UPDATE ) - { - } - -} ; - - -#endif diff --git a/src/gui/widgets/FadeButton.cpp b/src/gui/widgets/FadeButton.cpp index b633286b1..8f75ea33b 100644 --- a/src/gui/widgets/FadeButton.cpp +++ b/src/gui/widgets/FadeButton.cpp @@ -24,12 +24,10 @@ #include -#include #include #include "embed.h" #include "FadeButton.h" -#include "update_event.h" const float FadeDuration = 300; @@ -71,7 +69,7 @@ void FadeButton::activate() { m_stateTimer.restart(); activeNotes++; - signalUpdate(); + update(); } @@ -94,14 +92,6 @@ void FadeButton::noteEnd() m_releaseTimer.restart(); } - signalUpdate(); -} - - - - -void FadeButton::customEvent(QEvent *) -{ update(); } @@ -165,9 +155,3 @@ QColor FadeButton::fadeToColor(QColor startCol, QColor endCol, QTime timer, floa return col; } - - -void FadeButton::signalUpdate() -{ - QApplication::postEvent(this, new updateEvent()); -}