summaryrefslogtreecommitdiff
path: root/Userland/Applications/Calculator
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-12-04 18:02:33 +0000
committerAndreas Kling <kling@serenityos.org>2022-12-06 08:54:33 +0100
commit6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch)
tree372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Applications/Calculator
parentf74251606d74b504a1379ebb893fdb5529054ea5 (diff)
downloadserenity-6e19ab2bbce0b113b628e6f8e9b5c0640053933e.zip
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
Diffstat (limited to 'Userland/Applications/Calculator')
-rw-r--r--Userland/Applications/Calculator/CalculatorWidget.cpp4
-rw-r--r--Userland/Applications/Calculator/CalculatorWidget.h2
-rw-r--r--Userland/Applications/Calculator/Keypad.cpp6
-rw-r--r--Userland/Applications/Calculator/Keypad.h4
-rw-r--r--Userland/Applications/Calculator/main.cpp8
5 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Applications/Calculator/CalculatorWidget.cpp b/Userland/Applications/Calculator/CalculatorWidget.cpp
index 4835797214..0964eca72a 100644
--- a/Userland/Applications/Calculator/CalculatorWidget.cpp
+++ b/Userland/Applications/Calculator/CalculatorWidget.cpp
@@ -31,7 +31,7 @@ CalculatorWidget::CalculatorWidget()
m_label->set_frame_thickness(2);
for (int i = 0; i < 10; i++) {
- m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(String::formatted("{}_button", i));
+ m_digit_button[i] = *find_descendant_of_type_named<GUI::Button>(DeprecatedString::formatted("{}_button", i));
add_digit_button(*m_digit_button[i], i);
}
@@ -128,7 +128,7 @@ void CalculatorWidget::add_digit_button(GUI::Button& button, int digit)
};
}
-String CalculatorWidget::get_entry()
+DeprecatedString CalculatorWidget::get_entry()
{
return m_entry->text();
}
diff --git a/Userland/Applications/Calculator/CalculatorWidget.h b/Userland/Applications/Calculator/CalculatorWidget.h
index 556dadc22b..6f91bf75db 100644
--- a/Userland/Applications/Calculator/CalculatorWidget.h
+++ b/Userland/Applications/Calculator/CalculatorWidget.h
@@ -19,7 +19,7 @@ class CalculatorWidget final : public GUI::Widget {
C_OBJECT(CalculatorWidget)
public:
virtual ~CalculatorWidget() override = default;
- String get_entry();
+ DeprecatedString get_entry();
void set_entry(Crypto::BigFraction);
void shrink(unsigned);
diff --git a/Userland/Applications/Calculator/Keypad.cpp b/Userland/Applications/Calculator/Keypad.cpp
index c261800043..63b89432c7 100644
--- a/Userland/Applications/Calculator/Keypad.cpp
+++ b/Userland/Applications/Calculator/Keypad.cpp
@@ -112,15 +112,15 @@ void Keypad::set_to_0()
m_state = State::External;
}
-String Keypad::to_string() const
+DeprecatedString Keypad::to_string() const
{
if (m_state == State::External)
return m_internal_value.to_string(m_displayed_fraction_length);
StringBuilder builder;
- String const integer_value = m_int_value.to_base(10);
- String const frac_value = m_frac_value.to_base(10);
+ DeprecatedString const integer_value = m_int_value.to_base(10);
+ DeprecatedString const frac_value = m_frac_value.to_base(10);
unsigned const number_pre_zeros = m_frac_length.to_u64() - (frac_value.length() - 1) - (frac_value == "0" ? 0 : 1);
builder.append(integer_value);
diff --git a/Userland/Applications/Calculator/Keypad.h b/Userland/Applications/Calculator/Keypad.h
index ce57847284..7fb9799378 100644
--- a/Userland/Applications/Calculator/Keypad.h
+++ b/Userland/Applications/Calculator/Keypad.h
@@ -7,7 +7,7 @@
#pragma once
-#include <AK/String.h>
+#include <AK/DeprecatedString.h>
#include <LibCrypto/BigFraction/BigFraction.h>
#include <LibCrypto/BigInt/UnsignedBigInteger.h>
@@ -33,7 +33,7 @@ public:
void set_rounding_length(unsigned);
unsigned rounding_length() const;
- String to_string() const;
+ DeprecatedString to_string() const;
private:
// Internal representation of the current decimal value.
diff --git a/Userland/Applications/Calculator/main.cpp b/Userland/Applications/Calculator/main.cpp
index 2ad7653b53..af00b85f9d 100644
--- a/Userland/Applications/Calculator/main.cpp
+++ b/Userland/Applications/Calculator/main.cpp
@@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Optional<unsigned> last_rounding_mode = 1;
for (unsigned i {}; i < rounding_modes.size(); ++i) {
- auto round_action = GUI::Action::create_checkable(String::formatted("To &{} digits", rounding_modes[i]),
+ auto round_action = GUI::Action::create_checkable(DeprecatedString::formatted("To &{} digits", rounding_modes[i]),
[&widget, rounding_mode = rounding_modes[i], &last_rounding_mode, i](auto&) {
widget->set_rounding_length(rounding_mode);
last_rounding_mode = i;
@@ -89,11 +89,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
constexpr auto format { "&Custom - {} ..."sv };
- auto round_custom = GUI::Action::create_checkable(String::formatted(format, 0), [&](auto& action) {
+ auto round_custom = GUI::Action::create_checkable(DeprecatedString::formatted(format, 0), [&](auto& action) {
unsigned custom_rounding_length = widget->rounding_length();
if (RoundingDialog::show(window, "Choose custom rounding"sv, custom_rounding_length) == GUI::Dialog::ExecResult::OK) {
- action.set_text(String::formatted(format, custom_rounding_length));
+ action.set_text(DeprecatedString::formatted(format, custom_rounding_length));
widget->set_rounding_length(custom_rounding_length);
last_rounding_mode.clear();
} else if (last_rounding_mode.has_value())
@@ -107,7 +107,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (RoundingDialog::show(window, "Choose shrinking length"sv, shrink_length) == GUI::Dialog::ExecResult::OK) {
round_custom->set_checked(true);
- round_custom->set_text(String::formatted(format, shrink_length));
+ round_custom->set_text(DeprecatedString::formatted(format, shrink_length));
widget->set_rounding_length(shrink_length);
widget->shrink(shrink_length);
}