| 304 | |
| 305 | |
| 306 | std::wstring GUI::queue_pop_menu(int x, int y) |
| 307 | { |
| 308 | using namespace nana; |
| 309 | |
| 310 | std::wstring url_of_item_to_delete; |
| 311 | ::widgets::Menu m; |
| 312 | m.item_pixels(24); |
| 313 | auto sel {lbq.selected()}; |
| 314 | if(!sel.empty() && !thr_menu_start_stop.joinable()) |
| 315 | { |
| 316 | if(sel.size() == 1) |
| 317 | { |
| 318 | auto item {lbq.at(sel.front())}; |
| 319 | auto item_name {"item #" + item.text(0)}; |
| 320 | auto url {item.value<lbqval_t>().url}; |
| 321 | auto &bottom {bottoms.current()}; |
| 322 | const auto is_live {bottom.vidinfo_contains("is_live") && bottom.vidinfo["is_live"] || |
| 323 | bottom.vidinfo_contains("live_status") && bottom.vidinfo["live_status"] == "is_live"}; |
| 324 | static std::vector<drawerbase::listbox::item_proxy> stoppable, startable; |
| 325 | //static std::vector<std::wstring> completed; |
| 326 | static listbox::index_pairs completed; |
| 327 | stoppable.clear(); |
| 328 | startable.clear(); |
| 329 | completed.clear(); |
| 330 | for(auto &item : lbq.at(item.pos().cat)) |
| 331 | { |
| 332 | const auto text {item.text(3)}; |
| 333 | if(text == "done") |
| 334 | //completed.push_back(item.value<lbqval_t>().url); |
| 335 | completed.push_back(item.pos()); |
| 336 | else if(text.find("stopped") == -1 && text.find("queued") == -1 && text.find("error") == -1 && text.find("skip") == -1) |
| 337 | stoppable.push_back(item); |
| 338 | else startable.push_back(item); |
| 339 | } |
| 340 | |
| 341 | if(vidsel_item.m) |
| 342 | vidsel_item.m = &m; |
| 343 | |
| 344 | auto verb {btndl.caption().substr(0, 5)}; |
| 345 | if(verb.back() == ' ') |
| 346 | verb.pop_back(); |
| 347 | if(item.text(3).find("stopped") != -1) |
| 348 | verb = "Resume"; |
| 349 | m.append(verb + " " + item_name, [&, url, this](menu::item_proxy) |
| 350 | { |
| 351 | on_btn_dl(url); |
| 352 | api::refresh_window(btndl); |
| 353 | }); |
| 354 | m.append("Remove " + item_name, [&, url, this](menu::item_proxy) |
| 355 | { |
| 356 | url_of_item_to_delete = url; |
| 357 | }); |
| 358 | |
| 359 | fs::path file; |
| 360 | if(!bottom.is_ytplaylist && !bottom.is_bcplaylist) |
| 361 | { |
| 362 | file = bottom.file_path(); |
| 363 | if(!file.empty()) |
nothing calls this directly
no test coverage detected