Commit graph

2978 commits

Author SHA1 Message Date
Sam Atkins
59d9d1d07a ThemeEditor: Make GUI initialization fallible
To do this, all GUI logic is moved into try_create() factory functions.
2023-01-01 09:55:05 -05:00
Andreas Kling
e3b9f78eb9 MouseSettings: Tweak "Natural scrolling" checkbox size
The old size wasn't wide enough to accommodate a focus rect, and we
ended up clipping the right edge of it.
2023-01-01 13:48:29 +01:00
Cody Hein
ab8522aa17 PixelPaint: ColorPicker updates user colors while dragging
Now the user can hold primary and/or secondary mouse buttons
and move the mouse around while previewing the color on the
statusbar and fine tune their selection. The color will update
live so the color selected when mouse is released is the final
color used.
2022-12-31 04:49:19 -07:00
Cody Hein
29665668b6 PixelPaint: Allow ImageEditor event to append info to the statusbar
This provides an event on ImageEditor for other functions to
activate functions when appended_status_info is updated
2022-12-31 04:49:19 -07:00
Rafał Babiarz
3454891d38 Browser: Add window to inspect history 2022-12-31 04:36:22 -07:00
implicitfield
d49fccf0d5 ThemeEditor: Support editing color schemes 2022-12-31 04:20:59 -07:00
implicitfield
800c292be8 Terminal+LibVT: Get the color scheme from the system theme 2022-12-31 04:20:59 -07:00
implicitfield
4aec8491d6 Everywhere: Move Base/res/terminal-colors to Base/res/color-schemes 2022-12-31 04:20:59 -07:00
Karol Baraniecki
451ae985bf Calculator: Add adding/subtracting/multiplying/dividing by a percentage
It's now possible to easily calculate 50% of 50. :^)
2022-12-31 00:07:13 +01:00
Karol Baraniecki
21cc8f65f5 Calculator: Support chaining and repeating operations
The calculator now supports chaining (hitting "1+2+3=" shows "6"
instead of "5") and repeating ("2+2===" shows "8") operations. :^)
2022-12-31 00:07:13 +01:00
Karol Baraniecki
ef9fd6c286 Calculator: Fix which digits get animated when pressing keyboard keys
Previously every digit press would appear like "0" was pressed on the
keypad.
2022-12-31 00:07:13 +01:00
Andrew Kaster
18c559b0e3 SoundPlayer: Pledge proc so that we can actually open audio files 2022-12-31 00:04:34 +01:00
Ravi J
3a31f37b3d MouseSettings: Update "switch buttons" icon to reflect checkbox state
Using an additional "right button" variant of the graphic, it now
updates the icon based on the user's preference of primary button.
2022-12-30 09:20:42 -05:00
Karol Kosek
780d46c424 Presenter: Accept file drops 2022-12-29 10:22:49 -05:00
Jelle Raaijmakers
7b0adee487 LibGfx+Overall: Remove is_null from Point, Rect and Size
Having a `Point`, `Rect` or `Size` claim it's `null` is silly. We have
`Optional<T>` for that. For `Point`, rename `is_null` to `is_zero` to
better reflect what we're testing. For `Rect` and `Size`, `is_null` is
removed outright.

Also, remove `is_empty` from `Point`. Points can't be empty.
2022-12-28 22:32:21 -05:00
Liav A
e11dcd21c1 Applications: Remove i686 support 2022-12-28 11:53:41 +01:00
Liav A
85b453c2e4 Kernel+Userland: Remove dependency on i386-specific registers 2022-12-28 11:53:41 +01:00
Tim Ledbetter
fd3639ecba PixelPaint: Erase old active layer boundary when active layer changes 2022-12-26 09:40:11 +01:00
thankyouverycool
d938b9effe LibGUI+Applications: Rename automatic scrolling timer functions
Renames on_automatic_scrolling_timer_fired() =>
	automatic_scrolling_timer_did_fire()

The 'on_' prefix is usually reserved for AK::Function hooks.

Renames set_automatic_scrolling_{active,timer}() =>
	set_automatic_scrolling_timer_active()

For consistency, accuracy, and header file A E S T H E T I C S
2022-12-26 09:27:19 +01:00
Kampsjaak
cf47c850e7 TextEditor: Add option to open the current file in File Manager
This change adds functionality to open the current file in the File
Manager from the File menu or through a button on the toolbar. If
there is no saved data then the functionality is disabled.
2022-12-23 19:20:53 -05:00
Tim Schumacher
8455d58a44 LibCore: Use a StringView for the file path in File::remove
This allows us to use our nice syscall wrappers, avoids some accidental
string copying, and starts to unlink us from the old DeprecatedString.
2022-12-23 10:38:14 -05:00
Tim Schumacher
9805f73704 LibCore: Remove the force parameter from File::remove
About half of the usages were not using `force` anyways, and the other
half presumably just got confused about what "force" really means in
this context (which is "ignore nonexistent files").

The only 'legitimate' user, which is `rm`, instead now handles this
completely internally instead.
2022-12-23 10:38:14 -05:00
Tim Schumacher
355e761a02 LibCore: Let File::remove return a normal ErrorOr
Having the file path in there is nice, but it makes us incompatible with
comfortable error propagation in everything that isn't File::remove.
2022-12-23 10:38:14 -05:00
ericLemanissier
21e8099e42 FileManager: Propagate errors while loading bmp 2022-12-23 12:23:05 +00:00
FrHun
f413033a50 Magnifier: Add ability to drag the location when it is locked 2022-12-23 12:16:46 +00:00
FrHun
9d3debcbbe Magnifier: Remember grid color 2022-12-23 12:16:46 +00:00
FrHun
79f5c49afe Magnifier: Eliminate flickering when downsizing
Previously the content flickered when downsizing the window, because the
previously grabbed frame was still active, but was now too large for the
window.
This crops the source rect to a size where it now perfectly fits the
content area.
2022-12-23 12:16:46 +00:00
FrHun
9e0deb76b2 Magnifier: Prevent 0 size that otherwise hangs 2022-12-23 12:16:46 +00:00
FrHun
808eafcf1e Magnifier: Add option to choose grid color 2022-12-23 12:16:46 +00:00
FrHun
2b635b5330 Magnifier: Add option to display grid over the image 2022-12-23 12:16:46 +00:00
FrHun
837625e422 Magnifier: Allow locking location at current cursor position 2022-12-23 12:16:46 +00:00
Optimoos
d856dae07c Spreadsheet: Allow Functions Help HorizontalSplitter to resize
Using set_fixed_width prevents the splitter from resizing, so it has
been changed to set_preferred_width. Added a FIXME that I'm not
familiar enough with the codebase to tackle yet.

This addresses issue #16589
2022-12-23 07:53:26 +00:00
Kemal Zebari
1dddefa737 Browser: Introduce action for opening bookmarks in a new window
This change introduces an action to bookmarks that allows them to be
opened in a new browser window. This is done by accessing any
bookmark's context menu and pressing "Open in New Window".
2022-12-21 08:34:08 +00:00
Alexander Narsudinov
03107d4028 FileManager: Handle possible ByteBuffer allocation failure
Before this patch we created ByteBuffer with the help of the
VERIFY macro that could cause a crash of FileManager
in case of memory allocation failures.

