Commit graph

32 commits

Author SHA1 Message Date
Hugh Davenport c566ef2a9d PartitionEditor: Show better error when can't find partition table 2024-01-11 20:57:40 +00:00
Ali Mohammad Pur 5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Tim Ledbetter 3aa49f268c Userland: Make Window::set_main_widget() non-fallible 2023-09-21 10:20:23 +02:00
Tim Ledbetter 0d7b13edac Userland: Make GUI::Window construction non-fallible 2023-09-17 16:47:28 -06:00
Tim Ledbetter ccab5ddf9b LibGUI+Applications: Use String in make_about_action() 2023-09-16 11:05:49 +02:00
Andreas Kling bd61e75e0b LibGUI: Remove Window::try_add_menu()
And fall back to the infallible add_menu().
2023-08-14 14:57:54 +02:00
Andreas Kling f2faf2767f LibGUI: Remove Menu::try_add_action()
And fall back to the infallible add_action().
2023-08-14 14:57:54 +02:00
kleines Filmröllchen 1e67435ff5 Meta: Rename compile_gml to stringify_gml
This is what this function really does, it doesn't compile anything.
2023-08-11 21:33:48 +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
Andreas Kling 34344120f2 AK: Make "foo"_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Sam Atkins f33824d2e9 LibGUI+Userland: Propagate errors in Model::column_name() 2023-06-14 17:53:59 +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
Karol Kosek 945f05ed76 Userland: Port Model::column_name() to String 2023-05-15 06:42:10 +02: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
Karol Kosek 969543a847 LibGUI+Userland: Make Window::*add_menu take name using new string 2023-04-19 07:59:54 +02:00
Cameron Youell 1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
MacDue 52e2095a3f PartitionEditor: Add missing unveils
These were somewhat found by trial and error, but it seems like this
is now the required set to launch this without error.
2023-03-15 11:28:12 +01:00
Sam Atkins 8110cf9fab PartitionEditor: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01: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
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
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
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
demostanis 34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
Ali Mohammad Pur 166a905951 Userland: Properly populate GENERATED_SOURCES
We previously put the generated headers in SOURCES, which did not mark
them as GENERATED (and did not produce a proper dependency).
This commit moves all generated headers into GENERATED_SOURCES, and
removes useless header SOURCES.
2022-10-12 15:55:15 +01:00
electrikmilk a5cef2c41a Base: Add Icon for Partition Editor
This adds a 16x16 and 32x32 icon that is missing for the Partition
Editor.
2022-08-14 00:52:56 +01:00
Samuel Bowman fadd69263a PartitionEditor: Add size column 2022-07-21 20:13:44 +01:00
Samuel Bowman ba9f60785b PartitionEditor: Add total blocks column 2022-07-21 20:13:44 +01:00
Samuel Bowman 2f8c20816e LibPartition: Fix end block off by one error
Previously, end block was inconsistent. GUIDPartitionTable treated
end block as an inclusive bound, while MBRPartitionTable and
EBRPartitionTable treated end block as an exclusive bound.
Now all three treat end block as an inclusive upper bound.
2022-07-21 20:13:44 +01:00
Samuel Bowman fb4221ad52 PartitionEditor: Abort and show a dialog if not running as root 2022-07-21 20:13:44 +01:00
Samuel Bowman 7a8953a833 PartitionEditor: Add the beginnings of a partition editor :^)
This adds a new application PartitionEditor which will eventually be
used to create and edit partition tables. Since LibPartition does not
know how to write partition tables yet, it is currently read-only.

Devices are discovered by scanning /dev for block device files.
Since block devices are chmod 600, PartitionEditor be must run as root.

By default Serenity uses the entire disk for the ext2 filesystem
without a partition table. This isn't useful for testing as the
partition list for the default disk will be empty. To test properly,
I created a few disk images using various partitioning schemes
(MBR, EBR, and GPT) and attached them using the following command:

export SERENITY_EXTRA_QEMU_ARGS="
  -drive file=/path/to/mbr.img,format=raw,index=1,media=disk
  -drive file=/path/to/ebr.img,format=raw,index=2,media=disk
  -drive file=/path/to/gpt.img,format=raw,index=3,media=disk"
2022-07-21 20:13:44 +01:00