aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp104
1 files changed, 6 insertions, 98 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index bd9b091..c68ad0b 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -505,12 +505,6 @@ namespace QuickMedia {
search_suggestion_page();
body->clear_thumbnails();
break;
-#if 0
- case Page::SEARCH_RESULT:
- body->draw_thumbnails = current_plugin->search_results_has_thumbnails();
- search_result_page();
- break;
-#endif
case Page::VIDEO_CONTENT:
body->draw_thumbnails = false;
video_content_page();
@@ -952,7 +946,6 @@ namespace QuickMedia {
} else if(next_page == Page::VIDEO_CONTENT) {
watched_videos.clear();
if(content_url.empty())
- //next_page = Page::SEARCH_RESULT;
next_page = Page::SEARCH_SUGGESTION;
else {
page_stack.push(Page::SEARCH_SUGGESTION);
@@ -1072,23 +1065,12 @@ namespace QuickMedia {
return on_search_suggestion_submit_text(tabs[selected_tab].body, body);
};
- std::future<BodyItems> recommended_future;
- /*
- if(recommended_body) {
- recommended_future = std::async(std::launch::async, [this]() {
- BodyItems body_items;
- PluginResult front_page_result = current_plugin->get_front_page(body_items);
- return body_items;
- });
- } else {
- */
- if(current_plugin->get_front_page(body->items) != PluginResult::OK) {
- show_notification("QuickMedia", "Failed to get front page", Urgency::CRITICAL);
- current_page = Page::EXIT;
- return;
- }
- body->clamp_selection();
- /*}*/
+ if(current_plugin->get_front_page(body->items) != PluginResult::OK) {
+ show_notification("QuickMedia", "Failed to get front page", Urgency::CRITICAL);
+ current_page = Page::EXIT;
+ return;
+ }
+ body->clamp_selection();
sf::Vector2f body_pos;
sf::Vector2f body_size;
@@ -1103,8 +1085,6 @@ namespace QuickMedia {
sf::RoundedRectangleShape tab_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10);
tab_background.setFillColor(tab_selected_color);
- //sf::Clock tt;
- //int fps = 0;
while (current_page == Page::SEARCH_SUGGESTION) {
while (window.pollEvent(event)) {
base_event_handler(event, Page::EXIT, false, true, tabs[selected_tab].body != nullptr);
@@ -1208,14 +1188,6 @@ namespace QuickMedia {
autocomplete_running = false;
}
- /*
- if(recommended_future.valid() && recommended_future.wait_for(std::chrono::seconds(0)) == std::future_status::ready) {
- recommended_body->items = recommended_future.get();
- recommended_body->filter_search_fuzzy(recommended_filter);
- recommended_body->clamp_selection();
- }
- */
-
window.clear(back_color);
if(tabs[selected_tab].body)
search_bar->draw(window, false);
@@ -1251,12 +1223,6 @@ namespace QuickMedia {
}
}
- // fps++;
- // if(tt.getElapsedTime().asMilliseconds() >= 1000) {
- // fprintf(stderr, "fps: %d\n", fps);
- // fps = 0;
- // tt.restart();
- // }
window.display();
}
@@ -1264,52 +1230,6 @@ namespace QuickMedia {
search_bar->onAutocompleteRequestCallback = nullptr;
}
- void Program::search_result_page() {
- assert(false);
- #if 0
- search_bar->onTextUpdateCallback = [this](const std::string &text) {
- body->filter_search_fuzzy(text);
- body->clamp_selection();
- };
-
- search_bar->onTextSubmitCallback = [this](const std::string &text) {
- BodyItem *selected_item = body->get_selected();
- if(!selected_item)
- return;
- video_url = selected_item->url;
- current_page = Page::VIDEO_CONTENT;
- };
-
- sf::Vector2f body_pos;
- sf::Vector2f body_size;
- bool redraw = true;
- sf::Event event;
-
- while (current_page == Page::SEARCH_RESULT) {
- while (window.pollEvent(event)) {
- base_event_handler(event, Page::SEARCH_SUGGESTION);
- if(event.type == sf::Event::Resized || event.type == sf::Event::GainedFocus)
- redraw = true;
- }
-
- if(redraw) {
- redraw = false;
- search_bar->onWindowResize(window_size);
- get_body_dimensions(window_size, search_bar.get(), body_pos, body_size);
- }
-
- search_bar->update();
-
- window.clear(back_color);
- search_bar->draw(window);
- body->draw(window, body_pos, body_size);
-
- window.display();
- faefeaf
- }
- #endif
- }
-
static bool youtube_url_extract_id(const std::string &youtube_url, std::string &youtube_video_id) {
size_t index = youtube_url.find("youtube.com/watch?v=");
if(index != std::string::npos) {
@@ -1721,8 +1641,6 @@ namespace QuickMedia {
}
// TODO: Show loading video animation. load_video needs to be made asynchronous first
- //window.clear();
- //window.display();
/* Only save recommendations for the video if we have been watching it for 15 seconds */
if(is_youtube && video_loaded && !added_recommendations && time_watched_timer.getElapsedTime().asSeconds() >= 15) {
@@ -2057,17 +1975,7 @@ namespace QuickMedia {
image_plugin->for_each_page_in_chapter(chapter_url, [content_cache_dir_, &page, this](const std::string &url) {
if(image_download_cancel)
return false;
- #if 0
- size_t last_index = url.find_last_of('/');
- if(last_index == std::string::npos || (int)url.size() - (int)last_index + 1 <= 0) {
- show_notification("Manganelo", "Image url is in incorrect format, missing '/': " + url, Urgency::CRITICAL);
- return false;
- }
- std::string image_filename = url.substr(last_index + 1);
- Path image_filepath = content_cache_dir_;
- image_filepath.join(image_filename);
- #endif
// TODO: Save image with the file extension that url says it has? right now the file is saved without any extension
Path image_filepath = content_cache_dir_;
image_filepath.join(std::to_string(page++));