| 148 | } |
| 149 | } |
| 150 | void Data::markFavorite(const std::uint32_t &id, bool favourite) |
| 151 | { |
| 152 | auto sound = getSound(id); |
| 153 | if (sound) |
| 154 | { |
| 155 | sound->get().isFavorite = favourite; |
| 156 | if (favourite) |
| 157 | { |
| 158 | Globals::gFavorites->insert({id, sound->get()}); |
| 159 | } |
| 160 | else |
| 161 | { |
| 162 | auto scopedFavorites = Globals::gFavorites.scoped(); |
| 163 | if (scopedFavorites->find(id) != scopedFavorites->end()) |
| 164 | { |
| 165 | scopedFavorites->erase(id); |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | std::vector<std::uint32_t> Data::getFavoriteIds() |
| 171 | { |
| 172 | auto scopedFavorites = Globals::gFavorites.scoped(); |