summaryrefslogtreecommitdiff
path: root/Userland/Applications/ImageViewer
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-04-01 20:58:27 +0300
committerLinus Groh <mail@linusgroh.de>2022-04-01 21:24:45 +0100
commit086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch)
tree02b3699a66735ef806d9b46353491f18f8e4e7b4 /Userland/Applications/ImageViewer
parent0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff)
downloadserenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip
Everywhere: Run clang-format
Diffstat (limited to 'Userland/Applications/ImageViewer')
-rw-r--r--Userland/Applications/ImageViewer/ViewWidget.cpp12
-rw-r--r--Userland/Applications/ImageViewer/ViewWidget.h14
-rw-r--r--Userland/Applications/ImageViewer/main.cpp4
3 files changed, 15 insertions, 15 deletions
diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp
index 0bde797a59..0a1dfc7c4e 100644
--- a/Userland/Applications/ImageViewer/ViewWidget.cpp
+++ b/Userland/Applications/ImageViewer/ViewWidget.cpp
@@ -75,7 +75,7 @@ bool ViewWidget::is_previous_available() const
return false;
}
-Vector<String> ViewWidget::load_files_from_directory(const String& path) const
+Vector<String> ViewWidget::load_files_from_directory(String const& path) const
{
Vector<String> files_in_directory;
@@ -90,7 +90,7 @@ Vector<String> ViewWidget::load_files_from_directory(const String& path) const
return files_in_directory;
}
-void ViewWidget::set_path(const String& path)
+void ViewWidget::set_path(String const& path)
{
m_path = path;
m_files_in_same_dir = load_files_from_directory(path);
@@ -151,7 +151,7 @@ void ViewWidget::mouseup_event(GUI::MouseEvent& event)
GUI::AbstractZoomPanWidget::mouseup_event(event);
}
-void ViewWidget::load_from_file(const String& path)
+void ViewWidget::load_from_file(String const& path)
{
auto show_error = [&] {
GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image", GUI::MessageBox::Type::Error);
@@ -186,7 +186,7 @@ void ViewWidget::load_from_file(const String& path)
on_image_change(m_bitmap);
if (m_decoded_image->is_animated && m_decoded_image->frames.size() > 1) {
- const auto& first_frame = m_decoded_image->frames[0];
+ auto const& first_frame = m_decoded_image->frames[0];
m_timer->set_interval(first_frame.duration);
m_timer->on_timeout = [this] { animate(); };
m_timer->start();
@@ -229,7 +229,7 @@ void ViewWidget::resize_window()
window()->resize(new_size);
}
-void ViewWidget::set_bitmap(const Gfx::Bitmap* bitmap)
+void ViewWidget::set_bitmap(Gfx::Bitmap const* bitmap)
{
if (m_bitmap == bitmap)
return;
@@ -246,7 +246,7 @@ void ViewWidget::animate()
m_current_frame_index = (m_current_frame_index + 1) % m_decoded_image->frames.size();
- const auto& current_frame = m_decoded_image->frames[m_current_frame_index];
+ auto const& current_frame = m_decoded_image->frames[m_current_frame_index];
set_bitmap(current_frame.bitmap);
if ((int)current_frame.duration != m_timer->interval()) {
diff --git a/Userland/Applications/ImageViewer/ViewWidget.h b/Userland/Applications/ImageViewer/ViewWidget.h
index b016cd80e7..8aab232c92 100644
--- a/Userland/Applications/ImageViewer/ViewWidget.h
+++ b/Userland/Applications/ImageViewer/ViewWidget.h
@@ -29,13 +29,13 @@ public:
virtual ~ViewWidget() override = default;
- const Gfx::Bitmap* bitmap() const { return m_bitmap.ptr(); }
- const String& path() const { return m_path; }
+ Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); }
+ 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(const String& path);
+ void set_path(String const& path);
void resize_window();
void set_scaling_mode(Gfx::Painter::ScalingMode);
@@ -46,11 +46,11 @@ public:
void flip(Gfx::Orientation);
void rotate(Gfx::RotationDirection);
void navigate(Directions);
- void load_from_file(const String&);
+ void load_from_file(String const&);
Function<void()> on_doubleclick;
Function<void(const GUI::DropEvent&)> on_drop;
- Function<void(const Gfx::Bitmap*)> on_image_change;
+ Function<void(Gfx::Bitmap const*)> on_image_change;
private:
ViewWidget();
@@ -60,9 +60,9 @@ private:
virtual void mouseup_event(GUI::MouseEvent&) override;
virtual void drop_event(GUI::DropEvent&) override;
- void set_bitmap(const Gfx::Bitmap* bitmap);
+ void set_bitmap(Gfx::Bitmap const* bitmap);
void animate();
- Vector<String> load_files_from_directory(const String& path) const;
+ Vector<String> load_files_from_directory(String const& path) const;
String m_path;
RefPtr<Gfx::Bitmap> m_bitmap;
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index 10d73fa6eb..6a5bcf99aa 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app_icon = GUI::Icon::default_icon("filetype-image");
- const char* path = nullptr;
+ char const* path = nullptr;
Core::ArgsParser args_parser;
args_parser.add_positional_argument(path, "The image file to be displayed.", "file", Core::ArgsParser::Required::No);
args_parser.parse(arguments);
@@ -244,7 +244,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
widget->set_scaling_mode(Gfx::Painter::ScalingMode::BilinearBlend);
});
- widget->on_image_change = [&](const Gfx::Bitmap* bitmap) {
+ widget->on_image_change = [&](Gfx::Bitmap const* bitmap) {
bool should_enable_image_actions = (bitmap != nullptr);
bool should_enable_forward_actions = (widget->is_next_available() && should_enable_image_actions);
bool should_enable_backward_actions = (widget->is_previous_available() && should_enable_image_actions);