diff options
author | Linus Groh <mail@linusgroh.de> | 2022-12-04 18:02:33 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-06 08:54:33 +0100 |
commit | 6e19ab2bbce0b113b628e6f8e9b5c0640053933e (patch) | |
tree | 372d21b2f5dcff112f5d0089559c6af5798680d4 /Userland/Applications/Presenter | |
parent | f74251606d74b504a1379ebb893fdb5529054ea5 (diff) | |
download | serenity-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/Presenter')
-rw-r--r-- | Userland/Applications/Presenter/Presentation.cpp | 8 | ||||
-rw-r--r-- | Userland/Applications/Presenter/Presentation.h | 10 | ||||
-rw-r--r-- | Userland/Applications/Presenter/PresenterWidget.cpp | 4 | ||||
-rw-r--r-- | Userland/Applications/Presenter/Slide.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/Presenter/Slide.h | 6 | ||||
-rw-r--r-- | Userland/Applications/Presenter/SlideObject.h | 14 | ||||
-rw-r--r-- | Userland/Applications/Presenter/main.cpp | 2 |
7 files changed, 23 insertions, 23 deletions
diff --git a/Userland/Applications/Presenter/Presentation.cpp b/Userland/Applications/Presenter/Presentation.cpp index 68ba7f05af..18570427bb 100644 --- a/Userland/Applications/Presenter/Presentation.cpp +++ b/Userland/Applications/Presenter/Presentation.cpp @@ -12,13 +12,13 @@ #include <LibGfx/Forward.h> #include <errno_codes.h> -Presentation::Presentation(Gfx::IntSize normative_size, HashMap<String, String> metadata) +Presentation::Presentation(Gfx::IntSize normative_size, HashMap<DeprecatedString, DeprecatedString> metadata) : m_normative_size(normative_size) , m_metadata(std::move(metadata)) { } -NonnullOwnPtr<Presentation> Presentation::construct(Gfx::IntSize normative_size, HashMap<String, String> metadata) +NonnullOwnPtr<Presentation> Presentation::construct(Gfx::IntSize normative_size, HashMap<DeprecatedString, DeprecatedString> metadata) { return NonnullOwnPtr<Presentation>(NonnullOwnPtr<Presentation>::Adopt, *new Presentation(normative_size, move(metadata))); } @@ -107,9 +107,9 @@ ErrorOr<NonnullOwnPtr<Presentation>> Presentation::load_from_file(StringView fil return presentation; } -HashMap<String, String> Presentation::parse_metadata(JsonObject const& metadata_object) +HashMap<DeprecatedString, DeprecatedString> Presentation::parse_metadata(JsonObject const& metadata_object) { - HashMap<String, String> metadata; + HashMap<DeprecatedString, DeprecatedString> metadata; metadata_object.for_each_member([&](auto const& key, auto const& value) { metadata.set(key, value.to_string()); diff --git a/Userland/Applications/Presenter/Presentation.h b/Userland/Applications/Presenter/Presentation.h index e793924181..6ad200811d 100644 --- a/Userland/Applications/Presenter/Presentation.h +++ b/Userland/Applications/Presenter/Presentation.h @@ -7,10 +7,10 @@ #pragma once #include "Slide.h" +#include <AK/DeprecatedString.h> #include <AK/Forward.h> #include <AK/HashMap.h> #include <AK/NonnullOwnPtr.h> -#include <AK/String.h> #include <AK/Vector.h> #include <LibGfx/Painter.h> #include <LibGfx/Size.h> @@ -42,18 +42,18 @@ public: void paint(Gfx::Painter& painter) const; private: - static HashMap<String, String> parse_metadata(JsonObject const& metadata_object); + static HashMap<DeprecatedString, DeprecatedString> parse_metadata(JsonObject const& metadata_object); static ErrorOr<Gfx::IntSize> parse_presentation_size(JsonObject const& metadata_object); - Presentation(Gfx::IntSize normative_size, HashMap<String, String> metadata); - static NonnullOwnPtr<Presentation> construct(Gfx::IntSize normative_size, HashMap<String, String> metadata); + Presentation(Gfx::IntSize normative_size, HashMap<DeprecatedString, DeprecatedString> metadata); + static NonnullOwnPtr<Presentation> construct(Gfx::IntSize normative_size, HashMap<DeprecatedString, DeprecatedString> metadata); void append_slide(Slide slide); Vector<Slide> m_slides {}; // This is not a pixel size, but an abstract size used by the slide objects for relative positioning. Gfx::IntSize m_normative_size; - HashMap<String, String> m_metadata; + HashMap<DeprecatedString, DeprecatedString> m_metadata; Checked<unsigned> m_current_slide { 0 }; Checked<unsigned> m_current_frame_in_slide { 0 }; diff --git a/Userland/Applications/Presenter/PresenterWidget.cpp b/Userland/Applications/Presenter/PresenterWidget.cpp index b813a6dcce..21d2f7d159 100644 --- a/Userland/Applications/Presenter/PresenterWidget.cpp +++ b/Userland/Applications/Presenter/PresenterWidget.cpp @@ -75,10 +75,10 @@ void PresenterWidget::set_file(StringView file_name) { auto presentation = Presentation::load_from_file(file_name, *window()); if (presentation.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("The presentation \"{}\" could not be loaded.\n{}", file_name, presentation.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("The presentation \"{}\" could not be loaded.\n{}", file_name, presentation.error())); } else { m_current_presentation = presentation.release_value(); - window()->set_title(String::formatted(title_template, m_current_presentation->title(), m_current_presentation->author())); + window()->set_title(DeprecatedString::formatted(title_template, m_current_presentation->title(), m_current_presentation->author())); set_min_size(m_current_presentation->normative_size()); // This will apply the new minimum size. update(); diff --git a/Userland/Applications/Presenter/Slide.cpp b/Userland/Applications/Presenter/Slide.cpp index 5a02a64536..ff563bf7ac 100644 --- a/Userland/Applications/Presenter/Slide.cpp +++ b/Userland/Applications/Presenter/Slide.cpp @@ -12,7 +12,7 @@ #include <LibGfx/Size.h> #include <LibGfx/TextAlignment.h> -Slide::Slide(NonnullRefPtrVector<SlideObject> slide_objects, String title) +Slide::Slide(NonnullRefPtrVector<SlideObject> slide_objects, DeprecatedString title) : m_slide_objects(move(slide_objects)) , m_title(move(title)) { diff --git a/Userland/Applications/Presenter/Slide.h b/Userland/Applications/Presenter/Slide.h index cf96aa8ae8..565a64109c 100644 --- a/Userland/Applications/Presenter/Slide.h +++ b/Userland/Applications/Presenter/Slide.h @@ -7,9 +7,9 @@ #pragma once #include "SlideObject.h" +#include <AK/DeprecatedString.h> #include <AK/Forward.h> #include <AK/NonnullOwnPtrVector.h> -#include <AK/String.h> #include <LibGfx/Forward.h> // A single slide of a presentation. @@ -24,8 +24,8 @@ public: void paint(Gfx::Painter&, unsigned current_frame, Gfx::FloatSize display_scale) const; private: - Slide(NonnullRefPtrVector<SlideObject> slide_objects, String title); + Slide(NonnullRefPtrVector<SlideObject> slide_objects, DeprecatedString title); NonnullRefPtrVector<SlideObject> m_slide_objects; - String m_title; + DeprecatedString m_title; }; diff --git a/Userland/Applications/Presenter/SlideObject.h b/Userland/Applications/Presenter/SlideObject.h index 6c1cb74327..c41202aa9f 100644 --- a/Userland/Applications/Presenter/SlideObject.h +++ b/Userland/Applications/Presenter/SlideObject.h @@ -71,7 +71,7 @@ public: virtual void paint(Gfx::Painter&, Gfx::FloatSize display_scale) const override; - void set_font(String font) { m_font = move(font); } + void set_font(DeprecatedString font) { m_font = move(font); } StringView font() const { return m_font; } void set_font_size(int font_size) { m_font_size = font_size; } int font_size() const { return m_font_size; } @@ -79,13 +79,13 @@ public: unsigned font_weight() const { return m_font_weight; } void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; } Gfx::TextAlignment text_alignment() const { return m_text_alignment; } - void set_text(String text) { m_text = move(text); } + void set_text(DeprecatedString text) { m_text = move(text); } StringView text() const { return m_text; } protected: - String m_text; + DeprecatedString m_text; // The font family, technically speaking. - String m_font; + DeprecatedString m_font; int m_font_size; unsigned m_font_weight; Gfx::TextAlignment m_text_alignment; @@ -110,12 +110,12 @@ public: virtual void paint(Gfx::Painter&, Gfx::FloatSize display_scale) const override; - void set_image_path(String image_path) + void set_image_path(DeprecatedString image_path) { m_image_path = move(image_path); auto result = reload_image(); if (result.is_error()) - GUI::MessageBox::show_error(m_window, String::formatted("Loading image {} failed: {}", m_image_path, result.error())); + GUI::MessageBox::show_error(m_window, DeprecatedString::formatted("Loading image {} failed: {}", m_image_path, result.error())); } StringView image_path() const { return m_image_path; } void set_scaling(ImageScaling scaling) { m_scaling = scaling; } @@ -124,7 +124,7 @@ public: Gfx::Painter::ScalingMode scaling_mode() const { return m_scaling_mode; } protected: - String m_image_path; + DeprecatedString m_image_path; ImageScaling m_scaling { ImageScaling::FitSmallest }; Gfx::Painter::ScalingMode m_scaling_mode { Gfx::Painter::ScalingMode::SmoothPixels }; diff --git a/Userland/Applications/Presenter/main.cpp b/Userland/Applications/Presenter/main.cpp index 17ac0f86fb..327c7392e0 100644 --- a/Userland/Applications/Presenter/main.cpp +++ b/Userland/Applications/Presenter/main.cpp @@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) // rpath is required to load .presenter files, unix, sendfd and recvfd are required to talk to ImageDecoder and WindowServer. TRY(Core::System::pledge("stdio rpath unix sendfd recvfd")); - String file_to_load; + DeprecatedString file_to_load; Core::ArgsParser argument_parser; argument_parser.add_positional_argument(file_to_load, "Presentation to load", "file", Core::ArgsParser::Required::No); argument_parser.parse(arguments); |