CLANG warnings load indicator + style

This commit is contained in:
Klaus Basan
2019-02-07 02:55:54 +01:00
committed by Mat Sutcliffe
parent fe840613cb
commit 4e6437db4e
2 changed files with 16 additions and 11 deletions

View File

@@ -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();

View File

@@ -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