Krita Source Code Documentation
Loading...
Searching...
No Matches
KisBusyProgressIndicator Class Reference

#include <kis_busy_progress_indicator.h>

+ Inheritance diagram for KisBusyProgressIndicator:

Classes

struct  Private
 

Public Slots

void update ()
 

Signals

void sigStartTimer ()
 

Public Member Functions

 KisBusyProgressIndicator (KoProgressProxy *progressProxy)
 
void prepareDestroying ()
 
 ~KisBusyProgressIndicator () override
 

Private Slots

void slotStartTimer ()
 
void timerFinished ()
 

Private Attributes

const QScopedPointer< Privatem_d
 

Detailed Description

Definition at line 15 of file kis_busy_progress_indicator.h.

Constructor & Destructor Documentation

◆ KisBusyProgressIndicator()

KisBusyProgressIndicator::KisBusyProgressIndicator ( KoProgressProxy * progressProxy)
explicit

Definition at line 50 of file kis_busy_progress_indicator.cpp.

51 : m_d(new Private(this))
52{
53 connect(m_d->timer, SIGNAL(timeout()), SLOT(timerFinished()));
54 connect(this, SIGNAL(sigStartTimer()), SLOT(slotStartTimer()));
55 m_d->timer->setInterval(200);
56 m_d->progressProxy = progressProxy;
57}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
const QScopedPointer< Private > m_d

References connect(), m_d, sigStartTimer(), slotStartTimer(), and timerFinished().

◆ ~KisBusyProgressIndicator()

KisBusyProgressIndicator::~KisBusyProgressIndicator ( )
override

Definition at line 59 of file kis_busy_progress_indicator.cpp.

60{
61 m_d->stopProgressReport();
62}

References m_d.

Member Function Documentation

◆ prepareDestroying()

void KisBusyProgressIndicator::prepareDestroying ( )

To be called when progressProxy is and will be no longer available and this object is going to be deleted as well.

Definition at line 64 of file kis_busy_progress_indicator.cpp.

65{
66 m_d->progressProxy = 0;
67}

References m_d.

◆ sigStartTimer

void KisBusyProgressIndicator::sigStartTimer ( )
signal

◆ slotStartTimer

void KisBusyProgressIndicator::slotStartTimer ( )
privateslot

Call only via emitting sigStartTimer, to ensure it is called in the context of the QObject's thread.

Definition at line 95 of file kis_busy_progress_indicator.cpp.

96{
97 m_d->timerStarted.ref();
98 m_d->timer->start();
99 m_d->startProgressReport();
100}

References m_d.

◆ timerFinished

void KisBusyProgressIndicator::timerFinished ( )
privateslot

Definition at line 69 of file kis_busy_progress_indicator.cpp.

70{
71 int value = m_d->numUpdates.fetchAndStoreOrdered(0);
72
73 if (!value) {
74 m_d->numEmptyTicks++;
75
76 if (m_d->numEmptyTicks > 2) {
77 m_d->timerStarted = 0;
78 m_d->timer->stop();
79 m_d->stopProgressReport();
80 }
81 } else {
82 m_d->numEmptyTicks = 0;
83 }
84}
float value(const T *src, size_t ch)

References m_d, and value().

◆ update

void KisBusyProgressIndicator::update ( )
slot

Trigger update of progress state.

Definition at line 86 of file kis_busy_progress_indicator.cpp.

87{
88 m_d->numUpdates.ref();
89
90 if (!m_d->timerStarted) {
91 Q_EMIT sigStartTimer();
92 }
93}

References m_d, and sigStartTimer().

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisBusyProgressIndicator::m_d
private

Definition at line 48 of file kis_busy_progress_indicator.h.


The documentation for this class was generated from the following files: