mirror of
https://github.com/YACReader/yacreader
synced 2025-05-25 18:00:46 -04:00
Add a busy indicator to YACReaderTitledToolBar
It will be used in the libraries section to show that libraries are being updated in the background.
This commit is contained in:
parent
f02d4e5d98
commit
ecde1ee836
@ -1,6 +1,7 @@
|
||||
#include "yacreader_titled_toolbar.h"
|
||||
|
||||
#include "yacreader_global.h"
|
||||
#include "yacreader_busy_widget.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QHBoxLayout>
|
||||
@ -69,6 +70,15 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString &title, QWidget *pa
|
||||
setStyleSheet(styleSheet);
|
||||
|
||||
nameLabel = new DropShadowLabel(this);
|
||||
busyIndicator = new BusyIndicator(this, 12);
|
||||
busyIndicator->setIndicatorStyle(BusyIndicator::StyleArc);
|
||||
#ifdef Y_MAC_UI
|
||||
busyIndicator->setColor(QColor("#808080"));
|
||||
#else
|
||||
busyIndicator->setColor(Qt::white);
|
||||
#endif
|
||||
busyIndicator->setHidden(true);
|
||||
|
||||
nameLabel->setText(title);
|
||||
#ifdef Y_MAC_UI
|
||||
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
|
||||
@ -81,7 +91,8 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString &title, QWidget *pa
|
||||
#endif
|
||||
nameLabel->setStyleSheet(nameLabelStyleSheet);
|
||||
|
||||
mainLayout->addWidget(nameLabel, Qt::AlignLeft);
|
||||
mainLayout->addWidget(nameLabel);
|
||||
mainLayout->addWidget(busyIndicator);
|
||||
mainLayout->addStretch();
|
||||
|
||||
setLayout(mainLayout);
|
||||
@ -140,3 +151,13 @@ void YACReaderTitledToolBar::addSepartor()
|
||||
mainLayout->addWidget(w);
|
||||
mainLayout->addSpacing(10);
|
||||
}
|
||||
|
||||
void YACReaderTitledToolBar::showBusyIndicator()
|
||||
{
|
||||
busyIndicator->setHidden(false);
|
||||
}
|
||||
|
||||
void YACReaderTitledToolBar::hideBusyIndicator()
|
||||
{
|
||||
busyIndicator->setHidden(true);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QPoint>
|
||||
|
||||
class QIcon;
|
||||
class BusyIndicator;
|
||||
|
||||
class DropShadowLabel : public QLabel
|
||||
{
|
||||
@ -38,9 +39,12 @@ public slots:
|
||||
void addAction(QAction *action);
|
||||
void addSpacing(int space);
|
||||
void addSepartor();
|
||||
void showBusyIndicator();
|
||||
void hideBusyIndicator();
|
||||
|
||||
private:
|
||||
DropShadowLabel *nameLabel;
|
||||
BusyIndicator *busyIndicator;
|
||||
};
|
||||
|
||||
#endif // YACREADER_TITLED_TOOLBAR_H
|
||||
|
Loading…
Reference in New Issue
Block a user