comparison src/gui/window.cc @ 139:478f3b366199

dep/animia: separate lots of things, use base class for OS stuff
author Paper <mrpapersonic@gmail.com>
date Sun, 12 Nov 2023 16:43:07 -0500
parents 28842a8d0c6b
children 6fdf0632c003
comparison
equal deleted inserted replaced
138:28842a8d0c6b 139:478f3b366199
65 65
66 QTimer* timer = new QTimer(this); 66 QTimer* timer = new QTimer(this);
67 67
68 /* this is very very stinky */ 68 /* this is very very stinky */
69 connect(timer, &QTimer::timeout, this, [this] { 69 connect(timer, &QTimer::timeout, this, [this] {
70 bool success = false;
71
70 NowPlayingPage* page = reinterpret_cast<NowPlayingPage*>(stack->widget(static_cast<int>(Pages::NOW_PLAYING))); 72 NowPlayingPage* page = reinterpret_cast<NowPlayingPage*>(stack->widget(static_cast<int>(Pages::NOW_PLAYING)));
71 73
72 std::vector<std::string> files; 74 std::vector<std::string> files;
73 if (!Track::Media::GetCurrentlyPlaying(files)) 75 Track::Media::GetCurrentlyPlaying(files);
74 return;
75 76
76 /* this should really be more intertwined with anitomy */ 77 /* this should really be more intertwined with anitomy */
77 for (const auto& file : files) { 78 for (const auto& file : files) {
78 std::filesystem::path path(file); // in the future it will not be guaranteed this is a path! 79 std::filesystem::path path(file); // in the future it will not be guaranteed this is a path!
79 std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path.filename().string()); 80 std::unordered_map<std::string, std::string> elements = Track::Media::GetFileElements(path.filename().string());
82 continue; 83 continue;
83 84
84 qDebug() << id; 85 qDebug() << id;
85 86
86 page->SetPlaying(Anime::db.items[id], elements); 87 page->SetPlaying(Anime::db.items[id], elements);
87 } 88
89 success = true;
90 }
91
92 if (!success)
93 page->SetDefault();
88 }); 94 });
89 timer->start(5000); 95 timer->start(5000);
90 } 96 }
91 97
92 void MainWindow::AddMainWidgets() { 98 void MainWindow::AddMainWidgets() {