|
Krita Source Code Documentation
|
#include <KisIdleTaskStrokeStrategy.h>
Inheritance diagram for KisIdleTaskStrokeStrategy:Signals | |
| void | sigIdleTaskFinished () |
Static Public Member Functions | |
| static int | preferredIdleTaskMaximumTime () |
| static int | preferredIdleWatcherInterval () |
Static Public Member Functions inherited from KisSimpleStrokeStrategy | |
| static QLatin1String | jobTypeToString (JobType type) |
Protected Member Functions | |
| void | finishStrokeCallback () override |
| void | initStrokeCallback () override |
Protected Member Functions inherited from KisSimpleStrokeStrategy | |
| void | enableJob (JobType type, bool enable=true, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL) |
| KisSimpleStrokeStrategy (const KisSimpleStrokeStrategy &rhs) | |
Protected Member Functions inherited from KisStrokeStrategy | |
| void | addMutatedJob (KisStrokeJobData *data) |
| void | addMutatedJobs (const QVector< KisStrokeJobData * > list) |
| KisStrokeStrategy (const KisStrokeStrategy &rhs) | |
| void | setAsynchronouslyCancellable (bool value) |
| void | setBalancingRatioOverride (qreal value) |
| void | setCanForgetAboutMe (bool value) |
| void | setClearsRedoOnStart (bool value) |
| void | setExclusive (bool value) |
| void | setNeedsExplicitCancel (bool value) |
| void | setRequestsOtherStrokesToEnd (bool value) |
| void | setSupportsWrapAroundMode (bool value) |
Private Attributes | |
| QElapsedTimer | m_idleStrokeTime |
| QSharedPointer< boost::none_t > | m_idleTaskCookie |
Additional Inherited Members | |
Public Types inherited from KisSimpleStrokeStrategy | |
| enum | JobType { JOB_INIT = 0 , JOB_CANCEL , JOB_FINISH , JOB_DOSTROKE , JOB_SUSPEND , JOB_RESUME , NJOBS } |
A base class for strategies used in "idle tasks". Such strategy does not modify any undo stack and can be cancelled by the image at any moment (e.g. when the user starts a real brush stroke).
If you need to handle the cancellation event, implement cancelStrokeCallback() function.
Definition at line 26 of file KisIdleTaskStrokeStrategy.h.
| KisIdleTaskStrokeStrategy::KisIdleTaskStrokeStrategy | ( | const QLatin1String & | id, |
| const KUndo2MagicString & | name = KUndo2MagicString() ) |
Definition at line 9 of file KisIdleTaskStrokeStrategy.cpp.
References KisStrokeJobData::BARRIER, KisSimpleStrokeStrategy::enableJob(), KisStrokeJobData::EXCLUSIVE, KisSimpleStrokeStrategy::JOB_CANCEL, KisSimpleStrokeStrategy::JOB_DOSTROKE, KisSimpleStrokeStrategy::JOB_FINISH, KisSimpleStrokeStrategy::JOB_INIT, KisStrokeJobData::SEQUENTIAL, KisStrokeStrategy::setCanForgetAboutMe(), KisStrokeStrategy::setClearsRedoOnStart(), and KisStrokeStrategy::setRequestsOtherStrokesToEnd().
|
default |
|
overridevirtual |
We do not generate preview for Instant Preview mode. Even though we could do that, it is not very needed, because KisIdleWatcher ensures that overview preview is generated only when all the background jobs are completed.
The only thing we should do about Instant Preview is to avoid resetting LoDN planes, when the thumbnail is running. Therefore we should return a fake noop strategy as our LoDN clone (that is a marker of non-legacy stroke for the scheduler)
Reimplemented from KisStrokeStrategy.
Definition at line 25 of file KisIdleTaskStrokeStrategy.cpp.
References KisSimpleStrokeStrategy::KisSimpleStrokeStrategy().
|
overrideprotectedvirtual |
Just a small sanity check if idle tasks don't occupy too much time and don't interfere with user's workflow. Theoretically, even if the time consumed is too high, it may still be acceptable if the task is split in multiple jobs, which would be cancelled but the user's action.
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 47 of file KisIdleTaskStrokeStrategy.cpp.
References KisStrokeStrategy::id(), m_idleStrokeTime, preferredIdleTaskMaximumTime(), and sigIdleTaskFinished().
| QWeakPointer< boost::none_t > KisIdleTaskStrokeStrategy::idleTaskCookie | ( | ) |
Definition at line 68 of file KisIdleTaskStrokeStrategy.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and m_idleTaskCookie.
|
overrideprotectedvirtual |
Reimplemented from KisSimpleStrokeStrategy.
Reimplemented in KisImageThumbnailStrokeStrategyBase, and ThumbnailsStroke.
Definition at line 42 of file KisIdleTaskStrokeStrategy.cpp.
References m_idleStrokeTime.
|
static |
Sometimes (unless split into multiple jobs) idle tasks can interfere with user actions. We have a sanity check that checks if the tasks are quick enough to not interfere into the user's actions. This time limit is the maximum "allowed" idle task size.
Definition of "allowed" here is not strict, since the tasks are not cancelled when reaching the limit. Just a warning is spit into the terminal.
Definition at line 75 of file KisIdleTaskStrokeStrategy.cpp.
|
static |
Preferred idle watcher interval for checks of the image idleness state. Idle watcher checks the image four times before starting an idle task, so the actual idle task delay is 4 * preferredIdleWatcherInterval() milliseconds.
Definition at line 91 of file KisIdleTaskStrokeStrategy.cpp.
|
signal |
|
private |
Definition at line 47 of file KisIdleTaskStrokeStrategy.h.
|
private |
Definition at line 46 of file KisIdleTaskStrokeStrategy.h.