summaryrefslogtreecommitdiff
path: root/Userland/Applications/ImageViewer/ViewWidget.cpp
AgeCommit message (Collapse)Author
2022-12-06AK+Everywhere: Rename String to DeprecatedStringLinus Groh
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 :^)
2022-11-13Userland: Accept drag_enter events for widgets supporting file dropsKarol Kosek
This patch will switch cursor to DragCopy when a user enters a widget while dragging file(s), giving them a visual clue that it *might* be dropped into this widget. This is a rather naive approach, as the cursor icon will change for any kind of file, as currently programs don't know the drag contents before dropping it. But after all I think it's better than nothing. :^)
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-22Applications: Do not crash if decoded bitmap is nullJelle Raaijmakers
ImageViewer and PixelPaint would crash when the ImageDecoderClient returns a frame without a bitmap. This can happen with `.ico` files with an unsupported BPP, for example.
2022-02-14Applications: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-01-15LibCore+LibIPC+Everywhere: Return Stream::LocalSocket from LocalServersin-ack
This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
2022-01-14ImageViewer: Inherit from `AbstractZoomPanWidget`Mustafa Quraish
2021-12-29ImageViewer: Allow choice between nearest neighbor and bilinear scalingLuke Wilde
Currently, ImageViewer always uses nearest neighbor scaling. This allows the user to choose whether to use nearest neighbor or bilinear scaling. It current defaults to nearest neighbor.
2021-12-28ImageViewer: Change how scaling worksMaciej
- Store scale as a (float) factor (not as %) - Make scaling exponential so that matches PixelPaint and another image viewers/editors/etc
2021-11-23LibCore+AK: Move MappedFile from AK to LibCoreAndreas Kling
MappedFile is strictly a userspace thing, so it doesn't belong in AK (which is supposed to be user/kernel agnostic.)
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::flipped()Andreas Kling
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::rotated()Andreas Kling
2021-10-27Everywhere: Rename left/right-click to primary/secondaryFiliph Sandström
This resolves #10641.
2021-10-19ImageViewer: Use scaled image size when resizing window to fit itNícolas F. R. A. Prado
When the image is flipped or rotated, the window is resized to ensure that the image still fits in the frame. However, currently the original bitmap rect is used, which doesn't take into account the scaling factor. Fix this by using the scaled rect instead.
2021-09-13ImageViewer: Enable and disable navigationMohsan Ali
Before there was dialogs to indicate if current file is last or first. So in this commit, I added functionality to enable and disable forward and backward navigation based on if the next file is avialable or not and if the pervious file is avialable or not, respectively. ImageViewer: Refactor code and init data Data intialization was not happening properly, now I did Initializations properly so that navigation can work from the very first image.
2021-09-06Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safeAli Mohammad Pur
2021-07-20ImageViewer: Do not resize the window if the image fits into the windowAziz Berkay Yesilyurt
2021-07-20ImageViewer: Do not return early when the scale is not changedAziz Berkay Yesilyurt
When the image is rotated, the scale is still the same, but the window needs to be still resized.
2021-07-20ImageViewer: Use the same function to resize the windowAziz Berkay Yesilyurt
ImageViewer used two different logic to resize the display window, which leads to confusing behaviour for rotate function. Now all the resizing behaviour goes through the existing resize_window function.
2021-07-09ImageViewer: Use real path for the image pathAziz Berkay Yesilyurt
By using the real path for the image, ImageViewer can iterate over the images in the same directory. Before, this was not possible when ImageViewer opened from Terminal with a path argument.
2021-07-09ImageViewer: Use LexicalPath to grab current_dirAziz Berkay Yesilyurt
2021-05-16ImageViewer: Stop animation timer when deleting/changing imageDragonAlex98
Previously deleting an animated image wouldn't make the animation timer stop. This resulted in the animation still running in the ViewWidget. Moreover the timer wasn't stopped when loading different images, which led to high CPU usage when going from an animated image to a non-animated one.
2021-05-16ImageViewer: Disable image actions when there is no imageDragonAlex98
Previously some actions like Rotate/Flip/Set as Desktop Wallpaper would make the application crash if no image was loaded. Now image actions are enabled/disabled based on whether an image has been loaded or not.
2021-05-14ImageViewer: Sandbox image decoding using the ImageDecoder service :^)Andreas Kling
Instead of parsing untrusted and potentially malicious image files in the ImageViewer GUI process, take advantage of the ImageDecoder service that we already have on the system to sandbox the decode. This prevents bugs in our image decoding libraries from being used as an exploitation vector when viewing files in ImageViewer.
2021-05-14ImageViewer: Rename QSWidget => ImageViewer::ViewWidgetAndreas Kling