Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FSlowTask Struct Reference

#include <SlowTask.h>

+ Inheritance diagram for FSlowTask:
+ Collaboration diagram for FSlowTask:

Public Member Functions

 FSlowTask (float InAmountOfWork, const FText &InDefaultMessage=FText(), bool bInEnabled=true, FFeedbackContext &InContext= *GWarn)
 
void Initialize ()
 
void Destroy ()
 
void MakeDialogDelayed (float Threshold, bool bShowCancelButton=false, bool bAllowInPIE=false)
 
void MakeDialog (bool bShowCancelButton=false, bool bAllowInPIE=false)
 
void EnterProgressFrame (float ExpectedWorkThisFrame=1.f, const FText &Text=FText())
 
void TickProgress ()
 
const FTextGetCurrentMessage () const
 
bool ShouldCancel () const
 

Static Public Member Functions

static bool ShouldCreateThrottledSlowTask ()
 

Public Attributes

FText DefaultMessage
 
FText FrameMessage
 
float TotalAmountOfWork
 
float CompletedWork
 
float CurrentFrameScope
 
ESlowTaskVisibility Visibility
 
double StartTime
 
TOptional< floatOpenDialogThreshold
 

Private Member Functions

 FSlowTask (const FSlowTask &)
 
bool MakeDialogIfNeeded ()
 
void MakeRecursiveDialogIfNeeded ()
 

Static Private Member Functions

static void ForceRefresh (FFeedbackContext &Context)
 

Private Attributes

bool bEnabled
 
bool bCreatedDialog
 
FFeedbackContextContext
 
bool bDelayedDialogShowCancelButton: 1
 
bool bDelayedDialogAllowInPIE: 1
 
bool bSkipRecursiveDialogCreation: 1
 

Detailed Description

Data type used to store information about a currently running slow task. Direct use is not advised, use FScopedSlowTask instead

Definition at line 26 of file SlowTask.h.

Constructor & Destructor Documentation

◆ FSlowTask() [1/2]

FSlowTask::FSlowTask ( const FSlowTask & )
private

Prevent copying

◆ FSlowTask() [2/2]

FSlowTask::FSlowTask ( float InAmountOfWork,
const FText & InDefaultMessage = FText(),
bool bInEnabled = true,
FFeedbackContext & InContext = *GWarn )

Construct this scope from an amount of work to do, and a message to display

Parameters
InAmountOfWorkArbitrary number of work units to perform (can be a percentage or number of steps). 0 indicates that no progress frames are to be entered in this scope (automatically enters a frame encompassing the entire scope)
InDefaultMessageA message to display to the user to describe the purpose of the scope
bInVisibleWhen false, this scope will have no effect. Allows for proper scoped objects that are conditionally hidden.
+ Here is the caller graph for this function:

Member Function Documentation

◆ Destroy()

void FSlowTask::Destroy ( )

Function that finishes any remaining work and removes itself from the global scope stack

+ Here is the caller graph for this function:

◆ EnterProgressFrame()

void FSlowTask::EnterProgressFrame ( float ExpectedWorkThisFrame = 1.f,
const FText & Text = FText() )

