1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:17:45 +00:00

SoundPlayer: Update the SoundPlayer interface

Also fix rebase conflict
This commit is contained in:
Cesar Torres 2021-03-21 13:01:33 +01:00 committed by Andreas Kling
parent 45e928bfb2
commit 7aa5297835
5 changed files with 395 additions and 59 deletions

View file

@ -25,19 +25,22 @@
*/
#include "SoundPlayerWidget.h"
#include "Common.h"
#include <AK/StringBuilder.h>
#include <LibCore/MimeData.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Label.h>
#include <LibGUI/MessageBox.h>
#include <math.h>
SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, NonnullRefPtr<Audio::ClientConnection> connection)
SoundPlayerWidget::SoundPlayerWidget(GUI::Window& window, Audio::ClientConnection& connection, PlaybackManager& manager)
: m_window(window)
, m_connection(connection)
, m_manager(connection)
, m_manager(manager)
{
window.set_resizable(false);
window.resize(350, 140);
set_fill_with_background_color(true);
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 2, 2, 2, 2 });
@ -104,16 +107,7 @@ SoundPlayerWidget::~SoundPlayerWidget()
{
}
SoundPlayerWidget::Slider::~Slider()
{
}
void SoundPlayerWidget::hide_scope(bool hide)
{
m_sample_widget->set_visible(!hide);
}
void SoundPlayerWidget::open_file(String path)
void SoundPlayerWidget::open_file(StringView path)
{
NonnullRefPtr<Audio::Loader> loader = Audio::Loader::create(path);
if (loader->has_error() || !loader->sample_rate()) {
@ -192,3 +186,8 @@ void SoundPlayerWidget::update_position(const int position)
m_slider->set_value(total_norm_samples);
}
void SoundPlayerWidget::hide_scope(bool hide)
{
m_sample_widget->set_visible(!hide);
}