Use QApp::exec to run the nav-cache init dialog.
This avoids an issue where the dialog doesn’t update on macOS, if it’s shown immediately after a native message box, such as the migration warning dialog.
This commit is contained in:
parent
05d455debc
commit
31c66b3a37
1 changed files with 16 additions and 11 deletions
|
@ -106,15 +106,18 @@ void initNavCache()
|
|||
| Qt::WindowSystemMenuHint
|
||||
| Qt::MSWindowsFixedSizeDialogHint);
|
||||
rebuildProgress.setWindowModality(Qt::WindowModal);
|
||||
rebuildProgress.setMinimumWidth(600);
|
||||
rebuildProgress.show();
|
||||
|
||||
NavDataCache::RebuildPhase phase = cache->rebuild();
|
||||
|
||||
while (phase != NavDataCache::REBUILD_DONE) {
|
||||
// sleep to give the rebuild thread more time
|
||||
SGTimeStamp::sleepForMSec(50);
|
||||
phase = cache->rebuild();
|
||||
|
||||
|
||||
QTimer updateTimer;
|
||||
updateTimer.setInterval(500);
|
||||
QObject::connect(&updateTimer, &QTimer::timeout, [&cache, &rebuildProgress, &baseLabel]() {
|
||||
auto phase = cache->rebuild();
|
||||
if (phase == NavDataCache::REBUILD_DONE) {
|
||||
rebuildProgress.done(0);
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = std::find_if(progressStrings.begin(), progressStrings.end(), [phase]
|
||||
(const ProgressLabel& l) { return l.phase == phase; });
|
||||
if (it == progressStrings.end()) {
|
||||
|
@ -131,9 +134,11 @@ void initNavCache()
|
|||
rebuildProgress.setValue(static_cast<int>(cache->rebuildPhaseCompletionPercentage()));
|
||||
rebuildProgress.setMaximum(100);
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
});
|
||||
|
||||
updateTimer.start(); // timer won't actually run until we process events
|
||||
rebuildProgress.exec();
|
||||
updateTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue