Commit Graph

41 Commits

Author SHA1 Message Date
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
Sam Atkins
5702f016f0 LibGUI+Applications: Add --open-tab option to FooSettings applications
Similar to SystemMonitor's option of the same name, this allows you to
launch the given application with the specific tab open.
2022-04-21 17:24:42 +02:00
Sam Atkins
ded5ba1f87 LibGUI+Applications: Give SettingsWindow tabs a string ID
This gives us a convenient way to refer to them, which will be used in
the following commit.
2022-04-21 17:24:42 +02:00
Vitaly Dyachkov
32b8795091 LibConfig: Rename pledge_domains(String) => pledge_domain(String)
pledge_domains() that takes only one String argument was specifically
added as a shortcut for pledging a single domain. So, it makes sense to
use singular here.
2022-02-11 18:06:39 +01:00
Timur Sultanov
c7bd47c87c Base+WindowsServer+keymap: Store multiple keymaps in a config 2022-02-03 00:47:22 +01:00
Sam Atkins
3ca2aee054 Applications: Cast unused smart-pointer TRY return values to void 2021-12-05 15:31:03 +01:00
Andreas Kling
60c132d7d3 LibGUI: Move GUI::SettingsWindow setup out of the constructor
In order to propagate errors that occur during UI setup, we have to move
all that logic out of widget/window subclass constructors. This is a
first attempt at doing that, for GUI::SettingsWindow.
2021-11-28 08:54:22 +01:00
Andreas Kling
acd4cc97fc KeyboardSettings: Remove some unnecessary pledge promises
This program doesn't need to create or write files directly.
2021-11-28 08:54:22 +01:00
Andreas Kling
45844f9338 LibGUI: Make GUI::SettingsWindow::add_tab() return ErrorOr
This allows us to use TRY() when creating settings UI.
2021-11-28 08:10:53 +01:00
Brian Gianforcaro
cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Andreas Kling
31867bed5c KeyboardSettings: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Sam Atkins
0a2b6b64c6 KeyboardSettings: Migrate to using SettingsWindow :^) 2021-11-20 21:05:20 +00:00
Sam Atkins
4bac30f737 KeyboardSettings: Migrate layout to GML
All other Settings applications use this, so let's match them!
2021-11-20 21:05:20 +00:00
Andreas Kling
587f9af960 AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
Also add slightly richer parse errors now that we can include a string
literal with returned errors.

This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
FrHun
a261e4d9d5 LibGUI+Settings: Remove superfluous margin sets
The margin set is completely superfluous, because it only ever affects
grabbing (in splitters), which is never used for these classes.
2021-11-03 16:13:19 +01:00
Idan Horowitz
6704961c82 AK: Replace the mutable String::replace API with an immutable version
This removes the awkward String::replace API which was the only String
API which mutated the String and replaces it with a new immutable
version that returns a new String with the replacements applied. This
also fixes a couple of UAFs that were caused by the use of this API.

As an optimization an equivalent StringView::replace API was also added
to remove an unnecessary String allocations in the format of:
`String { view }.replace(...);`
2021-09-11 20:36:43 +03:00
Mustafa Quraish
fdc9ff2ee7 KeyboardSettings: Use LibConfig intead of Core::ConfigFile 2021-08-31 17:00:41 +02:00
Karol Kosek
d04c8d478f KeyboardSettings: Reuse generic GUI::ItemListModel
This change removes the manually created model class
in order to use a generic GUI::ItemListModel.

Besides from code reusability, it also makes the list
searchable as you type.
2021-08-31 16:43:18 +02:00
networkException
acde7d12b0 Everywhere: Rename get in ConfigFile::get_for_{lib,app,system} to open
This patch brings the ConfigFile helpers for opening lib, app and system
configs more inline with the regular ConfigFile::open functions.
2021-08-22 01:32:25 +02:00
networkException
938051feb8 Everywhere: Use Core::ConfigFile::AllowWriting::Yes to allow writing 2021-08-22 01:32:25 +02:00
sin-ack
e11d177618 Userland+LibGUI: Add shorthand versions of the Margins constructor
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
2021-08-18 10:30:50 +02:00
sin-ack
9c9a5c55cb Userland+LibGUI: Make Margins arguments match CSS ordering
Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
2021-08-18 10:30:50 +02:00
Brian Gianforcaro
a51e6547aa Applications: Remove unused header includes 2021-08-01 08:10:16 +02:00
Andreas Kling
b56a2c3e4c KeyboardSettings: Remove outdated FIXME 2021-07-31 11:22:53 +02:00
FrHun
8feab1836a KeyboardSettings: Fix button margins 2021-07-27 22:17:23 +02:00
Jamie Mansfield
3d4abd7154 KeyboardSettings: Prevent minimising the window
This matches how the new MouseSettings application works.
2021-07-26 14:56:49 +02:00
Jamie Mansfield
902559fc2d KeyboardSettings: Prevent resizing the window
This matches the other settings applications.
2021-07-26 14:56:49 +02:00
Andreas Kling
687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00
Jamie Mansfield
3be472176d KeyboardSettings: Use typical OK-Cancel-Apply arrangement
This brings KeyboardSettings in line with the other settings
applications.
2021-07-21 12:34:27 +02:00
ForLoveOfCats
ce6658acc1 KeyboardSettings+Kernel: Setting to enable Num Lock on login 2021-07-05 06:19:59 +02:00
Andreas Kling
31d4bcf5bf Userland: Tighten a *lot* of pledges! :^)
Since applications using Core::EventLoop no longer need to create a
socket in /tmp/rpc/, and also don't need to listen for incoming
connections on this socket, we can remove a whole bunch of pledges!
2021-05-13 23:28:40 +02:00
Linus Groh
91eda22208 Everywhere: Add Alt shortcuts to remaining top-level menus
Not sure why some menus did have one and others didn't, even in the
same application - now they all do. :^)
I added character shortcuts to some menu actions as well.
2021-05-12 18:09:42 +01:00
Ali Mohammad Pur
a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
Andreas Kling
4b0098e52f Everywhere: Rename app_menu to file_menu or game_menu 2021-05-01 17:40:54 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Andreas Kling
a2baab38fd Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"
I hereby declare these to be full nouns that we don't split,
neither by space, nor by underscore:

- Breadcrumbbar
- Coolbar
- Menubar
- Progressbar
- Scrollbar
- Statusbar
- Taskbar
- Toolbar

This patch makes everything consistent by replacing every other variant
of these with the proper one. :^)
2021-04-13 16:58:15 +02:00
Andreas Kling
78b12e1521 Userland: Turn all application menus into window menus :^) 2021-03-25 22:14:09 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
d312011708 Everywhere: Drop "shared_buffer" in most GUI programs, pledge "recvfd"
Now that WindowServer broadcasts the system theme using an anonymous
file, we need clients to pledge "recvfd" so they can receive it.

Some programs keep the "shared_buffer" pledge since it's still used for
a handful of things.
2021-01-16 19:30:32 +01:00
Andreas Kling
20915795a8 Everywhere: Pledge "sendfd" in WindowServer client programs
This is needed for the new way we transfer window backing stores.
2021-01-15 14:10:32 +01:00
Andreas Kling
dc28c07fa5 Applications: Move to Userland/Applications/ 2021-01-12 12:05:23 +01:00