MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / init

Method init

MediaLibrary/animemodel.cpp:39–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39void AnimeModel::init()
40{
41 if(inited) return;
42 inited = true;
43 Notifier::getNotifier()->showMessage(Notifier::LIBRARY_NOTIFY, tr("Fetching..."), NM_PROCESS | NM_DARKNESS_BACK);
44 ThreadTask task(GlobalObjects::workThread);
45 task.RunOnce([this](){
46 totalCount += AnimeWorker::instance()->animeCount();
47 QSharedPointer<QVector<Anime *>> animes = QSharedPointer<QVector<Anime *>>::create();
48 animes->reserve(limitCount);
49 AnimeWorker::instance()->fetchAnimes(animes.get(), 0, limitCount);
50 ThreadTask task(this->thread());
51 task.RunOnce([animes, this](){
52 if (!animes->empty())
53 {
54 beginInsertRows(QModelIndex(), 0, animes->count() - 1);
55 this->animes.append(*animes);
56 endInsertRows();
57 }
58 currentOffset+=animes->count();
59 hasMoreAnimes = animes->count() >= limitCount;
60 showStatisMessage();
61 Notifier::getNotifier()->showMessage(Notifier::LIBRARY_NOTIFY, tr("Down"), NM_HIDE);
62 });
63 });
64}
65
66void AnimeModel::setActive(bool isActive)
67{

Callers

nothing calls this directly

Calls 8

RunOnceMethod · 0.80
animeCountMethod · 0.80
fetchAnimesMethod · 0.80
countMethod · 0.80
showMessageMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected