TerraSync: add another ‘is downloading’ helper

This commit is contained in:
James Turner 2021-06-18 09:34:30 +01:00
parent 59307e9ba2
commit a49619fa6c
2 changed files with 14 additions and 2 deletions

View File

@ -1362,14 +1362,18 @@ void SGTerraSync::setSceneryPathSuffixes(const string_list& suffixes)
} }
bool SGTerraSync::isTileDirPending(const std::string& sceneryDir) const bool SGTerraSync::isTileDirPending(const std::string& sceneryDir) const
{
return innerIsTileDirPending(sceneryDir, false);
}
bool SGTerraSync::innerIsTileDirPending(const std::string& sceneryDir, bool isOSM) const
{ {
if (!_workerThread->isRunning()) { if (!_workerThread->isRunning()) {
return false; return false;
} }
for (const auto& suffix : _sceneryPathSuffixes) { for (const auto& suffix : _sceneryPathSuffixes) {
// don't wait on OSM dirs, even if enabled if (isOSM != isOSMSuffix(suffix)) {
if (isOSMSuffix(suffix)) {
continue; continue;
} }
@ -1382,6 +1386,11 @@ bool SGTerraSync::isTileDirPending(const std::string& sceneryDir) const
return false; return false;
} }
bool SGTerraSync::isTileDirPendingOSM(const std::string& sceneryDir) const
{
return innerIsTileDirPending(sceneryDir, true);
}
void SGTerraSync::scheduleDataDir(const std::string& dataDir) void SGTerraSync::scheduleDataDir(const std::string& dataDir)
{ {
if (!_workerThread->isRunning()) { if (!_workerThread->isRunning()) {

View File

@ -81,6 +81,7 @@ public:
*/ */
bool isTileDirPending(const std::string& sceneryDir) const; bool isTileDirPending(const std::string& sceneryDir) const;
bool isTileDirPendingOSM(const std::string& sceneryDir) const;
void scheduleDataDir(const std::string& dataDir); void scheduleDataDir(const std::string& dataDir);
@ -94,6 +95,8 @@ protected:
private: private:
void writeWarningFile(const SGPath& sceneryDir); void writeWarningFile(const SGPath& sceneryDir);
bool innerIsTileDirPending(const std::string& sceneryDir, bool isOSM) const;
private: private:
WorkerThread* _workerThread; WorkerThread* _workerThread;
SGPropertyNode_ptr _terraRoot; SGPropertyNode_ptr _terraRoot;