aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-07-09 05:59:39 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-09 05:59:39 +0200
commit03a228f81f4a7a827a5a383bc16b8a2fb3abadb4 (patch)
tree19607b44ad01f933fe8d8d76d1bf6d68929de5e3
parent4b90946f677c2b073108637b5c0c8efaa8c47deb (diff)
Fix item selection not working with empty search
Fix history not working on mangatown. Make image scrolling faster in infinite scroll mode.
-rw-r--r--include/Body.hpp2
-rw-r--r--src/Body.cpp8
-rw-r--r--src/ImageViewer.cpp4
-rw-r--r--src/QuickMedia.cpp7
-rw-r--r--src/plugins/Mangatown.cpp2
5 files changed, 18 insertions, 5 deletions
diff --git a/include/Body.hpp b/include/Body.hpp
index b90f64a..3cb735c 100644
--- a/include/Body.hpp
+++ b/include/Body.hpp
@@ -66,6 +66,8 @@ namespace QuickMedia {
// TODO: Ignore dot, whitespace and special characters
void filter_search_fuzzy(const std::string &text);
+ bool no_items_visible() const;
+
sf::Text title_text;
sf::Text progress_text;
sf::Text author_text;
diff --git a/src/Body.cpp b/src/Body.cpp
index 54134b6..da7152d 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -346,4 +346,12 @@ namespace QuickMedia {
item->visible = string_find_case_insensitive(item->title, text);
}
}
+
+ bool Body::no_items_visible() const {
+ for(auto &item : items) {
+ if(item->visible)
+ return false;
+ }
+ return true;
+ }
} \ No newline at end of file
diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp
index 41993ad..102d73a 100644
--- a/src/ImageViewer.cpp
+++ b/src/ImageViewer.cpp
@@ -118,8 +118,8 @@ namespace QuickMedia {
ImageViewerAction ImageViewer::draw(sf::RenderWindow &window) {
const double frame_delta = frame_timer.restart().asSeconds();
const double scroll_speed_key_input = 450.0;
- const double scroll_speed_mouse_wheel = 450.0;
- const double scroll_deaccel = 0.93;
+ const double scroll_speed_mouse_wheel = 600.0;
+ const double scroll_deaccel = 0.96;
if(!window_size_set) {
auto window_size_i = window.getSize();
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 956ab32..cae1234 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -378,7 +378,6 @@ namespace QuickMedia {
exit(1);
}
// TODO: Make asynchronous
- // TODO: Make this also work for mangadex. Would require storing both id and name of the manga
for_files_in_dir_sort_last_modified(content_storage_dir, [&history_body, this](const std::filesystem::path &filepath) {
Path fullpath(filepath.c_str());
Json::Value body;
@@ -396,6 +395,10 @@ namespace QuickMedia {
body_item->url = "https://manganelo.com/manga/" + base64_decode(filename.string());
else if(current_plugin->name == "mangadex")
body_item->url = "https://mangadex.org/title/" + base64_decode(filename.string());
+ else if(current_plugin->name == "mangatown")
+ body_item->url = "https://mangatown.com/manga/" + base64_decode(filename.string());
+ else
+ fprintf(stderr, "Error: Not implemented: filename to manga chapter list\n");
history_body.items.push_back(std::move(body_item));
}
return true;
@@ -423,7 +426,7 @@ namespace QuickMedia {
search_bar->onTextSubmitCallback = [this, &tabs, &selected_tab, &typing](const std::string &text) -> bool {
if(current_plugin->name != "dmenu") {
- if(typing || text.empty())
+ if(typing || tabs[selected_tab].body->no_items_visible())
return false;
}
diff --git a/src/plugins/Mangatown.cpp b/src/plugins/Mangatown.cpp
index 1954854..8dcf8d3 100644
--- a/src/plugins/Mangatown.cpp
+++ b/src/plugins/Mangatown.cpp
@@ -160,7 +160,7 @@ namespace QuickMedia {
std::string image_src;
std::string website_data;
std::string full_url = chapter_url + std::to_string(page_index++) + ".html";
- if(download_to_string(full_url, website_data, {}, use_tor, true) != DownloadResult::OK)
+ if(download_to_string_cache(full_url, website_data, {}, use_tor, true) != DownloadResult::OK)
break;
QuickMediaHtmlSearch html_search;