summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
AgeCommit message (Collapse)Author
2023-06-04TextEditor: Prevent autoscroll looping overAhmed Hussein
When a text file has only 1 line with long text autoscroll to the top will no longer loop over and set the cursor to the end of the line.
2023-06-01LibGUI: Add support for jumping to a line and column in TextEditorCaoimhe
We had support for going to a specific line before, but now we support jumping around using the `line:column` format :^)
2023-05-29LibGUI: Allow FilteringProxyModel to optionally sort results by scoreTim Ledbetter
When the `FilteringOptions::SortByScore` flag is set, filtered indices are sorted by match score in descending order, meaning the most relevant results should appear first. The default behavior of FilteringProxyModel is unchanged.
2023-05-28LibGUI: Fix crooked close button on active tabs in the TabWidgetKarol Kosek
This is a regression from f391ccfe53e18395842d0d6b743d08d23b9108e5. The bug didn't appear on inactive tabs, as they already use `translated(1, -2)`.
2023-05-24Everywhere: Use MonotonicTime instead of Durationkleines Filmröllchen
This is easily identifiable by anyone who uses Duration::now_monotonic, and any downstream users of that data.
2023-05-24AK: Rename Time to Durationkleines Filmröllchen
That's what this class really is; in fact that's what the first line of the comment says it is. This commit does not rename the main files, since those will contain other time-related classes in a little bit.
2023-05-23LibGfx+Everywhere: Change `Gfx::Rect` to be endpoint exclusiveJelle Raaijmakers
Previously, calling `.right()` on a `Gfx::Rect` would return the last column's coordinate still inside the rectangle, or `left + width - 1`. This is called 'endpoint inclusive' and does not make a lot of sense for `Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would return 4 as its right side. This same problem exists for `.bottom()`. This changes `Gfx::Rect` to be endpoint exclusive, which gives us the nice property that `width = right - left` and `height = bottom - top`. It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly the same. All users of `Gfx::Rect` have been updated accordingly.
2023-05-23Base+Userland: Apply Human Interface Guidelines to Object textthankyouverycool
Corrects a slew of titles, buttons, labels, menu items and status bars for capitalization, ellipses and punctuation. Rewords a few actions and dialogs to use uniform language and punctuation.
2023-05-23LibGUI: Adjust size and layout of InputBoxthankyouverycool
Increases default dimensions of InputBox, giving it slightly more divine proportions. Prompt text now always appears above the editor.
2023-05-21Clipboard: Avoid unnecessary IPC::Dictionary wrapperBen Wiederhake
We already have and use HashMap<DeprecatedString, DeprecatedString> nearly everywhere, which is equivalent.
2023-05-19LibIPC: Explicitly mark HashMap copy, offer move interfaceBen Wiederhake
2023-05-19LibGUI: Set Open/Save button as default in FilePickerthankyouverycool
This makes it more obvious that enter will return the current selection and prevents returning without a valid selection.
2023-05-16LibGUI: Actually set the first allowed file extension list in FilePickerKarol Kosek
Previously, the File Picker didn't activate the pre-selected filter.
2023-05-15LibGUI: Fix bad title alignment in GroupBoxAndreas Kling
Make a separate rect for the text and use IntRect::centered_within() to sidestep any subpixel jitter. This way it looks good with both bitmap and vector fonts.
2023-05-15LibGUI: Put a governor on Action activationthankyouverycool
Many actions affect Window modality, so let's put a temporary change governor on activation to stop race conditions. Fixes being able to spam open/close shortcuts and spawn multiple FilePickers, among other things.
2023-05-15LibGUI+FileSystemAccessServer: Avoid using dummy windowsthankyouverycool
Creates two new gatekept helpers for FilePicker and MessageBox to be used by FSAS to replace the "dummy window" approach to centering Dialogs. There was a slight delay in creating two windows, one a transparent intermediary hidden behind the second, to display FSAS Dialogs. Now we only need to make the window we actually see.
2023-05-15LibGUI: Simplify Dialog::ScreenPosition and allow Dialogs to opt outthankyouverycool
These options were created 2 years ago but the only use cases thus far are for Center and CenterWithinParent, so let's chuck the rest for now. Adds a new DoNotPosition option to opt out of automatic centering and a ScreenPosition setter and getter for configuration before exec()
2023-05-15LibGUI: Add Window::constrain_to_desktop() helperthankyouverycool
And a center_within(IntRect const&) overload
2023-05-15LibGUI+Userland: Store column names in JsonArrayModel as StringKarol Kosek
2023-05-15Userland: Port `Model::column_name()` to StringKarol Kosek
2023-05-15LibGUI: Increase the min width of the vertical opacity sliderMacDue
This prevents the <opacity>% text on the slider being clipped.
2023-05-15LibGUI: Ensure final stop of the opacity slider gradient has 255 alphaMacDue
Otherwise, if you change the opacity in the color picker, the slider's opacity changes.
2023-05-13LibGUI: Use ColorRole::DisabledText when AbstractView is disabledthankyouverycool
And only paint GlyphMapWidget's frame if disabled
2023-05-13LibGUI: Allow setting and clearing text in SpinBoxthankyouverycool
2023-05-13LibGUI+Applications: Let GlyphMapWidget initialize a null Fontthankyouverycool
FontEditor will need to clear references to its mutable font in the future while CharacterMap has no use for the highlights clone, so let's convert GlyphMapWidget's set_font wrapper into a separate initialize function for the editor and stop hiding the base function for others. Setting font null in either ultimately points the map to the system's default font.
2023-05-13LibGUI: Add fallible factories to ItemListModelthankyouverycool
2023-05-13LibGUI: Ignore Alt+{Left,Right} key events in GlyphMapWidgetthankyouverycool
Fixes seek actions not activating by keyboard shortcut when GlyphMapWidget has focus.
2023-05-12LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOrBen Wiederhake
This prevents callers from accidentally discarding the result of initialize(), which was the root cause of this OSS Fuzz bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55896&q=label%3AProj-serenity&sort=summary
2023-05-08Applets/ClipboardHistory: Add persistent storageLucas CHOLLET
Clipboard entries are now preserved upon reboot :^). Unfortunately, it only supports data with the mimetype "text/". This is done by writing all entries as a JSON object in a file located in ~/.data. Co-authored-by: Sagittarius-a <sagittarius-a@users.noreply.github.com>
2023-05-08LibGUI: Use cursor position when calculating autoscroll deltaAhmed Hussein
Autoscroll delta now takes into account the cursor position relative to the widget inner rect height to allow for faster rubber band autoscrolling.
2023-05-07LibGUI: Always paint vertical lines for Frames in unmaximized windowsthankyouverycool
Fixes incorrect thread highlighting for ResourceGraph panels. Prior to FrameStyles, these graphs were painted as faux-panels, this is, sunken containers with a thickness of 1, and weren't subject to the bug.
2023-05-07Everywhere: Change spelling of 'behaviour' to 'behavior'Ben Wiederhake
"The official project language is American English […]." https://github.com/SerenityOS/serenity/blob/5d2e9156239cd707a22ecea6c87d48e5fc1cbe84/CONTRIBUTING.md?plain=1#L30 Here's a short statistic of the occurrences of the word "behavio(u)r": $ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n 2 BEHAVIOR 24 Behaviour 32 behaviour 407 Behavior 992 behavior Therefore, it is clear that "behaviour" (56 occurrences) should be regarded a typo, and "behavior" (1401 occurrences) should be preferred. Note that The occurrences in LibJS are intentionally NOT changed, because there are taken verbatim from the specification. Hence: $ git grep -IPioh 'behaviou?r' | sort | uniq -c | sort -n 2 BEHAVIOR 10 behaviour 24 Behaviour 407 Behavior 1014 behavior
2023-05-06LibGUI: Guard us from trying to slice an empty Arguments::stringsKenneth Myhra
This fixes an issue when we sometime pass in an empty Main::Arguments to GUI::Application::create(). Also, this mimics the behavior that Application::construct() had which only iterated over argv when more than one argument was passed to it.
2023-05-06LibGUI: Use linear gradient to paint opacity slidersMacDue
No need to implement gradients again :^)
2023-05-06LibGUI: Fix ColorSlider crash when the selected hue is 360MacDue
If the ColorSlider returns a hue of 360 degrees one of the various `VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0);` in Color.h will be hit.
2023-05-05LibGUI: Fix crash on deleting word forwardXuekun Li
<Ctrl-Del> will crash when deleting at the end of line where the next line contains only punctuation and seperator characters, because TextDocument::first_word_break_after will return a wrong index of the next word break (+1 bigger than the correct index), thus RemoveTextCommand will try to remove a out-of-bound text range causing a crash.
2023-05-05LibGUI: Fix stuck on deleting word backwardXuekun Li
<Ctrl-Backspace> will stuck when deleting at the end of line which contains only one single character. When finding the previous word break position starting at column 0 in TextDocument::first_word_break_before, the code enters an infinite while loop. The early return should simply fix this.
2023-05-05LibGUI: Make `Clipboard::initialize` propagate errorsLucas CHOLLET
2023-05-05LibGUI: Make `Application`'s construction fallibleLucas CHOLLET
The pattern to construct `Application` was to use the `try_create` method from the `C_OBJECT` macro. While being safe from an OOM perspective, this method doesn't propagate errors from the constructor. This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually define a `create` method that can bubble up errors from the construction stage. This commit also removes the ability to use `argc` and `argv` to create an `Application`, only `Main`'s `Arguments` can be used. From a user point of view, the patch renames `try_create` => `create`, hence the huge number of modified files.
2023-05-05LibGUI: Fix crash when not using a custom font in `GlyphMapWidget`Caoimhe
`m_original_font` is only set if `GlyphMapWidget::set_font` is called. But, if the user of `GlyphMapWidget` decides not to set a font, there will be no value for `m_original_font`. This commit fixes that issue by checking if `m_original_font` is not null before attempting to use it.
2023-05-05LibGfx: Add first_animated_frame_index method to ImageDecoderTom
Some image formats such as APNG may not use the first frame for animations.
2023-05-03AK: Have `JsonArray::set()` change values instead of inserting valuesKemal Zebari
Resolves #18618. 8134dcc changed `JsonArray::set()` to insert elements at an index instead of changing existing elements in-place. Since no behavior such as `Vector::try_at()` exists yet, it returns nothing.
2023-05-02LibGUI: Only clear `TreeView::m_view_metadata` when requiredCaoimhe
Prior to this commit, we were always clearing the TreeView's metadata, even if it wasn't needed. Now, we only clear it if the callee says that we should invalidate indices. This fixes an issue in FileManager (#6903), where updating the file system by creating/deleting any file/folder would cause the tree to collapse completely. This may be more of a 'patch' than an actual fix, since I don't have a lot of experience with `GUI::TreeView` or `GUI::Model`, but it doesn't appear to break any other `TreeView` use-cases and using FileManager is now much better than it was before :^)
2023-05-01Userland+Base: Treat ".webp" files as images :^)Andreas Kling
2023-04-30LibGUI: Use Variant's built-in equality operator in Window and WidgetAndreas Kling
Now that Variant has operator==(), we don't need to go through all this trouble to compare two Variant values.
2023-04-30HackStudio: Move around execution order and prevent crashingiyush
Previously hackstudio tried to synchronize the language server before executing the command inside the editor. If sync-command for the server (for example the CommentLineCommand) is not implemented inside the function responsible for syncing the language server, the IDE would crash. This patch makes it such that the synchronization happens only after IDE executes the command locally. If such command is not implemented (as was the case earlier), it would simply reupdate the content inside the language server. Even though the reupdate might be expensive, it is better than crashing hackstudio altogether. Because of reordering, the relevant function names have been changed to better reflect the code flow.
2023-04-30LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStylethankyouverycool
Previously, Frames could set both these properties along with a thickness to confusing effect: Most shapes of the same shadowing only differentiated at a thickness >= 2, and some not at all. This led to a lot of creative but ultimately superfluous choices in the code. Instead let's streamline our options, automate thickness, and get the right look without so much guesswork. Plain shadowing has been consolidated into a single Plain style, and 0 thickness can be had by setting style to NoFrame.
2023-04-30LibGUI: Remove Label icons and replace instances with ImageWidgetthankyouverycool
These icons are a relic of GLabel and were never implemented to accomodate both image and text. This convenience can always be added in the future, but no current instance assumes or needs it, so let's replace them all with ImageWidget to show clearer intent.
2023-04-30LibGUI: Don't fix ImageWidget's size when disabling auto_resize()thankyouverycool
2023-04-30LibGUI: Propagate construction errors in LinkLabelthankyouverycool