mirror of https://github.com/stella-emu/stella.git
improved progress bar handling for long running file list operations
This commit is contained in:
parent
355658bf2e
commit
cace55868c
|
@ -157,7 +157,6 @@ ProgressDialog& FileListWidget::progress()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FileListWidget::incProgress()
|
||||
{
|
||||
if(_includeSubDirs)
|
||||
progress().incProgress();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ void ProgressDialog::setRange(int start, int finish, int step)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ProgressDialog::resetProgress()
|
||||
{
|
||||
myProgress = myStepProgress = 0;
|
||||
myLastTick = TimerManager::getTicks();
|
||||
myProgress = 0;
|
||||
mySlider->setValue(0);
|
||||
myIsCancelled = false;
|
||||
}
|
||||
|
@ -105,10 +106,10 @@ void ProgressDialog::resetProgress()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ProgressDialog::setProgress(int progress)
|
||||
{
|
||||
// Only increase the progress bar if we have arrived at a new step
|
||||
if(progress - myStepProgress >= myStep)
|
||||
// Only increase the progress bar if some time has passed
|
||||
if(TimerManager::getTicks() - myLastTick > 100000) // update every 1/10th second
|
||||
{
|
||||
myStepProgress = progress;
|
||||
myLastTick = TimerManager::getTicks();
|
||||
mySlider->setValue(progress % (myFinish - myStart + 1));
|
||||
|
||||
// Since this dialog is usually called in a tight loop that doesn't
|
||||
|
|
|
@ -47,7 +47,7 @@ class ProgressDialog : public Dialog
|
|||
|
||||
int myStart{0}, myFinish{0}, myStep{0};
|
||||
int myProgress{0};
|
||||
int myStepProgress{0};
|
||||
uInt64 myLastTick{0};
|
||||
bool myIsCancelled{false};
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue