Mercurial > minori
comparison src/gui/pages/anime_list.cc @ 230:2f5a9247e501
torrents: implement download button
erg
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sat, 13 Jan 2024 09:42:02 -0500 |
parents | 7cf53145de11 |
children | ff0061e75f0f |
comparison
equal
deleted
inserted
replaced
229:adc20fa321c1 | 230:2f5a9247e501 |
---|---|
26 #include <QProgressBar> | 26 #include <QProgressBar> |
27 #include <QShortcut> | 27 #include <QShortcut> |
28 #include <QTreeView> | 28 #include <QTreeView> |
29 #include <QStylePainter> | 29 #include <QStylePainter> |
30 #include <QStyledItemDelegate> | 30 #include <QStyledItemDelegate> |
31 #include <QThreadPool> | 31 #include <QThread> |
32 | 32 |
33 #include <set> | 33 #include <set> |
34 | 34 |
35 AnimeListPageSortFilter::AnimeListPageSortFilter(QObject* parent) : QSortFilterProxyModel(parent) { | 35 AnimeListPageSortFilter::AnimeListPageSortFilter(QObject* parent) : QSortFilterProxyModel(parent) { |
36 } | 36 } |
216 tree_view->setColumnHidden(AnimeListPageModel::AL_UPDATED, true); | 216 tree_view->setColumnHidden(AnimeListPageModel::AL_UPDATED, true); |
217 tree_view->setColumnHidden(AnimeListPageModel::AL_NOTES, true); | 217 tree_view->setColumnHidden(AnimeListPageModel::AL_NOTES, true); |
218 } | 218 } |
219 | 219 |
220 void AnimeListPage::UpdateAnime(int id) { | 220 void AnimeListPage::UpdateAnime(int id) { |
221 QThreadPool::globalInstance()->start([this, id] { | 221 QThread* thread = QThread::create([id] { |
222 Services::UpdateAnimeEntry(id); | 222 Services::UpdateAnimeEntry(id); |
223 Refresh(); | 223 }); |
224 }); | 224 |
225 connect(thread, &QThread::finished, this, &AnimeListPage::Refresh); | |
226 connect(thread, &QThread::finished, this, &QThread::deleteLater); | |
227 | |
228 thread->start(); | |
225 } | 229 } |
226 | 230 |
227 void AnimeListPage::RemoveAnime(int id) { | 231 void AnimeListPage::RemoveAnime(int id) { |
228 Anime::Anime& anime = Anime::db.items[id]; | 232 Anime::Anime& anime = Anime::db.items[id]; |
229 anime.RemoveFromUserList(); | 233 anime.RemoveFromUserList(); |