From 2372b3b8f9b6ff54e2be0593b4757a55ddee15af Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 15 Jan 2023 23:09:33 -0500 Subject: [PATCH] Presenter: Add `Presentation::has_a_[next,previous]_frame()` --- Userland/Applications/Presenter/Presentation.cpp | 10 ++++++++++ Userland/Applications/Presenter/Presentation.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/Userland/Applications/Presenter/Presentation.cpp b/Userland/Applications/Presenter/Presentation.cpp index cdd6f7321f..fa4e86e028 100644 --- a/Userland/Applications/Presenter/Presentation.cpp +++ b/Userland/Applications/Presenter/Presentation.cpp @@ -41,6 +41,16 @@ StringView Presentation::author() const return "Unknown Author"sv; } +bool Presentation::has_a_next_frame() const +{ + return m_current_slide < u32(m_slides.size() > 1 ? m_slides.size() - 1 : 0); +} + +bool Presentation::has_a_previous_frame() const +{ + return m_current_slide > 0u; +} + void Presentation::next_frame() { m_current_frame_in_slide++; diff --git a/Userland/Applications/Presenter/Presentation.h b/Userland/Applications/Presenter/Presentation.h index f2e6084d0a..210c9fefd1 100644 --- a/Userland/Applications/Presenter/Presentation.h +++ b/Userland/Applications/Presenter/Presentation.h @@ -32,6 +32,8 @@ public: unsigned current_slide_number() const { return m_current_slide.value(); } unsigned current_frame_in_slide_number() const { return m_current_frame_in_slide.value(); } + bool has_a_next_frame() const; + bool has_a_previous_frame() const; void next_frame(); void previous_frame(); void go_to_first_slide();