Commit Graph

49 Commits

Author SHA1 Message Date
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
Sam Atkins
988130a935 LibGUI+GMLPlayground: Set correct undo text for ReplaceAllTextCommand
- Make the text a parameter instead of forcing it to be about GML.
- Change the wording to be imperative, and match the action text.
2023-07-26 14:18:20 -04:00
Sam Atkins
ca3e0288e9 GMLPlayground: Keep a RefPtr to the "Save As..." action
Previously, the Save action held a reference to the local variable for
the Save As action, which goes out of scope at the end of
`initialize_menubar()`. This meant that if you tried to Save a new
file, it would instead crash and yeet your work into the abyss.
2023-07-19 19:36:17 +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
Sam Atkins
ae6bde6847 GMLPlayground: Add a Statusbar 2023-06-17 20:36:03 +02: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
Caoimhe
617edafbf2 LibGUI: Add support for jumping to a line and column in TextEditor
We had support for going to a specific line before, but now we support
jumping around using the `line:column` format :^)
2023-06-01 06:26:40 +02:00
Sam Atkins
f3fe9b64bf GMLPlayground: Keep view_frame_action around to prevent a crash
The `view_frame_action` variable only exists for the duration of
`initialize_menubar()`, so calling it in `m_preview_window->on_close`
would crash. This fixes that by storing the action pointer inside
MainWidget. (And storing the `view_window_action` too because it felt
weird storing one and not the other.)
2023-05-16 18:37:32 +01:00
Karol Kosek
e02cbd9daa GMLPlayground: Make 'Open' action start in the Application source folder
Font Editor and Theme Editor already open the dialog in system folders
(/res/fonts and /res/themes). To be fair, they do have a special folder
just for their files, but I think this is good enough if you want to
start hacking an app :^)

Additionaly, this also adds a filter to show only .gml files by default.
2023-05-16 12:57:34 +01:00
Karol Kosek
8dcfb6bfbd GMLPlayground: Reuse request_close() in 'Open' and recent files actions 2023-05-16 12:57:34 +01:00
Karol Kosek
e7954f62b3 GMLPlayground: Use current file name in the 'Save as...' dialog
Previously it was always "Untitled".
2023-05-16 12:57:34 +01:00
Karol Kosek
23ac52bc80 GMLPlayground: Use try_make for syntax highlighting and autocomplete 2023-05-16 12:57:34 +01:00
Karol Kosek
477ee34215 GMLPlayground: Set parent window for preview window
Closing the main window didn't close the preview window along with it.
2023-05-16 12:57:34 +01:00
Karol Kosek
94f408097a GMLPlayground: Remove one DeprecatedString usage 2023-05-16 12:57:34 +01:00
Karol Kosek
5fd4d34880 GMLPlayground: Handle drop events 2023-05-16 12:57:34 +01:00
Karol Kosek
8c00e57f56 GMLPlayground: Extract most logic into a MainWidget class 2023-05-16 12:57:34 +01:00
Karol Kosek
3c13faff57 GMLPlayground: Set file path when reading file
We weren't setting the path on the 'Open' action, which meant that a
startup file name was always visible in the title bar (unless we save a
file to a different path, or pick a file from the 'recent files' list).

By setting it to update the stored file path in the load_file()
function, it'll be guaranteed the file name will always be set.

This also will add the startup opened file to the recently opened files
list.
2023-05-16 12:57:34 +01:00
Lucas CHOLLET
1a97382305 LibGUI: Make Application's construction fallible
The pattern to construct `Application` was to use the `try_create`
method from the `C_OBJECT` macro. While being safe from an OOM
perspective, this method doesn't propagate errors from the constructor.
This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually
define a `create` method that can bubble up errors from the
construction stage.

This commit also removes the ability to use `argc` and `argv` to
create an `Application`, only `Main`'s `Arguments` can be used.

From a user point of view, the patch renames `try_create` => `create`,
hence the huge number of modified files.
2023-05-05 16:41:21 +01:00
Tim Ledbetter
05c8aa71f2 Applications: Update man page links for applications
This commit updates all application man page links to point to the
Applications subdirectory.
2023-04-25 02:16:48 -06:00
Karol Kosek
969543a847 LibGUI+Userland: Make Window::*add_menu take name using new string 2023-04-19 07:59:54 +02:00
Cameron Youell
0c98cde18e GMLPlayground: Pledge Calendar domain
This now allows for the preview of `@GUI::Calendar` without
crashing the whole program.
2023-04-06 08:24:25 +01:00
Sam Atkins
5c4ffbcb46 GMLPlayground: Let WindowServer handle the title's modification symbol 2023-03-20 09:06:12 +00:00
Sam Atkins
1fba3640cb GMLPlayground: Add list of recent files to the File menu 2023-03-20 09:06:12 +00:00
Ali Mohammad Pur
500044906d LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
2023-03-01 10:47:19 +01:00
Tim Schumacher
606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher
82a152b696 LibGfx: Remove try_ prefix from bitmap creation functions
Those don't have any non-try counterpart, so we might as well just omit
it.
2023-01-26 20:24:37 +00:00
Liav A
e241b47fee Userland: Remove a bunch of unveil calls on /sys/kernel/processes
These are not needed anymore since the introduction of the new
get_root_session_id syscall.
2023-01-13 13:41:30 +01:00
Sam Atkins
7164b2f758 GMLPlayground: Add a toolbar
No new features, but it sure makes things look more fancy. :^)
2023-01-13 13:37:19 +01:00
Sam Atkins
d443a51b50 GMLPlayground: Move layout to GML
There isn't much layout right now, but it felt very wrong to not have
the GML editor use GML. :^)
2023-01-13 13:37:19 +01:00
Lucas CHOLLET
8a87aa85ae GMLPlayground: Port to Core::Stream 2023-01-07 19:53:35 +00:00
Sam Atkins
f0395a2042 LibGUI+Userland: Rename try_load_from_gml() -> load_from_gml() :^)
It's the only one, so the `try` prefix is unnecessary now.
2023-01-07 14:39:30 +01:00
Sam Atkins
54b1326165 Userland: Replace all uses of load_from_gml with try_load_from_gml
MOAR FIXMES! ;^)
2023-01-07 14:39:30 +01:00
Karol Kosek
247db3fdd0 LibFileSystemAccessClient: Rename try_* functions to try_*_deprecated
These functions return the deprecated `Core::File` class, so let's mark
it as such to avoid possible confusion between future non try_*
functions which will use Core::Stream family classes and to possibly
grab someone's attention. :^)
2023-01-07 10:53:43 +00:00
Sam Atkins
0c24522635 LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off!

This does the following, in one big, awkward jump:
- Replace all uses of `set_main_widget<Foo>()` with the `try` version.
- Remove `set_main_widget<Foo>()`.
- Rename the `try` version to just be `set_main_widget` because it's now
  the only one.

The majority of places that call `set_main_widget<Foo>()` are inside
constructors, so this unfortunately gives us a big batch of new
`release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06 13:36:02 -07:00
Sam Atkins
3b682e885e GMLPlayground: Fill preview window with background color
Without this, the "Widget not registered" error stays visible if the
widgets defined by the GML do not themselves fill with their background
color.

Also tidied up some unused includes.
2023-01-05 18:58:08 +01:00
Sam Atkins
fa98034ff7 LibGUI+Userland: Make GML unregistered_child_handler fallible 2023-01-01 09:55:05 -05: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
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
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Timothy Flynn
67e396d931 GMLPlayground: Replace /proc/all unveil with /sys/kernel/processes
This was missed before commit dc5b28e26c.

Fixes #15809.
2022-10-26 18:41:11 +01:00
demostanis
34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
Karol Kosek
37729f5b91 GMLPlayground: Restrict filesystem access using unveil() 2022-10-24 23:09:30 +01:00
Karol Kosek
25104a30c1 GMLPlayground: Open and save files using FileSystemAccessClient 2022-10-24 23:09:30 +01:00
Samuel Bowman
5e26bb7643 GMLPlayground: Allow previewing GML in a separate window
Previously, Playground would always preview the rendered GML in a frame
next to the editor. This can be annoying when trying to work with small
or large widget hierarchies since the size of the preview is tied to the
size of the editor. Now there is a view menu which allows you to toggle
between the frame or a separate window which can be resized independent
of the editor.
2022-10-15 23:16:38 +02:00
networkException
4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
Linus Groh
cc4bb59a7e Playground: Rename the application to GMLPlayground
Just "Playground" is too generic and doesn't match the general rule of
"application name equals display name minus spaces".
2022-06-28 21:10:10 +01:00