Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_progress_update_helper.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2013 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __KIS_PROGRESS_UPDATE_HELPER_H
8#define __KIS_PROGRESS_UPDATE_HELPER_H
9
10#include <KoUpdater.h>
11#include <kis_types.h>
12
14public:
15 KisProgressUpdateHelper(KoUpdaterPtr progressUpdater, int portion, int numSteps)
16 : m_progressUpdater(progressUpdater),
18 m_portion(portion),
20 m_numSteps(numSteps),
22 {
25 }
26 }
27
33
34 void step() {
35 int localProgress = m_numSteps ?
37
38 if (m_progressUpdater && m_lastReportedLocalProgress != localProgress) {
39 m_lastReportedLocalProgress = localProgress;
40 m_progressUpdater->setProgress(m_baseProgress + localProgress);
41 }
42 // TODO: handle interrupted processing (connect to other layers, i.e. undo)
43 }
44
45private:
52};
53
54#endif /* __KIS_PROGRESS_UPDATE_HELPER_H */
KisProgressUpdateHelper(KoUpdaterPtr progressUpdater, int portion, int numSteps)