mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:47:45 +00:00
ImageViewer: Use LibFileSystemAccessClient
This commit also starts the adoption of ErrorOr<T> and the String class in ImageViewer. However, there is still a few more changes that could be made. Since the actions of using LibFSAC and using String in more places are tightly coupled, I decided to put them in one commit.
This commit is contained in:
parent
c943ab823d
commit
208e3f1978
4 changed files with 83 additions and 46 deletions
|
@ -4,6 +4,7 @@
|
|||
* Copyright (c) 2021, Mohsan Ali <mohsan0073@gmail.com>
|
||||
* Copyright (c) 2022, Mustafa Quraish <mustafa@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
* Copyright (c) 2023, Caoimhe Byrne <caoimhebyrne06@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -30,12 +31,12 @@ public:
|
|||
virtual ~ViewWidget() override = default;
|
||||
|
||||
Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); }
|
||||
DeprecatedString const& path() const { return m_path; }
|
||||
String const& path() const { return m_path; }
|
||||
void set_toolbar_height(int height) { m_toolbar_height = height; }
|
||||
int toolbar_height() { return m_toolbar_height; }
|
||||
bool scaled_for_first_image() { return m_scaled_for_first_image; }
|
||||
void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; }
|
||||
void set_path(DeprecatedString const& path);
|
||||
void set_path(String const& path);
|
||||
void resize_window();
|
||||
void scale_image_for_window();
|
||||
void set_scaling_mode(Gfx::Painter::ScalingMode);
|
||||
|
@ -47,7 +48,7 @@ public:
|
|||
void flip(Gfx::Orientation);
|
||||
void rotate(Gfx::RotationDirection);
|
||||
void navigate(Directions);
|
||||
void load_from_file(DeprecatedString const&);
|
||||
void open_file(String const&, Core::File&);
|
||||
|
||||
Function<void()> on_doubleclick;
|
||||
Function<void(const GUI::DropEvent&)> on_drop;
|
||||
|
@ -66,8 +67,9 @@ private:
|
|||
void set_bitmap(Gfx::Bitmap const* bitmap);
|
||||
void animate();
|
||||
Vector<DeprecatedString> load_files_from_directory(DeprecatedString const& path) const;
|
||||
ErrorOr<void> try_open_file(String const&, Core::File&);
|
||||
|
||||
DeprecatedString m_path;
|
||||
String m_path;
|
||||
RefPtr<Gfx::Bitmap const> m_bitmap;
|
||||
Optional<ImageDecoderClient::DecodedImage> m_decoded_image;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue