Commit Graph

3850 Commits

Author SHA1 Message Date
Shannon Booth
9ce8189f21 Everywhere: Use unqualified AK::URL
Now possible in LibWeb now that there is no longer a Web::URL.
2024-02-25 08:54:31 +01:00
Hugh Davenport
2e8ff1855c Browser: Allow system shortcuts to function
Before shortcuts like ALT-F4, etc did not work. This makes the window
ignore keydown events. In the future this may be altered to allow for
custom shortcuts from within ladybird?
2024-02-24 16:30:50 -07:00
implicitfield
896f213c6f LibFileSystem+Userland: Rename size() to size_from_stat()
This reflects what the functions does more accurately, and allows for
adding functions to get sizes through other methods.

This also corrects the return type of said function, as size_t may only
hold sizes up to 4GB on 32-bit platforms.
2024-02-24 15:54:52 -07:00
Hugh Davenport
b365356eba Assistant: Check for access before showing file results
Fixing up from #22597.

This change checks whether a file is readable to the user before adding
files to the cache.
2024-02-23 09:48:28 +01:00
Hugh Davenport
bba53441ef Assistant: Enable escalation of commands that need it
Ideal for applications such as PartitionEditor. Previously an error
about how it needs to run as root was displayed which differed from
the behaviour when clicking from the system menus.

Use the new AppFile::spawn_with_escalation to perform the escalation
2024-02-23 09:47:27 +01:00
Tim Ledbetter
3f6f3a90c1 HexEditor: Fix typo in parameter name 2024-02-21 23:32:15 +01:00
Tim Ledbetter
f742334b93 HexEditor: Prefer enum class to enum for FindDialog::OptionId 2024-02-21 23:32:15 +01:00
Tim Ledbetter
b330d83be4 HexEditor: Prefer ErrorOr to Result in FindDialog 2024-02-21 23:32:15 +01:00
Tim Ledbetter
ad62e433f0 PixelPaint: Don't crash when cancel is pressed when saving a file
Previously, we were attempting to add an empty string to the most
recently open files list when no file was saved.
2024-02-21 22:37:34 +01:00
Lucas CHOLLET
8e2102fb73 ImageViewer: Transform the image's dimension accordingly to the metadata
Exif metadata have two tags to store the pixel density along each axis.
If both values are different and no action is taken, the resulting image
will appear deformed. This commit scales the displayed bitmap
accordingly to these tags in order to show the image in its intended
shape. This unfortunately includes a lot of plumbing to get this
information through IPC.
2024-02-21 08:31:17 +00:00
Tim Ledbetter
cfbd14b958 Userland: Use MUST() to unwrap String values 2024-02-14 17:46:06 -05:00
Tim Ledbetter
2331d2bafa Userland: Propagate errors with TRY() where possible 2024-02-14 17:46:06 -05:00
Sam Atkins
c6e5581682 HexEditor: Include annotation text in the "Delete annotation?" dialog
It's helpful to have some description of what you're deleting. :^)

40 characters is chosen completely arbitrarily, but seems reasonable.
2024-02-09 17:00:15 +00:00
Sam Atkins
56eb45ccbc HexEditor: Add toolbar and context menus to the Annotations panel
The Annotations panel is the most obvious place to perform actions
related to annotations, so let's make that possible. :^)

The toolbar gets open/save/save-as actions for annotations, and one for
adding an annotation. The table itself gets a context menu for editing
or deleting the selected annotation.
2024-02-09 17:00:15 +00:00
Sam Atkins
a5d11c0a26 HexEditor: Convert panels to DynamicWidgetContainer
This lets the user swap them around and pop them out as separate windows
as desired. We do lose the ability to individually resize them though,
until DynamicWidgetContainer supports that.
2024-02-09 17:00:15 +00:00
Sam Atkins
6850ef9014 HexEditor: Respond to font changes 2024-02-09 16:59:02 +00:00
Sam Atkins
3318563ad9 HexEditor: Size the offset area based on the text width
This gets rid of the last use of the offset_margin_width() magic number.

