MCPcopy Create free account
hub / github.com/ErrorFlynn/ytdlp-interface / queue_remove_all

Method queue_remove_all

ytdlp-interface/queue.cpp:820–888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

818
819
820void GUI::queue_remove_all(size_t cat)
821{
822 if(!thr_queue_remove.joinable())
823 {
824 bottoms.show(L"");
825 qurl.clear();
826 l_url.update_caption();
827 auto *pfm {fm_alert("Shutting down active yt-dlp instances", "Please wait...", false).release()};
828 activate();
829 thr_queue_remove = std::thread([this, cat, pfm]
830 {
831 if(active_info_threads || bottoms.joinable_dl_threads())
832 {
833 pfm->show();
834 PostMessage(hwnd, WM_REFRESH, reinterpret_cast<WPARAM>(pfm->handle()), 0);
835 subclass::eat_mouse = true;
836 }
837 for(auto &item : lbq.at(cat))
838 {
839 auto url {item.value<lbqval_t>().url};
840 auto &bottom {bottoms.at(url)};
841 bottom.working_info = false;
842 bottom.working = false;
843 }
844 lbq.auto_draw(false);
845 auto item {lbq.at(cat).begin()};
846 while(item != lbq.at(cat).end() && !g_exiting)
847 {
848 auto url {item.value<lbqval_t>().url};
849 auto &bottom {bottoms.at(url)};
850 if(bottom.timer_proc.started())
851 bottom.timer_proc.stop();
852
853 if(bottom.info_thread.joinable())
854 {
855 bottom.info_thread.join();
856 }
857 if(bottom.dl_thread.joinable())
858 {
859 //fm_alert_text.caption(url);
860 bottom.dl_thread.join();
861 }
862 item = lbq.listbox::erase(item);
863 bottoms.erase(url);
864 outbox.erase(url);
865 }
866 if(cat)
867 {
868 lbq.erase(cat);
869 if(lbq.at(cat - 1).size())
870 lbq_url_to_select = lbq.at(cat - 1).back().value<lbqval_t>();
871 }
872 else
873 {
874 auto vis {lbq.visibles()};
875 if(!vis.empty())
876 lbq_url_to_select = lbq.at(vis.front().cat).at(0).value<lbqval_t>();
877 }

Callers

nothing calls this directly

Calls 15

update_captionMethod · 0.80
joinable_dl_threadsMethod · 0.80
handleMethod · 0.80
atMethod · 0.80
auto_drawMethod · 0.80
stopMethod · 0.80
backMethod · 0.80
closeMethod · 0.80
showMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected