Public Member Functions | Protected Member Functions | List of all members
DialogWindowWithBackgroundThread Class Referenceabstract

A dialog window that performs an operation on a background thread. More...

Inherits AlertWindow, QuasiModalComponent, and AsyncUpdater.

Inherited by CodeReplacer, ExternalResourceCollector, FileImportDialogWindow, MultimicMergeDialogWindow, NormalizeThread, PresetLoadingThread, ReferenceFinder, SampleDataExporter, SampleDataImporter, SampleResolver, and SampleStartTrimmer.

Public Member Functions

virtual bool checkConditionsBeforeStartingThread ()
 If you want to check something (on the message thread) before launching the actual task, overwrite this method. More...
 
virtual void resultButtonClicked (const String &)
 If you want to use a button for anything else than starting or cancelling, you can override this method and do whatever you need. More...
 
virtual void run ()=0
 Overwrite this method and do your thing. More...
 
void runSynchronous ()
 Starts the task synchronously. More...
 
void runThread ()
 Starts the thread. More...
 
void setProgress (double progressValue)
 Sets the progressbar during job execution. More...
 
void showStatusMessage (const String &message) const
 Shows a status message during job execution. More...
 
virtual void threadFinished ()=0
 This will be called after the thread has finished its task. More...
 
bool threadShouldExit () const
 Checks if the thread should exist. More...
 
virtual ~DialogWindowWithBackgroundThread ()
 This stops the thread. More...
 

Protected Member Functions

void addBasicComponents (bool addOkButton=true)
 Call this method in your constructor after you created all custom methods. More...
 
 DialogWindowWithBackgroundThread (const String &title, bool synchronous=false)
 Creates a new instance with the given title. More...
 

Detailed Description

A dialog window that performs an operation on a background thread.

In order to use it, subclass it and overwrite the two callbacks run() and threadFinished().

Then simply create a instance and call its method 'setModalComponentOfMainEditor()'

Constructor & Destructor Documentation

This stops the thread.

In order to avoid killing, check threadShouldExit() regularly in your run() method.

DialogWindowWithBackgroundThread ( const String &  title,
bool  synchronous = false 
)
protected

Creates a new instance with the given title.

Don't forget to call 'addBasicComponents' after you added your stuff.

Member Function Documentation

void addBasicComponents ( bool  addOkButton = true)
protected

Call this method in your constructor after you created all custom methods.

virtual bool checkConditionsBeforeStartingThread ( )
inlinevirtual

If you want to check something (on the message thread) before launching the actual task, overwrite this method.

This will be called when the user presses OK. If you return false, it won't launch the process.

virtual void resultButtonClicked ( const String &  )
inlinevirtual

If you want to use a button for anything else than starting or cancelling, you can override this method and do whatever you need.

The name is the same String that you specified with 'addButton()'

virtual void run ( )
pure virtual

Overwrite this method and do your thing.

void runSynchronous ( )

Starts the task synchronously.

void runThread ( )

Starts the thread.

void setProgress ( double  progressValue)
inline

Sets the progressbar during job execution.

void showStatusMessage ( const String &  message) const

Shows a status message during job execution.

virtual void threadFinished ( )
pure virtual

This will be called after the thread has finished its task.

It is called from the message loop so you can do some interface stuff without caring about the MessageManagerLock.

bool threadShouldExit ( ) const

Checks if the thread should exist.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.