Commit graph

87 commits

Author SHA1 Message Date
Stephan Unverwerth
b4d1390714 LibGFX: Move default_xxx_font() methods from Font to FontDatabase
When we have an abstract font class it makes no sense to keep
these methods in the Font class.
2020-12-30 20:40:30 +01:00
Andreas Kling
cb67264f61 LibGUI: Rename AbstractSlider::on_value_changed => on_change
This matches other similar hook names.
2020-12-30 15:20:47 +01:00
Andreas Kling
7dc5a3ead8 LibGUI: Rewrite layout system in terms of min and max sizes
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.

Box layout now works in 3 passes:

    1) Set all items (widgets/spacers) to their min-size
    2) Distribute remaining space evenly, respecting max-size
    3) Place widgets one after the other, adding spacing in between

I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)

This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
2020-12-30 01:36:41 +01:00
Brendan Coles
6b6594e3d0 MenuApplets: Username: init app early, pledge early, do not unveil /tmp 2020-12-26 15:18:12 +01:00
Andreas Kling
f1b1558c7b Everywhere: Tweak "2020-2020" => "2020" in copyright headers 2020-12-25 12:24:05 +01:00
Tom
5f51d85184 Kernel: Improve time keeping and dramatically reduce interrupt load
This implements a number of changes related to time:
* If a HPET is present, it is now used only as a system timer, unless
  the Local APIC timer is used (in which case the HPET timer will not
  trigger any interrupts at all).
* If a HPET is present, the current time can now be as accurate as the
  chip can be, independently from the system timer. We now query the
  HPET main counter for the current time in CPU #0's system timer
  interrupt, and use that as a base line. If a high precision time is
  queried, that base line is used in combination with quering the HPET
  timer directly, which should give a much more accurate time stamp at
  the expense of more overhead. For faster time stamps, the more coarse
  value based on the last interrupt will be returned. This also means
  that any missed interrupts should not cause the time to drift.
* The default system interrupt rate is reduced to about 250 per second.
* Fix calculation of Thread CPU usage by using the amount of ticks they
  used rather than the number of times a context switch happened.
* Implement CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE and use it
  for most cases where precise timestamps are not needed.
2020-12-21 18:26:12 +01:00
Brendan Coles
4d89c1885d MenuApplets: Add Network menu applet 2020-12-19 18:28:56 +01:00
Brendan Coles
098f06f042 ClipboardHistory: Add window icon 2020-12-18 17:25:24 +01:00
Ben Wiederhake
6c2ea4c4e9 Clipboard: Remove-unused bpp metadata
It's just more attack surface, and can be deduced from the format anyway.
2020-12-08 09:37:30 +01:00
Florian Förster
438829a1d5
MenuApplets: Added ability to remove entry from ClipboardHistory (#4143) 2020-11-24 21:37:04 +01:00
Zac
7ef8835e5a
ClipboardHistoryModel: Prevent duplicate rows (#4073)
Prevents the adding of items to the ClipboardHistoryModel if the raw
data and mime_type of the item being added is the same as another item
already in the list.
2020-11-17 09:50:39 +01:00
Andreas Kling
adabcf24ec Everywhere: Add missing <AK/ByteBuffer.h> includes
All of these files were getting ByteBuffer.h from someone else and then
using it. Let's include it explicitly.
2020-11-15 13:11:21 +01:00
Andreas Kling
23a5a484d5 ClipboardHistory: Bring window to front when applet is clicked
Fixes #4031.
2020-11-11 20:31:35 +01:00
Marcin Gasperowicz
3039c36836 AudioApplet: Make the slider exponential for finer volume control
The volume slider was linear, which is not ideal for an audio volume 
control. Perceived volume would not change much within 30-100% range
and would change in leaps within 0-30% range where the resolution is
not sufficient for fine grained control.

The simplest solution is to bring the value into 0.0-1.0 range and 
square it to obtain an exponential curve. This is a decent 
approximation of the logarithmic taper used in audio potentiometers.
2020-10-15 13:47:27 +02:00
Ben Wiederhake
42dd0675c0 Meta+MenuApplets: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Linus Groh
724c5bd8d9 ResourceGraph: Fix graph line position calculation
The calculation was only taking the rect's inner height, but not its top
offset into account.

Fixes #3540.
2020-09-19 00:32:06 +02:00
Andreas Kling
40e6a3dcc3 ClipboardHistory: Copy metadata when reusing a historical clipping 2020-09-05 17:06:34 +02:00
Andreas Kling
2e446b662b ClipboardHistory: Show bitmap width/height/bpp for bitmap clippings 2020-09-05 17:05:22 +02:00
Andreas Kling
0b051a5e15 ClipboardHistory: Show the size (in bytes) of each remembered clipping 2020-09-05 17:02:25 +02:00
Andreas Kling
b8d73e259c ClipboardHistory: Cap the history at 20 entries for now
Now that we can copy bitmaps, we need some kind of cap here or memory
usage quickly skyrockets.

This could probably be improved or made adaptive somehow, this is just
a simple hard cap for now.
2020-09-05 17:00:18 +02:00
Andreas Kling
51146e3075 LibGUI: Make the Clipboard API deal in raw byte buffers a bit more
To open up for putting not just text/plain content on the clipboard,
let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
2020-09-05 16:16:01 +02:00
thankyouverycool
ebba297b42 Base: Move 16x16 common icons to /res/icons/16x16/
Drops the '16' suffix from filenames. Resizes inconsistent
audio-volume icons to intended size.
2020-08-27 15:38:02 +02:00
thankyouverycool
0359a5ce27 MenuApplets: Add a mini calendar to Clock applet 2020-08-22 11:54:30 +02:00
Andreas Kling
b36ac88349 ResourceGraph: Keep the graph inside the GUI::Frame rect
Part of the graph was hidden under the frame rect, which had the effect
of delaying the appearance of spikes (well, all changes really.)
2020-08-21 16:13:19 +02:00
Nico Weber
c0c7b4a098 Clock MenuApplet: Use Core::DateTime to simplify the code 2020-08-17 21:23:11 +02:00
Andreas Kling
a1e381a0f8 LibGUI: Move GUI::Model::Role to GUI::ModelRole
This is preparation for using ModelRole in the ModelIndex API.
2020-08-16 16:44:09 +02:00
Nico Weber
430b265cd4 AK: Rename KB, MB, GB to KiB, MiB, GiB
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9".
The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30".

Let's use the correct name, at least in code.

Only changes the name of the constants, no other behavior change.
2020-08-16 16:33:28 +02:00
Nico Weber
d5b2233f2e ResourceGraph: add tooltips to cpu and memory graphs
The tooltip doesn't update while it's visible.
2020-08-14 16:09:58 +02:00
Andreas Kling
8cf818e7c7 ResourceGraph.MenuApplet: Disown child processes after spawning 2020-08-04 18:17:16 +02:00
Andreas Kling
9e81b93ab9 Clock.MenuApplet: Disown child process after spawning 2020-08-04 18:17:16 +02:00
thankyouverycool
bbcdab2baa Base+MenuApplet: Add new controls and icons for AudioApplet
Adds a classic volume slider to the AudioApplet. Percent text
and mute state can now be toggled via checkboxes. Left click opens,
right click mutes. Updates existing icons and adds unique icons for
muted vs zero volume states.
2020-07-26 11:32:12 +02:00
Andreas Kling
299824de73 LibGUI: Rename GUI::Image => GUI::ImageWidget
"Image" was a bit too vague, "ImageWidget" is obviously a widget of
some sort.
2020-07-23 17:31:08 +02:00
Benoît Lormeau
0e172f8ed7 Base: rename audio volume icons with descriptive names 2020-07-21 19:02:25 +02:00
Benoît Lormeau
4916cfa3a3 AudioApplet: Scrolling the Audio applet will adjust the main mix volume
The Audio applet now dislays the main mix volume next to the speaker
icon. A click on the applet still mutes the global mixer. By scrolling
the mouse wheel while on the applet, you can decrease/increase the mixer
volume. Different icons will be painted depending on the volume and the
mute state.

Happy listening :^)
2020-07-21 19:02:25 +02:00
Nico Weber
9cc32d6e95 Userland+MenuApplets: Replace two more fork/exec with posix_spawn 2020-07-05 16:03:23 +02:00
Andreas Kling
1dd1595043 LibGUI: Make GUI::Application a Core::Object
Having this on the stack makes whole-program teardown iffy. Turning it
into a Core::Object allows anyone who needs it to extends its lifetime.
2020-07-04 14:05:57 +02:00
Nico Weber
12cbc4ad0d Everywhere: Replace some uses of fork/exec with posix_spawn
It's less code, and it's potentially more efficient once
posix_spawn is a real syscall.
2020-06-29 12:04:27 +02:00
Andreas Kling
d480944f6a ClipboardHistory: Use pledge() and unveil() :^) 2020-06-18 22:34:15 +02:00
Hüseyin ASLITÜRK
3a676c6fd2 ClipboardHistory: Replace IconWidget with GUI::Image 2020-06-18 16:35:57 +02:00
Matthew Olsson
e8e728454c AK: JsonParser improvements
- Parsing invalid JSON no longer asserts
    Instead of asserting when coming across malformed JSON,
    JsonParser::parse now returns an Optional<JsonValue>.
