Commit graph

1017 commits

Author SHA1 Message Date
Andreas Kling
4697195645 LibGUI: Use set_layout<LayoutType>() in lots of client code 2020-03-04 13:49:48 +01:00
Andreas Kling
03e0ddce52 LibGUI: Some more convenience functions for constructing widgets
This patch adds two new API's:

- WidgetType& GUI::Window::set_main_widget<WidgetType>();

  This creates a new main widget for a window, assigns it, and returns
  it to you as a WidgetType&.

- LayoutType& GUI::Widget::set_layout<LayoutType>();

  Same basic idea, creates a new layout, assigns it, and returns it to
  you as a LayoutType&.
2020-03-03 22:37:48 +01:00
Andreas Kling
a26b63a958 LibGUI: Remove Button& parameter from Button::on_click hook
There was but a single user of this parameter and it's a bit tedious
to write it out every time, so let's get rid of it.
2020-03-03 17:02:38 +01:00
Andreas Kling
b1d35248e4 SystemMenu: Fix bad behavior in shutdown dialog
The selected option was stored in a captured stack variable which was
long gone by the time we looked at it, so this dialog didn't really
behave the way you'd expect. Put it in a member instead. :^)
2020-03-03 16:46:39 +01:00
Andreas Kling
686ade6b5a AK: Make quick_sort() a little more ergonomic
Now it actually defaults to "a < b" comparison, instead of forcing you
to provide a trivial less-than comparator. Also you can pass in any
collection type that has .begin() and .end() and we'll sort it for you.
2020-03-03 16:02:58 +01:00
Andreas Kling
2719d6d502 SystemMonitor: Unbreak the in-table progress bars showing disk usage 2020-03-02 23:05:04 +01:00
Andreas Kling
22d0a6d92f AK: Remove unnecessary casts to size_t, after Vector changes
Now that Vector uses size_t, we can remove a whole bunch of redundant
casts to size_t.
2020-03-01 12:58:22 +01:00
Andreas Kling
d61359ae91 About: Add mascot tooltip 2020-02-29 21:35:44 +01:00
Andreas Kling
40860f6f2c Terminal: Put PAGER=more in the default environment
This should be done at some other level (shell rc script for example),
this is just to make "git" stop complaining that I don't have "less".
2020-02-29 18:48:39 +01:00
Andreas Kling
9cf92831e3 Welcome: Remove the default GUI::Frame look from TextWidget 2020-02-29 17:04:46 +01:00
Andreas Kling
e705e4e083 About: Adopt Buggie :^)
Simon Struthers drew a SerenityOS ladybug and since it's so cute,
I figured we could adopt it!
2020-02-29 15:12:58 +01:00
Andreas Kling
f0b68f8bc0 SystemMonitor: Show VMObject types in process memory maps 2020-02-28 23:25:40 +01:00
Andreas Kling
46256da7b0 PaintBrush: Pledge "thread" so that GUI::FilePicker works 2020-02-28 19:48:29 +01:00
Andreas Kling
f72e5bbb17 Kernel+LibC: Rename shared buffer syscalls to use a prefix
This feels a lot more consistent and Unixy:

    create_shared_buffer()   => shbuf_create()
    share_buffer_with()      => shbuf_allow_pid()
    share_buffer_globally()  => shbuf_allow_all()
    get_shared_buffer()      => shbuf_get()
    release_shared_buffer()  => shbuf_release()
    seal_shared_buffer()     => shbuf_seal()
    get_shared_buffer_size() => shbuf_get_size()

Also, "shared_buffer_id" is shortened to "shbuf_id" all around.
2020-02-28 12:55:58 +01:00
Liav A
7beae40508 DisplayProperties: Warn user about failed resolution setting
Also, we have now two new resolutions - 1368x768 and 1366x768.
The 1366x768 resolution is currently not supported but is good
for testing a failed resolution setting.
2020-02-28 12:16:05 +01:00
William McPherson
72cbbd5297 Piano: New timing system and zoomable piano roll
This patch allows roll notes to be of different sizes. This necessitates
a new internal representation of time. BPM and time signatures are
mostly implemented but not exposed.

Roll notes are now sample-accurate and the grid is aligned to 60 BPM
4/4. The roll is divided by the time signature raised to some power of
2, giving the musical divisions of (in the case of 4/4) 16, 32, 64 etc.

Before, our timing was derived from the buffer size and we relied on
that to implement delay. Delay has been rewritten to be sample-granular.
It's now exposed as the proper "divisions of a beat".
Something to be wary of is that the last buffer in the loop is also used
for the start of the next loop. In other words, we loop mid-buffer. This
means we write WAVs with a tiny bit of silence due to breaking the loop
after filling half a buffer.

The data structure for the roll is an array of SinglyLinkedLists of
RollNotes. Separating by pitch (via the array layout) makes insertion
much simpler and faster. Using sorted lists (and thus
SinglyLinkedListIterators) to do lookups is very quick as you know the
sample of the next note and can just compare it to the current sample. I
implemented this with HashMaps and the cost of lookups was abysmal. I
also tried a single SinglyLinkedList and the insertion code got even
more complicated than it already is.
2020-02-27 10:21:13 +01:00
Tibor Nagy
712e7102b0 DisplayProperties: Do not assert on trying to select unset wallpaper
When wallpapers are not present in WindowServer.ini, don't try
to select them in the wallpapers list.
2020-02-27 09:53:11 +01:00
Jesse Buhagiar
9fcb37ad30 Meta: Claim copyright on DisplayProperties files
If anyone's machine blows up setting their wallpaper, they know to blame
me and not AK :P
2020-02-26 12:15:54 +01:00
Andreas Kling
4f99c3726c SystemMonitor: Add pagemap visualization for VM regions
This patch adds a new column to the per-process memory regions view in
SystemMonitor. It's a scaled view of the underlying pagemap of a region
that tells you which chunks of the region are resident/null/zero.
2020-02-25 23:06:40 +01:00
Tibor Nagy
3b8713a9df Terminal: Open settings as a modal window
To prevent the settings window from getting orphaned when someone
closes the main window behind it.
2020-02-25 19:57:48 +01:00
joshua stein
0d2bfe5c65 Build: Only look at SUBDIRS with Makefiles
If a directory is renamed or deleted before 'make clean', git will
delete the Makefile but leave all of the object and dependency files
around.  When make would try to recurse into that directory from the
wildcard, it would error out since there is no Makefile.
2020-02-25 19:56:48 +01:00
joshua stein
a17e702eba Terminal: Don't set an initial command_to_execute
Otherwise we end up executing "/bin/Shell -c /bin/Shell" on a normal
launch.  With a null command_to_execute, we'll just execute
/bin/Shell
2020-02-25 16:17:43 +01:00
joshua stein
61340c12d6 SoundPlayer: Cast Audio::Sample to float for fabsf() 2020-02-25 15:32:58 +01:00
Andreas Kling
fbe4081f4b AK: Make Queue use size_t for its size 2020-02-25 14:55:04 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Andreas Kling
ee3811dee8 TextEditor: Pledge "thread" since it's needed by GUI::FilePicker
This is a little bit awkward since it's only used for generating
thumbnails on a background thread and it's not like I care about
thumbnails very much in a text editor, but for now let's just pledge
"thread" so I can get on with the thing I wanted to get on with.
2020-02-24 19:51:22 +01:00
thatlittlegit
525f8df5b8 SystemMenu: Migrate PowerDialog to (widget)->add like in 3d20da9e
This also fixes the build.
2020-02-23 22:03:03 +01:00
thatlittlegit
30556a0a93 SystemMenu: Move SystemDialog into SystemMenu and remove INI config
I probably would've done INI config removal in another commit, but it
fit well here because I didn't want to pledge wpath for SystemMenu if I
didn't need to.

