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

#include <KoUpdaterPrivate_p.h>

+ Inheritance diagram for KoUpdaterPrivate:

Public Slots

void cancel ()
 Cancel comes from KoUpdater.
 
void setAutoNestedName (const QString &name)
 
void setHasValidRange (bool value)
 
void setInterrupted (bool value=true)
 
void setProgress (int percent)
 progress comes from KoUpdater
 

Signals

void sigCancelled ()
 Emitted whenever the operation is cancelled by the downstream updater.
 
void sigUpdated ()
 Emitted whenever the progress changed.
 

Public Member Functions

QString autoNestedName () const
 
QPointer< KoUpdaterconnectedUpdater () const
 
bool hasValidRange () const
 
bool interrupted () const
 
bool isCompleted () const
 
bool isPersistent () const
 
 KoUpdaterPrivate (int weight, const QString &name, bool isPersistent=false)
 
QString mergedSubTaskName () const
 
int progress () const
 
QString subTaskName () const
 
int weight () const
 
 ~KoUpdaterPrivate () override
 

Private Attributes

QString m_autoNestedName
 
QPointer< KoUpdaterm_connectedUpdater
 
bool m_hasValidRange
 
bool m_interrupted
 
bool m_isPersistent
 
int m_progress
 
QString m_subTaskName
 
int m_weight
 

Detailed Description

KoUpdaterPrivate is the gui-thread side of KoUpdater. Communication between KoUpdater and KoUpdaterPrivate is handled through queued connections – this is the main app thread part of the KoUpdater-KoUpdaterPrivate bridge.

The gui thread can iterate over its list of KoUpdaterPrivate instances for the total progress computation: the queued signals from the threads will only arrive when the eventloop in the gui thread has a chance to deliver them.

Definition at line 28 of file KoUpdaterPrivate_p.h.

Constructor & Destructor Documentation

◆ KoUpdaterPrivate()

KoUpdaterPrivate::KoUpdaterPrivate ( int weight,
const QString & name,
bool isPersistent = false )

Definition at line 12 of file KoUpdaterPrivate_p.cpp.

◆ ~KoUpdaterPrivate()

KoUpdaterPrivate::~KoUpdaterPrivate ( )
override

when deleting an updater, make sure the accompanying thread is interrupted, too.

Definition at line 25 of file KoUpdaterPrivate_p.cpp.

26{
27 setInterrupted(true);
28 m_connectedUpdater->deleteLater();
29}
void setInterrupted(bool value=true)

References m_connectedUpdater, and setInterrupted().

Member Function Documentation

◆ autoNestedName()

QString KoUpdaterPrivate::autoNestedName ( ) const

Definition at line 31 of file KoUpdaterPrivate_p.cpp.

32{
33 return m_autoNestedName;
34}

References m_autoNestedName.

◆ cancel

void KoUpdaterPrivate::cancel ( )
slot

Cancel comes from KoUpdater.

Definition at line 71 of file KoUpdaterPrivate_p.cpp.

72{
73 Q_EMIT sigCancelled();
74}
void sigCancelled()
Emitted whenever the operation is cancelled by the downstream updater.

References sigCancelled().

◆ connectedUpdater()

QPointer< KoUpdater > KoUpdaterPrivate::connectedUpdater ( ) const

Definition at line 100 of file KoUpdaterPrivate_p.cpp.

101{
102 return m_connectedUpdater;
103}

References m_connectedUpdater.

◆ hasValidRange()

bool KoUpdaterPrivate::hasValidRange ( ) const

Definition at line 56 of file KoUpdaterPrivate_p.cpp.

57{
58 return m_hasValidRange;
59}

References m_hasValidRange.

◆ interrupted()

bool KoUpdaterPrivate::interrupted ( ) const
inline

Definition at line 41 of file KoUpdaterPrivate_p.h.

41{ return m_interrupted; }

References m_interrupted.

◆ isCompleted()

bool KoUpdaterPrivate::isCompleted ( ) const

Definition at line 66 of file KoUpdaterPrivate_p.cpp.

67{
68 return m_progress >= 100;
69}

References m_progress.

◆ isPersistent()

bool KoUpdaterPrivate::isPersistent ( ) const

Definition at line 61 of file KoUpdaterPrivate_p.cpp.

62{
63 return m_isPersistent;
64}

References m_isPersistent.

◆ mergedSubTaskName()

QString KoUpdaterPrivate::mergedSubTaskName ( ) const

Definition at line 41 of file KoUpdaterPrivate_p.cpp.

42{
43 QString result = m_subTaskName;
44
45 if (!m_autoNestedName.isEmpty()) {
46 if (result.isEmpty()) {
47 result = m_autoNestedName;
48 } else {
49 result = QString("%1: %2").arg(result).arg(m_autoNestedName);
50 }
51 }
52
53 return result;
54}

References m_autoNestedName, and m_subTaskName.

◆ progress()

int KoUpdaterPrivate::progress ( ) const
inline

Definition at line 43 of file KoUpdaterPrivate_p.h.

43{ return m_progress; }

References m_progress.

◆ setAutoNestedName

void KoUpdaterPrivate::setAutoNestedName ( const QString & name)
slot

Definition at line 88 of file KoUpdaterPrivate_p.cpp.

89{
91 Q_EMIT sigUpdated();
92}
void sigUpdated()
Emitted whenever the progress changed.
const char * name(StandardAction id)

References m_autoNestedName, and sigUpdated().

◆ setHasValidRange

void KoUpdaterPrivate::setHasValidRange ( bool value)
slot

Definition at line 94 of file KoUpdaterPrivate_p.cpp.

95{
97 Q_EMIT sigUpdated();
98}
float value(const T *src, size_t ch)

References m_hasValidRange, sigUpdated(), and value().

◆ setInterrupted

void KoUpdaterPrivate::setInterrupted ( bool value = true)
slot

Definition at line 76 of file KoUpdaterPrivate_p.cpp.

77{
79 m_connectedUpdater->setInterrupted(true);
80}

References m_connectedUpdater, m_interrupted, and value().

◆ setProgress

void KoUpdaterPrivate::setProgress ( int percent)
slot

progress comes from KoUpdater

Definition at line 82 of file KoUpdaterPrivate_p.cpp.

83{
84 m_progress = percent;
85 Q_EMIT sigUpdated();
86}

References m_progress, and sigUpdated().

◆ sigCancelled

void KoUpdaterPrivate::sigCancelled ( )
signal

Emitted whenever the operation is cancelled by the downstream updater.

◆ sigUpdated

void KoUpdaterPrivate::sigUpdated ( )
signal

Emitted whenever the progress changed.

◆ subTaskName()

QString KoUpdaterPrivate::subTaskName ( ) const

Definition at line 36 of file KoUpdaterPrivate_p.cpp.

37{
38 return m_subTaskName;
39}

References m_subTaskName.

◆ weight()

int KoUpdaterPrivate::weight ( ) const
inline

Definition at line 45 of file KoUpdaterPrivate_p.h.

45{ return m_weight; }

References m_weight.

Member Data Documentation

◆ m_autoNestedName

QString KoUpdaterPrivate::m_autoNestedName
private

Definition at line 83 of file KoUpdaterPrivate_p.h.

◆ m_connectedUpdater

QPointer<KoUpdater> KoUpdaterPrivate::m_connectedUpdater
private

Definition at line 87 of file KoUpdaterPrivate_p.h.

◆ m_hasValidRange

bool KoUpdaterPrivate::m_hasValidRange
private

Definition at line 85 of file KoUpdaterPrivate_p.h.

◆ m_interrupted

bool KoUpdaterPrivate::m_interrupted
private

Definition at line 82 of file KoUpdaterPrivate_p.h.

◆ m_isPersistent

bool KoUpdaterPrivate::m_isPersistent
private

Definition at line 86 of file KoUpdaterPrivate_p.h.

◆ m_progress

int KoUpdaterPrivate::m_progress
private

Definition at line 80 of file KoUpdaterPrivate_p.h.

◆ m_subTaskName

QString KoUpdaterPrivate::m_subTaskName
private

Definition at line 84 of file KoUpdaterPrivate_p.h.

◆ m_weight

int KoUpdaterPrivate::m_weight
private

Definition at line 81 of file KoUpdaterPrivate_p.h.


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