I initially tried using `character_width() * 10` and found it was not
accurate enough with between-character spacing, so instead this measures
a specific string. All offset strings should be the same width in a
fixed-width font.
2024-02-09 16:59:02 +00:00
Sam Atkins
0fdbdc5084 HexEditor: Use glyph_fixed_width() for character width 2024-02-09 16:59:02 +00:00
Sam Atkins
d3012f2df1 HexEditor: Share the code for updating the content size
And make setting the bytes_per_row a no-op if it's the same value.
2024-02-09 16:59:02 +00:00
Sam Atkins
db23d0f464 HexEditor: Save and reuse horizontal positions when painting 2024-02-09 16:59:02 +00:00
Sam Atkins
60f52aa0ef HexEditor: Save and reuse vertical positions when painting rows
Rather than repeatedly calculating the same y offset over and over,
calculate it once per row, and re-use that result.
2024-02-09 16:59:02 +00:00
Sam Atkins
4af565362c HexEditor: Remove redundant checks in offset_at()
Neither of these is possible based on the if statement above them.
2024-02-09 16:59:02 +00:00
Sam Atkins
ca3f21f273 HexEditor: Account for padding in offset_at()
Compare the x position with the start of the hex characters, which is
m_padding pixels to the right of hex_start_x. (And the same for the
text characters.) If the position is within the padding area, clamp it
so it's on the nearest character.

This was previously covered-up somewhat by using the buggy
m_address_bar_width value to calculate the start and end x positions of
these areas. Fixing that in the previous commit made this more obvious.
2024-02-09 16:59:02 +00:00
Sam Atkins
c4dc150ed7 HexEditor: Extract some content-width calculations
We repeat the same calculations a lot, and it's easy to make mistakes.

m_address_bar_width and offset_margin_width() have basically the same
purpose, but both are a little wrong. This removes the former, but
we'll get to the latter soon.
2024-02-09 16:59:02 +00:00
Sam Atkins
4dc3816853 HexEditor: Combine row-iteration loops 2024-02-09 16:59:02 +00:00
Sam Atkins
8b5d2c710b HexEditor: Make border of offset area straight down
Subtracting 1 from both axes causes a kink in the line, because the
start point isn't also translated. The clip rect prevents us from
painting too far down, so we can just remove the translated() call.
2024-02-09 16:59:02 +00:00
Sam Atkins
f57d9789f8 HexEditor: Paint byte characters with correct width 2024-02-09 16:59:02 +00:00
Sam Atkins
e2f927a7a7 HexEditor: Give i and j variables clearer names 2024-02-09 16:59:02 +00:00
Sanil
433fe3dc26 Calendar: Add ability to view events 2024-02-08 08:13:04 -07:00
ronak69
90d68d43ce KeyboardMapper: Convert Utf-8 char in String to Utf-32 code point
Ensure that the Utf-8 encoded "mapping character" in String (from
InputBox) gets converted to Utf-32 code point. Before, only the first
byte of Utf-8 char sequence was used as a Utf-32 code point.

That used to result in incorrect characters getting written in the
keymap file for all the "non-ascii" characters used as the mapping
character.
2024-02-08 07:07:25 -07:00
Tim Ledbetter
f961a0eb61 TerminalSettings: Ensure automark setting is reverted on cancel 2024-02-07 13:35:49 +01:00
Tim Ledbetter
fa37a220d6 Terminal: Propagate changes in automark settings to the terminal 2024-02-07 13:35:49 +01:00
Tim Ledbetter
0bdb222953 Terminal: Deduplicate bell mode parsing code 2024-02-07 13:35:49 +01:00
Tim Ledbetter
5c8962b8f1 LibVT+TerminalSettings: Move settings parsing functions to LibVT
This change moves the automark and bell settings parsing functions to
LibVT, so that they can be shared between Terminal and TerminalSettings.
2024-02-07 13:35:49 +01:00
Tim Ledbetter
2850bb881a TerminalSettings: Provide default values for terminal settings
The change ensures that functions that parse string values for terminal
settings fall back to a default value, if there is no value present or
the value is invalid.
2024-02-07 13:35:49 +01:00
Tim Ledbetter
1df31e426d TerminalSettings: Use correct name for the automark_off radio button
This was causing a segfault when opening the Terminal Settings window.
2024-02-07 13:35:49 +01:00
Ali Mohammad Pur
54ab6fe5b9 LibVT+Everywhere: Introduce 'automarks' and 'clear previous command'
Automarks are similar to bookmarks placed by the terminal, allowing the
user to selectively remove a single command and its output from the
terminal scrollback.
This commit implements a single way to add marks: automatically placing
them when the shell becomes interactive.

To make sure the shell behaves correctly after its expected prompt
position changes, the terminal layer forces a resize event to be passed
to the shell on such (possibly) partial clears; this also has the nice
side effect of fixing the disappearing prompt on the preexisting "clear
including history" action: Fixes #4192.
2024-02-07 00:43:11 +01:00
Gabriel Tassinari
946a4d6f0f Presenter: Add Manual link in help menu 2024-02-06 20:43:31 +00:00
Bastiaan van der Plaat
582bf1eaf3 Run: Fix bug where it would crash because uninitialized main widget
The set_main_widget<T>() function only calls the construct and not
`try_create()` that the GMLCompiler generates so all calls to
`find_descendant_of_type_named()` would result in null
pointers that would resolve in a crash.
2024-02-06 08:41:01 +01:00
Bastiaan van der Plaat
f4d5ff9ed9 Welcome: Move tips.txt to /usr/share/Welcome because it's system wide 2024-02-05 16:30:52 +01:00
Andrew Kaster
677bdc2a4f Ladybird: Add IPC call for creating a new child tab
This will be used for choosing a navigable that requires opening a new
tab or new window. Such as calls to window.open(), or specific WebDriver
calls.
2024-02-03 20:51:37 -05:00
Sam Atkins
d930ea1242 HexEditor: Add an option to load an annotations file on startup 2024-01-31 17:38:56 +00:00
Sam Atkins
4cef57a021 HexEditor: Parse arguments using ArgsParser 2024-01-31 17:38:56 +00:00
Sam Atkins
56caee44e3 HexEditor: Save and load annotations to/from JSON files
This is a fairly simple JSON format: A single array, containing objects,
with the Annotation fields as key:value pairs.

When reading a file, we let invalid or missing keys fall back to the
default values. This is mostly intended to set a pattern so that if we
add new fields in the future, we won't fail to load old annotations
files. If loading the file fails though, we keep the previously loaded
set of annotations.
2024-01-31 17:38:56 +00:00
Sam Atkins
aa07c232f1 HexEditor: Optionally display annotations in the side panel 2024-01-30 23:34:49 +00:00
Sam Atkins
8cac2e89a9 HexEditor: Store annotations in a Model
A model is necessary for displaying a list of them in the UI. We might
as well make that their home.
2024-01-30 23:34:49 +00:00
Sam Atkins
a54952795a HexEditor: Add comments to annotations
The comment appears as a tooltip when hovering over the annotation.

A couple of properties of the TextEditor would ideally be set in GML,
but either don't have a setter exposed, or the GML compiler doesn't
recognise the enum. I'll fix those up after the current big GML
compiler PR gets merged.
2024-01-30 23:34:49 +00:00
Brendan Kelly
00ab8e0a14 Maps: Add massage_for_display for lat and long
This prevents a crash when attempting to add a
favorite or load favorites list in Maps application
2024-01-30 21:07:37 +00:00
Sam Atkins
1750af83b0 3DFileViewer: Use ByteString for file paths 2024-01-29 23:14:39 +00:00
Sam Atkins
90240c0e02 Spreadsheet: Use ByteString for file paths 2024-01-29 23:14:39 +00:00