1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +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

@ -134,11 +134,11 @@ void FileOperationProgressWidget::did_error(StringView message)
{
// FIXME: Communicate more with the user about errors.
close_pipe();
GUI::MessageBox::show(window(), DeprecatedString::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
GUI::MessageBox::show(window(), ByteString::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
window()->close();
}
DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
ByteString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count)
{
i64 const elapsed_seconds = m_elapsed_timer.elapsed_time().to_seconds();
@ -149,7 +149,7 @@ DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, of
int seconds_remaining = (bytes_left * elapsed_seconds) / bytes_done;
if (seconds_remaining < 30)
return DeprecatedString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
return ByteString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5);
if (seconds_remaining < 60)
return "About a minute";
if (seconds_remaining < 90)
@ -162,14 +162,14 @@ DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, of
if (minutes_remaining < 60) {
if (seconds_remaining < 30)
return DeprecatedString::formatted("About {} minutes", minutes_remaining);
return DeprecatedString::formatted("Over {} minutes", minutes_remaining);
return ByteString::formatted("About {} minutes", minutes_remaining);
return ByteString::formatted("Over {} minutes", minutes_remaining);
}
time_t hours_remaining = minutes_remaining / 60;
minutes_remaining %= 60;
return DeprecatedString::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining);
return ByteString::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining);
}
void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView current_filename)
@ -195,7 +195,7 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt
VERIFY_NOT_REACHED();
}
estimated_time_label.set_text(String::from_deprecated_string(estimate_time(bytes_done, total_byte_count)).release_value_but_fixme_should_propagate_errors());
estimated_time_label.set_text(String::from_byte_string(estimate_time(bytes_done, total_byte_count)).release_value_but_fixme_should_propagate_errors());
if (total_byte_count) {
window()->set_progress(100.0f * bytes_done / total_byte_count);