From bbbf5a37c855b5068ad17833822f08441790287a Mon Sep 17 00:00:00 2001 From: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:04:00 -0600 Subject: [PATCH] Add progress bar to Soundboard app (#1875) * Add progress bar to Soundboard app * Clang --- firmware/application/apps/soundboard_app.cpp | 12 ++++++------ firmware/application/apps/soundboard_app.hpp | 8 ++++---- firmware/application/apps/ui_view_wav.cpp | 1 + firmware/application/apps/ui_view_wav.hpp | 3 ++- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/firmware/application/apps/soundboard_app.cpp b/firmware/application/apps/soundboard_app.cpp index fba441322..304ca2b8a 100644 --- a/firmware/application/apps/soundboard_app.cpp +++ b/firmware/application/apps/soundboard_app.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2016 Furrtek + * Copyright (C) 2024 Mark Thompson * * This file is part of PortaPack. * @@ -51,7 +52,7 @@ void SoundBoardView::stop() { void SoundBoardView::handle_replay_thread_done(const uint32_t return_code) { stop(); - // progressbar.set_value(0); + progressbar.set_value(0); if (return_code == ReplayThread::END_OF_FILE) { if (check_random.value()) { @@ -100,7 +101,7 @@ void SoundBoardView::start_tx(const uint32_t id) { playing_id = id; - // progressbar.set_max(reader->sample_count()); + progressbar.set_max(reader->sample_count()); // button_play.set_bitmap(&bitmap_stop); @@ -148,8 +149,7 @@ void SoundBoardView::start_tx(const uint32_t id) { }*/ void SoundBoardView::on_tx_progress(const uint32_t progress) { - (void)progress; // avoid warning - // progressbar.set_value(progress); + progressbar.set_value(progress); } void SoundBoardView::on_select_entry() { @@ -213,7 +213,7 @@ void SoundBoardView::refresh_list() { for (size_t n = 0; n < file_list.size(); n++) { menu_view.add_item({file_list[n].string().substr(0, 30), - ui::Color::white(), + ui::Color::dark_magenta(), nullptr, [this](KeyEvent) { on_select_entry(); @@ -240,7 +240,7 @@ SoundBoardView::SoundBoardView( &options_tone_key, //&text_title, //&text_duration, - //&progressbar, + &progressbar, &field_volume, &text_volume_disabled, &page_info, diff --git a/firmware/application/apps/soundboard_app.hpp b/firmware/application/apps/soundboard_app.hpp index 52b1c96f2..37d74e9d1 100644 --- a/firmware/application/apps/soundboard_app.hpp +++ b/firmware/application/apps/soundboard_app.hpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2016 Furrtek + * Copyright (C) 2024 Mark Thompson * * This file is part of PortaPack. * @@ -103,7 +104,7 @@ class SoundBoardView : public View { "<="}; Text page_info{ - {0, 30 * 8 - 4, 30 * 8, 16}}; + {0, 29 * 8, 30 * 8, 16}}; MenuView menu_view{ {0, 0, 240, 175}, @@ -142,9 +143,8 @@ class SoundBoardView : public View { 6, "Random"}; - // ProgressBar progressbar { - // { 0 * 8, 30 * 8 - 4, 30 * 8, 16 } - // }; + ProgressBar progressbar{ + {0 * 8, 31 * 8 + 2, 30 * 8, 4}}; TransmitterView tx_view{ 16 * 16, diff --git a/firmware/application/apps/ui_view_wav.cpp b/firmware/application/apps/ui_view_wav.cpp index 617b7ac01..78ec1b8c2 100644 --- a/firmware/application/apps/ui_view_wav.cpp +++ b/firmware/application/apps/ui_view_wav.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2017 Furrtek + * Copyright (C) 2024 Mark Thompson * * This file is part of PortaPack. * diff --git a/firmware/application/apps/ui_view_wav.hpp b/firmware/application/apps/ui_view_wav.hpp index 46febabec..2d235d17b 100644 --- a/firmware/application/apps/ui_view_wav.hpp +++ b/firmware/application/apps/ui_view_wav.hpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. * Copyright (C) 2017 Furrtek + * Copyright (C) 2024 Mark Thompson * * This file is part of PortaPack. * @@ -126,7 +127,7 @@ class ViewWavView : public View { Color::white()}; ProgressBar progressbar{ - {0 * 8, 11 * 16, 30 * 8, 8}}; + {0 * 8, 11 * 16, 30 * 8, 4}}; NumberField field_pos_seconds{ {9 * 8, 12 * 16},