You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
FScopedSlowTask has been refactored to better allow for nesting of slow operations. This allows us to cascade nested scopes and provide accurate feedback on slow tasks. FScopedSlowTasks now work together when nested inside sub functions. Break up long functions that contain calls to multiple nested FScopedSlowTasks with FScopedSlowTask::EnterProgressFrame().
Example Usage:
void DoSlowWork()
{
FScopedSlowTask Progress(2.f, LOCTEXT("DoingSlowWork", "Doing Slow Work..."));
// Optionally make this show a dialog if not already shown
Progress.MakeDialog();
// Indicate that we are entering a frame representing 1 unit of work
Progress.EnterProgressFrame(1.f);
// DoFirstThing() can follow a similar pattern of creating a scope divided into frames. These contribute to their parent's progress frame proportionately.
DoFirstThing();
Progress.EnterProgressFrame(1.f);
DoSecondThing();
}
This addresses TTP#338602 - NEEDS REVIEW: Editor progress bars nearly always just show 100%, don't offer useful indication of progress
[CL 2322391 by Andrew Rodham in Main branch]
66 lines
1.7 KiB
Objective-C
66 lines
1.7 KiB
Objective-C
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
|
|
@interface FMacNativeFeedbackContextWindowController : NSObject
|
|
{
|
|
@public
|
|
NSTextView* TextView;
|
|
@private
|
|
NSScrollView* LogView;
|
|
NSWindow* Window;
|
|
NSTextField* StatusLabel;
|
|
NSButton* CancelButton;
|
|
NSButton* ShowLogButton;
|
|
NSProgressIndicator* ProgressIndicator;
|
|
}
|
|
-(id)init;
|
|
-(void)dealloc;
|
|
-(void)setShowProgress:(bool)bShowProgress;
|
|
-(void)setShowCancelButton:(bool)bShowCancelButton;
|
|
-(void)setTitleText:(NSString*)Title;
|
|
-(void)setStatusText:(NSString*)Text;
|
|
-(void)setProgress:(double)Progress total:(double)Total;
|
|
-(void)showWindow;
|
|
-(void)hideWindow;
|
|
-(bool)windowOpen;
|
|
@end
|
|
|
|
/**
|
|
* Feedback context implementation for Mac.
|
|
*/
|
|
class FMacNativeFeedbackContext : public FFeedbackContext
|
|
{
|
|
public:
|
|
// Constructor.
|
|
FMacNativeFeedbackContext();
|
|
virtual ~FMacNativeFeedbackContext();
|
|
|
|
virtual void Serialize( const TCHAR* V, ELogVerbosity::Type Verbosity, const class FName& Category ) override;
|
|
|
|
virtual bool YesNof(const FText& Text) override;
|
|
|
|
virtual bool ReceivedUserCancel() override;
|
|
|
|
virtual void StartSlowTask( const FText& Task, bool bShowCancelButton=false ) override;
|
|
virtual void FinalizeSlowTask( ) override;
|
|
virtual void ProgressReported( const float TotalProgressInterp, FText DisplayMessage ) override;
|
|
|
|
FContextSupplier* GetContext() const;
|
|
void SetContext( FContextSupplier* InSupplier );
|
|
|
|
private:
|
|
void SetDefaultTextColor();
|
|
|
|
private:
|
|
/** Critical section for Serialize() */
|
|
FCriticalSection CriticalSection;
|
|
FMacNativeFeedbackContextWindowController* WindowController;
|
|
NSDictionary* TextViewTextColor;
|
|
FContextSupplier* Context;
|
|
uint64 OutstandingTasks;
|
|
int32 SlowTaskCount;
|
|
bool bShowingConsoleForSlowTask;
|
|
};
|