1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 13:27:36 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -5,7 +5,7 @@
*/
#include "ExportProgressWindow.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <Applications/Piano/ExportProgressWidget.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Label.h>

View file

@ -50,7 +50,7 @@ ErrorOr<void> PlayerWidget::initialize()
m_track_dropdown = add<GUI::ComboBox>();
m_track_dropdown->set_max_width(75);
m_track_dropdown->set_model(*GUI::ItemListModel<DeprecatedString>::create(m_track_number_choices));
m_track_dropdown->set_model(*GUI::ItemListModel<ByteString>::create(m_track_number_choices));
m_track_dropdown->set_only_allow_values_from_model(true);
m_track_dropdown->set_model_column(0);
m_track_dropdown->set_selected_index(0);
@ -117,7 +117,7 @@ void PlayerWidget::add_track()
{
m_track_manager.add_track();
auto latest_track_count = m_track_manager.track_count();
auto latest_track_string = DeprecatedString::number(latest_track_count);
auto latest_track_string = ByteString::number(latest_track_count);
m_track_number_choices.append(latest_track_string);
m_track_dropdown->set_selected_index(latest_track_count - 1);
}

View file

@ -31,7 +31,7 @@ private:
TrackManager& m_track_manager;
MainWidget& m_main_widget;
AudioPlayerLoop& m_audio_loop;
Vector<DeprecatedString> m_track_number_choices;
Vector<ByteString> m_track_number_choices;
RefPtr<Gfx::Bitmap> m_play_icon;
RefPtr<Gfx::Bitmap> m_pause_icon;

View file

@ -20,12 +20,12 @@ class ProcessorParameterDropdown : public GUI::ComboBox {
C_OBJECT(ProcessorParameterDropdown);
public:
ProcessorParameterDropdown(DSP::ProcessorEnumParameter<EnumT>& parameter, Vector<DeprecatedString> modes)
ProcessorParameterDropdown(DSP::ProcessorEnumParameter<EnumT>& parameter, Vector<ByteString> modes)
: ComboBox()
, m_parameter(parameter)
, m_modes(move(modes))
{
auto model = GUI::ItemListModel<EnumT, Vector<DeprecatedString>>::create(m_modes);
auto model = GUI::ItemListModel<EnumT, Vector<ByteString>>::create(m_modes);
set_model(model);
set_only_allow_values_from_model(true);
set_model_column(0);
@ -55,5 +55,5 @@ public:
private:
DSP::ProcessorEnumParameter<EnumT>& m_parameter;
Vector<DeprecatedString> m_modes;
Vector<ByteString> m_modes;
};

View file

@ -26,7 +26,7 @@ ProcessorParameterWidget::ProcessorParameterWidget(DSP::ProcessorParameter& raw_
case DSP::ParameterType::Enum: {
// FIXME: We shouldn't do that, but the only user is the synth right now.
auto& parameter = static_cast<DSP::ProcessorEnumParameter<DSP::Synthesizers::Waveform>&>(raw_parameter);
auto enum_strings = Vector<DeprecatedString> { "Sine", "Triangle", "Square", "Saw", "Noise" };
auto enum_strings = Vector<ByteString> { "Sine", "Triangle", "Square", "Saw", "Noise" };
m_parameter_modifier = add<ProcessorParameterDropdown<DSP::Synthesizers::Waveform>>(parameter, move(enum_strings));
break;
}

View file

@ -163,7 +163,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
painter.draw_text(note_name_rect, note_name, Gfx::TextAlignment::CenterLeft);
note_name_rect.translate_by(Gfx::FontDatabase::default_font().width(note_name) + 2, 0);
if (note % notes_per_octave == 0)
painter.draw_text(note_name_rect, DeprecatedString::formatted("{}", note / notes_per_octave + 1), Gfx::TextAlignment::CenterLeft);
painter.draw_text(note_name_rect, ByteString::formatted("{}", note / notes_per_octave + 1), Gfx::TextAlignment::CenterLeft);
}
int x = m_roll_width * (static_cast<double>(m_track_manager.transport()->time()) / roll_length);

View file

@ -52,11 +52,11 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager)
m_open_button->set_focus_policy(GUI::FocusPolicy::TabFocus);
m_open_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
m_open_button->on_click = [this](auto) {
Optional<DeprecatedString> open_path = GUI::FilePicker::get_open_filepath(window());
Optional<ByteString> open_path = GUI::FilePicker::get_open_filepath(window());
if (!open_path.has_value())
return;
// TODO: We don't actually load the sample.
m_recorded_sample_name->set_text(String::from_deprecated_string(open_path.value()).release_value_but_fixme_should_propagate_errors());
m_recorded_sample_name->set_text(String::from_byte_string(open_path.value()).release_value_but_fixme_should_propagate_errors());
m_wave_editor->update();
};

View file

@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TrackManager track_manager;
Threading::MutexProtected<Audio::WavWriter> wav_writer;
Optional<DeprecatedString> save_path;
Optional<ByteString> save_path;
Atomic<bool> need_to_write_wav = false;
Atomic<int> wav_percent_written = 0;
@ -65,11 +65,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
save_path = GUI::FilePicker::get_save_filepath(window, "Untitled", "wav");
if (!save_path.has_value())
return;
DeprecatedString error;
ByteString error;
wav_writer.with_locked([&](auto& wav_writer) {
auto error_or_void = wav_writer.set_file(save_path.value());
if (error_or_void.is_error())
error = DeprecatedString::formatted("Failed to export WAV file: {}", error_or_void.error());
error = ByteString::formatted("Failed to export WAV file: {}", error_or_void.error());
});
if (!error.is_empty()) {
GUI::MessageBox::show_error(window, error);