Commit graph

3587 commits

Author SHA1 Message Date
Andreas Kling
2eaa528a0e LibJS: Rip out the AST interpreter :^)
This has been superseded by the bytecode VM, which is both faster
and more capable.
2023-08-08 13:07:13 +02:00
Andreas Kling
fcc72a787b Spreadsheet: Use the LibJS bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling
acd366eddd Assistant: Use the LibJS bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling
99ac34eeae Ladybird+LibWebView+Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling
4eb43cc107 Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Jelle Raaijmakers
14091f32c6 Browser: Synchronize database statements used for cookies
Since SQLServer is inherently asynchronous, database statements can run
in parallel. Our `CookieJar` did not require synchronous actions on the
database for its cookies, resulting in cookies not being set
immediately. This resulted in a bug that could be exposed by setting
`document.cookie` and immediately querying its value, revealing that the
cookie was not yet persisted.

Solve this by requiring all database statements to be executed
synchronously. Ideally SQLServer has a mechanism to determine interquery
dependencies and blocks until dependent queries are fully executed, but
until we have that, this works around that limitation.
2023-08-08 06:25:11 -04:00
Andreas Kling
18c54d8d40 LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs.

Work towards #20405
2023-08-08 07:39:11 +02:00
Lucas CHOLLET
3f35ffb648 Userland: Prefer _string over _short_string
As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Lucas CHOLLET
a5edc9cdfc Userland: Prefer _short_string over String::from_utf8_short_string
This user-defined literal is a strictly equivalent but shorter alias to
`String::from_utf8_short_string`.
2023-08-08 07:37:21 +02:00
Monroe Clinton
1b5b1e4153 Calendar: Implement saving, loading, and displaying of calendars
The user can now save, load, and view calendars. A calendar is made up
of an array of events which are saved in a JSON file. In the future we
should implement the iCalendar standard instead of using a custom
format.
2023-08-07 13:14:58 -06:00
Andreas Kling
34344120f2 AK: Make "foo"_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Andreas Kling
ddbe6bd7b4 Userland: Rename Core::Object to Core::EventReceiver
This is a more precise description of what this class actually does.
2023-08-06 20:39:51 +02:00
Zaggy1024
ba236e3f21 PixelPaint: Don't const_cast to update the editor on filter application 2023-08-06 11:56:21 +02:00
Hediadyoin1
50bf303edd LibJS: Capture UnrealizedSourceRanges in ExecutionContext, not ASTNodes
This loosens the connection to the AST interpreter and will allow us to
generate SourceRanges for the Bytecode interpreter in the future as well

Moves UnrealizedSourceRanges from TracebackFrame to the JS namespace for
this
2023-08-05 06:39:06 +02:00
0GreenClover0
259228d8d2 Spreadsheet: Set Help window mode to Modeless in the constructor
And don't try to do it every time the Help button is clicked.
This fixes a crash when clicking the Help button twice (setting window
mode on an already visible window is not supported).

This also fixes a situation where when opening the Help window with an
action, we didn't set its mode to "Modeless".
2023-08-05 02:14:51 +03:30
Karol Kosek
49df2e1e3a Ladybird+Browser: Update zoom text on menu after clicking zoom button 2023-08-04 15:16:48 +02:00
Fabian Neundorf
413e212ea8 Piano: Cache buffers in Track and WaveWidget
The Track itself caches the Samples after each processing step which
allows it to be queried without the need to process it every time.

This result is queried by the WaveWidget which then caches the result to
prevent unnecessary heap allocations every paint event.
2023-08-04 12:56:27 +02:00
Fabian Neundorf
885e35e92c Piano: Use Sample struct from LibDSP
Removes the Sample struct inside Piano and replaces it with the struct
from LibDSP.

