Mercurial > minori
comparison src/gui/window.cc @ 383:27c462bc7815
make the "Now Playing" page actually work
| author | Paper <paper@tflc.us> |
|---|---|
| date | Thu, 06 Nov 2025 07:10:58 -0500 |
| parents | 47c9f8502269 |
| children |
comparison
equal
deleted
inserted
replaced
| 382:0265e125f680 | 383:27c462bc7815 |
|---|---|
| 105 | 105 |
| 106 AddMainWidgets(); | 106 AddMainWidgets(); |
| 107 sidebar_.SetCurrentItem(static_cast<int>(Pages::ANIME_LIST)); | 107 sidebar_.SetCurrentItem(static_cast<int>(Pages::ANIME_LIST)); |
| 108 setCentralWidget(&main_widget_); | 108 setCentralWidget(&main_widget_); |
| 109 | 109 |
| 110 /* This is disgusting */ | |
| 110 NowPlayingPage *page = reinterpret_cast<NowPlayingPage *>(stack_.widget(static_cast<int>(Pages::NOW_PLAYING))); | 111 NowPlayingPage *page = reinterpret_cast<NowPlayingPage *>(stack_.widget(static_cast<int>(Pages::NOW_PLAYING))); |
| 111 | 112 |
| 112 connect(&playing_thread_, &MainWindowPlayingThread::Done, this, [page](const std::vector<std::string> &files) { | 113 connect(&playing_thread_, &MainWindowPlayingThread::Done, this, [page](const std::vector<std::string> &files) { |
| 114 if (!files.size()) { | |
| 115 page->SetDefault(); | |
| 116 return; | |
| 117 } | |
| 118 | |
| 113 for (const auto &file : files) { | 119 for (const auto &file : files) { |
| 114 anitomy::Anitomy anitomy; | 120 anitomy::Anitomy anitomy; |
| 115 anitomy.Parse(file); | 121 anitomy.Parse(file); |
| 116 | 122 |
| 117 const auto &elements = anitomy.elements(); | 123 const auto &elements = anitomy.elements(); |
| 133 | 139 |
| 134 playing_thread_.start(); | 140 playing_thread_.start(); |
| 135 }); | 141 }); |
| 136 | 142 |
| 137 #ifdef MACOSX | 143 #ifdef MACOSX |
| 144 /* Anitomy needs specific permissions for window title grabbing */ | |
| 138 if (!osx::AskForPermissions()) | 145 if (!osx::AskForPermissions()) |
| 139 return; | 146 return; |
| 140 #endif | 147 #endif |
| 141 | 148 |
| 142 playing_thread_timer_.start(5000); | 149 playing_thread_timer_.start(5000); |
