2021-11-18 14:58:01 +00:00
|
|
|
#include "spinnable_toolbar_icon.h"
|
2018-08-27 08:50:40 +00:00
|
|
|
#include "theme.h"
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
SpinnableToolbarIcon::SpinnableToolbarIcon(QWidget* parent)
|
|
|
|
: QWidget(parent)
|
2018-08-27 08:50:40 +00:00
|
|
|
{
|
|
|
|
setFixedSize(Theme::toolIconSize, Theme::toolIconSize);
|
|
|
|
|
|
|
|
m_spinner = new WaitingSpinnerWidget(this);
|
|
|
|
m_spinner->setColor(Theme::white);
|
|
|
|
m_spinner->setInnerRadius(Theme::toolIconSize / 8);
|
|
|
|
m_spinner->setLineLength(Theme::toolIconSize / 4);
|
|
|
|
m_spinner->setNumberOfLines(9);
|
|
|
|
m_spinner->hide();
|
|
|
|
}
|
|
|
|
|
2021-11-18 14:58:01 +00:00
|
|
|
void SpinnableToolbarIcon::showSpinner(bool showSpinner)
|
2018-08-27 08:50:40 +00:00
|
|
|
{
|
|
|
|
if (showSpinner) {
|
|
|
|
m_spinner->start();
|
|
|
|
m_spinner->show();
|
|
|
|
} else {
|
|
|
|
m_spinner->stop();
|
|
|
|
m_spinner->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-18 14:58:01 +00:00
|
|
|
bool SpinnableToolbarIcon::isSpinning()
|
2018-08-27 08:50:40 +00:00
|
|
|
{
|
|
|
|
return m_spinner->isVisible();
|
|
|
|
}
|