Commit Graph

1691 Commits

Author SHA1 Message Date
Timothy Flynn
aff81d318b Everywhere: Run clang-format
The following command was used to clang-format these files:

    clang-format-16 -i $(find . \
        -not \( -path "./\.*" -prune \) \
        -not \( -path "./Base/*" -prune \) \
        -not \( -path "./Build/*" -prune \) \
        -not \( -path "./Toolchain/*" -prune \) \
        -not \( -path "./Ports/*" -prune \) \
        -type f -name "*.cpp" -o -name "*.h")
2023-07-08 10:32:56 +01:00
MacDue
ee09ecaf42 Userland: Register MIME type/extension for .tvg
These both come from the specification.
2023-07-03 23:54:51 +02:00
kleines Filmröllchen
33829f05fe Userland: Convert config listener callbacks to use StringView
The immutability of the string is not relevant here, since the string
we're given was allocated in the IPC serialization layer and will be
destroyed shortly afterwards. Additionally, noone relies on
DeprecatedString-specific functionality. This will make it easier to
convert the IPC layer itself to String later on.
2023-06-27 15:37:00 +01:00
Valtteri Koskivuori
6931a5a0a8 WindowServer+LibGUI: Yank out window-global opacity
From what I can tell, this facility was added to WSWindow/GWindow in
2019 in 9b71307. I only found a single place in the codebase still using
this facility: `WindowServer::Menu::start_activation_animation()`. A
subtle fade-out animation that happens when a menu item is selected, and
the menu disappears.
I think our compositing facilities have improved enough to make this
facility redundant. The remaining use mentioned above was ported to just
directly blit the fade-out animation instead of requesting it from
WindowServer.
2023-06-24 23:45:27 +02:00
Sam Atkins
506f9484e3 LibGUI: Give recent-file actions a nicer status tip
"Open /path/to/file" instead of just "/path/to/file".
2023-06-17 20:36:03 +02:00
Xuekun Li
a33af174b2 LibGUI: Prevent crashes/hangs when deleting words backwards
When the user hits <Ctrl-Backspace> where the previous content has the
format [Punctuation|Seperator]+ before the cursor, there will be a
size_t index underflow in TextDocument::first_word_break_before,
which returns an invalid word break position with a huge column index
(18446744073709551615, -1 in size_t). The invalid text position later
used for executing RemoveTextCommand will cause a crash.