Now we propagate the error to a caller instead of using the
`release_value_but_fixme_should_propagate_errors()` method.
2022-12-20 11:04:44 +01:00
Cnidarias
0ca1247a7f PixelPaint: Propagate errors when creating images or layers
This fixes a dozen release_value_but_fixme_should_propage_errors
2022-12-20 10:42:11 +01:00
Jelle Raaijmakers
25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
Rodrigo Tobar
89061883f2 PDFViewer: Prompt password for encrypted documents
This tackles a FIXME, but also makes sense to implement only now that
the SecurityHandler logic has been fixed. When a Document is created an
automatic attempt is made to provide the empty string as the password;
even if this attempt failed the SecurityHandler still reported it had a
user password, hence we never arrived to the VERIFY_NOT_REQUIRED line
this commit is changing.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
b8dc05a08e PDFViewer: Fix indexing error in ErrorsView
I confused myself when implementing this, plus I tested using pages that
had errors in pages 1 and 2, so the index and the number of the page
(internally represented as 0-indexed) was always the same. When opening
files with errors on higher pages it became evident that there was an
issue with how I was reading the errors per page from the corresponding
ModelIndex object.
2022-12-20 10:28:58 +01:00
thankyouverycool
91609f9327 FontEditor: Update preview window after pasting and deleting glyphs 2022-12-20 10:22:27 +01:00
thankyouverycool
96d7964913 FontEditor: Add Unicode block/glyph selection Statusbar Segment
Displays the current active Unicode block range, or, if multiple
glyphs are selected, their count. Clicking toggles the Unicode
block ListView.
2022-12-20 10:22:27 +01:00
thankyouverycool
40e94a315a LibGUI+FontEditor: Restore normalized selections on Undo/Redo
Selections are always normalized when saving undo commands.
The restore_selection() function reverses this process so
negatively sized selections (created right-to-left) continue
to resize correctly with the keyboard when restored.
2022-12-20 10:22:27 +01:00
thankyouverycool
61d214eab1 FontEditor: Set Unicode ListView's focus proxy to its search box
Provides a visual cue that arrow key input is shared between these
widgets.
2022-12-20 10:22:27 +01:00
thankyouverycool
b8969ffe97 FontEditor: Remove unused includes 2022-12-20 10:22:27 +01:00
Karol Kosek
9b3335723f TextEditor: Suggest saving new files with an extension from highlighter 2022-12-19 14:13:50 -05:00
Karol Kosek
b00865bce5 LibSyntax+TextEditor: Move Highlighter::language_string() out of class 2022-12-19 14:13:50 -05:00
MacDue
3de5dcf383 Browser+WebContent: Fixup some DOM inspector weirdness
This fixes a few things I noticed whilst working on the inspector
for Ladybird.

1.
The computed and resolved values were being passed swapped around
from the inspect_dom_node() IPC call. I.e. computed values were
passed as resolved values and vice versa. This was then fixed by
swapping them again in the InspectorWidget (two errors canceled out).

2.
Resolved values were called "specified values" seemingly only in the
inspect_dom_node() IPC calls. This was a little confusing so I've
renamed them to back to "resolved values" for consistency.

3.
The inspector took and stored the DOM JSON strings unnecessarily,
all the models immediately parse the JSON and don't need the strings
to hang around.
2022-12-19 11:37:56 -05:00
MacDue
e3ad5731f7 Browser: Close inspectors and JS console when tab closes
Keeping these around can lead to use-after-frees and crashes.
2022-12-19 11:37:56 -05:00
implicitfield
39fc7359d4 FileManager: Clear the selection after deleting files 2022-12-19 08:03:24 -05:00
Tim Ledbetter
53133b4359 PixelPaint: Debounce ImageEditor on_modified_change event
This limits the frequency of updates performed by the histogram and
vectorscope widgets.
2022-12-17 19:52:11 +00:00
Tim Ledbetter
7e020154a5 PixelPaint: Improve guide tool performance for large images
This commit ensures that the vectorscope and histogram widgets are not
updated while moving a guide with the guide tool. This significantly
improves performance for large images.
2022-12-17 19:52:11 +00:00
Keir Davis
4a0af3dc77 SystemMonitor: Propagate errors when trying to load an icon 2022-12-17 19:20:21 +00:00
Rodrigo Tobar
d116b9a8c6 PDFViewer: Move to page when outline item is selected 2022-12-17 19:40:52 +01:00
Rodrigo Tobar
d739877807 PDFViewer: Inform about selections on Outline view
Selecting an Outline Item from the Outline view informs via callback the
corresponding Destination that has been selected. This will be used to
move the application to the corresponding page/section/etc.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
aaa210e6db PDFViewer: Show page numbers in Outline TreeView
This is a nice addition to the outline view, which previously simply
displayed the titles of each section. Pages are shown in the first
column, but the tree is expanded via the second column, where the title
is.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
c76564b533 PDFViewer: Fix parent_index() implementation in OutlineModel
The previous implementation had some repeated code, and wasn't really
working (because the OutlineItem.parent member was never populated). In
fact, when navigating with the up/down arrows in the associted TreeView
one could experience some funky behavior.

Now that we store OutlineItem's parents, we are fixing the
implementation for parent_index(), which was comparing the parent
siblings against the item's outline item instead of to its parent.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
2ea8d2547e PDFViewer: Propagate errors from OutlineModel construction
This follows the same idea that Andreas was doing in this latest videos,
where construction-time TRY()s were not present but should have been.
Like Andreas did, moving the initialisation of such fields to the
factory function, which then returns ErrorOr solves the issue.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
cb2cf6de99 PDFViewer: Perform standard error handling when opening files
The previous implementation of open_file had a lambda that was used to
inspect the call of ErrorOr-returning calls. This was a non-standard way
of doing this though, as the more usual and clearer way is to have an
inner function that returns ErrorOr, then handle any incoming errors on
the top level function.

This commit adds a try_open_file function, where all the logic occurs,
and all the failure-producing steps are simplied TRY'ed. The top level
open_file function takes that result and does what the lambda previously
did: showing a message box with the actual error.
2022-12-17 19:40:52 +01:00
Karol Kosek
5049b103c0 PixelPaint: Encode layers in PixelPaint project files as PNG
Previously layers weren't compressed at all and the file size could go
up really fast in a project with multiple layers.  By switching to PNG,
the situation is slightly better now.

Interestingly enough, this change won't break compatibility with old
files, as PixelPaint loads layers using ImageDecoder which will try
every codec possible. :^)
2022-12-17 18:37:04 +01:00
Karol Kosek
11377bf0f8 PixelPaint: Propagate more errors when saving a project file 2022-12-17 18:37:04 +01:00
Tim Ledbetter
213d82f39b PixelPaint: Fix move tool scaling function when zoomed
The move tool enters scaling mode when the user mouses within 10
pixels either side of the the bottom right of the active layer
boundary.

Previously, the bounding box used to determine whether the mouse was
at the bottom right of the layer used coordinates that were scaled to
the size of the image. This made the size of the area
you need to enter proportional the current zoom level.

This commit fixes the issue by using non-scaled coordinates to
calculate the bounding box, meaning its size is unaffected by the
current zoom level.
2022-12-16 10:24:34 +00:00
Tim Ledbetter
5ba0b551f4 PixelPaint: Display a preview image when scaling with the move tool
A preview of the scaled image and an outline of the updated layer
boundary are now shown when scaling with the move tool.
2022-12-16 10:24:34 +00:00
Timothy Slater
7b4e5d6ac0 PixelPaint: Add Text Tool 2022-12-16 10:14:20 +00:00
Timothy Slater
296b76095f PixelPaint: Change tool keydown handle to non-const
This was changed to const in PR #15788 but presents problems for tools
that may need to forward this event to non-const event handlers.
2022-12-16 10:14:20 +00:00
Timothy Slater
159f6cf0ac PixelPaint: Account for rulers on Tool second paint events
This change makes ImageEditor provide an altered PaintEvent to the
active tool when rulers are visible. This PaintEvent has a rect that has
been adjust to account for the thickness of the rulers. Tools use this
rect for Painter clipping and this prevents a Tool's on_second_paint
from drawing over top of the rulers
2022-12-16 10:14:20 +00:00
Timothy Slater
a321df12e1 PixelPaint: Allow tools to know when the user has left them 2022-12-16 10:14:20 +00:00
Rodrigo Tobar
d4ecdf3ced PDFViewer: Avoid errors due to copying of ErrorOr
The handle_error took PDFErrorOr<T> objects by value, meaning that their
inner values (the error or value stored in the underlying Variant) were
somehow copied over. In the first instance where this lambda is called
with T = NonnullRefPtr, resulting in funky behavior (invalid
NonnullRefPtr state with a VALIDATE fail): if there is no error then the
PDFErrorOr<T> copy is destroyed, which might be causing the underlying
NonnullRefPtr to be destroyed, but somehow the original in the caller
context gets affected and fails verification.

The solution seems simple anyway: just pass the value by reference
(lvalue or rvalue) so the original object can be used directly, avoiding
destruction.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
124ab5bec6 PDFViewer: Remove unnecessary ternary operation 2022-12-16 10:04:23 +01:00
Rodrigo Tobar
6d0869c14a PDFViewer: Add TreeView to communicate rendering errors
Now that the rendering process communicates all errors upstream, and
PDFViewer has a way to tap into those errors as they occur, we can
visualise them more neatly.

This commit adds a TreeView that we populate with the errors stemming
from the rendering process. The TreeView has two levels: at the top sit
pages where errors can be found, and under each page we can see the
errors that have been found on that page. The TreeView sits below the
main PDF rendering.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
e87fecf710 LibPDF: Switch to best-effort PDF rendering
The current rendering routine aborts as soon as an error is found during
rendering, which potentially severely limits the contents we show on
screen. Moreover, whenever an error happens the PDFViewer widget shows
an error dialog, and doesn't display the bitmap that has been painted so
far.

This commit improves the situation in both fronts, implementing
rendering now with a best-effort approach. Firstly, execution of
operations isn't halted after an operand results in an error, but
instead execution of all operations is always attempted, and all
collected errors are returned in bulk. Secondly, PDFViewer now always
displays the resulting bitmap, regardless of error being produced or
not. To communicate errors, an on_render_errors callback has been added
so clients can subscribe to these events and handle them as appropriate.
2022-12-16 10:04:23 +01:00
Cody Hein
8d6283c229 PixelPaint: Replace vectorscope boxes with colored corner brackets
This completes a FIXME which requested us to replace the rects/boxes
with just corner brackets. I also added some color to the brackets
matching the colors they represent. The text remains white :)
2022-12-16 01:25:50 -07:00
Tim Ledbetter
8353df03a8 PixelPaint: Disable bucket tool outside of the current selection
Previously, if the user clicked outside of the current selection with
the bucket tool, the selection would be filled.
2022-12-16 08:10:33 +00:00
Baitinq
626142c312 ClockSettings: Add a factory function for TimeZoneSettingsWidget
This removes an unbelievable 4 FIXMEs :))
2022-12-15 21:00:24 +00:00
Lucas CHOLLET
2693745336 LibThreading+Everywhere: Support returning error from BackgroundAction
This patch allows returning an `Error` from the `on_complete` callback
in `BackgroundAction`.

It also adds a custom callback to manage errors returned during its
execution.
2022-12-15 17:36:57 +00:00
kleines Filmröllchen
b7eea03103 Piano: Overhaul AudioPlayerLoop and throw out event loops
The audio player loop uses custom IPC plumbing to safely bypass any
event loop shenanigans. There is still work to be done, but this already
improves the realtime capabilities of Piano.
2022-12-15 00:21:00 -07:00
kleines Filmröllchen
f1d486bcde Piano: Make AudioPlayerLoop::is_playing const 2022-12-15 00:21:00 -07:00
meiskam
1943aef2cb PixelPaint: Make sure modified state is updated when undo_stack changes 2022-12-15 00:14:35 -07:00
meiskam
b33aa1bc9b PixelPaint: Update window modified to look at all tabs
This causes the corner X to correctly have dots when any of the open
tabs have unsaved changes. Event calls and undo stack modifications
have been collected to one spot.
2022-12-15 00:14:35 -07:00
Arda Cinar
2dd7fa2d44 HexEditor: Handle some errors inside the editor
Specifically, the ones HexEditor::did_complete_action possibly raised in
case creating an undo stack entry or pushing it onto the undo stack
fails. In this case, an error popup is displayed and the modifications
are undone.

This removes 2 FIXMEs inside the code :^)
2022-12-14 23:43:20 -07:00
Lucas CHOLLET
d3ce9cf8f6 CrashReporter: Use the Core::Stream friendly API, save_file() 2022-12-14 18:26:25 +00:00
Lucas CHOLLET
9ae97c8cb1 LibFileSystemAccessClient: Rename try_save_file =>
`try_save_file_deprecated`

This precedes the addition of a new api using `Core::Stream`
2022-12-14 18:26:25 +00:00
Cygnix Proto
806a55eda1 LibGfx+Userland: Make Gfx::SystemTheme propagate errors
This patch introduces error propagation to Gfx::SystemTheme to remove
instances of release_value_but_fixme_should_propagate_errors().

Userland applications that have been affected by this change have been
updated to utilise this propagation and as a result 4 such instances of
the aforementioned method have been removed.
2022-12-14 18:25:28 +00:00
Sam Atkins
bdd9bc16de Piano: Only treat unmodified key presses as playing notes
This makes Action shortcuts work again. :^)

`note_key_action()` and `special_key_action()` now return whether they
consumed the event. We don't even call them if any modifier keys were
held down, so things like `Ctrl+T` no longer play notes.
2022-12-14 18:25:02 +00:00
Sam Atkins
7c17e73c7f SpaceAnalyzer: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
97e157708f Presenter: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Maciej
b409d3cf88 FileManager: Display message box if stat()'ing a file to activate fails 2022-12-14 15:48:25 +00:00
MacDue
e8dbb1a8b2 PixelPaint: Add background color options to "new image" dialog
This now allows you to select a background color for your new image,
and optionally allows saving that default. You can pick between
Transparent, White, Black, or a custom color (similar to other
editors).
2022-12-14 15:23:07 +00:00
Maciej
8c082869d0 Help: Move-capture help page path
Previously it was reference-captured, causing crash because of stack
use after return.
2022-12-14 15:06:38 +00:00
Timothy Flynn
9a9c8460aa Browser: Inject cookies timestamps as integers rather than doubles
Now that LibSQL can store 64-bit integers, let's use them.
2022-12-14 09:21:30 -05:00
Andreas Kling
4abdb68655 LibJS: Remove Object(Object& prototype) footgun
This constructor was easily confused with a copy constructor, and it was
possible to accidentally copy-construct Objects in at least one way that
we dicovered (via generic ThrowCompletionOr construction).

This patch adds a mandatory ConstructWithPrototypeTag parameter to the
constructor to disambiguate it.
2022-12-14 15:11:57 +01:00
Arda Cinar
3ea1584f2e Presenter: Provide default text styles to text objects
Having an uninitialized text alignment value caused a crash in
Gfx::Painter::draw_text.
2022-12-14 07:45:06 -05:00
Arda Cinar
9d9a6b6b64 Presenter: Fix a crash in loading untitled presentations
The Presentation::title() and Presentation::author() functions return a
StringView to the title/author defined in the json file or a default
value. Previously, this would return a StringView to already-freed
memory and crash the application when setting the window title. This
commit fixes that issue :^)
2022-12-14 07:45:06 -05:00
Ali Mohammad Pur
f96a3c002a Everywhere: Stop shoving things into ::std and mentioning them as such
Note that this still keeps the old behaviour of putting things in std by
default on serenity so the tools can be happy, but if USING_AK_GLOBALLY
is unset, AK behaves like a good citizen and doesn't try to put things
in the ::std namespace.

std::nothrow_t and its friends get to stay because I'm being told that
compilers assume things about them and I can't yeet them into a
different namespace...for now.
2022-12-14 11:44:32 +01:00
Cody Hein
8855334fcc PixelPaint: Use source alpha for CloneTool drawing
Prior to this change when using CloneTool on a transparent background
the output was a solid black brush stroke. Now it is based on the
source content alpha as well as it's color blended with the target.
2022-12-13 11:35:25 +01:00
Cody Hein
074ba104c8 PixelPaint: Single-clicking the BrushTool now adds to undo_stack
Simple change, prior to this BrushTool and EraseTool would not
have update the undo_stack for the ImageEditor unless you were
clicking and dragging.
2022-12-12 17:34:35 +00:00
Snow
0049dfd717 LibGUI+TextEditor: Add a relative line number option for TextEditor
This adds an option for displaying relative line numbers in the ruler,
the line numbers are still absolute by default.
2022-12-12 16:02:06 +00:00
Baitinq
af1c26f05b Browser: Go back/forward when pressing back/forward mouse buttons
This currently doesn't work when running Serenity through QEMU, as it
doesn't pass the side button events over to Serenity due to some bug or
missing feature.
2022-12-12 15:00:08 +00:00
Tim Schumacher
9a3e95785e LibCore: Propagate errors from Stream::*_entire_buffer 2022-12-12 14:16:42 +01:00
Tim Schumacher
6c7c5a6786 LibCore: Rename Stream::*_or_error to *_entire_buffer
All of our functions are `_or_error` (or are about to be), and maybe
making it less reminiscient of AK::Stream will make people use it more.
2022-12-12 14:16:42 +01:00
Tim Schumacher
ed4c2f2f8e LibCore: Rename Stream::read_all to read_until_eof
This generally seems like a better name, especially if we somehow also
need a better name for "read the entire buffer, but not the entire file"
somewhere down the line.
2022-12-12 14:16:42 +01:00
kleines Filmröllchen
5a346c4297 Help+LibManual: Without arguments, open index page instead of crashing
This is the old behavior before the recent LibManual refactor. It also
moves the definition of the index page into LibManual for better reuse.
2022-12-12 00:37:29 -07:00
kleines Filmröllchen
dd66f5e838 Help: Link to LibLocale
This managed to fly under my radar for the LibManual PR, and somehow it
only happens for the Clang build but doesn't always trigger on CI.
2022-12-11 13:59:41 -07:00
kleines Filmröllchen
b65258c093 Help+man+LibManual: Move argument handling to LibManual
This deduplicates argument handling logic from Help and man and makes it
more modular for future use cases. The argument handling works as
before: two arguments specify section and page (in this order), one
argument specifies either a page (the first section that it's found in
is used) or a path to a manpage markdown file.
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
146bce53dd Help: Fix search query parsing
This was failing probably because AK::URL was being too strict; and the
query emptyness check was flipped.
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
a438c4d568 Help+LibManual: Move all manpage path handling to LibManual
This way, we'll have an easier time changing these paths.
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
4625f7aab5 LibManual: Refactor SectionNode in preparation for subsections
- Calculate the full name on demand
- Make section and name protected
- Reorder some members logically
- Change the name getter to be fallible, as some implementors need to
  allocate
2022-12-11 16:05:23 +00:00
kleines Filmröllchen
ad6a55e1f0 Help+LibManual: Move non-UI-specific manual handling to LibManual
This is a first step in deduplicating code within and across Help and
man.

Because LibManual also doesn't contain any DeprecatedString, some
adjustments to Help's string handling is included, just to interoperate
with LibManual better. Further work in this area mostly requires String
APIs in LibGUI.
2022-12-11 16:05:23 +00:00
Andreas Kling
a3a5d2b27d SpaceAnalyzer: Consolidate the node context menus
Instead of having two separate context menus and popping up either the
"file" or "directory" one depending on the selected node, we now have a
single context menu and update it (before popping it up) to show the
context-appropriate actions.

This is achieved by simply updating the visibility of the actions.

This takes care of one TODO! :^)
2022-12-10 14:28:38 +01:00
thankyouverycool
31f4ec66c5 Magnifier: Add a manual to Help menu and propagate construction errors 2022-12-10 13:15:35 +01:00
thankyouverycool
5e96ad0345 Magnifier: Standardize File menu
File->Quit should appear as the final item in its menu
2022-12-10 13:15:35 +01:00
thankyouverycool
f8e0bcbedf Magnifier: Remove always_on_top_action
This action was originally added so that Magnifier's window would
always be on top by default, but it's a redundant menu item and wasn't
actually setting itself at start-up. Instead, rely on the same menu
item provided to all Modeless windows by default for a more consistent
UX, and set the option after show() so it takes effect.
2022-12-10 13:15:35 +01:00
Arda Cinar
6361584d4a KeyboardSettings: Disable "activate keymap" button if keymap is active 2022-12-10 12:00:30 +00:00
Tim Schumacher
8940f2da7f LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
Rodrigo Tobar
67b50d7994 PDFViewer: Let users change image rendering
A new checkbox in the toolbar now allows users toggle image rendering. A
corresponding Config option makes this setting non-volatile. To void
clashing with the previous "show_clipping_paths" option when caching a
Page, we now use the RenderingPreferences.hash() and the pair_int_hash
funcitons to compute a unique key into the page cache map for a given
RenderingPreferences and zoom level.
2022-12-10 10:49:03 +01:00
Sam Atkins
64cfe2b163 SpaceAnalyzer: Display the current location in the window title :^) 2022-12-09 23:23:00 +00:00
Sam Atkins
d8ceaf7870 SpaceAnalyzer: Add a tooltip for the hovered tree node
Many of the nodes are visually too small to show their full name and
file size, so this makes that information visible.
2022-12-09 23:23:00 +00:00
Sam Atkins
6d64e650f1 SpaceAnalyzer: Remove declaration for unimplemented method 2022-12-09 23:23:00 +00:00
Arda Cinar
d46315bcc0 SpaceAnalyzer: Propagate possible errors up
These include a JSON parse error, file open errors, and vector appends.
These fix a bunch of calls to functions with `fixme` in them.
2022-12-09 16:14:32 +00:00
Arda Cinar
f0b61e1443 SpaceAnalyzer: Use raw_delta_y in TreeMapWidget::mousewheel_event
There was a FIXME about using raw delta y value of the mousewheel event
in TreeMapWidget::mousewheel_event. Some time after that code was
written, a raw delta x/y API was added to GUI::MouseEvent. This patch
simply uses that API and removes the FIXME message there.
2022-12-09 16:14:32 +00:00
Moustafa Raafat
ae2abcebbb Everywhere: Use C++ concepts instead of requires clauses 2022-12-09 11:25:30 +00:00
FrHun
59028515c0 LibGUI: Split OpacitySlider into vertical and horizontal helper classes 2022-12-09 00:25:30 +01:00
Lucas CHOLLET
f14006637d CrashReporter: Factorize exiting behavior to window->close() 2022-12-08 17:20:51 +01:00
Timothy Flynn
fef255ee22 Browser: Store cookies in a LibSQL database :^)
Currently, cookies are ephemeral and only survive for the lifetime of
Browser instance. This will make Browser instead store cookies in a SQL
database for persisted access.
2022-12-08 17:14:48 +01:00
Timothy Flynn
bf060adcf9 Browser+LibWebView+WebContent: Do not domain match on cookie updates
Updating cookies through these hooks happens in one of two manners:
1. Through the Browser's storage inspector.
2. Through WebDriver's delete-cookies operation.

In (1), we should not restrict ourselves to being able to delete cookies
for the current page. For example, it's handy to open the inspector from
the welcome page and be able to delete cookies for any domain.

In (2), we already are only interacting with cookies that have been
matched against the document URL.
2022-12-08 17:14:48 +01:00
Andreas Kling
d88c7fee32 LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>
This is a first step towards handling PNG encoding failures instead of
just falling over and crashing the program.

This initial step will cause encode() to return an error if the final
ByteBuffer copy fails to allocate. There are more potential failures
that will be surfaced by subsequent commits.

Two FIXMEs were killed in the making of this patch. :^)
2022-12-08 13:01:11 +00:00
Tim Schumacher
2fc2025f49 LibCore: Move Core::Stream::File::exists() to Core::File
`Core::Stream::File` shouldn't hold any utility methods that are
unrelated to constructing a `Core::Stream`, so let's just replace the
existing `Core::File::exists` with the nicer looking implementation.
2022-12-08 12:52:14 +00:00
Lucas CHOLLET
1ac0aaa555 CrashReporter: Disable save button until it is ready to use 2022-12-08 07:12:01 -05:00
Filiph Sandström
01cdd3f181 WindowServer+MouseSettings: Improve buttons_switched naming
Before this commit it was a bit ambiguous which buttons the function
name were referring to; this instead now makes it clear that it's
related to mouse input. Additionally, this also fixes incorrect getter
naming leftover from yesteryear.
2022-12-08 07:04:09 -05:00
Sam Atkins
81fe2ef178 FileManager: Silence the "not found" error when setting no wallpaper
If we're setting the path to "" then we can just set the wallpaper to
nullptr and carry on with our day. :^)
2022-12-07 17:12:45 +00:00
Linus Groh
525f22d018 LibJS: Replace standalone js_string() with PrimitiveString::create()
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
e011eafd37 Meta+Userland: Pass Gfx::FloatPoint by value
Just a small 8-byte value like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
MacDue
bbc149ebb9 Meta+Userland: Pass Gfx::Color by value
Gfx::Color is always 4 bytes (it's just a wrapper over u32) it's less
work just to pass the color directly.

This also updates IPCCompiler to prevent from generating
Gfx::Color const &, which makes replacement easier.
2022-12-07 11:48:27 +01:00
Linus Groh
112b3f7342 LibJS: Convert MarkupGenerator to the new String 2022-12-07 09:58:38 +00:00
Maciej
6e4f886999 3DFileViewer: Properly propagate errors from WavefrontOBJLoader
Fixes 3 FIXMEs.
2022-12-06 17:24:45 +00:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
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-12-06 08:54:33 +01:00
Filiph Sandström
2e3efd34c3 MouseSettings: Add "Natural scrolling" toggle 2022-12-04 19:32:43 +00:00
Osamu-kj
ac556e2623 DisplaySettings: Remove unnecessary check for an overridden theme
Issue discussed in #16290
2022-12-04 12:12:55 +00:00
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Andreas Oppebøen
8cca9e94a2 PixelPaint: Record action for all select operations to allow undo
Since selections with the select tools support undo, it makes
sense for the edit operations 'select all', 'none', 'invert' and
'clear selection' to also support undo.
2022-11-30 12:18:06 +00:00
Andreas Oppebøen
427d488d7e PixelPaint: Record action when erasing a selection to allow undo 2022-11-30 12:18:06 +00:00
thankyouverycool
a97768001b TextEditor: Change Find/Replace shortcut to Ctrl+Shift+F 2022-11-29 15:39:13 +00:00
MacDue
458ca83d8c PixelPaint: Fix lasso tool preview when zoomed in
Previously only part of the preview would be visible when zoomed in,
with less visible the more you zoomed. This also now doesn't scale
the preview line thickness, similar to other image editing programs.
2022-11-27 20:35:22 +01:00
MacDue
fccda26ef9 PixelPaint: Don't scale preview thickness for polygonal select tool
This is consistent with other editors and makes it a little easier
to precisely select things when zoomed in.
2022-11-27 20:35:22 +01:00
MacDue
0482190bc8 PixelPaint: Make antialiasing the default for tools
Our AA painting works with opacity and generally has a nicer look
so lets make it the default.
2022-11-27 20:35:22 +01:00
Baitinq
f3763a5275 Browser: Remove previous history entry in History::replace_current()
The lack of this action caused a bug in my original patch
(https://github.com/SerenityOS/serenity/pull/16004) that appeared when
accessing a site that redirected the client and it was the first site
the client loaded.
2022-11-26 20:54:55 +01:00
thankyouverycool
bc0d56fa74 Assistant: Add a context menu for search results
Right-clicking now reveals menu options for copying text and
showing results in the File Manager
2022-11-26 18:11:51 +01:00
thankyouverycool
65c5901e7c Assistant: Automatically compute Assistant's window dimensions
Disregarding minimum widget size was originally set as a quick fix
when converting Assistant to a Popup window, but it's really much
easier to let layout manage dynamic resizing instead of trying to
add up pixels piecemeal.
2022-11-26 18:11:51 +01:00
thankyouverycool
518964e7c7 Assistant: Convert ResultRows to Coolbar Buttons
This gives search results a more tactile look and feel, consistent
with other iconified widgets across the system. Custom provider
subtitles now appear as tooltips.
2022-11-26 18:11:51 +01:00
Baitinq
f1205b608f Browser: Replace history entry if loading URL because of a redirect
We now replace the current history entry if the page-load has been
caused because of a redirect. This makes it able to traverse the
history if one of the entries redirects you, which previously
caused an infinite history traversion loop.
2022-11-26 11:03:24 +01:00
Baitinq
b447e486b5 Browser: Add History::replace_current() function
This function replaces the current history entry with a new history
entry.
2022-11-26 11:03:24 +01:00
Timothy Flynn
34fd5cb206 SoundPlayer+VideoPlayer: Set the play/pause action text on state change 2022-11-26 09:02:25 +01:00
kleines Filmröllchen
9b819a0dc9 LibAudio: Set asynchronous audio enqueuer thread to maximum priority
Anything that handles audio in this way should run at maximum priority.
2022-11-25 17:01:44 -07:00
Lucas CHOLLET
4219d50a21 LibGfx: Use the Midpoint Ellipse Algorithm
It is only used to draw non-antialiased and non-filled ellipses.
2022-11-26 00:49:05 +01:00
Zaggy1024
ceb7632862 VideoPlayer: Add an option to enable fast seeking
The fast seeking toggle is in the new Playback menu, and when enabled
it makes the PlaybackManager immediately start playing after finding a
keyframe to decode.
2022-11-25 23:28:39 +01:00
Zaggy1024
9a9fe08449 LibVideo: Rewrite the video frame present function to be more readable
The PlaybackManager::update_presented_frame function was getting out of
hand and adding seeking was making it illegible. This rewrites it to be
(hopefully) quite a bit more readable, and adds a few comments to help
future readers of the code.

In addition, some helpful debugging prints were added that should help
debug any future issues with the player.
2022-11-25 23:28:39 +01:00
Zaggy1024
f31621b3f2 VideoPlayer/LibVideo: Implement the UI functionality for seeking
With these changes, the seek bar can be used, but only to seek to the
start of the file. Seeking to anywhere else in the file will cause an
error in the demuxer.

The timestamp label that was previously invisible now has its text set
according to either the playback or seek slider's position.
2022-11-25 23:28:39 +01:00
Zaggy1024
9cf7e8c5aa LibVideo: Reorganize demuxer file hierarchy and rename Matroska files
As new demuxers are added, this will get quite full of files, so it'll
be good to have a separate folder for these.

To avoid too many chained namespaces, the Containers subdirectory is
not also a namespace, but the Matroska folder is for the sake of
separating the multiple classes for parsed information entering the
Video namespace.
2022-11-25 23:28:39 +01:00
Baitinq
75e20a5fd7 PixelPaint: Add the Pen tool as the default tool
We now preselect the pen tool when PixelPaint is launched.
2022-11-25 23:17:44 +01:00
Rodrigo Tobar
44c518e767 PDFViewer: Show single/multi page actions on toolbar
These actions were being constructed, and they work, but were not shown
in the toolbar. Adding them will allow users to actually use them, as
well as pick up any bugs they might have.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
cbb373e135 PDFViewer: Toggle prev/next page actions when page changes
These actions were not updated accordingly when one scrolled through the
document, and thus one could accidentally, for example, move to the next
page when standing on the last, which caused a crash.

This commit fixes that behavior, toggling the actions' enabled status
depending on the new page being displayed.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
a740423e23 PDFViewer: Prevent infinity recursion
When removing all contents from the NumericInput box in PDFViewer the
callback set the (empty) text again back in the box, triggering another
callback in a recursive, non-stopping fashion. Not setting the text back
in the box avoids the problem.
2022-11-25 23:03:24 +01:00
Rodrigo Tobar
bc7da24fe6 PDFViewer: Let users change clipping paths visibility
Now that the Renderer accepts preferences, PDFViewer can offer ways for
changing these preferences. The first step in this direction is to add a
checkbox that allows toggling whether clipping paths are visible or not.
A Config item has also been added to remember this setting.
2022-11-25 23:03:24 +01:00
Timothy Slater
3d542b0c38 PixelPaint: Add lasso selection tool
Lasso selection works by allowing the user to draw an arbitrary shape
much like the pen tool and ensuring the shape is closed by connecting
the start/end points when the user is done drawing. Everything inside
the shape becomes the selection.

Selection is determined via an outer flood fill. We begin a flood fill
from a point that is guaranteed to be outside of the drawn shape, and
anything the fill doesn't touch is determined to be the selection
region.
2022-11-25 22:52:45 +01:00
Timothy Slater
dc5402f61e PixelPaint: Clear selection with escape key regardless of active tool
This makes ImageEditor responsible for clearing the active selection
when the escape key is pressed. If the active tool didn't act on the
Escape key (like some selection tools use this to indicate cancelling of
making a new selection), then ImageEditor will check for an active
selection and clear it.
2022-11-25 22:52:45 +01:00
kleines Filmröllchen
de44d6c0a6 Applications: Add Presenter
This version can already:
- load all of the defined file format except for the image type and the
  frame-specific stuff
- navigate frames and slides (though frames are mostly stubbed out)
- display text with various common settings
- displays text with various fitting and scaling methods
- scale and position objects correctly no matter the window size
2022-11-25 14:28:33 -07:00
Andreas Kling
b0b022507b LibJS: Reduce AST memory usage by shrink-wrapping source range info
Before this change, each AST node had a 64-byte SourceRange member.
This SourceRange had the following layout:

    filename:       StringView (16 bytes)
    start:          Position (24 bytes)
    end:            Position (24 bytes)

The Position structs have { line, column, offset }, all members size_t.

To reduce memory consumption, AST nodes now only store the following:

    source_code:    NonnullRefPtr<SourceCode> (8 bytes)
    start_offset:   u32 (4 bytes)
    end_offset:     u32 (4 bytes)

SourceCode is a new ref-counted data structure that keeps the filename
and original parsed source code in a single location, and all AST nodes
have a pointer to it.

The start_offset and end_offset can be turned into (line, column) when
necessary by calling SourceCode::range_from_offsets(). This will walk
the source code string and compute line/column numbers on the fly, so
it's not necessarily fast, but it should be rare since this information
is primarily used for diagnostics and exception stack traces.

With this, ASTNode shrinks from 80 bytes to 32 bytes. This gives us a
~23% reduction in memory usage when loading twitter.com/awesomekling
(330 MiB before, 253 MiB after!) :^)
2022-11-22 21:13:35 +01:00
Names4Noobs
610f1a5aab 3DFileViewer: Propagate key events to the window
Before this, shortcuts would not work due to key events not
being propagated to the window.
2022-11-22 11:23:44 +00:00
thankyouverycool
f7eb72a8be Terminal+LibVT: Toggle TerminalWidget's focus on input preemption
This prevents Terminal's cursor from blinking when a Popup is open.
2022-11-19 16:04:42 +01:00
thankyouverycool
4aa608aa71 LibGUI+Taskbar+Applets+Applications: Set various windows as Popups
Makes the Audio applet, Taskbar clock, CommandPalette, EmojiPicker,
and Assistant work as Popup windows. Popups are frameless, unmovable,
and unresizable by default, in addition to their preemptive function.
Also sets Assistant not to obey widget min size so its search result
area resizes correctly
2022-11-19 16:04:42 +01:00
Julian Offenhäuser
0308300b78 PDFViewer: Take the mousewheel delta into account for scrolling
We now respect the system-wide setting for scroll speed, where we would
previously use a fixed step.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
9b1331a984 PDFViewer: Simplify user-facing error messages
We now show a simple, if less helpful, message to the user and print
the verbose error message to serial instead.
2022-11-19 15:42:08 +01:00
Julian Offenhäuser
e782d03f96 PDFViewer: Invalidate document when a page fails to load
This fixes an issue where we would show an error message on every
subsequent paint event, making it impossible to close or use the
application further.

Some more architectural work is needed if we want to invalidate the
sidebar entries as well.
2022-11-19 15:42:08 +01:00
thankyouverycool
92a75ccaed FontEditor: Include file basename in error messages when available
And write messages in the [action] failed: [error] format to match
common error message formatting elsewhere in Userland.
2022-11-19 15:41:09 +01:00
thankyouverycool
9725fd162f LibGUI+Applications: Allow GlyphMapWidget's set_font() to fail
And TRY early during initialization in FontEditor to leave the app
in a valid state on error. Fixes OOM crashes when cloning the original
font for highlight modifications.
2022-11-19 15:41:09 +01:00
thankyouverycool
d9fb838cf6 LibGUI+FontEditor: Allow system emoji to be toggled in GlyphMapWidget
And remove their red backgrounds when visible to not be confused with
deletion highlights.
2022-11-19 15:41:09 +01:00
thankyouverycool
c974e644ec FontEditor: Add Layout options to View menu
Like other apps, FontEditor now organizes widget visibility toggles
under a View->Layout submenu. The main toolbar and the status bar
can now be turned on and off.
2022-11-19 15:41:09 +01:00
thankyouverycool
61d93092cf FontEditor: Remove redundant set_scale() helper 2022-11-19 15:41:09 +01:00
thankyouverycool
8f7dbf363e FontEditor: Remove overzealous find-and-replace ""sv operator 2022-11-19 15:41:09 +01:00
thankyouverycool
894b41ef4d FontEditor: Consolidate GlyphEditor's flip_{horizontally,vertically} 2022-11-19 15:41:09 +01:00
thankyouverycool
d867871bda FontEditor: Standardize Gfx::RotationDirections for rotate_90() 2022-11-19 15:41:09 +01:00
MacDue
8a5d2be617 Everywhere: Remove unnecessary mutable attributes from lambdas
These lambdas were marked mutable as they captured a Ptr wrapper
class by value, which then only returned const-qualified references
to the value they point from the previous const pointer operators.

Nothing is actually mutating in the lambdas state here, and now
that the Ptr operators don't add extra const qualifiers these
can be removed.
2022-11-19 14:37:31 +00:00
thankyouverycool
d444724d24 ThemeEditor: Update GML and polish interface
Registers the PreviewWidget for addition directly into GML. Fixes
its previous double Frame borders. Also standardizes the Apply and
Reset buttons as DialogButtons and spaces them consistently with
other apps. Gives the TabWidget some tasteful container margins.
2022-11-19 11:04:11 +01:00
thankyouverycool
e99277611b Magnifier+ThemeEditor: Use CommonMenus::make_accessibility_menu() 2022-11-19 11:04:11 +01:00
Idan Horowitz
798d7c6fae LibWeb: Add 'should block pop ups' user config to Page
This will also be used by the window.open algorithm steps.
2022-11-15 21:48:19 +00:00
Timothy Flynn
4fd9e3ab08 Userland: Remove workarounds for LibIPC include order sensitivity 2022-11-15 13:25:51 -05:00
Zaggy1024
66b15e6cd6 KeyboardMapper: Call event.ignore() on keydown in the main widget 2022-11-14 16:08:11 +00:00
Zaggy1024
76627ec0a2 HexEditor: Allow keydown events to propagate if they are not handled 2022-11-14 16:08:11 +00:00
Zaggy1024
7ce346e50e PixelPaint: Allow keydown events to bubble from ImageEditor
Previously, all keydown KeyEvents were accepted, causing parent widgets
not to receive them. With the addition of shortcut handling to keydown,
shortcuts were not called when the ImageEditor was focused.
2022-11-14 16:08:11 +00:00
Zaggy1024
87aed17a46 VideoPlayer: Make PlaybackManager use OwnPtr
VideoPlayerWidget was keeping a reference to PlaybackManager when
changing files, so the old and new managers would both send frames to
be presented at the same time, causing it to flicker back and forth
between the two videos. However, PlaybackManager no longer relies on
event bubbling to pass events to its parent. By changing it to send
events directly to an Object, it can avoid being ref counted, so that
it will get destroyed with its containing object and stop sending
events.
2022-11-14 10:05:56 +00:00
Andrew Kaster
5925d3b26b Browser: Remove unused WebDriverSessionServer.ipc
This was missed in 7972916be7
2022-11-14 10:01:44 +00:00
Lucas CHOLLET
7649feb26f SoundPlayer: Load cover image from music files
When the visualization is set to "Album Cover", the player will now try
to load the embedded image. On failure, it defaults to a "Cover" image
file in the directory.

In Player::play_file_path, file_name_changed now needs to be executed
after that the loader have been set, to get the correct image.
2022-11-13 18:51:18 -07:00
Karol Kosek
0b7f5bbdfb Userland: Accept drag_enter events for widgets supporting file drops
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-11-13 16:13:03 -07:00
Timothy Slater
461ee18d64 PixelPaint: Correct active tool ImageEditor sync issue
This fixes a scenario in which the active tool can get out of sync in
regards to what it believes it the current ImageEditor. In the case
where multiple images are open, switching between the editor tabs with a
tool selected can lead to this unsynchronized state due to a check that
the ImageEditor's active tool matches the current tool. If this is the
case the method returns early before we properly set the new editor
pointer on the active tool.
2022-11-13 16:08:48 -07:00
kleines Filmröllchen
276be7f8cc Piano: Guard against all allocations at top level of the audio pipeline
Therefore, we don't rely on LibDSP Processors to use allocation guards
themselves. It also demonstrates that nested allocation guards work
correctly :^)
2022-11-13 19:17:21 +00:00
kleines Filmröllchen
59a9f8a958 Piano: Alphabetize sources
:greenlinus:
2022-11-13 19:13:28 +00:00
Tobias Christiansen
1aa16b4dd4 WebDriver: Implement POST /session/{id}/window/fullscreen endpoint 2022-11-12 12:12:05 +00:00
Timothy Flynn
7972916be7 Browser+WebDriver: Remove the connection between Browser and WebDriver
WebDriver now only has an IPC connection to WebContent. WebDriver still
launches the browser, but now when the session ends, we simply send a
SIGTERM signal to the browser.
2022-11-11 22:03:23 +00:00
Timothy Flynn
c64da0d00c Browser+WebDriver: Add missing header includes
These are currently being included transitively, and will cause an error
when those intermediate includes are removed.
2022-11-11 22:03:23 +00:00
Timothy Flynn
2c9549cb76 Browser+WebContent+WebDriver: Move Get Title to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
7f142745e2 Browser+WebContent+WebDriver: Move Back, Forward, Refresh to WebContent 2022-11-11 22:03:23 +00:00
Timothy Flynn
ff6055e0a3 Browser+WebContent+WebDriver: Move Delete All Cookies to WebContent 2022-11-11 18:02:04 +00:00
Timothy Flynn
b7f21bb92e Browser+WebContent+WebDriver: Move Delete Cookie to WebContent 2022-11-11 18:02:04 +00:00
Timothy Flynn
18abc6c85d Browser+WebContent+WebDriver: Move Add Cookie to WebContent
The new implementation is made a bit simpler by way of TRY. It also
implements setting the SameSite attribute.
2022-11-11 18:02:04 +00:00
Timothy Flynn
a3d6c2f6af Browser+WebContent+WebDriver: Move Get Named Cookie to WebContent
Instead of sending *all* cookies over IPC and filtering by name, we now
filter by name from the cookie jar and send just the first matching
cookie.
2022-11-11 18:02:04 +00:00
Timothy Flynn
c77260c480 Browser+WebContent+WebDriver: Move Get All Cookies to WebContent
There are a couple changes here from the existing Get All Cookies
implementation.

1. Previously, WebDriver actually returned *all* cookies in the cookie
   jar. The spec dictates that we only return cookies that match the
   document's URL. Specifically, it calls out that we must run just the
   first step of RFC 6265 section 5.4 to perform domain matching.

   This change adds a special mode to our implementation of that section
   to skip the remaining steps.

2. We now fill in the SameSite cookie attribute when serializing the
   cookie to JSON (this was a trival FIXME that didn't get picked up
   when SameSite was implemented).
2022-11-11 18:02:04 +00:00
Timothy Flynn
31469ee45a Browser+WebContent+WebDriver: Move Execute Async Script to WebContent
With this, WebDriverEndpoints is unused and removed :^)
2022-11-11 11:36:07 +00:00
Timothy Flynn
88dcdf681f Browser+WebContent+WebDriver: Move Get Page Source to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
ea0561a0b3 Browser+WebContent+WebDriver: Move Take Element Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
de1e882601 Browser+WebContent+WebDriver: Move Take Screenshot to WebContent 2022-11-11 11:36:07 +00:00
Timothy Flynn
93e14799c5 Browser+WebContent+WebDriver: Move Is Element Enabled to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
30d6a73d0e Browser+WebContent+WebDriver: Move Get Element Rect to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
9dd62228c8 Browser+WebContent+WebDriver: Move Get Element Tag Name to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
5d32fd7026 Browser+WebContent+WebDriver: Move Get Element Text to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
06f1b8825c Browser+WebContent+WebDriver: Move Get Element CSS Value to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
3c00d0e92b Browser+WebContent+WebDriver: Move Get Element Property to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
1bc94e135f Browser+WebContent+WebDriver: Move Get Element Attribute to WebContent
In doing so, this also implements a FIXME to handle boolean attributes.
2022-11-10 17:02:11 +00:00
Timothy Flynn
04ea3992e9 Browser+WebContent+WebDriver: Move Is Element Selected to WebContent 2022-11-10 17:02:11 +00:00
Timothy Flynn
560da56a1d Browser+WebContent+WebDriver: Move Find Elements From Element to WC
This also lets us remove the element location strategy and some
WebContent IPC from Browser/LibWebView now that they are unused.
2022-11-10 13:10:16 +00:00
Zaggy1024
18a6a1dd10 LibVideo: Handle corrupted video errors without spamming dialogs
No longer will the video player explode with error dialogs that then
lock the user out of closing them.

To avoid issues where the playback state becomes invalid when an error
occurs, I've made all decoder errors pass through the frame queue.
This way, when a video is corrupted, there should be no chance that the
playback state becomes invalid due to setting the state to Corrupted
in the event handler while a presentation event is still pending.
Or at least I think that was what caused some issues I was seeing :^)

This system should be a lot more robust if any future errors need to be
handled.
2022-11-10 12:32:55 +03:30
Timothy Flynn
03d0c7a5b6 Browser+WebContent+WebDriver: Move [Max,Min]imize Window to WebContent
This also lets us more fully implement the "iconify the window" method,
which requires we block until the document reaches the "hidden" state.
2022-11-09 19:59:26 +00:00
Timothy Flynn
1c398b32ce Browser+LibWebView+WebContent: Add IPC to minimize and maximize window
Requests to maximize and minimize Browser windows will be coming from
the WebContent process rather than the WebDriver process. Add hooks to
propagate these requests back up to the Browser.
2022-11-09 19:59:26 +00:00
Timothy Flynn
b57d7e4332 Browser+WebContent+WebDriver: Move Get/Set Window Rect to WebContent
This also lets us more fully implement the "restore the window" method,
which requires we block until the document reaches the "visible" state.
2022-11-09 19:59:26 +00:00
Timothy Flynn
9505928fdb Browser+LibWebView+WebContent: Add IPC to re[store,size,position] window
Requests to restore, resize, and reposition Browser windows will be
coming from the WebContent process rather than the WebDriver process.
Add hooks to propagate these requests back up to the Browser.

The spec notes "The specification does not guarantee that the resulting
window size will exactly match that which was requested", so these new
methods return the actual new size/position.
2022-11-09 19:59:26 +00:00
Timothy Flynn
71aba39562 Browser: Remove unused WebDriver IPC endpoints
I had originally thought to just leave these and remove them all at once
at the end of the WebContent migration. But it is kind of confusing to
have them around, so this removes the endpoints that have already been
ported.
2022-11-09 19:59:26 +00:00
Timothy Slater
75c359ef31 PixelPaint: Make filters apply to a selection if one is present
This changes ImageProcessor to use the scratch bitmap of the layer which
will cause the changes to only be applied inside the active selection
(if there is one). This also updates the FilterPreviewWidget to show the
filter preview with active selection taken into account.
2022-11-09 22:13:26 +03:30
Timothy Flynn
31bb79295d WebContent+WebDriver: Move the Navigate To command to WebContent 2022-11-08 19:58:34 -05:00
Timothy Flynn
50ae1ad18a Browser+LibWebView+WebDriver: Connect WebDriver to WebContent
First, this moves the WebDriver socket to the /tmp/websocket/ directory,
as WebDriver now creates multiple sockets per session. Those sockets are
now created with Core::LocalServer rather than manually setting up the
listening sockets (this was an existing FIXME which resolved some issues
I was hitting with creating a second listening socket).

WebDriver passes both socket paths to Browser via command line. Browser
continues to connect itself via one socket path, then forwards the other
socket path to the WebContent process created by the OOPWV. WebContent
then connects to WebDriver over this path.

WebContent will temporarily set the navigator.webdriver flag to true
after connecting to WebDriver. This will soon be moved to its own IPC to
be sent by WebDriver.
2022-11-08 19:58:34 -05:00
Torstennator
a66dbef1ed PixelPaint: Improve brushtool gradient for low hardness
This patch mitigates a rough gradient for the brush tool with a low
hardness. Previously the gradient alpha value was truncated by the type
conversion to int. Now the desired alpha value is scaled up to mitigate
the information loss due to type conversion which results in a much
smoother gradient.
2022-11-07 20:58:02 +00:00
Torstennator
e520b9c3a3 PixelPaint: Relate cursor to brush tool size
This patch changes the cursor for the brush tool to a circle of dynamic
size to indicate the region where the tool will apply color changes.
2022-11-07 20:58:02 +00:00
Karol Kosek
9805cdeaf5 ThemeEditor: Warn about unsaved changes on file open 2022-11-07 12:55:46 +00:00
Karol Kosek
6b8d351b40 TextEditor+HexEditor: Warn about unsaved changes after dropping files 2022-11-07 12:55:46 +00:00
Torstennator
65919bcbb5 PixelPaint: Remember visibility for histogram and vectorscope
This patch allows pixelpaint to remember if the histogram or vectorscope
was visible last time the application was used.
2022-11-07 12:39:44 +00:00
Slimey
e00b16460c Base+VideoPlayer: Add an icon for video player
Co-authored-by: TreuKS <ks2225@protonmail.com>
2022-11-06 22:27:22 -08:00
Daniel Bertalan
4296425bd8 Everywhere: Remove redundant inequality comparison operators
C++20 can automatically synthesize `operator!=` from `operator==`, so
there is no point in writing such functions by hand if all they do is
call through to `operator==`.

This fixes a compile error with compilers that implement P2468 (Clang
16 currently). This paper restores the C++17 behavior that if both
`T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be
rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators
makes the rewriting possible again.
See https://reviews.llvm.org/D134529#3853062
2022-11-06 10:25:08 -07:00
Slimey
bb95374b49 VideoPlayer: Add quit action and help menu
I also moved the menubar initialization code to VideoPlayerWidget in
order to keep all of the bulk out of main.cpp :)
2022-11-06 16:27:18 +01:00
Slimey
8006bdf6b4 VideoPlayer: Show current open file in the title 2022-11-06 14:49:09 +01:00
Timothy Flynn
ea7ce76d20 Browser: Add a context menu item to take a full document screenshot 2022-11-05 09:29:28 +01:00
Timothy Flynn
59b1dfa4e5 Browser: Rename "take screenshot" action to "take visible screenshot"
This is to differentiate between this and an upcoming action to take a
screenshot of the entire document.
2022-11-05 09:29:28 +01:00
Linus Groh
b667cd69ca Browser: Add a banner to tabs controlled by WebDriver
From https://www.w3.org/TR/webdriver/#security:

It is also suggested that user agents make an effort to visually
distinguish a user agent session that is under control of WebDriver from
those used for normal browsing sessions. This can be done through a
browser chrome element such as a “door hanger”, colorful decoration of
the OS window, or some widget element that is prevalent in the window so
that it easy to identify automation windows.
2022-11-04 23:38:38 -04:00
Linus Groh
3ed1a14371 Browser: Refactor WebDriver flag activation into a single function 2022-11-04 23:38:38 -04:00
Timothy Flynn
b0eb45f7c7 WebDriver+Browser: Implement GET /session/{id}/element/{id}/screenshot 2022-11-05 01:10:03 +00:00
Gunnar Beutner
0eb7d1e05c FileManager: Improve error handling when posix_spawn() fails
Previously we'd try to disown() the newly created process even if
posix_spawn() had failed.
2022-11-04 09:47:30 +01:00
Timothy Flynn
2d75229192 WebDriver+Browser: Implement GET /session/{id}/element/{id}/selected 2022-11-03 19:40:43 -04:00
Timothy Flynn
0f2b4d0aac WebDriver+Browser: Implement GET /session/{id}/element/{id}/enabled 2022-11-03 19:15:43 +00:00
Timothy Flynn
08c687ef20 WebDriver+Browser: Implement GET /session/{id}/element/{id}/rect 2022-11-03 19:15:43 +00:00
Nico Weber
daeaefad17 Everywhere: Clean up "the the" comment typos 2022-11-03 17:38:32 +00:00
Timothy Flynn
61d0b66bfb WebDriver+Browser: Implement GET /session/{id}/source 2022-11-03 14:48:04 +00:00
Linus Groh
747ba2a88f Browser+LibWebView: Add WebDriver IPC plumbing for executing scripts 2022-11-02 23:46:30 +00:00