A thread that automatically pops up a modal dialog box with a progress bar and cancel button while it's busy running. More...
|ThreadWithProgressWindow (const String &windowTitle, bool hasProgressBar, bool hasCancelButton, int timeOutMsWhenCancelling=10000, const String &cancelButtonText=String(), Component *componentToCentreAround=nullptr)|
|Creates the thread. |
|void||launchThread (int threadPriority=5)|
|Starts the thread and returns. |
|void||setProgress (double newProgress)|
|The thread should call this periodically to update the position of the progress bar. |
|void||setStatusMessage (const String &newStatusMessage)|
|The thread can call this to change the message that's displayed in the dialog box. |
|AlertWindow *||getAlertWindow () const noexcept|
|Returns the AlertWindow that is being used. |
|virtual void||threadComplete (bool userPressedCancel)|
|This method is called (on the message thread) when the operation has finished. |
|Public Member Functions inherited from Thread|
|Thread (const String &threadName)|
|Creates a thread. |
|virtual void||run ()=0|
|Must be implemented to perform the thread's actual code. |
|Starts the thread running. |
|void||startThread (int priority)|
|Starts the thread with a given priority. |
|bool||stopThread (int timeOutMilliseconds)|
|Attempts to stop the thread running. |
|bool||isThreadRunning () const|
|Returns true if the thread is currently active. |
|Sets a flag to tell the thread it should stop. |
|bool||threadShouldExit () const|
|Checks whether the thread has been told to stop running. |
|bool||waitForThreadToExit (int timeOutMilliseconds) const|
|Waits for the thread to stop. |
|bool||setPriority (int priority)|
|Changes the thread's priority. |
|void||setAffinityMask (uint32 affinityMask)|
|Sets the affinity mask for the thread. |
|bool||wait (int timeOutMilliseconds) const|
|Makes the thread wait for a notification. |
|void||notify () const|
|Wakes up the thread. |
|ThreadID||getThreadId () const noexcept|
|Returns the ID of this thread. |
|const String &||getThreadName () const|
|Returns the name of the thread. |
|Public Types inherited from Thread|
|typedef void *||ThreadID|
|A value type used for thread IDs. |
|Static Public Member Functions inherited from Thread|
|static bool||setCurrentThreadPriority (int priority)|
|Changes the priority of the caller thread. |
|static void JUCE_CALLTYPE||setCurrentThreadAffinityMask (uint32 affinityMask)|
|Changes the affinity mask for the caller thread. |
|static void JUCE_CALLTYPE||sleep (int milliseconds)|
|static void JUCE_CALLTYPE||yield ()|
|Yields the calling thread's current time-slot. |
|static ThreadID JUCE_CALLTYPE||getCurrentThreadId ()|
|Returns an id that identifies the caller thread. |
|static Thread *JUCE_CALLTYPE||getCurrentThread ()|
|Finds the thread object that is currently running. |
|static void JUCE_CALLTYPE||setCurrentThreadName (const String &newThreadName)|
|Changes the name of the caller thread. |
|Private Member Functions inherited from Timer|
|void||startTimer (int intervalInMilliseconds) noexcept|
|Starts the timer and sets the length of interval required. |
|void||stopTimer () noexcept|
|Stops the timer. |
|bool||isTimerRunning () const noexcept|
|Checks if the timer has been started. |
|int||getTimerInterval () const noexcept|
|Returns the timer's interval. |
|Timer () noexcept|
|Creates a Timer. |
|Timer (const Timer &other) noexcept|
|Creates a copy of another timer. |
|Static Private Member Functions inherited from Timer|
|static void JUCE_CALLTYPE||callPendingTimersSynchronously ()|
|For internal use only: invokes any timers that need callbacks. |
A thread that automatically pops up a modal dialog box with a progress bar and cancel button while it's busy running.
These are handy for performing some sort of task while giving the user feedback about how long there is to go, etc.
|ThreadWithProgressWindow::ThreadWithProgressWindow||(||const String &||windowTitle,|
|const String &||cancelButtonText =
|Component *||componentToCentreAround =
Creates the thread.
Initially, the dialog box won't be visible, it'll only appear when the runThread() method is called.
|windowTitle||the title to go at the top of the dialog box|
|hasProgressBar||whether the dialog box should have a progress bar (see setProgress() )|
|hasCancelButton||whether the dialog box should have a cancel button|
|timeOutMsWhenCancelling||when 'cancel' is pressed, this is how long to wait for the thread to stop before killing it forcibly (see Thread::stopThread() )|
|cancelButtonText||the text that should be shown in the cancel button (if it has one). Leave this empty for the default "Cancel"|
|componentToCentreAround||if this is non-null, the window will be positioned so that it's centred around this component.|
|void ThreadWithProgressWindow::launchThread||(||int||threadPriority = ||)|
Starts the thread and returns.
This will start the thread and make the dialog box appear in a modal state. When the thread finishes normally, or the cancel button is pressed, the window will be hidden and the threadComplete() method will be called.
|threadPriority||the priority to use when starting the thread - see Thread::startThread() for values|
The thread should call this periodically to update the position of the progress bar.
|newProgress||the progress, from 0.0 to 1.0|
|void ThreadWithProgressWindow::setStatusMessage||(||const String &||newStatusMessage||)|
The thread can call this to change the message that's displayed in the dialog box.
Returns the AlertWindow that is being used.
This method is called (on the message thread) when the operation has finished.
You may choose to use this callback to delete the ThreadWithProgressWindow object.