mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -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_titled_toolbar.h"
|
||||||
|
|
||||||
#include "yacreader_global.h"
|
#include "yacreader_global.h"
|
||||||
|
#include "yacreader_busy_widget.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@ -69,6 +70,15 @@ YACReaderTitledToolBar::YACReaderTitledToolBar(const QString &title, QWidget *pa
|
|||||||
setStyleSheet(styleSheet);
|
setStyleSheet(styleSheet);
|
||||||
|
|
||||||
nameLabel = new DropShadowLabel(this);
|
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);
|
nameLabel->setText(title);
|
||||||
#ifdef Y_MAC_UI
|
#ifdef Y_MAC_UI
|
||||||
QString nameLabelStyleSheet = "QLabel {padding:0 0 0 10px; margin:0px; font-size:11px; font-weight:bold;}";
|
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
|
#endif
|
||||||
nameLabel->setStyleSheet(nameLabelStyleSheet);
|
nameLabel->setStyleSheet(nameLabelStyleSheet);
|
||||||
|
|
||||||
mainLayout->addWidget(nameLabel, Qt::AlignLeft);
|
mainLayout->addWidget(nameLabel);
|
||||||
|
mainLayout->addWidget(busyIndicator);
|
||||||
mainLayout->addStretch();
|
mainLayout->addStretch();
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
@ -140,3 +151,13 @@ void YACReaderTitledToolBar::addSepartor()
|
|||||||
mainLayout->addWidget(w);
|
mainLayout->addWidget(w);
|
||||||
mainLayout->addSpacing(10);
|
mainLayout->addSpacing(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YACReaderTitledToolBar::showBusyIndicator()
|
||||||
|
{
|
||||||
|
busyIndicator->setHidden(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void YACReaderTitledToolBar::hideBusyIndicator()
|
||||||
|
{
|
||||||
|
busyIndicator->setHidden(true);
|
||||||
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
|
|
||||||
class QIcon;
|
class QIcon;
|
||||||
|
class BusyIndicator;
|
||||||
|
|
||||||
class DropShadowLabel : public QLabel
|
class DropShadowLabel : public QLabel
|
||||||
{
|
{
|
||||||
@ -38,9 +39,12 @@ public slots:
|
|||||||
void addAction(QAction *action);
|
void addAction(QAction *action);
|
||||||
void addSpacing(int space);
|
void addSpacing(int space);
|
||||||
void addSepartor();
|
void addSepartor();
|
||||||
|
void showBusyIndicator();
|
||||||
|
void hideBusyIndicator();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DropShadowLabel *nameLabel;
|
DropShadowLabel *nameLabel;
|
||||||
|
BusyIndicator *busyIndicator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // YACREADER_TITLED_TOOLBAR_H
|
#endif // YACREADER_TITLED_TOOLBAR_H
|
||||||
|
Loading…
Reference in New Issue
Block a user