Mercurial > minori
diff src/gui/window.cc @ 232:ff0061e75f0f
theme: add OS detection with glib
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 13 Jan 2024 11:06:16 -0500 |
parents | d030b30526d5 |
children | 4d461ef7d424 |
line wrap: on
line diff
--- a/src/gui/window.cc Sat Jan 13 09:43:41 2024 -0500 +++ b/src/gui/window.cc Sat Jan 13 11:06:16 2024 -0500 @@ -87,27 +87,28 @@ */ thread.reset(new PlayingThread(this)); + connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { + for (const auto& file : files) { + anitomy::Anitomy anitomy; + anitomy.Parse(Strings::ToWstring(file)); + + const auto& elements = anitomy.elements(); + + int id = Anime::db.GetAnimeFromTitle(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle))); + if (id <= 0) + continue; + + page->SetPlaying(Anime::db.items[id], elements); + break; + } + }); + QTimer* timer = new QTimer(this); connect(timer, &QTimer::timeout, this, [this, page] { if (!thread.get() || thread->isRunning()) return; - connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { - for (const auto& file : files) { - anitomy::Anitomy anitomy; - anitomy.Parse(Strings::ToWstring(file)); - - const auto& elements = anitomy.elements(); - - int id = Anime::db.GetAnimeFromTitle(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle))); - if (id <= 0) - continue; - - page->SetPlaying(Anime::db.items[id], elements); - break; - } - }); thread->start(); });