It automatically scales the height of the wave depending on the maximum
amplitude, as the Samples now contain floats and not integers.
2023-08-04 12:56:27 +02:00
Torstennator
5e6f5a524a PixelPaint: New submenu for masking actions
This patch moves the mask related menu actions into a submenu in order
to keep the menu more clear.
2023-08-04 12:11:13 +02:00
Torstennator
8c681a1603 PixelPaint: Add color-masking for editing masks
This patch adds the ability to refine a editing mask by a color-range
based on the pixels of the content image. This is useful for image
editing where mask restirction via luminosity might not fit or just
certain color ranges should be edited.
2023-08-04 12:11:13 +02:00
Torstennator
df4904f61d PixelPaint: Use editing masks in filter gallery
With this change the image modifications of a filter is only applied to
regions of the image where a editing mask is defined. If no editing
mask is defined the filter modifications are applied to the whole
image.
2023-08-04 12:11:13 +02:00
Torstennator
dbbf54df2c PixelPaint: Add luminosity masking for editing masks
This adds a function where editing masks can be refined by selecting
a luminosity range that is applied to the content image and mapped to
the editing mask. This function allows the editing of image regions
that match only certain luminosity values.
2023-08-04 12:11:13 +02:00
Torstennator
660d6f171c PixelPaint: Add function to visualize editing-masks
This patch adds a function to make the editing-eask visible while
beeing in mask-mode so that the user can see which parts are covered
by the masks and can therefore be modified by other tools that support
editing masks.
2023-08-04 12:11:13 +02:00
Karol Kosek
86ad896f35 Mail: Fetch mailbox contents with BODY.PEEK[] type instead of BODY[]
We don't want to mark the entire mailbox as read when checking emails,
don't we? :^)
2023-08-02 11:21:03 +01:00
Karol Kosek
eb41f0144b AK: Decode data URLs to separate class (and parse like every other URL)
Parsing 'data:' URLs took it's own route. It never set standard URL
fields like path, query or fragment (except for scheme) and instead
gave us separate methods called `data_payload()`, `data_mime_type()`,
and `data_payload_is_base64()`.

Because parsing 'data:' didn't use standard fields, running the
following JS code:

    new URL('#a', 'data:text/plain,hello').toString()

not only cleared the path as URLParser doesn't check for data from
data_payload() function (making the result be 'data:#a'), but it also
crashes the program because we forbid having an empty MIME type when we
serialize to string.

With this change, 'data:' URLs will be parsed like every other URLs.
To decode the 'data:' URL contents, one needs to call process_data_url()
on a URL, which will return a struct containing MIME type with already
decoded data! :^)
2023-08-01 14:19:05 +02:00
Shannon Booth
8751be09f9 AK: Serialize URL hosts with 'concept-host-serializer'
In order to follow spec text to achieve this, we need to change the
underlying representation of a host in AK::URL to deserialized format.
Before this, we were parsing the host and then immediately serializing
it again.

Making that change resulted in a whole bunch of fallout.

After this change, callers can access the serialized data through
this concept-host-serializer. The functional end result of this
change is that IPv6 hosts are now correctly serialized to be
surrounded with '[' and ']'.
2023-07-31 05:18:51 +02:00
Sam Atkins
7c8772ad86 FileManager: Add file properties tab for PDF documents 2023-07-30 22:16:40 +01:00
Sam Atkins
a333d9959c FileManager: Add file properties tab for ZIP archives 2023-07-30 22:16:40 +01:00
Edwin Rijkee
dfbc2839b4 DisplaySettings: Handle case where there is no DPI value
DisplaySettings uses the optional `screen_dpi` value before checking
if it is set, causing an assertion failure. This change moves the
usage into the block where it is known to be set.

One situation where this is known to occur is on real hardware when
using the MULTIBOOT_VIDEO_MODE multiboot flag to enable graphical
display output.
2023-07-27 12:53:25 -04:00
Edwin Rijkee
fedd087546 NetworkSettings: Don't assert when there are no network adapters
NetworkSettings normally filters out `loop` when populating its list of
adapters. However, when checking if there aren't any adapters it did
not take this into account. This causes it to crash later when trying
to set the selected index of an empty combo box.

This moves the check for no adapters to after filtering the list, so
that shows the error message and exits.
2023-07-27 12:10:56 -04:00
Andreas Kling
a3e97ea153 Browser+LibWebView: Run with the JavaScript bytecode VM by default
The AST interpreter is still available behind a new `--ast` flag.
2023-07-25 20:00:46 +02:00
Valtteri Koskivuori
8ed3cc5f7b Spreadsheet: Update cell colors interactively while picking
Spreadsheet cells now show a real-time preview of the currently selected
color while the user is picking in `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Valtteri Koskivuori
0388bb019f PixelPaint: Update palette colors in real-time while picking
Palette color selections in `PaletteWidget` now update while interacting
with `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Valtteri Koskivuori
5866a3a731 Magnifier: Update grid color in real-time
The grid color now updates while interacting with `GUI::ColorPicker`
2023-07-24 11:30:54 +03:30
Timothy Flynn
e62cb539fd Revert "FileManager: Remove duplicate log statement"
This reverts commit e0b7717a6a.
2023-07-22 12:19:53 -04:00
Michal Grich
2e9fcc17a0 SystemMonitor: Fix calculation of CPU percentage
This commit addresses an issue when 'Zombie' threads are
included in CPU % calculation. This caused negative
time_scheduled_diff, resulting in a data type overflow.
2023-07-22 08:54:23 -04:00
Sam Atkins
8ec691057f FileManager: Add "Font" tab to File Properties window
We now keep the MappedFile around when inspecting a font, so that we can
use that font to display a preview.
2023-07-20 08:02:12 +01:00
Sam Atkins
50b6ed2aa3 FileManager: Add "Image" tab to File Properties window
We don't yet expose most image metadata yet, so most of this is ICC
profile data since we do have a way to access that.
2023-07-20 08:02:12 +01:00
Sam Atkins
91b677c81e FileManager: Add "Audio" tab to File Properties window 2023-07-20 08:02:12 +01:00
Sam Atkins
8e0fa57e5b FileManager: Extract creation of PropertiesWindow General tab 2023-07-20 08:02:12 +01:00
Sam Atkins
a847bd463a FileManager: Remove unused PropertyValuePair struct 2023-07-20 08:02:12 +01:00
Sam Atkins
9cd6b97dd9 FileManager: Don't wrap long paths on Properties window
These have a fixed height, so any wrapping made them entirely illegible.
2023-07-20 08:02:12 +01:00
Sam Atkins
d00f489cdc SoundPlayer: Rename main widget to SoundPlayerWidget
This is the main widget, and is never replaced by something else, so
having "AdvancedView" in there is a bit confusing.
2023-07-19 19:37:27 +01:00
Sam Atkins
fae350be3f SoundPlayer: Use an enum for PlaylistModel columns
Also correct some const-positioning.
2023-07-19 19:37:27 +01:00
Sam Atkins
32e5593ca9 SoundPlayer: Use AK::human_readable_size() for file sizes 2023-07-19 19:37:27 +01:00
Sam Atkins
7d0f70bfa0 Userland: Use AK::human_readable_digital_time() instead of custom code
Use this handy AK function instead of reimplementing the formatting code
several times. The one minor difference is that now, hours are only
shown if the duration is at least an hour long, but that seems like an
improvement to me. :^)
2023-07-19 08:45:43 -04:00
Sam Atkins
f25adbd5ae SoundPlayer: Correct formatting of PlaylistModel duration text
The previous code would format 5400 seconds as "1:90:00", when it should
be "1:30:00".
2023-07-18 21:17:58 +01:00
Sam Atkins
e0b7717a6a FileManager: Remove duplicate log statement
Now that warnln() also outputs to the debug console, this would print
the error twice.
2023-07-16 00:59:13 +02:00
Lucas CHOLLET
c5a6f0fb4d FileManager: Exit the properties window on escape 2023-07-14 06:52:38 +02:00
Lucas CHOLLET
3e6e75bb5e FileManager: Return a StringView from PropertiesWindow::get_description 2023-07-14 06:52:38 +02:00
MacDue
4aa0ef9f98 ImageViewer: Support displaying vector graphics (at arbitrary scales)
With this, you can scale, flip, and rotate vector graphics in the image
viewer like any other image, but with no pixelation :^)

With this change, vector graphics are decoded in-process (since there's
no standard way to encode them over IPC, a new encoding would be needed
for each format, which would be pretty much just be recreating that
format).

Raster images are still decoded out of process, so the surface area for
attack is still kept to a minimum.
2023-07-14 06:51:05 +02:00
implicitfield
9a1018389c LibGUI+Calendar: Move date control logic to the calendar widget 2023-07-13 04:31:40 +03:30
Karol Kosek
d8bdf26917 MailSettings: Make TLS option checked by default
The window by default showed port 993 with TLS unchecked, which was
slightly misleading as port 993 uses implicit TLS connections and
cleartext is on port 143.

This change also makes it consistent with the Mail app, as its fallback
value is also set to true.
2023-07-12 14:20:29 -04:00
Andreas Kling
52cd671163 LibJS: Make Object::internal_get() reveal the used property offset
This function now takes an optional out parameter for callers who would
like to what kind of property we ended up getting.

This will be used to implement inline caching for property lookups.

Also, to prepare for adding more forms of caching, the out parameter
is a struct CacheablePropertyMetadata rather than just an offset. :^)
2023-07-09 12:54:06 +02:00
Ali Mohammad Pur
0c5c75e8a4 LibCore: Slightly rework the Core::Promise API
The previous iteration of this API was somewhat odd and rough in random
places, which degraded usability and made less than perfect sense.
This commit reworks the API to be a little closer to more
conventional promise APIs (a la javascript promises).

Also adds a test to ensure the class even works.
2023-07-08 23:13:00 +01:00
Timothy Flynn
c911781c21 Everywhere: Remove needless trailing semi-colons after functions
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Jonah
afb07281ad Browser+LibWebView: Load and Display ARIA Properites and State
The inspector widget now has a new ARIA tab which displays an
individual element's ARIA properties and state. The view itself
is pretty basic for now, just being a table- there is definitely room
for some better UX here but it's enough for a first cut.
2023-07-06 11:21:36 +01:00
kleines Filmröllchen
10931dceb8 SystemMonitor: Only read process command line once
Process command line reading took up 50% (!) of all of SystemMonitor's
work. However, a process's command line per definition never changes, so
we can read it once and carry it over. Also, if we couldn't read a
process's command line once, it is close to impossible that we'll ever
be able to read it in the future. Therefore, skip reading such command
lines again as well.

This commit also converts the command line itself to use String, while
we're at it.
2023-07-06 11:07:45 +01:00
kleines Filmröllchen
7d53767ce8 SystemMonitor: Don't reopen process statistics file on every update
This file can just remain open; we seek to its start anyways.
This previously accounted for over 5% of SystemMonitor runtime.
2023-07-06 11:07:45 +01:00
kleines Filmröllchen
26d8ac844c Terminal: Modernize
- Replace C with C++
- Use Core::System, Core::Account and Core::Process wrappers
- Remove DeprecatedString
- Remove invalid close() call to the pts file descriptor in the shell
  child (the fd cannot be valid there anymore since it's an
  automatically-closing fd, we just previously ignored this error)
2023-07-06 11:07:11 +01:00
kleines Filmröllchen
bd13cc0732 GamesSettings+LibCards: Get rid of DeprecatedString 2023-07-06 10:15:37 +01:00
Karol Kosek
bd853de716 Mail: Fix crash caused by migration from NonnullRefPtrVector
When we moved from NonnullRefPtrVector<T> to Vector<NonnullRefPtr<T>>
in commit 8a48246ed1, the `at()` function
started returning a NonnullRefPtr<T>& instead of T&.

The code calling create_index() was not then updated and ended up taking
a pointer to a temporary NonnullRefPtr<>, instead of an actual object,
leading to a crash after logging in.
2023-07-05 11:39:27 +02:00
Sam Atkins
6d02403e06 FileManager: Restore inline message behavior for inaccessible dirs
Print the correct error from Core::System::chdir() instead of errno, and
display the error in the DirectoryView instead of continuing to show the
previous location's contents.

This regressed in 1dc3ba6ed5.
2023-07-04 12:40:22 +01:00
Niklas Lahnstein
e2b0cacb89 3DFileViewer: Properly handle ENOENT errors 2023-07-02 17:35:35 +02:00
Niklas Lahnstein
8534506ab0 3DFileViewer: Use ArgsParser 2023-07-02 17:35:35 +02:00
Torstennator
0c95564533 PixelPaint: FilterGallery fix preview
This patch fixes an issue where the preview for an filter was always
based on the content bitmap even if the edit mode was set to Mask.
Now the preview is using the content or mask bitmap based on the
current edit mode and therefore generates the correct preview of
what is going to be changed.
2023-07-02 15:23:42 +02:00
Torstennator
d9d9103cbb PixelPaint: Start using Editing-Masks for some tools
This patch starts to integrate the usage of Editing-Masks for the
following tools: Spray-Tool, Brush-Tool and Erase-Tool
2023-07-02 15:23:42 +02:00
Torstennator
0a120e239a PixelPaint: Remove todo from LevelDialog
This patch removes a todo where the revert for any changes could be
optimized. Previously every single pixel was copied back from the
reference bitmap to the content bitmap. Now the editors content
bitmap is just replaced with the reference bitmap that is a copy
of the unchanged content bitmap.
2023-07-02 15:23:42 +02:00
Torstennator
1f31e72843 PixelPaint: LevelDialog enhancements
This patch adds the ability to apply slider changes only to regions
where a editing-mask was drawn.
2023-07-02 15:23:42 +02:00
Torstennator
e3509efc1b PixelPaint: Introduce new mask features
This patch adds a new Editing-Mask type to layers. This kind of mask
is used to restrict changes on the content bitmap only to areas where
the mask is drawn. The intensity of a pixel change is controlled by the
alpha-value of the mask.

Furthermore a function to invert and clear masks has been introduced.
When a new mask is created for a layer the edit mode of the layer is
also changed to Mask so that the user can immediately start to draw the
mask.
2023-07-02 15:23:42 +02:00
kleines Filmröllchen
b4fbd30b70 AudioServer+Userland: Decouple client sample rates from device rate
This change was a long time in the making ever since we obtained sample
rate awareness in the system. Now, each client has its own sample rate,
accessible via new IPC APIs, and the device sample rate is only
accessible via the management interface. AudioServer takes care of
resampling client streams into the device sample rate. Therefore, the
main improvement introduced with this commit is full responsiveness to
sample rate changes; all open audio programs will continue to play at
correct speed with the audio resampled to the new device rate.

The immediate benefits are manifold:
- Gets rid of the legacy hardware sample rate IPC message in the
  non-managing client
- Removes duplicate resampling and sample index rescaling code
  everywhere
- Avoids potential sample index scaling bugs in SoundPlayer (which have
  happened many times before) and fixes a sample index scaling bug in
  aplay
- Removes several FIXMEs
- Reduces amount of sample copying in all applications (especially
  Piano, where this is critical), improving performance
- Reduces number of resampling users, making future API changes (which
  will need to happen for correct resampling to be implemented) easier

I also threw in a simple race condition fix for Piano's audio player
loop.
2023-07-01 23:27:24 +01: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
Xexxa
e3a0f84ffb Browser: Change "Same Origin" to "Same-Origin" 2023-06-24 06:19:39 +02:00
Tim Ledbetter
1737a0d1d9 Browser: Set DownloadWidget progress bar minimum value correctly
This fixes a typo from #19462.
2023-06-19 18:50:52 +02:00
Timothy Flynn
2e5fbe8052 Ladybird: Add context menu items to directly open audio files
After commit 7ec7015, we can open audio documents directly. This adds
content menu items to do so, similar to images and videos.
2023-06-19 17:42:55 +02:00
Tim Ledbetter
1a17e08f87 Everywhere: Correctly report progress of downloads larger than 4GiB
This commit changes the variables used to represent the size and
progress of downloads from u32 to u64. This allows `pro` and
`Browser` to report the total size and progress of a download
correctly for downloads larger than 4GiB.
2023-06-19 06:13:19 +02:00
Sam Atkins
f3b08ffc8a SpaceAnalyzer: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins
aa7346d23e HexEditor: Show status tips in Statusbar 2023-06-17 20:36:03 +02:00
Sam Atkins
200892868a ThemeEditor: Add a recent files list 2023-06-17 20:36:03 +02:00
Sam Atkins
16240942ba ThemeEditor: Add a Statusbar 2023-06-17 20:36:03 +02:00
Timothy Flynn
9e95c9892c Ladybird+LibWeb+WebContent: Add context menu controls for muting audio 2023-06-16 19:34:42 +02:00
Timothy Flynn
b3bbdb1e2c Ladybird: Add a context menu for audio elements 2023-06-16 19:34:42 +02:00
Timothy Flynn
14ca04de25 Ladybird+LibWeb+WebContent: Generalize video context menus for all media
The data we want to send out of the WebContent process is identical for
audio and video elements. Rather than just duplicating all of this for
audio, generalize the names used for this IPC for all media elements.

This also encapsulates that data into a struct. This makes adding new
fields to be sent much easier (such as an upcoming field for muting the
element).
2023-06-16 19:34:42 +02:00
Karol Kosek
65a927d16e Help: Clear statusbar when leaving link 2023-06-15 13:53:22 +01:00
Karol Kosek
bd8e16b704 CharacterMap: Override statusbar text on action hover
We have quite a lot of nicely described action status tips here that we
have never shown. Let's change that!
2023-06-15 13:53:22 +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
Ben Wiederhake
342e1c6eab Browser: Avoid unnecessary copies of temporary Storages 2023-06-15 08:07:17 +02:00
Sam Atkins
11af5119b6 FileManager: Save the DirectoryView's visible columns
Since these are stored as numbers, and "1,2,3,5,6" is a bit meaningless
to anyone who looks at this code, the default set of visible columns is
provided as it was before, by them all being visible except a couple
that are specifically hidden.

The callback is wrapped in a debounce() so that if set_visible_columns
() is called, we'll just save the value once instead of doing so for
each column changed.
2023-06-14 17:53:59 +02:00
Sam Atkins
08edc872aa LibCore+Applications: Put timeout parameter first in debounce()
This matches the parameter order for Core::Timer's factory methods,
stops clang-format freaking out so much, and just seems nicer to
me. :^)
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
a45682dcdc Applications: Stop lying about string types 2023-06-13 01:49:02 +02:00
Karol Kosek
8bd68198d6 Userland: Filter out unsupported file types in open dialogs in more apps 2023-06-11 09:40:17 +01:00
Karol Kosek
27011cf55d LibFSAC+Userland: Pass options for FSAC::open_file() using a struct
It was rather inconvenient having to specify all arguments if you wanted
to modify only the last one.
2023-06-11 09:40:17 +01:00
Tim Ledbetter
2b89020b6c SystemMonitor: Make byte counts in ProcessStateWidget human-readable 2023-06-11 09:26:54 +01:00
Tim Ledbetter
8d721dc0f7 Kernel+LibCore+SystemMonitor: Make thread statistics values 64-bit
Thread statistics values which count bytes are now 64-bit. This avoids
overflow when these values go above 4GiB.
2023-06-11 09:26:54 +01:00
Karol Kosek
b0bd1e5eb5 MailSettings: Convert MailSettingsWidget to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
1ad81687e7 TerminalSettings: Convert setting widgets to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
754a5bda7a NetworkSettings: Convert NetworkSettingsWidget to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
956a932a87 KeyboardSettings: Convert KeyboardSettingsWidget to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
90819e2d71 MouseSettings: Convert setting widgets to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
ab8be9aed5 ClockSettings: Convert ClockSettingsWidget to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
e36e465b41 CalendarSettings: Propagate errors when creating CalendarSettingsWidget
We need to add another pair of parenthesizes when propagating an
initialization of ItemListModel, because a comma in a template argument
would work as a separator of macro arguments, leading to a compile
error.
2023-06-10 07:19:06 +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
thankyouverycool
96e60c98cf FontEditor: Propagate errors in update_statusbar()
Errors are sent only to stderr as they can be spammy
2023-06-09 17:21:43 +02:00
thankyouverycool
fe6b36507f FontEditor: Check complete mime type on paste_glyphs() 2023-06-09 17:21:43 +02:00
thankyouverycool
9b431bc2ab FontEditor: Don't add ineffectual glyph moves to the undo stack
And fix effectual glyph paints failing to create new undo events when
beginning at unmodifiable cells but mousing to settable ones.
2023-06-09 17:21:43 +02:00
Timothy Flynn
5a3825b561 Browser+Ladybird+LibWebView: Consolidate title handling in LibWebView
Namely, let's have empty titles behave the same in both Browser and
Ladybird (display the URL).
2023-06-08 07:21:08 +02:00
Karol Kosek
f12dc8b7f5 SystemMonitor: Ignore unveil error about unexisting HackStudio binary
The minimal build configuration doesn't include HackStudio and
SystemMonitor refused to run after trying to unveil a not exiting file.

This change will just ignore this specific error for this specific file
as if nothing really happened.

The ability to quickly debug a process in HackStudio is not the main
feature of the application and HackStudio itself is rather heavy to be
put in the minimal configuration.

Additionally, I find it unnecessary to disable/hide the 'Debug in
HackStudio' action because build configurations are mostly for testing
purposes anyway. You will get a 'No such file or directory' error in the
console after activating the action though. :^)
2023-06-07 00:35:50 +02:00
Ben Wiederhake
f20d04726a LibFileSystem+Everything: Remove resolve_executable_from_environment 2023-06-06 23:46:36 +02:00
Ben Wiederhake
6a351376aa Everywhere: Only use local includes where appropriate
If a local include does not point to a file in the repository, it should
be a system include instead.
2023-06-06 23:19:50 +02:00
Ben Wiederhake
2420effa7d Browser: Store default config values in a single place
Note that this fixes contradictory default values for group
"Preferences", key "Home". This is exactly the kind of errors I want to
prevent with this new style.

The hope is that this can later be used to:
- verify that all accesses to the same key use the same default value,
- and extract the default values more easily.
2023-06-06 00:47:23 +02:00
Ben Wiederhake
3d6b838df3 LibPartition: Migrate from DeprecatedFile to File
The implemented cloning mechanism should be sound:
- If a PartitionTable is passed a File with
  ShouldCloseFileDescriptor::Yes, then it will keep it alive until the
  PartitionTable is destroyed.
- If a PartitionTable is passed a File with
  ShouldCloseFileDescriptor::No, then the caller has to ensure that the
  file descriptor remains alive.
If the caller is EBRPartitionTable, the same consideration holds.
If the caller is PartitionEditor::PartitionModel, this is satisfied by
keeping an OwnPtr<Core::File> around which is the originally opened
file.

Therefore, we never leak any fds, and never access a Core::File or fd
after destroying it.
2023-06-05 14:50:09 +02:00
Tim Ledbetter
55e103deb5 PixelPaint: Make "Crop Image to Content" work with disjoint layers 2023-06-04 21:06:28 +02:00
Tim Ledbetter
c98ec85fb5 PixelPaint: Make "Crop Image to Selection" work with disjoint layers
The "Crop Image to Selection" action will now crop all layers within
the current selection.

Any layers outside of the current selection are deleted.

If there are no layers within the current selection, a new layer the
same size as the selection is created, which has the same name as the
current active layer.
2023-06-04 21:06:28 +02:00
Jelle Raaijmakers
13086d3c97 KeyboardMapper: Do not drop the unix pledge
Without it, KeyboardMapper crashes as soon as you try to open a file.
2023-05-31 16:25:01 +02:00
Tim Ledbetter
8bb6a820e2 Help: Sort search results by score
This makes pages with matching titles appear at the top of the search
results.
2023-05-29 10:47:48 -06: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
Tim Ledbetter
a042c4e93d Help: Perform a fuzzy match on the page title when searching
This allows for slight misspellings to still return a result.
2023-05-29 10:47:48 -06:00
Ben Wiederhake
8df7b42078 FileSystemAccessServer: Don't transmit unused data
The server cannot use these values anywhere, because this method always
sets 'prompt = ShouldPrompt::No'. This saves a bunch of roundtrips for
all clients that use FSAS to read abritrary files.
2023-05-29 13:17:22 +02:00
Ali Mohammad Pur
e47f81d954 Ladybird+Browser: Add a 'Dump All Resolved Styles' debug option
This option dumps all styles for all elements in the document; very
helpful for finding properties that have changed unintentionally :^)
2023-05-29 05:35:41 +02:00
Sam Atkins
a5aabb7940 SpaceAnalyzer: Migrate to Core::Directory::for_each_entry() 2023-05-28 05:51:27 -06:00
Sam Atkins
cec8543097 Terminal: Migrate to Core::Directory::for_each_entry() 2023-05-28 05:51:27 -06:00
Sam Atkins
28a4adba3d DisplaySettings: Migrate to Core::Directory::for_each_entry() 2023-05-28 05:51:27 -06:00
Andreas Kling
87ac906ee6 LibJS: Make Error stack traces lazier
Instead of eagerly populating the stack trace with a textual
representation of every call frame, just store the raw source code range
(code, start offset, end offset). From that, we can generate the full
rich backtrace when requested, and save ourselves the trouble otherwise.

This makes test-wasm take ~7 seconds on my machine instead of ~60. :^)
2023-05-28 10:03:11 +02:00
sec05
6a886e4aac Browser: Download Widget file and directory text changes
fixes #18678

This is because the "From:" URL regularly overflows the line, leading
to an unreadable mess. Make sure that the labels for the widget
don't wrap as well, as the widget is fixed height and width.
2023-05-25 17:45:16 -06: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
effcd080ca Userland: Remove remaining users of Duration::now_realtime()
This is a clear sign that they want to use a UnixDateTime instead.

This also adds support for placing durations and date times into SQL
databases via their millisecond offset to UTC.
2023-05-24 23:18:07 +02:00
kleines Filmröllchen
82c681e44b LibTimeZone+Userland: Change timezone functions to use UnixDateTime
This incurs a whole host of changes in, among others, JavaScript Intl
and Date.
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
Andreas Kling
655d9d1462 LibWeb: Make CSSPixels and Length use 64-bit (double) floating point
This fixes a plethora of rounding problems on many websites.
In the future, we may want to replace this with fixed-point arithmetic
(bug #18566) for performance (and consistency with other engines),
but in the meantime this makes the web look a bit better. :^)

There's a lot more things that could be converted to doubles, which
would reduce the amount of casting necessary in this patch.
We can do that incrementally, however.
2023-05-24 14:40:35 +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
Andreas Kling
8ce1b7ab7e Browser: Default to HTTPS instead of HTTP if no protocol is specified 2023-05-23 11:16:36 +02:00
Kemal Zebari
8f5cc613d2 Browser: Don't show error message box when canceling editor dialog
Currently, an error message box appears when a user tries to cancel
the editor dialog while editing or adding a bookmark.

This snapshot resolves this by having `add_bookmark()` and
`BookmarksBarWidget::edit_bookmark()` perform an if check on the
result of `BookmarkEditor::edit_bookmark()` to see if the dialog
was canceled.
2023-05-23 06:03:13 +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
Karol Kosek
6ab660b62f SystemMonitor: Store text in UnavailableProcessWidget using String class 2023-05-22 06:12:17 +02:00
Karol Kosek
2f8f7eb899 SystemMonitor: Propagate more errors on startup 2023-05-22 06:12:17 +02:00
Karol Kosek
412630637a SystemMonitor: Convert most widgets to a failable factory
I didn't convert widgets that don't do any failable tasks currently
or are lazy-initialized.
2023-05-22 06:12:17 +02:00
Sam Atkins
7cc118e84e Magnifier: Correct captured bitmap's clipping
Previously, we would get a line of junk pixels to the right or bottom of
the captured bitmap.

Two aspects to this:
- Use Painter's clip-rect functionality instead of trying to implement
  it ourselves.
- Switch from ScalingMode::NearestFractional to ::NearestNeighbor.
  Somehow, `draw_scaled_bitmap(NearestFractional)` draws outside of the
  Painter's clip-rect. I can't discern any difference in behavior
  between these two otherwise.

We also now use the same bitmap for drawing the grid as we used for the
bitmap, since this had issues where it wasn't drawn to the edge of the
bitmap.
2023-05-22 01:38:41 +02:00
Ben Wiederhake
41b45d5599 SystemMonitor: Prefer File::read_until_eof over DeprecatedFile
Because MemoryStatsWidget::refresh is run nearly directly by the
EventLoop, the only real alternative to crashing would be to cancel the
update, and keep the old data. That doesn't sound sufficiently better to
warrant being implemented.
2023-05-19 23:31:20 +02:00
Jelle Raaijmakers
fae9a05039 PixelPaint: Use box sampling scaling for layer thumbnails 2023-05-19 18:36:36 +02:00
Jelle Raaijmakers
aebc260940 PixelPaint: Add support for box sampling scaling 2023-05-19 18:36:36 +02:00
Jelle Raaijmakers
6b07926466 ImageViewer: Add support for box sampling scaling 2023-05-19 18:36:36 +02:00
Andreas Kling
9fb81c2c4e Revert "ImageViewer: Add support for box sampling scaling"
This reverts commit 032c2a882a.
2023-05-19 13:33:53 +02:00
Andreas Kling
20537ed3da Revert "PixelPaint: Add support for box sampling scaling"
This reverts commit d6aefb1bf1.
2023-05-19 13:33:53 +02:00
Andreas Kling
1c4d69681c Revert "PixelPaint: Use box sampling scaling for layer thumbnails"
This reverts commit 81b30ec372.
2023-05-19 13:33:52 +02:00
thankyouverycool
444470b238 Applications: Improve FSAC error message handling
Fixes apps showing redundant error messages and terminating
unnecessarily on failed file requests. It's nicer to drop the
user off at the equivalent of a default document on failure if
possible.

Also fixes TextEditor not showing response errors for missing files
in the recently opened list.
2023-05-19 06:20:41 +02:00
Jelle Raaijmakers
81b30ec372 PixelPaint: Use box sampling scaling for layer thumbnails 2023-05-19 06:16:14 +02:00