mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
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 :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -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());
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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 };
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue