Commit graph

1218 commits

Author SHA1 Message Date
Sam Atkins 489f20d997 HackStudio: Remove unused Editor::m_autocomplete_in_focus field 2023-07-24 16:39:02 +01:00
Sam Atkins 4c551bfad9 HackStudio: Make use of existing TextEditor::on_focusin callback 2023-07-24 16:39:02 +01: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
Shannon Booth f690807c5a LibDiff: Change underlying representation of Hunk to allow context
The existing hunk data structure does not contain any way to easily
store information about context surrounding the additions and removals
in a hunk. While this does work fine for normal diffs (where there is
never any surrounding context) this data structure is quite limiting for
other use cases.

Without support for surrounding context it is not possible to:
 * Add support for unified or context format to the diff utility to
   output surrounding context.
 * Be able to implement a patch utility that uses the surrounding
   context to reliably locate where to apply a patch when a hunk range
   does not apply perfectly.

This patch changes Diff::Hunk such that its data structure more closely
resembles a unified diff. Each line in a hunk is now either a change,
removal, addition or context.

Allowing hunks to have context inside of them exposes that HackStudio
heavily relies on there being no context in the hunks that it uses for
its' git gutter implementation. The fix here is simple - ask git to
produce us a diff that has no context in it!
2023-07-02 11:18:11 -06:00
Liav A 23a7ccf607 Kernel+LibCore+LibC: Split the mount syscall into multiple syscalls
This is a preparation before we can create a usable mechanism to use
filesystem-specific mount flags.
To keep some compatibility with userland code, LibC and LibCore mount
functions are kept being usable, but now instead of doing an "atomic"
syscall, they do multiple syscalls to perform the complete procedure of
mounting a filesystem.

The FileBackedFileSystem IntrusiveList in the VFS code is now changed to
be protected by a Mutex, because when we mount a new filesystem, we need
to check if a filesystem is already created for a given source_fd so we
do a scan for that OpenFileDescription in that list. If we fail to find
an already-created filesystem we create a new one and register it in the
list if we successfully mounted it. We use a Mutex because we might need
to initiate disk access during the filesystem creation, which will take
other mutexes in other parts of the kernel, therefore making it not
possible to take a spinlock while doing this.
2023-07-02 01:04:51 +02:00
Shannon Booth c60150da15 HackStudio: Use StringView in DiffViewer::draw_line 2023-06-26 19:26:34 +02:00
Shannon Booth 23df5748f6 LibDiff: Make Diff::parse_hunks fallible
Currently the only error that can happen is an OOM. However, in the
future there may be other errors that this function may throw, such as
detecting an invalid patch.
2023-06-26 19:26:34 +02:00
Sam Atkins ae6bde6847 GMLPlayground: Add a Statusbar 2023-06-17 20:36:03 +02: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
Sam Atkins f33824d2e9 LibGUI+Userland: Propagate errors in Model::column_name() 2023-06-14 17:53:59 +02:00
Hendiadyoin1 3d1fd17f8b SQLStudio: Stop lying about string types 2023-06-13 01:49:02 +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
Ben Wiederhake f20d04726a LibFileSystem+Everything: Remove resolve_executable_from_environment 2023-06-06 23:46:36 +02:00
Ben Wiederhake 00bd443d1c UserspaceEmulator: Prefer FileSystem over DeprecatedFile 2023-06-06 23:46:36 +02:00
Liav A aaa1de7878 Kernel: Move {Virtual,Physical}Address classes to the Memory directory 2023-06-04 21:32:34 +02: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
Ben Wiederhake f07ac8f20a HackStudio: Prefer FileSystem over DeprecatedFile
This also straightens out the logic to determine the project_path.
Instead of calling realpath on potentially-null strings and sometimes
not even reading the result, we now only make these calls when required,
and properly handle any error.
2023-05-27 17:30:55 +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
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
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
Ben Wiederhake f9a24eb7eb LibCore: Migrate Command from Deprecated{File,String}
This gives us free error-propagation in Core::command(...) and
HackStudio::ProjectBuilder::for_each_library_dependencies.