Frankly, that's something that I think should be done: allow ConfigFile
to be used read-only.
2020-02-23 22:03:03 +01:00
thatlittlegit
9784ab99d2 SystemDialog+Base: Add icon for SystemDialog 2020-02-23 22:03:03 +01:00
thatlittlegit
ba6a290f4f SystemMenu: Remove --shutdown argument when calling SystemDialog 2020-02-23 22:03:03 +01:00
thatlittlegit
efc4861786 SystemDialog: Revamp to be more Win95-like
Only thing I don't like right now is the fact that we rely on the shell.
2020-02-23 22:03:03 +01:00
Andreas Kling
6c5100b644 LibGUI: Add helper for constructing new TabWidget tabs
This patch adds the following convenience helper:

    auto tab_widget = GUI::TabWidget::construct();
    auto my_widget = tab_widget->add_tab<GUI::Widget>("My tab", ...);

The above is equivalent to:

    auto tab_widget = GUI::TabWidget::construct();
    auto my_widget = GUI::Widget::construct(...);
    tab_widget->add_widget("My tab", my_widget);
2020-02-23 12:27:53 +01:00
Andreas Kling
c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Tibor Nagy
3d32c3352b FontEditor: Fix focus and implement keyboard navigation in the glyph map 2020-02-23 12:18:17 +01:00
Andreas Kling
bfd86c4631 LibGUI: Make GUI::Frame have the 2px sunken container look by default
The overwhelming majority of GUI::Frame users set the same appearance,
so let's just make it the default.
2020-02-23 11:10:52 +01:00
Andreas Kling
3d20da9ee4 Userspace: Use Core::Object::add() when building interfaces 2020-02-23 11:10:52 +01:00
Andreas Kling
8efafdfc12 IRCClient: Modernize Core::Object usage 2020-02-23 11:10:52 +01:00
Brian Gianforcaro
edb66f214d SystemMonitor: Fix display of file system size column.
The Size column in the "File systems" tab of SystemMonitor
had a rendering artifact where the bounding box outline would
be drawn in the same location as the text. This makes the text
look strange and hard to read.

Pad the size with a signle space character on either side to
give the text a gap on each side.
2020-02-22 21:25:00 +01:00
Andreas Kling
21c78e2fc3 SystemMenu: Silence debug spam on startup 2020-02-22 17:01:06 +01:00
Tibor Nagy
e490fc9e35 FontEditor: Make the application theme-aware 2020-02-20 14:19:30 +01:00
Andreas Kling
7592f9afd5 AK: Use size_t for CircularQueue and CircularDeque 2020-02-20 13:20:34 +01:00
Andreas Kling
88b9fcb976 AK: Use size_t for ByteBuffer sizes
This matches what we already do for string types.
2020-02-20 13:20:34 +01:00
Tibor Nagy
6eae2ef9cf HexEditor: Make the application theme-aware
Also updates the ruler style a bit to be more consitent with TextEditor.
2020-02-19 12:24:39 +01:00
Tibor Nagy
ca4d4cac45 HexEditor: Clear tracked changes when setting a new buffer 2020-02-19 10:10:53 +01:00
Tibor Nagy
97878dfb4d HexEditor: Fix out of bounds cursor
Fixing out of bounds cursor in three different cases:
- when the buffer is empty
- when loading new files
- when entering values at the end of the buffer
2020-02-19 10:10:53 +01:00
Andreas Kling
25b987ce4c SystemMenu: Use pledge() and unveil() 2020-02-17 20:20:46 +01:00
Andreas Kling
b711f1eab5 SystemMenu: Finish the implementation and start this at boot :^)
Fixes #1231.
2020-02-17 20:20:32 +01:00
Andreas Kling
737e455cbc SystemMenu: Add a separate program to host the system menu
This will allow us to run the system menu as any user. It will also
enable further lockdown of the WindowServer process since it should no
longer need to pledge proc and exec. :^)

Note that this program is not finished yet.

Work towards #1231.
2020-02-17 16:50:48 +01:00
thatlittlegit
6eccd166ed SystemDialog: Use Yes/No dialog instead of OK/Cancel
This also removes some unecessary debug lines. (The debug lines are
unnecessary because LibGUI already outputs the debug information, so
SystemDialog just doubled it up.)
2020-02-17 16:28:21 +01:00
thatlittlegit
14aaf75e3a TextEditor: Use Yes/No/Cancel for some dialogs when buffer is dirty 2020-02-17 16:28:21 +01:00