Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 231:69f4768a820c | 232:ff0061e75f0f |
|---|---|
| 85 * close of the program OR on the destruction | 85 * close of the program OR on the destruction |
| 86 * of MainWindow | 86 * of MainWindow |
| 87 */ | 87 */ |
| 88 thread.reset(new PlayingThread(this)); | 88 thread.reset(new PlayingThread(this)); |
| 89 | 89 |
| 90 connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { | |
| 91 for (const auto& file : files) { | |
| 92 anitomy::Anitomy anitomy; | |
| 93 anitomy.Parse(Strings::ToWstring(file)); | |
| 94 | |
| 95 const auto& elements = anitomy.elements(); | |
| 96 | |
| 97 int id = Anime::db.GetAnimeFromTitle(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle))); | |
| 98 if (id <= 0) | |
| 99 continue; | |
| 100 | |
| 101 page->SetPlaying(Anime::db.items[id], elements); | |
| 102 break; | |
| 103 } | |
| 104 }); | |
| 105 | |
| 90 QTimer* timer = new QTimer(this); | 106 QTimer* timer = new QTimer(this); |
| 91 | 107 |
| 92 connect(timer, &QTimer::timeout, this, [this, page] { | 108 connect(timer, &QTimer::timeout, this, [this, page] { |
| 93 if (!thread.get() || thread->isRunning()) | 109 if (!thread.get() || thread->isRunning()) |
| 94 return; | 110 return; |
| 95 | 111 |
| 96 connect(thread.get(), &PlayingThread::Done, this, [page](const std::vector<std::string>& files) { | |
| 97 for (const auto& file : files) { | |
| 98 anitomy::Anitomy anitomy; | |
| 99 anitomy.Parse(Strings::ToWstring(file)); | |
| 100 | |
| 101 const auto& elements = anitomy.elements(); | |
| 102 | |
| 103 int id = Anime::db.GetAnimeFromTitle(Strings::ToUtf8String(elements.get(anitomy::kElementAnimeTitle))); | |
| 104 if (id <= 0) | |
| 105 continue; | |
| 106 | |
| 107 page->SetPlaying(Anime::db.items[id], elements); | |
| 108 break; | |
| 109 } | |
| 110 }); | |
| 111 thread->start(); | 112 thread->start(); |
| 112 }); | 113 }); |
| 113 | 114 |
| 114 timer->start(5000); | 115 timer->start(5000); |
| 115 } | 116 } |
