Need to wait for application initialization before reading placefiles, and emit placefile enabled when adding an enabled URL

This commit is contained in:
Dan Paulat 2023-08-23 01:14:18 -05:00
parent 6f14745a59
commit e7da934db1

View file

@ -1,5 +1,6 @@
#include <scwx/qt/manager/placefile_manager.hpp>
#include <scwx/qt/manager/resource_manager.hpp>
#include <scwx/qt/main/application.hpp>
#include <scwx/qt/util/json.hpp>
#include <scwx/qt/util/network.hpp>
#include <scwx/gr/placefile.hpp>
@ -131,8 +132,10 @@ PlacefileManager::PlacefileManager() : p(std::make_unique<Impl>(this))
boost::asio::post(p->threadPool_,
[this]()
{
// Read placefile settings on startup
p->InitializePlacefileSettings();
// Read placefile settings on startup
main::Application::WaitForInitialization();
p->ReadPlacefileSettings();
});
}
@ -397,6 +400,11 @@ void PlacefileManager::AddUrl(const std::string& urlString,
lock.unlock();
if (enabled)
{
Q_EMIT PlacefileEnabled(normalizedUrl, record->enabled_);
}
Q_EMIT PlacefileUpdated(normalizedUrl);
// Queue a placefile update