Ark Server API (ASA) - Wiki
|
#include <SlowTask.h>
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 FText & | GetCurrentMessage () const |
bool | ShouldCancel () const |
Static Public Member Functions | |
static bool | ShouldCreateThrottledSlowTask () |
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 |
FFeedbackContext & | Context |
bool | bDelayedDialogShowCancelButton: 1 |
bool | bDelayedDialogAllowInPIE: 1 |
bool | bSkipRecursiveDialogCreation: 1 |
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.
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
InAmountOfWork | Arbitrary 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) |
InDefaultMessage | A message to display to the user to describe the purpose of the scope |
bInVisible | When false, this scope will have no effect. Allows for proper scoped objects that are conditionally hidden. |
void FSlowTask::Destroy | ( | ) |
Function that finishes any remaining work and removes itself from the global scope stack
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).
ExpectedWorkThisFrame | The amount of work that will happen between now and the next frame, as a numerator of TotalAmountOfWork. |
Text | Optional text to describe this frame's purpose. |
|
staticprivate |
Whenever we encounter edge condition requiring to force a UI refresh
Get the frame message or default message if empty
void FSlowTask::Initialize | ( | ) |
Function that initializes the scope by adding it to its context's stack
Creates a new dialog for this slow task, if there is currently not one open
bShowCancelButton | Whether to show a cancel button on the dialog or not |
bAllowInPIE | Whether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions. |
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.
Threshold | Time in seconds before dialog will be shown. |
bShowCancelButton | Whether to show a cancel button on the dialog or not |
bAllowInPIE | Whether to allow this dialog in PIE. If false, this dialog will not appear during PIE sessions. |
|
private |
Handle dialog and delayed dialog creation logic
|
private |
Call MakeDialogIfNeeded on all scopes recursively to give them a chance to create a delayed dialog in the hierarchy
bool FSlowTask::ShouldCancel | ( | ) | const |
True if the user has requested that the slow task be canceled
True if a slow task should be created. False if a slow task should not be created because another was created recently.
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.
|
private |
Flag that specifies whether this feedback scope created a new slow task dialog
Definition at line 58 of file SlowTask.h.
|
private |
Specify whether the delayed dialog is allowed in PIE
Definition at line 67 of file SlowTask.h.
|
private |
Specify whether the delayed dialog should show a cancel button
Definition at line 64 of file SlowTask.h.
|
private |
Boolean flag to control whether this scope actually does anything (unset for quiet operations etc)
Definition at line 55 of file SlowTask.h.
|
private |
Avoid calling hierarchical dialog creation if not required
Definition at line 70 of file SlowTask.h.
float FSlowTask::CompletedWork |
The amount of work we have already completed in this scope
Definition at line 38 of file SlowTask.h.
|
private |
The feedback context that we belong to
Definition at line 61 of file SlowTask.h.
float FSlowTask::CurrentFrameScope |
The amount of work the current frame is responsible for
Definition at line 41 of file SlowTask.h.
FText FSlowTask::DefaultMessage |
Default message to display to the user when not overridden by a frame
Definition at line 29 of file SlowTask.h.
FText FSlowTask::FrameMessage |
Message pertaining to the current frame's work
Definition at line 32 of file SlowTask.h.
Threshold before dialog is opened
Definition at line 50 of file SlowTask.h.
double FSlowTask::StartTime |
The time that this scope was created
Definition at line 47 of file SlowTask.h.
float FSlowTask::TotalAmountOfWork |
The amount of work to do in this scope
Definition at line 35 of file SlowTask.h.
ESlowTaskVisibility FSlowTask::Visibility |
The visibility of this slow task
Definition at line 44 of file SlowTask.h.