The comment about "String will be in the null state" has been misleading
for a long time, so it is removed.
2023-05-19 23:31:20 +02:00
Ben Wiederhake 9f820fa2c5 HackStudio: Prefer FileSystem::copy_file_or_directory 2023-05-19 21:12:15 +02:00
Timothy Flynn d1a1b1ab75 LibWebView: Remove the DumpLayoutTree program
This program's purpose is now achieved with headless-browser, which has
the added benefit of being runnable outside of Serenity.
2023-05-16 13:22:23 -07: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
Karol Kosek b7558a5ce4 LibGUI+Userland: Store column names in JsonArrayModel as String 2023-05-15 06:42:10 +02:00
Karol Kosek 945f05ed76 Userland: Port Model::column_name() to String 2023-05-15 06:42:10 +02:00
Ben Wiederhake 88334f67be HackStudio: Prefer FileSystem over DeprecatedFile 2023-05-13 17:04:05 +02:00
Lucas CHOLLET 8c34959b53 AK: Add the Input word to input-only buffered streams
This concerns both `BufferedSeekable` and `BufferedFile`.
2023-05-09 11:18:46 +02:00
Maciej cf52542fcf LibMarkdown+LibSyntax: Add a Markdown syntax highlighter
It currently supports only headers and code blocks.
2023-05-05 17:08:40 +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
iyush a268dcb1e2 HackStudio: Move around execution order and prevent crashing
Previously hackstudio tried to synchronize the language server before
executing the command inside the editor.  If sync-command for the server
(for example the CommentLineCommand) is not implemented inside the
function responsible for syncing the language server, the IDE would
crash.

This patch makes it such that the synchronization happens only after IDE
executes the command locally.  If such command is not implemented (as
was the case earlier), it would simply reupdate the content inside the
language server. Even though the reupdate might be expensive, it is
better than crashing hackstudio altogether.

Because of reordering, the relevant function names have been changed to
better reflect the code flow.
2023-04-30 06:08:22 +02:00
thankyouverycool f7e034d4b2 LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStyle
Previously, Frames could set both these properties along with a
thickness to confusing effect: Most shapes of the same shadowing only
differentiated at a thickness >= 2, and some not at all. This led
to a lot of creative but ultimately superfluous choices in the code.

Instead let's streamline our options, automate thickness, and get
the right look without so much guesswork.

Plain shadowing has been consolidated into a single Plain style,
and 0 thickness can be had by setting style to NoFrame.
2023-04-30 05:49:46 +02:00
thankyouverycool 91bafc2653 LibGUI+Userland: Port Labels to String 2023-04-30 05:48:14 +02:00
Ali Mohammad Pur 7e6341587b AK+Everywhere: Disallow Error::from_string_view(FooString)
That pattern seems to show up a lot in code written by people that
aren't intimately familiar with the lifetime model of Error and Strings.
This commit makes the compiler detect it and present a more helpful
diagnostic than "garbage string at runtime".
2023-04-28 05:55:20 +02:00
Andreas Kling c756e021a7 Userland: Remove "Inspector" program and related utilities
This program has never lived up to its original idea, and has been
broken for years (property editing, etc). It's also unmaintained and
off-by-default since forever.

At this point, Inspector is more of a maintenance burden than a feature,
so this commit removes it from the system, along with the mechanism in
Core::EventLoop that enables it.

If we decide we want the feature again in the future, it can be
reimplemented better. :^)
2023-04-25 14:48:40 +02: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
Cameron Youell ba38984a60 SQLStudio: Convert MainWidget to a failable constructor 2023-04-24 09:21:51 +02:00
Karol Kosek 83af64f053 SQLStudio: Propagate errors from MainWidget::initialize_menubar() 2023-04-20 17:02:23 +01:00
Karol Kosek 51bd9ca037 LibGUI+Userland: Make Menu::*add_submmenu take name using new string 2023-04-19 07:59:54 +02:00
Karol Kosek 969543a847 LibGUI+Userland: Make Window::*add_menu take name using new string 2023-04-19 07:59:54 +02:00
Karol Kosek 956f4d9205 Userland: Construct Menus with name using the non-deprecated String 2023-04-19 07:59:54 +02:00
thankyouverycool 02a9e5d3f6 LibGUI+Userland: Improve error and font handling for InputBox
Adds fallible factories, ports DeprecatedString, and rebuilds the
layout to accomodate system font changes.
2023-04-18 10:05:21 +02:00
MacDue 35612c6a7f AK+Everywhere: Change URL::path() to serialize_path()
This now defaults to serializing the path with percent decoded segments
(which is what all callers expect), but has an option not to. This fixes
`file://` URLs with spaces in their paths.

