mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:20:06 +00:00
Placefile "Remove" functionality
This commit is contained in:
parent
9955c4ccbe
commit
ad5c2b583d
6 changed files with 115 additions and 2 deletions
|
|
@ -314,6 +314,33 @@ void PlacefileManager::LoadFile(const std::string& filename)
|
|||
});
|
||||
}
|
||||
|
||||
void PlacefileManager::RemoveUrl(const std::string& urlString)
|
||||
{
|
||||
std::unique_lock lock(p->placefileRecordLock_);
|
||||
|
||||
// Determine if the placefile has been loaded previously
|
||||
auto it = std::find_if(p->placefileRecords_.begin(),
|
||||
p->placefileRecords_.end(),
|
||||
[&urlString](auto& record)
|
||||
{ return record->name_ == urlString; });
|
||||
if (it == p->placefileRecords_.end())
|
||||
{
|
||||
logger_->debug("Placefile doesn't exist: {}", urlString);
|
||||
return;
|
||||
}
|
||||
|
||||
// Placefile exists, proceed with removing
|
||||
logger_->info("RemoveUrl: {}", urlString);
|
||||
|
||||
// Remove record
|
||||
p->placefileRecords_.erase(it);
|
||||
p->placefileRecordMap_.erase(urlString);
|
||||
|
||||
lock.unlock();
|
||||
|
||||
Q_EMIT PlacefileRemoved(urlString);
|
||||
}
|
||||
|
||||
void PlacefileManager::Impl::PlacefileRecord::Update()
|
||||
{
|
||||
logger_->debug("Update: {}", name_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue