From 4e6437db4edd2f99d609c0347f0124521f8a63da Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 7 Feb 2019 02:55:54 +0100 Subject: [PATCH] CLANG warnings load indicator + style --- src/blackgui/loadindicator.cpp | 15 +++++++-------- src/blackgui/loadindicator.h | 12 +++++++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/blackgui/loadindicator.cpp b/src/blackgui/loadindicator.cpp index 27f719ea0..5d9f943e0 100644 --- a/src/blackgui/loadindicator.cpp +++ b/src/blackgui/loadindicator.cpp @@ -146,23 +146,23 @@ namespace BlackGui // painter.setBrush(QBrush(QColor(0, 0, 255))); // painter.drawEllipse(0, 0, width, width); - int outerRadius = (width - 1) * 0.5; - int innerRadius = (width - 1) * 0.5 * 0.38; + int outerRadius = qRound((width - 1) * 0.5); + int innerRadius = qRound((width - 1) * 0.5 * 0.38); int capsuleHeight = outerRadius - innerRadius; - int capsuleWidth = (width > 32) ? capsuleHeight * .23 : capsuleHeight * .35; + int capsuleWidth = (width > 32) ? qRound(capsuleHeight * .23) : qRound(capsuleHeight * .35); int capsuleRadius = capsuleWidth / 2; for (int i = 0; i < 12; i++) { QColor color = m_color; - color.setAlphaF(1.0f - (i / 12.0f)); + color.setAlphaF(qRound(1.0f - (i / 12.0f))); painter.setPen(Qt::NoPen); painter.setBrush(color); painter.save(); painter.translate(rect().center()); - painter.rotate(m_angle - i * 30.0f); - painter.drawRoundedRect(-capsuleWidth * 0.5, -(innerRadius + capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius); + painter.rotate(m_angle - qRound(i * 30.0f)); + painter.drawRoundedRect(-qRound(capsuleWidth * 0.5), -(innerRadius + capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius); painter.restore(); } } @@ -197,8 +197,7 @@ namespace BlackGui if (!m_loadIndicator) { m_loadIndicator = new CLoadIndicator(64, 64, m_usingWidget); - QObject::connect(m_loadIndicator, &CLoadIndicator::timedOut, - [this] { this->indicatorTimedOut(); }); + QObject::connect(m_loadIndicator, &CLoadIndicator::timedOut, [this] { this->indicatorTimedOut(); }); } this->centerLoadIndicator(); diff --git a/src/blackgui/loadindicator.h b/src/blackgui/loadindicator.h index 20846bc75..bb84f1e52 100644 --- a/src/blackgui/loadindicator.h +++ b/src/blackgui/loadindicator.h @@ -133,6 +133,12 @@ namespace BlackGui //! Destructor virtual ~CLoadIndicatorEnabled() {} + //! Copy constructor + CLoadIndicatorEnabled(const CLoadIndicatorEnabled &) = delete; + + //! Copy assignment operator + CLoadIndicatorEnabled &operator =(const CLoadIndicatorEnabled &) = delete; + //! Showing load indicator? bool isShowingLoadIndicator() const; @@ -153,10 +159,10 @@ namespace BlackGui //! \remark override for usage virtual void indicatorTimedOut(); - QWidget *m_usingWidget = nullptr; //!< widget which uses load indicator + QWidget *m_usingWidget = nullptr; //!< widget which uses load indicator CLoadIndicator *m_loadIndicator = nullptr; //!< indicator itself - bool m_loadInProgress = false; //!< flag indicating loading - int m_indicatorId = -1; //!< last indicator id returned + bool m_loadInProgress = false; //!< flag indicating loading + int m_indicatorId = -1; //!< last indicator id returned }; } // ns