The name has been changed to serialize_path() path to make it more clear
that this method will generate a new string each call (except for the
cannot_be_a_base_url() case). A few callers have then been updated to
avoid repeatedly calling this function.
2023-04-15 06:37:04 +02:00
iyush cc301f9861 HackStudio: Set_cursor even if the file is already open
Upon opening already opened file, the cursor was previously not
set to the correct line and column. With this patch, it should
be correctly set.

Fixes a bug where ctrl+clicking a function declaration would not
jump to the line if the file containing the function is already
open.
2023-04-13 09:52:33 +02:00
Tim Ledbetter 0829101eb8 Applications: Use thousands separator for numbers shown in status bar
TextEditor, HackStudio and SQLStudio now print the current line and
column number, as well as the number of currently selected words, with
thousands separators.

TextEditor also uses thousands seperators for the current word and
character count.
2023-04-12 09:03:01 +02:00
Evan Smal 5b906d9a40 HackStudio: Add configuration domain pledge for FileManager
This fixes a bug where clicking the "Save" button would crash the
application because 'FileManager' was a pledged domain.
2023-04-06 08:56:57 +01: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 0761926127 HackStudio: Migrate git-diff indicators to TextEditor API
As part of this, the CodeDocument now keeps track of the kind of
difference for each line. Previously, we iterated every hunk every time
the editor was painted, but now we do that once whenever the diff
changes, and then save the type of difference for each line.
2023-03-31 12:09:40 +02:00
Sam Atkins 620bf45f43 HackStudio: Migrate execution-position indicator to TextEditor API 2023-03-31 12:09:40 +02:00
Sam Atkins 99221a436e HackStudio: Migrate breakpoint indicators to TextEditor API 2023-03-31 12:09:40 +02:00
Cameron Youell 752f06f228 LibFileSystem: Move TempFile from LibCore to LibFileSystem
As suggested in commit de18485
2023-03-21 19:03:21 +00:00
Cameron Youell 1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00: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
Karol Kosek 66402b0666 LibGUI+Userland: Port TabWidget set_tab_title to new string 2023-03-16 09:58:42 +01:00
Karol Kosek 797968c310 LibGUI+Userland: Make TabWidget::*add_tab() take title using new string 2023-03-16 09:58:42 +01:00
Karol Kosek 3805e4e3a9 LibGUI+HackStudio+PixelPaint: Port Widget title to the new String
I had to add a set_title(String) helper function for ImageEditor because
TabWidget requires it. This is a temporary fix and will be handled in
subsequent commit.
2023-03-16 09:58:42 +01:00
Liav A d16d805d96 Kernel: Merge {get,set}_process_name syscalls to the prctl syscall
It makes much more sense to have these actions being performed via the
prctl syscall, as they both require 2 plain arguments to be passed to
the syscall layer, and in contrast to most syscalls, we don't get in
these removed syscalls an automatic representation of Userspace<T>, but
two FlatPtr(s) to perform casting on them in the prctl syscall which is
suited to what has been done in the removed syscalls.

