aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-29 09:27:41 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-29 09:27:41 +0200
commita12c897435e615618b14f5cbdd50c7d01dd291fa (patch)
treedae906a7a4a46f45f77ff2d41c53569b1354d8f6 /src
parentb4f2787ef695f9957fbf6c8674ef1669d8524b0a (diff)
Allow bookmarking manga from chapters page
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp8
-rw-r--r--src/Storage.cpp1
-rw-r--r--src/plugins/Manga.cpp6
3 files changed, 11 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 9dd8c25..174d779 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2179,11 +2179,13 @@ namespace QuickMedia {
});
}
} else if(event.key.code == sf::Keyboard::B && event.key.control) {
- BodyItem *selected_item = tabs[selected_tab].body->get_selected();
- if(selected_item) {
+ auto bookmark_item = tabs[selected_tab].page->get_bookmark_body_item();
+ if(!bookmark_item)
+ bookmark_item = tabs[selected_tab].body->get_selected_shared();
+ if(bookmark_item) {
const char *bookmark_name = tabs[selected_tab].page->get_bookmark_name();
if(bookmark_name) {
- if(toggle_bookmark(selected_item, bookmark_name)) {
+ if(toggle_bookmark(bookmark_item.get(), bookmark_name)) {
for(Tab &tab : tabs) {
if(tab.page && tab.page->is_bookmark_page())
tab.page->needs_refresh = true;
diff --git a/src/Storage.cpp b/src/Storage.cpp
index 1b5435f..35cf5f8 100644
--- a/src/Storage.cpp
+++ b/src/Storage.cpp
@@ -331,7 +331,6 @@ namespace QuickMedia {
}
bool is_program_executable_by_name(const char *name) {
- // TODO: Implement for Windows. Windows also uses semicolon instead of colon as a separator
char *env = getenv("PATH");
if(!env)
return false;
diff --git a/src/plugins/Manga.cpp b/src/plugins/Manga.cpp
index 2c7bae0..3fa5d47 100644
--- a/src/plugins/Manga.cpp
+++ b/src/plugins/Manga.cpp
@@ -20,4 +20,10 @@ namespace QuickMedia {
if(extract_id_from_url(content_url, manga_id))
load_manga_content_storage(get_service_name(), content_title, manga_id);
}
+
+ std::shared_ptr<BodyItem> MangaChaptersPage::get_bookmark_body_item() {
+ auto body_item = std::make_shared<BodyItem>(content_title);
+ body_item->url = content_url;
+ return body_item;
+ }
} \ No newline at end of file