- Disallow trailing commas in JSON objects and arrays
- No longer parse 'undefined', as that is a purely JS thing
- No longer allow non-whitespace after anything consumed by the initial
  parse() call. Examples of things that were valid and no longer are:
    - undefineddfz
    - {"foo": 1}abcd
    - [1,2,3]4
- JsonObject.for_each_member now iterates in original insertion order
2020-06-13 12:43:22 +02:00
Sergey Bugaev
62d1ac63e8 MenuApplets: Fix using OwnPtr<> with RefCounted types 2020-06-12 16:08:45 +02:00
Andreas Kling
2adb0a07e5 LibGUI: Get rid of Model::ColumnMetadata and always use auto-sizing
Auto-sizing of view columns is now enabled by default. This removes the
last remaining need for ColumnMetadata, so this patch gets rid of it.
2020-05-21 19:55:44 +02:00
Andreas Kling
ff4eaa12b4 ClipboardHistory: Always place the applet at the same location :^) 2020-05-20 20:24:44 +02:00
Andreas Kling
21cfa9acd4 ResourceGraph: Add a thin frame around the graphs
Make the graph widgets into 1px GUI::Frames for a pleasant 90's feel.
2020-05-20 20:22:22 +02:00
Sergey Bugaev
f7ae66cee3 ClipboardHistory: Add a clipboard history applet :^)
It will listen for clipboard content changes in the backgroud. Once you click
on its icon, it will pop up a window listing all recorded clipboard contents.
You can then double-click on an item to copy it again.
2020-05-16 09:13:25 +02:00
Sergey Bugaev
450a2a0f9c Build: Switch to CMake :^)
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-14 20:15:18 +02:00
Ben Wiederhake
da837fe46e Meta: Fix Makefile permissions (not executable) 2020-05-03 14:24:08 +02:00
Linus Groh
54fc972a72 MenuApplets: Support memory usage and custom colors in ResourceGraph
The ResourceGraph menu applet now supports a few command line options:

--cpu / -C to display a CPU usage graph
--memory / -M to display a memory usage graph
--name / -n to set a name which is used to order applets
--color / -c to set the graph color (supports anything
Gfx::Color::from_string() understands)

The SystemServer.ini and WindowServer.ini config files have been updated
to spawn and show two ResourceGraph menu applets, one for CPU usage
(green) and one for memory usage (cyan) - this matches the colors in the
SystemMonitor graphs.
2020-04-11 10:03:12 +02:00
Linus Groh
b46a8d7335 MenuApplets: Rename CPUGraph to ResourceGraph
The plan is to extend what currently is known as "CPUGraph" and let the
SystemServer spawn multiple instances of it - which then can show memory
or network usages as well :^)

Simply renaming the applet is the first step.
2020-04-11 10:03:12 +02:00
AnotherTest
9ba9bba529 Clock menu applet: launch the new Calendar on click 2020-04-01 10:42:33 +02:00