mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
PixelPaint: Move title
and path
from Image to ImageEditor
As noted in the latest hacking video, it doesn't seem to make much sense to store the title and path in the image itself. These fields have now been moved to the actual ImageEditor itself. This allows some nice simplicfications, including getting rid of the `image_did_change_title` hook of ImageClient (which was just a way to report back to the editor that the title had changed).
This commit is contained in:
parent
0b43a92eed
commit
2440d2c2fe
6 changed files with 45 additions and 56 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Mustafa Quraish <mustafa@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Mustafa Quraish <mustafa@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -13,7 +13,6 @@
|
|||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonObjectSerializer.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -36,8 +35,7 @@ ErrorOr<NonnullRefPtr<Image>> Image::try_create_with_size(Gfx::IntSize const& si
|
|||
}
|
||||
|
||||
Image::Image(Gfx::IntSize const& size)
|
||||
: m_title("Untitled")
|
||||
, m_size(size)
|
||||
: m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -468,19 +466,6 @@ void ImageUndoCommand::redo()
|
|||
undo();
|
||||
}
|
||||
|
||||
void Image::set_title(String title)
|
||||
{
|
||||
m_title = move(title);
|
||||
for (auto* client : m_clients)
|
||||
client->image_did_change_title(m_title);
|
||||
}
|
||||
|
||||
void Image::set_path(String path)
|
||||
{
|
||||
m_path = move(path);
|
||||
set_title(LexicalPath::basename(m_path));
|
||||
}
|
||||
|
||||
void Image::flip(Gfx::Orientation orientation)
|
||||
{
|
||||
for (auto& layer : m_layers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue