Krita Source Code Documentation
Loading...
Searching...
No Matches
KoUpdaterPrivate_p.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 *
3 * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
4 * SPDX-FileCopyrightText: 2009 Boudewijn Rempt <boud@valdyas.org>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
10#include <KoUpdater.h>
11
12KoUpdaterPrivate::KoUpdaterPrivate(int weight, const QString &name, bool isPersistent)
13 : QObject(0)
14 , m_progress(0)
15 , m_weight(weight)
16 , m_interrupted(false)
17 , m_autoNestedName()
18 , m_subTaskName(name)
19 , m_hasValidRange(true)
20 , m_isPersistent(isPersistent)
21 , m_connectedUpdater(new KoUpdater(this))
22{
23}
24
30
32{
33 return m_autoNestedName;
34}
35
37{
38 return m_subTaskName;
39}
40
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}
55
57{
58 return m_hasValidRange;
59}
60
62{
63 return m_isPersistent;
64}
65
67{
68 return m_progress >= 100;
69}
70
72{
73 Q_EMIT sigCancelled();
74}
75
77{
79 m_connectedUpdater->setInterrupted(true);
80}
81
83{
84 m_progress = percent;
85 Q_EMIT sigUpdated();
86}
87
88void KoUpdaterPrivate::setAutoNestedName(const QString &name)
89{
90 m_autoNestedName = name;
91 Q_EMIT sigUpdated();
92}
93
99
float value(const T *src, size_t ch)
QPointer< KoUpdater > m_connectedUpdater
void cancel()
Cancel comes from KoUpdater.
void sigCancelled()
Emitted whenever the operation is cancelled by the downstream updater.
void setInterrupted(bool value=true)
QString mergedSubTaskName() const
void setHasValidRange(bool value)
QPointer< KoUpdater > connectedUpdater() const
KoUpdaterPrivate(int weight, const QString &name, bool isPersistent=false)
void setAutoNestedName(const QString &name)
void sigUpdated()
Emitted whenever the progress changed.
QString subTaskName() const
void setProgress(int percent)
progress comes from KoUpdater
QString autoNestedName() const