Mercurial > minori
comparison src/gui/pages/anime_list.cpp @ 11:fc1bf97c528b
*: use C++11 standard
I've been meaning to do this for a while, but I didn't want to reimplement
the filesystem code. Now we are on C++11 and most compilers from the past 5 centuries should support this now
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 17 Sep 2023 06:14:30 -0400 |
parents | 4b198a111713 |
children | cde8f67a7c7d |
comparison
equal
deleted
inserted
replaced
10:4b198a111713 | 11:fc1bf97c528b |
---|---|
191 } | 191 } |
192 | 192 |
193 void AnimeListWidgetModel::UpdateAnime(int id) { | 193 void AnimeListWidgetModel::UpdateAnime(int id) { |
194 /* meh... it might be better to just reinit the entire list */ | 194 /* meh... it might be better to just reinit the entire list */ |
195 int i = 0; | 195 int i = 0; |
196 for (const auto& [a_id, anime] : Anime::db.items) { | 196 for (const auto& a : Anime::db.items) { |
197 if (anime.IsInUserList() && a_id == id && anime.GetUserStatus() == status) { | 197 if (a.second.IsInUserList() && a.first == id && a.second.GetUserStatus() == status) { |
198 emit dataChanged(index(i), index(i)); | 198 emit dataChanged(index(i), index(i)); |
199 } | 199 } |
200 i++; | 200 i++; |
201 } | 201 } |
202 } | 202 } |
208 void AnimeListWidgetModel::RefreshList() { | 208 void AnimeListWidgetModel::RefreshList() { |
209 bool has_children = !!rowCount(index(0)); | 209 bool has_children = !!rowCount(index(0)); |
210 if (has_children) beginResetModel(); | 210 if (has_children) beginResetModel(); |
211 list.clear(); | 211 list.clear(); |
212 | 212 |
213 for (const auto& [id, anime] : Anime::db.items) { | 213 for (const auto& a : Anime::db.items) { |
214 if (anime.IsInUserList() && anime.GetUserStatus() == status) { | 214 if (a.second.IsInUserList() && a.second.GetUserStatus() == status) { |
215 list.push_back(anime); | 215 list.push_back(a.second); |
216 } | 216 } |
217 } | 217 } |
218 if (has_children) endResetModel(); | 218 if (has_children) endResetModel(); |
219 } | 219 } |
220 | 220 |