Also, it makes sense to have these actions in the prctl syscall, because
they are strongly related to the process control concept of the prctl
syscall.
2023-03-15 20:10:48 +01:00
Sam Atkins 6d8f046fd0 LibGfx+Userland: Make TextAttributes::underline_style optional
Rather than having a style AND a field saying whether to use the style,
just make the style Optional.
2023-03-15 14:55:49 +01:00
Tim Schumacher ecd1862859 AK: Rename Stream::write_entire_buffer to Stream::write_until_depleted
No functional changes.
2023-03-13 15:16:20 +00:00
Sam Atkins 08c1effc04 HackStudio: Use Syntax::Language instead of our own one
The one behavior difference here is that the statusbar used to display
"Unknown" for unknown file types, and "Markdown" for md, but we now
display "Plain Text" for all file types without syntax highlighters.
2023-03-11 13:22:57 +00:00
Andreas Kling a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Sam Atkins 24d5bf8173 HackStudio: Store correct address in ClassViewModel's ModelIndices
When 359d6e7b0b happened, the return value
of `children[row]` went from being `ClassViewNode&` to
`NonnullOwnPtr<ClassViewNode>&`, so we were putting the wrong address
into the ModelIndex's data.
2023-03-08 23:14:21 +01:00
Sam Atkins b1ce852c37 HackStudio: Enable CMakeCache.txt highlighting 2023-03-08 14:21:37 +00:00
Andreas Kling 7369d0ab5f Kernel: Stop using NonnullLockRefPtrVector 2023-03-06 23:46:36 +01:00
Andreas Kling 21db2b7b90 Everywhere: Remove NonnullOwnPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling 359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Andreas Kling 689ca370d4 Everywhere: Remove NonnullRefPtr.h includes 2023-03-06 23:46:35 +01:00
Andreas Kling 8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Sam Atkins 774f328783 LibCore+Everywhere: Return an Error from DirIterator::error()
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
2023-03-05 20:23:42 +01:00
Liav A be1d7c325a Kernel: Move process coredump metadata modification to the prctl syscall 2023-03-05 16:55:08 +01:00
Sam Atkins 0d0ad22572 HackStudio: Enable CMake syntax highlighting 2023-03-04 05:43:43 -07:00
Andreas Kling b71c7a6e44 Userland: Use Font::pixel_size_rounded_up() instead of glyph_height()
The only remaining clients of this API are specific to bitmap fonts and
editing thereof.
2023-03-04 00:29:38 +01:00
Andreas Kling c44bc58aaa HackStudio: Don't hard-code a default code font
If no HackStudio specific code font is set, we fall back to the system
default fixed-width font.
2023-03-03 15:23:47 +01: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
Linus Groh 09d40bfbb2 Everywhere: Use _{short_,}string to create Strings from literals 2023-02-25 20:51:49 +01:00
Itamar 47f5a3ea9a HackStudio: Add 'pause debuggee' button
This button sends a SIGSTOP to the debugged process, which pauses it.
The debuggee can be resumed with the 'continue' button.
2023-02-24 19:09:27 +01:00
Itamar 91224d47d2 SystemMonitor: Add "Debug In HackStudio" action to process context menu
This action launches HackStudio with its debugger attached to the
selected process.
2023-02-24 19:09:27 +01:00
Itamar 6e5b1f5819 HackStudio: Add progress bar to Debugger initialization
During Debugger initialization, most of the time is spent creating
DebugInfo objects for the libraries that the program has loaded.
2023-02-24 19:09:27 +01:00
Itamar 0896c03744 HackStudio: Add commandline option to debug a running process 2023-02-24 19:09:27 +01:00
Itamar 58c4fe52d4 HackStudio: Fix event loop usage in debugger callbacks
These callbacks are called from a different thread than the UI thread,
so we need to explicitly use the Application's event loop to perform GUI
logic.
2023-02-24 19:09:27 +01:00
Itamar ff6fb2cb10 HackStudio: Add ability to attach debugger to a running process 2023-02-24 19:09:27 +01:00
Andreas Kling 33e87d1627 Userland: Fix remaining smart pointer const-correctness issues 2023-02-21 00:54:04 +01:00
Sam Atkins 1a5159df73 LibGUI+HackStudio: Simplify TextEditor gutter & ruler calculations
- Make gutter/ruler_content_rect() return rectangles relative to the
  TextEditor widget.
- Re-order painting code to translate the Painter after the gutter/ruler
  has been painted, to use those coordinates.
- Consistently put gutter before ruler in code, because that's the order
  they physically appear.
2023-02-20 18:41:47 +01:00
Sam Atkins 307cd4a1da HackStudio: Make wrapping modes consistent
We were only setting the wrapping mode when triggering the action. So:
- Any editors open without triggering a wrapping-mode action would have
  the default (WrapAtWords) instead of the selected item (NoWrap).
- Any editors opened after triggering an action would have the default
  too.

This fixes both situations, by:
- Storing the current wrapping mode in `m_wrapping_mode`. Later this
  could be loaded from the config.
- Changing that value any time a wrapping-mode action is triggered.
- Setting the wrapping mode on newly-created editors.
2023-02-19 18:52:26 +01:00
Sam Atkins 6b66e39df4 LibGUI+Userland: Stop returning Layout from Widget::(try_)set_layout()
Nobody uses this return value any more. It also lets us remove a whole
bunch of `(void)` casts. :^)
2023-02-18 16:56:56 +00:00
Sam Atkins 77ad0fdb07 Userland: Specify margins and spacing in the GUI::Layout constructor 2023-02-18 16:56:56 +00:00
Ben Wiederhake 9a7b3c145f Everywhere: Change all XXX into FIXME or remove as appropriate 2023-02-15 23:33:25 +01:00
Tim Schumacher 43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher 874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher 606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Karol Kosek e39adc4772 Userland: Set Button text using the new String class 2023-02-13 00:45:09 +00:00
Nico Weber 9cfd7a299c Userland: Use allocation-failure safe functions where it's easy
I went through all callers of adopt_own() and replaced them with
try_make<>() if possible or adopt_nonnull_own_or_enomem() else
in cases where it was easy (i.e. in functions already returning
ErrorOr).

No intended behavior change.
2023-02-12 22:54:28 +01:00
Lucas CHOLLET 107e15c5bc LibGUI: Base write_to_file(StringView path) on the stream overload
`write_to_file(StringView path)` was based on the `Core::File` overload.
The return type also changed from `bool` to `ErrorOr<void>` to ease
error propagation.
2023-02-11 14:20:26 +00:00
Timothy Flynn 4a916cd379 Everywhere: Remove needless copies of Error / ErrorOr instances
Either take the underlying objects with release_* methods or move() the
instances around.
2023-02-10 09:08:52 +00:00
Timothy Flynn e96df1599c SQLStudio: Display real column names in the results tab 2023-02-03 20:34:45 +01:00
Timothy Flynn 4fe437b4d2 SQLStudio: Separate the script and results tabs with a vertical splitter 2023-02-03 20:34:45 +01:00
Timothy Flynn d6dee8c0e8 LibSQL+Userland: Pass SQL IPC results to clients in a structure
SQLClient exists as a wrapper around SQL IPC to provide a bit friendlier
interface for clients to deal with. Though right now, it mostly forwards
values as-is from IPC to the clients. This makes it a bit verbose to add
values to IPC responses, as we then have to add it to the callbacks used
by all clients. It's also a bit confusing seeing a sea of "auto" as the
parameter types for these callbacks.

This patch moves these response values to named structures instead. This
will allow adding values without needing to simultaneously update all
clients. We can then separately handle the new values in interested
clients only.
2023-02-03 20:34:45 +01:00
Jelle Raaijmakers f0f9d8f1e0 Profiler: Standardize percentage formatting
This implements the same percentage formatting for the disassembly and
flamegraph views as we have for the profile model.
2023-02-02 14:37:01 +01:00
Tim Schumacher 8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Linus Groh 6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Sam Atkins 0d37121fc4 Inspector: Remove declarations for non-existent methods 2023-01-27 20:33:18 +00:00
Sam Atkins 88d746c775 HackStudio: Remove declarations for non-existent methods 2023-01-27 20:33:18 +00:00
Sam Atkins b592629fe5 Profiler: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-27 08:07:24 -05:00
Sam Atkins 33ab3a212f Inspector: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-27 08:07:24 -05:00
Sam Atkins 141aa37eda HackStudio: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-27 08:07:24 -05: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
Sam Atkins 86b1b49d9a UserspaceEmulator: Use Core::Process::set_name() 2023-01-25 14:27:45 +01:00
Karol Kosek e45434c0c7 FileManager+HackStudio+SpaceAnalyzer: Use File::can_delete_or_move 2023-01-24 20:13:30 +00:00
Tim Schumacher e62269650a LibDebug: Propagate errors throughout DWARF parsing
Splitting this into a separate commit was an afterthought, so this does
not yet feature any fallible operations.
2023-01-22 19:12:26 +01:00
Tim Schumacher 9d7606b8de UserspaceEmulator: Use Core::Stream for writing profiling data
This looks like it should compile, but UserspaceEmulator is currently
broken on any non-i686 platform anyways, so I can't test that.
2023-01-21 14:43:56 +01:00
Timothy Flynn 027aee2c66 Userland: Add missing Math.h and IntegralMath.h header includes
These are currently being implicitly including by FixedPoint.h by way of
Format.h. The former will soon be removed from the latter, which would
otherwise cause a compile error in these files.
2023-01-19 11:29:48 +00:00
Sam Atkins 1dd6b7f5b7 AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17 19:52:52 -05:00
MacDue 9a120d7243 AK: Add support for "debug only" formatters
These are formatters that can only be used with debug print
functions, such as dbgln(). Currently this is limited to
Formatter<ErrorOr<T>>. With this you can still debug log ErrorOr
values (good for debugging), but trying to use them in any
String::formatted() call will fail (which prevents .to_string()
errors with the new failable strings being ignored).

You make a formatter debug only by adding a constexpr method like:
static constexpr bool is_debug_only() { return true; }
2023-01-13 21:09:26 +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
Sam Atkins e181b1cb82 Userland: Use Core::Timer::create_foo() factory functions where possible 2023-01-12 11:25:51 +01:00
Sam Atkins 6edc0cf5ab LibCore+Userland: Don't auto-start new Core::Timers
This was unintuitive, and only useful in a few cases. In the majority,
users had to immediately call `stop()`, and several who did want the
timer started would call `start()` on it immediately anyway. Case in
point: There are only two places I had to add a manual `start()`.
2023-01-12 11:25:51 +01:00
Sam Atkins a15d44f019 LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOr
The FIXMEs must flow!
2023-01-12 11:25:51 +01:00
Matthew Olsson 95df712c2e HackStudio: Hide autocomplete popup when switching tabs 2023-01-11 09:15:10 +00:00
Timothy Flynn f3db548a3d AK+Everywhere: Rename FlyString to DeprecatedFlyString
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so
let's rename it to A) match the name of DeprecatedString, B) write a new
FlyString class that is tied to String.
2023-01-09 23:00:24 +00:00
Lucas CHOLLET 8a87aa85ae GMLPlayground: Port to Core::Stream 2023-01-07 19:53:35 +00:00
Andrew Kaster a492e2018d Userland: Silence warnings from ElapsedTimer::elapsed() type change
We changed elapsed() to return i64 instead of int as that's what
AK::Time::to_milliseconds() returns, causing a bunch of implicit lossy
conversions in callers. Clean those up with a mix of type changes and
casts.
2023-01-07 14:51:04 +01:00
Andrew Kaster ddf348daeb Everywhere: Use ElapsedTimer::elapsed_time() for comparisons
Simplify a lot of uses of ElapsedTimer by converting the callers to
elapsed_time from elapsed, as the AK::Time returned is better for unit
conversions and comparisons against constants.
2023-01-07 14:51:04 +01: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
Timothy Flynn ab99ed5fba LibIPC+Everywhere: Change IPC::encode's return type to ErrorOr
In doing so, this removes all uses of the Encoder's stream operator,
except for where it is currently still used in the generated IPC code.
So the stream operator currently discards any errors, which is the
existing behavior. A subsequent commit will propagate the errors.
2023-01-04 11:49:15 +01:00
Ben Wiederhake 6b7ce19161 Everywhere: Remove unused includes of LibC/stdlib.h
These instances were detected by searching for files that include
stdlib.h, but don't match the regex:

\\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_
uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex
it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs|
ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble
n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o
penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo
c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete
nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou
l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use anything from the stdlib.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
2023-01-02 20:27:20 -05:00
Ben Wiederhake 8a331d4fa0 Everywhere: Move AK/Debug.h include to using files or remove 2023-01-02 20:27:20 -05:00
Ben Wiederhake b83cb09db1 Everywhere: Fix badly-formatted includes
In 7c5e30daaa, the focus was "only" on
Userland/Libraries/, whereas this commit cleans up the remaining
headers in the repo, and any new badly-formatted include.
2023-01-02 11:06:15 -05:00
Sam Atkins fa98034ff7 LibGUI+Userland: Make GML unregistered_child_handler fallible 2023-01-01 09:55:05 -05:00
Timothy Flynn e3d5b67eaf SQLStudio: Remove (unimplemented) ability to open database storage files
It may be handy to have some sort of storage inspector at some point but
for now, it doesn't make sense to open a database file. So only allow
opening script files, and don't make assumptions on their extension.
2022-12-30 14:17:18 +01:00
Timothy Flynn 690389ae81 SQLStudio: Display error message boxes when connections/executions fail
In a GUI application, this is vastly more useful than logging to the
terminal or ignoring the error completely.
2022-12-30 14:17:18 +01:00