summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2023-02-09 13:36:10 +0100
committerAndrew Kaster <andrewdkaster@gmail.com>2023-02-25 20:49:41 -0700
commit9f5f6b38688eb3615a3a121d5ff43f718f64a005 (patch)
tree44de0dafee3cc68493525997abfb43b8d5432158 /Userland
parent401a21e4f471641ac789e06d99c82a4ca456d856 (diff)
downloadserenity-9f5f6b38688eb3615a3a121d5ff43f718f64a005.zip
Piano: Clean up code style with help from clang-tidy
Includes shadowed variables and if-else return.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/Piano/KeysWidget.cpp3
-rw-r--r--Userland/Applications/Piano/MainWidget.cpp3
-rw-r--r--Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp4
-rw-r--r--Userland/Applications/Piano/TrackManager.cpp3
4 files changed, 5 insertions, 8 deletions
diff --git a/Userland/Applications/Piano/KeysWidget.cpp b/Userland/Applications/Piano/KeysWidget.cpp
index e063e449d7..13851b9f2c 100644
--- a/Userland/Applications/Piano/KeysWidget.cpp
+++ b/Userland/Applications/Piano/KeysWidget.cpp
@@ -23,8 +23,7 @@ int KeysWidget::mouse_note() const
{
if (m_mouse_down && m_mouse_note + m_keyboard->virtual_keyboard_octave_base() < note_count)
return m_mouse_note; // Can be -1.
- else
- return -1;
+ return -1;
}
void KeysWidget::set_key(i8 key, DSP::Keyboard::Switch switch_note)
diff --git a/Userland/Applications/Piano/MainWidget.cpp b/Userland/Applications/Piano/MainWidget.cpp
index c7ad9050a7..db990ef11e 100644
--- a/Userland/Applications/Piano/MainWidget.cpp
+++ b/Userland/Applications/Piano/MainWidget.cpp
@@ -94,8 +94,7 @@ void MainWidget::keydown_event(GUI::KeyEvent& event)
// This is to stop held-down keys from creating multiple events.
if (m_keys_pressed[event.key()])
return;
- else
- m_keys_pressed[event.key()] = true;
+ m_keys_pressed[event.key()] = true;
bool event_was_accepted = false;
if (note_key_action(event.key(), DSP::Keyboard::Switch::On))
diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp b/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp
index d1b598e0c9..7882577826 100644
--- a/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp
+++ b/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp
@@ -30,12 +30,12 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP:
if (m_value_label != nullptr)
m_value_label->set_text(DeprecatedString::formatted("{:.2f}", static_cast<double>(m_parameter)));
- on_change = [this](auto value) {
+ on_change = [this](auto raw_value) {
if (m_currently_setting_from_ui)
return;
m_currently_setting_from_ui = true;
DSP::ParameterFixedPoint real_value;
- real_value.raw() = value;
+ real_value.raw() = raw_value;
if (is_logarithmic())
// FIXME: Implement exponential for fixed point
real_value = exp2(static_cast<double>(real_value));
diff --git a/Userland/Applications/Piano/TrackManager.cpp b/Userland/Applications/Piano/TrackManager.cpp
index 93a15cc754..7ec57324b9 100644
--- a/Userland/Applications/Piano/TrackManager.cpp
+++ b/Userland/Applications/Piano/TrackManager.cpp
@@ -74,6 +74,5 @@ int TrackManager::next_track_index() const
auto next_track_index = m_current_track + 1;
if (next_track_index >= m_tracks.size())
return 0;
- else
- return next_track_index;
+ return static_cast<int>(next_track_index);
}