Indicate that we are to enter a frame that will take up the specified amount of work. Completes any previous frames (potentially contributing to parent scopes' progress).

Parameters
ExpectedWorkThisFrameThe amount of work that will happen between now and the next frame, as a numerator of TotalAmountOfWork.
TextOptional text to describe this frame's purpose.

◆ ForceRefresh()

static void FSlowTask::ForceRefresh ( FFeedbackContext & Context)
staticprivate

Whenever we encounter edge condition requiring to force a UI refresh

◆ GetCurrentMessage()

const FText & FSlowTask::GetCurrentMessage ( ) const

Get the frame message or default message if empty

◆ Initialize()

void FSlowTask::Initialize ( )

Function that initializes the scope by adding it to its context's stack

+ Here is the caller graph for this function:

◆ MakeDialog()

void FSlowTask::MakeDialog ( bool bShowCancelButton = false,
bool bAllowInPIE = false )

Creates a new dialog for this slow task, if there is currently not one open

Parameters
bShowCancelButtonWhether to show a cancel button on the dialog or not
bAllowInPIEWhether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions.

◆ MakeDialogDelayed()

void FSlowTask::MakeDialogDelayed ( float Threshold,
bool bShowCancelButton = false,
bool bAllowInPIE = false )

Creates a new dialog for this slow task after the given time threshold. If the task completes before this time, no dialog will be shown.

Parameters
ThresholdTime in seconds before dialog will be shown.
bShowCancelButtonWhether to show a cancel button on the dialog or not
bAllowInPIEWhether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions.

◆ MakeDialogIfNeeded()

bool FSlowTask::MakeDialogIfNeeded ( )
private

Handle dialog and delayed dialog creation logic

◆ MakeRecursiveDialogIfNeeded()

void FSlowTask::MakeRecursiveDialogIfNeeded ( )
private

Call MakeDialogIfNeeded on all scopes recursively to give them a chance to create a delayed dialog in the hierarchy

◆ ShouldCancel()

bool FSlowTask::ShouldCancel ( ) const

True if the user has requested that the slow task be canceled

◆ ShouldCreateThrottledSlowTask()

static bool FSlowTask::ShouldCreateThrottledSlowTask ( )
static

True if a slow task should be created. False if a slow task should not be created because another was created recently.

◆ TickProgress()

void FSlowTask::TickProgress ( )

Let the UI refresh but doesn't advance progress. This should be called at regular intervals even when no progress is being made to keep the UI responsive.

Member Data Documentation

◆ bCreatedDialog

bool FSlowTask::bCreatedDialog
private

Flag that specifies whether this feedback scope created a new slow task dialog

Definition at line 58 of file SlowTask.h.

◆ bDelayedDialogAllowInPIE

bool FSlowTask::bDelayedDialogAllowInPIE
private

Specify whether the delayed dialog is allowed in PIE

Definition at line 67 of file SlowTask.h.

◆ bDelayedDialogShowCancelButton

bool FSlowTask::bDelayedDialogShowCancelButton
private

Specify whether the delayed dialog should show a cancel button

Definition at line 64 of file SlowTask.h.

◆ bEnabled

bool FSlowTask::bEnabled
private

Boolean flag to control whether this scope actually does anything (unset for quiet operations etc)

Definition at line 55 of file SlowTask.h.

◆ bSkipRecursiveDialogCreation

bool FSlowTask::bSkipRecursiveDialogCreation
private

Avoid calling hierarchical dialog creation if not required

Definition at line 70 of file SlowTask.h.

◆ CompletedWork

float FSlowTask::CompletedWork

The amount of work we have already completed in this scope

Definition at line 38 of file SlowTask.h.

◆ Context

FFeedbackContext& FSlowTask::Context
private

The feedback context that we belong to

Definition at line 61 of file SlowTask.h.

◆ CurrentFrameScope

float FSlowTask::CurrentFrameScope

The amount of work the current frame is responsible for

Definition at line 41 of file SlowTask.h.

◆ DefaultMessage

FText FSlowTask::DefaultMessage

Default message to display to the user when not overridden by a frame

Definition at line 29 of file SlowTask.h.

◆ FrameMessage

FText FSlowTask::FrameMessage

Message pertaining to the current frame's work

Definition at line 32 of file SlowTask.h.

◆ OpenDialogThreshold

TOptional<float> FSlowTask::OpenDialogThreshold

Threshold before dialog is opened

Definition at line 50 of file SlowTask.h.

◆ StartTime

double FSlowTask::StartTime

The time that this scope was created

Definition at line 47 of file SlowTask.h.

◆ TotalAmountOfWork

float FSlowTask::TotalAmountOfWork

The amount of work to do in this scope

Definition at line 35 of file SlowTask.h.

◆ Visibility

ESlowTaskVisibility FSlowTask::Visibility

The visibility of this slow task

Definition at line 44 of file SlowTask.h.


The documentation for this struct was generated from the following file: