Commit Graph

30482 Commits

Author SHA1 Message Date
Andreas Kling
dbab20782e LibGUI: Make FilteringProxyModel factory function return ErrorOr 2021-11-24 13:52:01 +01:00
Andreas Kling
71414821b4 Help: TRY() all the things in serenity_main() :^)
This patch makes use of all the new fallible APIs in LibGUI together
with TRY() to catch and propagate errors. The main error getting caught
is allocation failures while trying to construct the Help UI.

It's quite interesting to see how the code changes as more and more
fallible calls get branded as such by wrapping them in TRY().

There's a lot of repetitive "TRY(try_foo())" going on right now. Once
this becomes the dominant programming pattern, we can drop the "try_"
prefix everywhere. :^)
2021-11-24 13:52:01 +01:00
Andreas Kling
51c4de8774 LibGUI: Add GUI::Menu::try_add_action() and try_add_separator()
These are fallible variants that return ErrorOr. :^)
2021-11-24 13:52:01 +01:00
Andreas Kling
9b07e13fb6 LibGUI: Add GUI::Toolbar::try_add_action()
This is a fallible variant of add_action() that returns ErrorOr.
It's careful to not fail with a partially added action.
2021-11-24 13:52:01 +01:00
Andreas Kling
47b6339025 LibGUI: Add GUI::TabWidget::try_add_tab<T>(...)
This is a fallible variant of add_tab<T>(...) that returns ErrorOr.
2021-11-24 13:52:01 +01:00
Andreas Kling
dc47fce2d9 LibGUI: Add GUI::Window::try_set_main_widget<T>(...)
This is a fallible variant of set_main_widget<T>() that returns ErrorOr.
2021-11-24 13:52:01 +01:00
Andreas Kling
bde9c2bc65 LibGUI: Add GUI::Window::try_add_menu()
This is a fallible variant of add_menu() that returns ErrorOr.
2021-11-24 13:52:01 +01:00
Andreas Kling
6b79745aa4 LibGUI: Add GUI::Widget::try_set_layout<T>(...)
This is a fallible variant of set_layout<T>(...) that returns ErrorOr.
2021-11-24 13:52:01 +01:00
Andreas Kling
bc79be362d LibGUI: Add GUI::Menubar::try_add_menu()
This is a fallible variant of Menubar::add_menu() that returns ErrorOr.
2021-11-24 13:52:01 +01:00
Andreas Kling
b81ce827b6 LibCore: Add Core::Object::try_add<T>(...)
This is a fallible version of add<T>(...) that returns ErrorOr<T>.
It can be used together with TRY() to handle allocation failures when
instantiating new Core::Objects.
2021-11-24 13:52:01 +01:00
Pedro Pereira
2efec90fb7 Spider: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
302784ebf8 Solitaire: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
2c6dc6d5f6 Snake: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
5934e95402 Pong: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
36056c1cba Minesweeper: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
0a800cc1bb Hearts: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
a0db5cca8a GameOfLife: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
da50667bb5 FlappyBug: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
70a3962ce9 Chess: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
92e9b447f4 Breakout: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Pedro Pereira
5b33ee20df 2048: Replace construct() with TRY(try_create()) pattern 2021-11-24 13:51:07 +01:00
Vyacheslav Pukhanov
2189cc6bf1 LibGUI: Reverse FilteringProxyModel update propagation flow
FilteringProxyModel is a narrowing projection of its parent model with
a filter applied. That means that updates of FilteringProxyModel should
not propagate to its parent model, but the opposite - updates happening
in the parent model should "trickle down" and trigger an update of the
filtering model.
2021-11-24 13:46:09 +01:00
thankyouverycool
781bc67a96 LibGfx: Correct BitmapFont row indexing when un/masking fonts
Now indexes by total bytes per glyph to account for changes made
to row's pointer type in 3ca00c8. Fixes glyphs not showing and
saving correctly in FontEditor.
2021-11-24 16:05:40 +03:30
Linus Groh
78724fdd33 LibJS: Don't accept UTC designators in strings for plain Temporal types
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/cd2dc7d
2021-11-24 08:56:03 +00:00
Linus Groh
836ce8ee5d LibJS: Fix parse ErrorType used in parse_temporal_date_string()
TemporalInvalidDateString, not TemporalInvalidDateTimeString.
2021-11-24 08:38:50 +00:00
Andreas Kling
b6f49924be LibDesktop: Make allowlist APIs return ErrorOr<void>
This makes it very smooth to use TRY() when setting up these lists,
as you can see in the rest of this commit. :^)
2021-11-24 00:25:23 +01:00
Andreas Kling
4a64bb80ea Inspector: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
4283702fb8 Playground: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
dfca0def63 Profiler: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
f526325e24 ImageViewer: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
ba4fd8fa15 FontEditor: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
973cb0a49e Calculator: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
b3d412d3c1 CrashDaemon: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
365379bcb1 Applets/Audio: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
31867bed5c KeyboardSettings: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
10b5393506 MouseSettings: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Andreas Kling
788be69bcd Clipboard: Port to LibMain :^) 2021-11-24 00:25:22 +01:00
Andreas Kling
db79f1cb78 Welcome: Port to LibMain :^) 2021-11-24 00:25:22 +01:00
Andreas Kling
ca23644397 logout: Port to LibMain :^) 2021-11-24 00:25:22 +01:00
Andreas Kling
8b7b726680 LibCore: Add kill() syscall wrapper 2021-11-24 00:25:22 +01:00
Andreas Kling
e7d4622ce0 Help: Port to LibMain :^) 2021-11-24 00:25:22 +01:00
Samuel El-Borai
86b3769e59 Keymaps: Add bépo keymaps 2021-11-24 00:20:59 +01:00
Timothy Flynn
0aa3e5c2ea LibUnicode: Port generator utility methods to ErrorOr
Most of these were VERIFY-ing for success, but propagating an error
message up to serenity_main() is much nicer than just a SIGABRT.
2021-11-23 22:58:05 +01:00
Timothy Flynn
7f780e43a6 LibCore: Allow moving, but not copying, DirIterator
An explicit move constructor is required to null-out the moved-from
directory descriptor. Otherwise, we would call closedir() twice when
using ErrorOr<DirIterator>::release_value().
2021-11-23 22:58:05 +01:00
Timothy Flynn
55e0b91d8d LibUnicode: Port GenerateUnicodeNumberFormat to ErrorOr and LibMain 2021-11-23 22:58:05 +01:00
Timothy Flynn
8c5f19f7c8 LibUnicode: Port GenerateUnicodeLocale to ErrorOr and LibMain 2021-11-23 22:58:05 +01:00
Timothy Flynn
88dbf3c348 LibUnicode: Port GenerateUnicodeData to ErrorOr and LibMain
Also store command line arguments as StringViews rather than pointers.
2021-11-23 22:58:05 +01:00
Timothy Flynn
4c4b752ab8 Meta: Allow lagom_tool invocations to specify libraries to link 2021-11-23 22:58:05 +01:00
Timothy Flynn
a2ea704d21 Meta: Define LagomMain outside of the BUILD_LAGOM branch
This allows code generators to use LagomMain. Otherwise, during CI, they
are built during the superbuild without BUILD_LAGOM=ON.
2021-11-23 22:58:05 +01:00
Timothy Flynn
1539ed12f1 LibUnicode: Functionalize the Unicode generator CMake commands
Makes it a bit easier to add a new generator.
2021-11-23 22:58:05 +01:00