aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-07 02:33:11 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-07 02:33:11 +0100
commit9539a71dbeafdc4107d3b92eefada332ee45579a (patch)
tree65b8ceb183ee939f9684a783a40fc0f8fe5fd860
parent9f12d8a7f6e4cdf0cb95130b69da2b368cc9cbb5 (diff)
Manga: fix crashes when navigating from/to creators page/bookmarks page (shared ptr deinit in non-main thread deiniting gl resources in non main thread), add pgup/pgdown/home/end to navigate manga faster
-rw-r--r--README.md20
-rw-r--r--src/QuickMedia.cpp27
-rw-r--r--src/plugins/MangaCombined.cpp4
-rw-r--r--src/plugins/MangaGeneric.cpp5
-rw-r--r--src/plugins/Mangadex.cpp5
-rw-r--r--src/plugins/Page.cpp6
-rw-r--r--src/plugins/Soundcloud.cpp4
7 files changed, 56 insertions, 15 deletions
diff --git a/README.md b/README.md
index 6fd692d..7b0f8e8 100644
--- a/README.md
+++ b/README.md
@@ -44,8 +44,8 @@ If you are running arch linux then you can install QuickMedia from aur (https://
Type text and then wait and QuickMedia will automatically search.\
`Enter`: Go to the page in the selected item.\
`Esc`: Go back to the previous page or close QuickMedia if there is no previous page (for all plugins except matrix).\
-`Up`/`Ctrl+K`: Move up.\
-`Down`/`Ctrl+J`: Move down.\
+`Arrow up`/`Ctrl+K`: Move up.\
+`Arrow down`/`Ctrl+J`: Move down.\
`Left`/`Ctrl+H`: Move left.\
`Right`/`Ctrl+L`: Move right.\
`Ctrl+Left`/`Ctrl+Alt+H`/`Ctrl+Shift+Tab`: Select the tab to the left.\
@@ -75,13 +75,17 @@ Type text and then wait and QuickMedia will automatically search.\
### Manga search/history/chapters page controls
`Ctrl+B`: Bookmark the selected manga. If the manga is already bookmarked then its removed from bookmarks.
### Manga page view controls
-`Up`/`Ctrl+K`: Go to the next page (or chapter if the current page is the last one).\
-`Down`/`Ctrl+J`: Go to the previous page (or chapter if the current page is the first one).\
+`Arrow up`/`Ctrl+K`: Go to the next page (or chapter if the current page is the last one).\
+`Arrow down`/`Ctrl+J`: Go to the previous page (or chapter if the current page is the first one).\
+`Page up`: Go back 10 pages.\
+`Page down`: Go forward 10 pages.\
+`Home`: Go to the first page.\
+`End`: Go to the last page.\
`F`: Toggle between scaling the image to the window size or only down scaling if the image is too large.\
`I`: Switch to scroll view.
### Manga scroll view controls
-`Up`/`Ctrl+K`: Move up.\
-`Down`/`Ctrl+J`: Move down.\
+`Arrow up`/`Ctrl+K`: Move up.\
+`Arrow down`/`Ctrl+J`: Move down.\
`Mouse scroll`/`Middle mouse click+Move mouse`: Smoothly scroll.\
`F`: Toggle between scaling the image to the window size or only down scaling if the image is too large.\
`I`: Switch to page view.
@@ -114,8 +118,8 @@ Type text and then wait and QuickMedia will automatically search.\
#### Message input controls
`Esc`: Stop typing (also clears the input text).\
`Enter`: Post message.\
-`Up`: Go to the previous line.\
-`Down`: Go to the next line.\
+`Arrow up`: Go to the previous line.\
+`Arrow down`: Go to the next line.\
`Left`: Go to the previous character.\
`Right`: Go to the next character.\
`Ctrl+Left`: Go to the previous word.\
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a5c423d..5a57022 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -205,7 +205,9 @@ namespace QuickMedia {
const char* get_title() const override { return "History"; }
PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override {
search_page->submit_body_item = submit_body_item;
- return search_page->submit(title, url, result_tabs);
+ PluginResult result = search_page->submit(title, url, result_tabs);
+ search_page->submit_body_item = nullptr;
+ return result;
}
PluginResult lazy_fetch(BodyItems &result_items) override {
switch(history_type) {
@@ -3658,6 +3660,26 @@ namespace QuickMedia {
page_navigation = 1;
goto end_of_images_page;
}
+ } else if(event.key.code == mgl::Keyboard::PageUp) {
+ if(image_index > 0) {
+ image_index = std::max(0, image_index - 10);
+ goto end_of_images_page;
+ }
+ } else if(event.key.code == mgl::Keyboard::PageDown) {
+ if(image_index < num_manga_pages) {
+ image_index = std::min(num_manga_pages, image_index + 10);
+ goto end_of_images_page;
+ }
+ } else if(event.key.code == mgl::Keyboard::Home) {
+ if(image_index > 0) {
+ image_index = 0;
+ goto end_of_images_page;
+ }
+ } else if(event.key.code == mgl::Keyboard::End) {
+ if(image_index < num_manga_pages) {
+ image_index = num_manga_pages;
+ goto end_of_images_page;
+ }
} else if(event.key.code == mgl::Keyboard::Escape) {
current_page = pop_page_stack();
} else if(event.key.code == mgl::Keyboard::I) {
@@ -7423,12 +7445,13 @@ namespace QuickMedia {
if(window.is_key_pressed(mgl::Keyboard::LControl) || window.is_key_pressed(mgl::Keyboard::RControl))
return;
- BodyItem *selected = file_manager_body->get_selected();
+ auto selected = file_manager_body->get_selected_shared();
if(!selected)
return;
std::vector<Tab> new_tabs;
TaskResult task_result = run_task_with_loading_screen([selected, &file_manager_page, &new_tabs]() {
+ file_manager_page->submit_body_item = selected;
return file_manager_page->submit(selected->get_title(), selected->url, new_tabs) == PluginResult::OK;
});
diff --git a/src/plugins/MangaCombined.cpp b/src/plugins/MangaCombined.cpp
index f678e57..06ecfc0 100644
--- a/src/plugins/MangaCombined.cpp
+++ b/src/plugins/MangaCombined.cpp
@@ -123,7 +123,9 @@ namespace QuickMedia {
Page *page = (Page*)submit_body_item->userdata;
if(!page) return PluginResult::OK;
page->submit_body_item = submit_body_item;
- return page->submit(title, url, result_tabs);
+ PluginResult result = page->submit(title, url, result_tabs);
+ page->submit_body_item = nullptr;
+ return result;
}
void MangaCombinedSearchPage::cancel_operation() {
diff --git a/src/plugins/MangaGeneric.cpp b/src/plugins/MangaGeneric.cpp
index 0c1ee37..e8d8992 100644
--- a/src/plugins/MangaGeneric.cpp
+++ b/src/plugins/MangaGeneric.cpp
@@ -406,7 +406,10 @@ namespace QuickMedia {
}
PluginResult MangaGenericCreatorPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return search_page->submit(title, url, result_tabs);
+ search_page->submit_body_item = submit_body_item;
+ PluginResult result = search_page->submit(title, url, result_tabs);
+ search_page->submit_body_item = nullptr;
+ return result;
}
PluginResult MangaGenericCreatorPage::lazy_fetch(BodyItems &result_items) {
diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp
index 88f4c18..79341bd 100644
--- a/src/plugins/Mangadex.cpp
+++ b/src/plugins/Mangadex.cpp
@@ -386,7 +386,10 @@ namespace QuickMedia {
}
PluginResult MangadexCreatorPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return search_page->submit(title, url, result_tabs);
+ search_page->submit_body_item = submit_body_item;
+ PluginResult result = search_page->submit(title, url, result_tabs);
+ search_page->submit_body_item = nullptr;
+ return result;
}
PluginResult MangadexCreatorPage::get_page(const std::string&, int page, BodyItems &result_items) {
diff --git a/src/plugins/Page.cpp b/src/plugins/Page.cpp
index 2e3caf4..c7b0bb3 100644
--- a/src/plugins/Page.cpp
+++ b/src/plugins/Page.cpp
@@ -72,7 +72,11 @@ namespace QuickMedia {
}
PluginResult BookmarksPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return redirect_page->submit(title, url, result_tabs);
+ // TODO: Find a better solution to not keep the submit body item alive
+ redirect_page->submit_body_item = submit_body_item;
+ PluginResult result = redirect_page->submit(title, url, result_tabs);
+ redirect_page->submit_body_item = nullptr;
+ return result;
}
PluginResult BookmarksPage::lazy_fetch(BodyItems &result_items) {
diff --git a/src/plugins/Soundcloud.cpp b/src/plugins/Soundcloud.cpp
index fa37e29..7f2b1f1 100644
--- a/src/plugins/Soundcloud.cpp
+++ b/src/plugins/Soundcloud.cpp
@@ -288,7 +288,9 @@ namespace QuickMedia {
PluginResult SoundcloudSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
submit_page.submit_body_item = submit_body_item;
- return submit_page.submit(title, url, result_tabs);
+ PluginResult result = submit_page.submit(title, url, result_tabs);
+ submit_page.submit_body_item = nullptr;
+ return result;
}
SearchResult SoundcloudSearchPage::search(const std::string &str, BodyItems &result_items) {