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

#include <KisAsynchronousStrokeUpdateHelper.h>

+ Inheritance diagram for KisAsynchronousStrokeUpdateHelper:

Classes

class  UpdateData
 

Public Types

using UpdateDataFactory = std::function<KisStrokeJobData*(bool)>
 

Public Member Functions

void cancelUpdateStream ()
 
void endUpdateStream ()
 
void initUpdateStreamLowLevel (KisStrokesFacade *strokesFacade, KisStrokeId strokeId)
 
bool isActive () const
 
 KisAsynchronousStrokeUpdateHelper ()
 
void setCustomUpdateDataFactory (UpdateDataFactory factory)
 
void startUpdateStream (KisStrokesFacade *strokesFacade, KisStrokeId strokeId)
 
void startUpdateStreamLowLevel ()
 
 ~KisAsynchronousStrokeUpdateHelper ()
 

Private Slots

void slotAsyncUpdateCame (bool forceUpdate=false)
 

Private Attributes

UpdateDataFactory m_customUpdateFactory
 
KisStrokeId m_strokeId
 
KisStrokesFacadem_strokesFacade
 
QTimer m_updateThresholdTimer
 

Detailed Description

Definition at line 20 of file KisAsynchronousStrokeUpdateHelper.h.

Member Typedef Documentation

◆ UpdateDataFactory

Constructor & Destructor Documentation

◆ KisAsynchronousStrokeUpdateHelper()

KisAsynchronousStrokeUpdateHelper::KisAsynchronousStrokeUpdateHelper ( )

Definition at line 10 of file KisAsynchronousStrokeUpdateHelper.cpp.

12{
13 m_updateThresholdTimer.setSingleShot(false);
14 m_updateThresholdTimer.setInterval(80 /* ms */);
15 connect(&m_updateThresholdTimer, SIGNAL(timeout()), SLOT(slotAsyncUpdateCame()));
16}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))

References connect(), m_updateThresholdTimer, and slotAsyncUpdateCame().

◆ ~KisAsynchronousStrokeUpdateHelper()

KisAsynchronousStrokeUpdateHelper::~KisAsynchronousStrokeUpdateHelper ( )

Definition at line 18 of file KisAsynchronousStrokeUpdateHelper.cpp.

19{
20
21}

Member Function Documentation

◆ cancelUpdateStream()

void KisAsynchronousStrokeUpdateHelper::cancelUpdateStream ( )

◆ endUpdateStream()

◆ initUpdateStreamLowLevel()

void KisAsynchronousStrokeUpdateHelper::initUpdateStreamLowLevel ( KisStrokesFacade * strokesFacade,
KisStrokeId strokeId )

A low-level version of startUpdateStream(...), initializes the helper but doesn't start the stream of update events. That is needed for the tool to issue endUpdateStream() signals, when the action has been ended before the stroke actually managed to initialize itself.

Definition at line 23 of file KisAsynchronousStrokeUpdateHelper.cpp.

24{
25 m_strokesFacade = strokesFacade;
26 m_strokeId = strokeId;
27}

References m_strokeId, and m_strokesFacade.

◆ isActive()

bool KisAsynchronousStrokeUpdateHelper::isActive ( ) const

Definition at line 60 of file KisAsynchronousStrokeUpdateHelper.cpp.

61{
62 return bool(m_strokeId);
63}

References m_strokeId.

◆ setCustomUpdateDataFactory()

void KisAsynchronousStrokeUpdateHelper::setCustomUpdateDataFactory ( KisAsynchronousStrokeUpdateHelper::UpdateDataFactory factory)

Definition at line 65 of file KisAsynchronousStrokeUpdateHelper.cpp.

References m_customUpdateFactory.

◆ slotAsyncUpdateCame

void KisAsynchronousStrokeUpdateHelper::slotAsyncUpdateCame ( bool forceUpdate = false)
privateslot

Definition at line 70 of file KisAsynchronousStrokeUpdateHelper.cpp.

71{
72 if (!m_strokeId || !m_strokesFacade) return;
75 m_customUpdateFactory(forceUpdate) :
76 new UpdateData(forceUpdate));
77}
virtual void addJob(KisStrokeId id, KisStrokeJobData *data)=0

References KisStrokesFacade::addJob(), m_customUpdateFactory, m_strokeId, and m_strokesFacade.

◆ startUpdateStream()

void KisAsynchronousStrokeUpdateHelper::startUpdateStream ( KisStrokesFacade * strokesFacade,
KisStrokeId strokeId )

Initialize the update helper and start the steam of the update events. This is just a simple combination of initUpdateStreamLowLevel() and startUpdateStreamLowLevel().

Definition at line 37 of file KisAsynchronousStrokeUpdateHelper.cpp.

38{
39 initUpdateStreamLowLevel(strokesFacade, strokeId);
41}
void initUpdateStreamLowLevel(KisStrokesFacade *strokesFacade, KisStrokeId strokeId)

References initUpdateStreamLowLevel(), and startUpdateStreamLowLevel().

◆ startUpdateStreamLowLevel()

void KisAsynchronousStrokeUpdateHelper::startUpdateStreamLowLevel ( )

Start the stream of the update events on already initialized helper. One should call initUpdateStreamWithoutStart() before calling startUpdateStream().

Definition at line 29 of file KisAsynchronousStrokeUpdateHelper.cpp.

References KIS_SAFE_ASSERT_RECOVER_RETURN, m_strokeId, m_strokesFacade, and m_updateThresholdTimer.

Member Data Documentation

◆ m_customUpdateFactory

UpdateDataFactory KisAsynchronousStrokeUpdateHelper::m_customUpdateFactory
private

Definition at line 93 of file KisAsynchronousStrokeUpdateHelper.h.

◆ m_strokeId

KisStrokeId KisAsynchronousStrokeUpdateHelper::m_strokeId
private

Definition at line 92 of file KisAsynchronousStrokeUpdateHelper.h.

◆ m_strokesFacade

KisStrokesFacade* KisAsynchronousStrokeUpdateHelper::m_strokesFacade
private

Definition at line 90 of file KisAsynchronousStrokeUpdateHelper.h.

◆ m_updateThresholdTimer

QTimer KisAsynchronousStrokeUpdateHelper::m_updateThresholdTimer
private

Definition at line 91 of file KisAsynchronousStrokeUpdateHelper.h.


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