The while loop condition in TextDocument::first_word_break_before is
not right, the loop will never stop when the target.column() becomes
0 inside.
2023-06-16 08:20:09 +01:00
Karol Kosek
92ff12a0d0 LibGUI+Userland: Port StatusBar::set_override_text() to String 2023-06-15 13:53:22 +01:00
Karol Kosek
5234a30731 LibGUI+Userland: Port Action status tips to String 2023-06-15 13:53:22 +01:00
Karol Kosek
4b169cf25f LibGUI+Userland: Use action text as a fallback in Action::status_tip()
Many applications already do this in their code. This change will simply
move the logic to a single function to stop repeating ourselves!
2023-06-15 13:53:22 +01:00
Karol Kosek
2029750519 LibGUI+Userland: Port StatusBar::text() and set_text functions to String 2023-06-15 13:53:22 +01:00
Karol Kosek
2064f544c6 LibGUI: Store Statusbar text as String 2023-06-15 13:53:22 +01:00
Ben Wiederhake
fe9e09fa3a LibGUI: Avoid unnecessary copies of MenuItem pointer sets 2023-06-15 08:09:16 +02:00
Ben Wiederhake
592e6c89a5 LibGUI: Avoid unnecessary copies of clipboard metadata 2023-06-15 08:07:17 +02:00
Sam Atkins
4c349165f2 LibGUI: Add a callback when the visible columns of a TableView change 2023-06-14 17:53:59 +02:00
Sam Atkins
8eff3b1910 LibGUI: Add functions to get/set all a TableView's visible columns
Specifically, this is to make it easier to save and restore this state
to a config file. I had hoped to use the column names instead of their
IDs, but some columns have an empty string as their name so we wouldn't
be able to distinguish between those.
2023-06-14 17:53:59 +02:00
Sam Atkins
f33824d2e9 LibGUI+Userland: Propagate errors in Model::column_name() 2023-06-14 17:53:59 +02:00
Hendiadyoin1
e4f627f299 LibGUI: Stop lying about string types 2023-06-13 01:49:02 +02:00
thankyouverycool
caa8f43dbe Applications+Demos+LibGUI: Migrate to fallible WizardDialogs and Pages
And port page text to String. Also removes WizardDialog::show() helper
as all current implementations prefer to derive their own Dialog.
2023-06-09 17:21:43 +02:00
Xuekun Li
200a4a00dd LibGUI: Fix wrong cursor position after undoing RemoveTextCommand
When you undo some forward delete shortcuts like <Del> or <Ctrl-Del>,
the cursor will be put at the end of the text deleted, while the right
position should be the start of those text.
2023-06-06 23:53:02 +02:00
Ahmed Hussein
fd9dbf1f20 TextEditor: Prevent autoscroll looping over
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-04 21:28:41 +02:00
Caoimhe
617edafbf2 LibGUI: Add support for jumping to a line and column in TextEditor
We had support for going to a specific line before, but now we support
jumping around using the `line:column` format :^)
2023-06-01 06:26:40 +02:00
Tim Ledbetter
556c4ac358 LibGUI: Allow FilteringProxyModel to optionally sort results by score
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-29 10:47:48 -06:00
Karol Kosek
dfde972baf LibGUI: Fix crooked close button on active tabs in the TabWidget
This is a regression from f391ccfe53.
The bug didn't appear on inactive tabs, as they already use
`translated(1, -2)`.
2023-05-28 21:12:19 +02:00
kleines Filmröllchen
fc5cab5c21 Everywhere: Use MonotonicTime instead of Duration
This is easily identifiable by anyone who uses Duration::now_monotonic,
and any downstream users of that data.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen
213025f210 AK: Rename Time to Duration
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-24 23:18:07 +02:00
Jelle Raaijmakers
f391ccfe53 LibGfx+Everywhere: Change Gfx::Rect to be endpoint exclusive
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-23 12:35:42 +02:00
thankyouverycool
02d94a303c Base+Userland: Apply Human Interface Guidelines to Object text
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-23 05:59:49 +02:00
thankyouverycool
a03fb66216 LibGUI: Adjust size and layout of InputBox
Increases default dimensions of InputBox, giving it slightly more
divine proportions. Prompt text now always appears above the editor.
2023-05-23 05:59:49 +02:00
Ben Wiederhake
0ee5a4e308 Clipboard: Avoid unnecessary IPC::Dictionary wrapper
We already have and use HashMap<DeprecatedString, DeprecatedString>
nearly everywhere, which is equivalent.
2023-05-21 07:53:45 +02:00
Ben Wiederhake
362773d4a6 LibIPC: Explicitly mark HashMap copy, offer move interface 2023-05-19 22:33:57 +02:00
thankyouverycool
7a183ee568 LibGUI: Set Open/Save button as default in FilePicker
This makes it more obvious that enter will return the current
selection and prevents returning without a valid selection.
2023-05-19 06:20:41 +02:00
Karol Kosek
3e12d84f0f LibGUI: Actually set the first allowed file extension list in FilePicker
Previously, the File Picker didn't activate the pre-selected filter.
2023-05-16 12:57:34 +01:00
Andreas Kling
4d0d0a99b4 LibGUI: Fix bad title alignment in GroupBox
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-15 14:15:53 +02:00
thankyouverycool
c87c4f6d94 LibGUI: Put a governor on Action activation
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-15 12:15:39 +02:00
thankyouverycool
7323a54e59 LibGUI+FileSystemAccessServer: Avoid using dummy windows
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-15 12:15:39 +02:00
thankyouverycool
f76d24c2ec LibGUI: Simplify Dialog::ScreenPosition and allow Dialogs to opt out
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-15 12:15:39 +02:00
thankyouverycool
dfe06096c7 LibGUI: Add Window::constrain_to_desktop() helper
And a center_within(IntRect const&) overload
2023-05-15 12:15:39 +02:00
Karol Kosek
b7558a5ce4 LibGUI+Userland: Store column names in JsonArrayModel as String 2023-05-15 06:42:10 +02:00
Karol Kosek
945f05ed76 Userland: Port Model::column_name() to String 2023-05-15 06:42:10 +02:00
MacDue
741f07dedf LibGUI: Increase the min width of the vertical opacity slider
This prevents the <opacity>% text on the slider being clipped.
2023-05-15 06:40:18 +02:00
MacDue
9685d54291 LibGUI: Ensure final stop of the opacity slider gradient has 255 alpha
Otherwise, if you change the opacity in the color picker, the slider's
opacity changes.
2023-05-15 06:40:18 +02:00
thankyouverycool
aaf60053f1 LibGUI: Use ColorRole::DisabledText when AbstractView is disabled
And only paint GlyphMapWidget's frame if disabled
2023-05-13 12:53:49 +02:00
thankyouverycool
ec29d3abae LibGUI: Allow setting and clearing text in SpinBox 2023-05-13 12:53:49 +02:00
thankyouverycool
0ad5e85163 LibGUI+Applications: Let GlyphMapWidget initialize a null Font
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-13 12:53:49 +02:00
thankyouverycool
8dda4e4ab5 LibGUI: Add fallible factories to ItemListModel 2023-05-13 12:53:49 +02:00
thankyouverycool
023c1dffab LibGUI: Ignore Alt+{Left,Right} key events in GlyphMapWidget
Fixes seek actions not activating by keyboard shortcut when
GlyphMapWidget has focus.
2023-05-13 12:53:49 +02:00
Ben Wiederhake
da394abe04 LibGfx+Fuzz: Convert ImageDecoder::initialize to ErrorOr
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-12 09:40:24 +01:00
Lucas CHOLLET
07c6cebbab Applets/ClipboardHistory: Add persistent storage
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-08 21:06:13 -06:00
Ahmed Hussein
214eaebe73 LibGUI: Use cursor position when calculating autoscroll delta
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-08 11:28:52 +02:00
thankyouverycool
af8cd477b4 LibGUI: Always paint vertical lines for Frames in unmaximized windows
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-07 21:12:35 +02:00