diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-12-26 11:21:26 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-12-26 11:21:26 +0100 |
commit | 3003cf04c015a3a847a5d598e3a3b0521ff6bdf9 (patch) | |
tree | 7c08c7afb470f44ec7b13c3ce4bad40010a5e673 | |
parent | 29c346fea61da23813dbee30f774547d913abf33 (diff) |
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | include/ImageViewer.hpp | 2 | ||||
-rw-r--r-- | include/QuickMedia.hpp | 1 | ||||
-rw-r--r-- | src/ImageViewer.cpp | 25 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 19 |
5 files changed, 32 insertions, 17 deletions
@@ -105,6 +105,7 @@ Type text and then wait and QuickMedia will automatically search.\ `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.\ +`B`: Show/hide the bottom progress bar.\ `I`: Switch to scroll view. ### Manga scroll view controls `Arrow up`/`K`: Move up.\ @@ -113,6 +114,7 @@ Type text and then wait and QuickMedia will automatically search.\ `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.\ +`B`: Show/hide the bottom progress bar.\ `I`: Switch to page view. ### Manga chapters controls `Ctrl+T`: Start tracking the manga after the selected chapter ([AutoMedia](https://git.dec05eba.com/AutoMedia/) needs to be installed). diff --git a/include/ImageViewer.hpp b/include/ImageViewer.hpp index b587b82..b3b18dc 100644 --- a/include/ImageViewer.hpp +++ b/include/ImageViewer.hpp @@ -104,5 +104,7 @@ namespace QuickMedia { mgl::vec2d prev_size_first_page; mgl::vec2d prev_size_last_page; + + bool show_progress_bar = true; }; }
\ No newline at end of file diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index a6de75c..038cf19 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -245,5 +245,6 @@ namespace QuickMedia { std::mutex login_inputs_mutex; const char *yt_dl_name = nullptr; bool yt_dl_name_checked = false; + bool show_manga_bottom_bar = true; }; } diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp index fb9912c..454f34b 100644 --- a/src/ImageViewer.cpp +++ b/src/ImageViewer.cpp @@ -296,6 +296,9 @@ namespace QuickMedia { if(event.key.code == mgl::Keyboard::F) *fit_image_to_window = !*fit_image_to_window; + + if(event.key.code == mgl::Keyboard::B) + show_progress_bar = !show_progress_bar; } else if(event.type == mgl::Event::KeyReleased) { if(is_key_scroll_up(event.key)) up_pressed = false; @@ -426,16 +429,18 @@ namespace QuickMedia { const float font_height = page_text_character_size + 8.0f; const float background_height = font_height + 6.0f; - mgl::Rectangle page_text_background(mgl::vec2f(window_size.x, background_height)); - mgl::Color text_background_color = get_theme().shade_color; - text_background_color.a = 225; - page_text_background.set_color(text_background_color); - page_text_background.set_position(mgl::vec2f(0.0f, window_size.y - background_height)); - window->draw(page_text_background); - - auto page_text_bounds = page_text.get_bounds(); - page_text.set_position(mgl::vec2f(floor(window_size.x * 0.5f - page_text_bounds.size.x * 0.5f), floor(window_size.y - background_height * 0.5f - font_height * 0.55f))); - window->draw(page_text); + if(show_progress_bar) { + mgl::Rectangle page_text_background(mgl::vec2f(window_size.x, background_height)); + mgl::Color text_background_color = get_theme().shade_color; + text_background_color.a = 225; + page_text_background.set_color(text_background_color); + page_text_background.set_position(mgl::vec2f(0.0f, window_size.y - background_height)); + window->draw(page_text_background); + + auto page_text_bounds = page_text.get_bounds(); + page_text.set_position(mgl::vec2f(floor(window_size.x * 0.5f - page_text_bounds.size.x * 0.5f), floor(window_size.y - background_height * 0.5f - font_height * 0.55f))); + window->draw(page_text); + } // Free pages that are not visible on the screen int i = 0; diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index f3e21da..e0568d9 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -4490,6 +4490,9 @@ namespace QuickMedia { } else if(event.key.code == mgl::Keyboard::F) { fit_image_to_window = !fit_image_to_window; redraw = true; + } else if(event.key.code == mgl::Keyboard::B) { + show_manga_bottom_bar = !show_manga_bottom_bar; + redraw = true; } } } @@ -4514,7 +4517,7 @@ namespace QuickMedia { } const float font_height = chapter_text_character_size + 8.0f; - const float bottom_panel_height = font_height + 6.0f; + const float bottom_panel_height = show_manga_bottom_bar ? font_height + 6.0f : 0.0f; mgl::vec2f content_size; content_size.x = window_size.x; @@ -4553,13 +4556,15 @@ namespace QuickMedia { window.draw(image); } - chapter_text_background.set_size(mgl::vec2f(window_size.x, bottom_panel_height)); - chapter_text_background.set_position(mgl::vec2f(0.0f, std::floor(window_size.y - bottom_panel_height))); - window.draw(chapter_text_background); + if(show_manga_bottom_bar) { + chapter_text_background.set_size(mgl::vec2f(window_size.x, bottom_panel_height)); + chapter_text_background.set_position(mgl::vec2f(0.0f, std::floor(window_size.y - bottom_panel_height))); + window.draw(chapter_text_background); - auto text_bounds = chapter_text.get_bounds(); - chapter_text.set_position(vec2f_floor(window_size.x * 0.5f - text_bounds.size.x * 0.5f, window_size.y - bottom_panel_height * 0.5f - font_height * 0.55f)); - window.draw(chapter_text); + auto text_bounds = chapter_text.get_bounds(); + chapter_text.set_position(vec2f_floor(window_size.x * 0.5f - text_bounds.size.x * 0.5f, window_size.y - bottom_panel_height * 0.5f - font_height * 0.55f)); + window.draw(chapter_text); + } window.display(); } else { |