Commit graph

34 commits

Author SHA1 Message Date
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
Linus Groh f1b596e75e Inspector: unveil("/bin", "r") so it can show app icons 2020-12-29 13:42:21 +01:00
Paul Scharnofske d94f674bbb
Use new format functions in remaining DevTools. (#3755)
* AK: Add formatter for JsonValue.

* Inspector: Use new format functions.

* Profiler: Use new format functions.

* UserspaceEmulator: Use new format functions.
2020-10-13 18:34:27 +02:00
Andreas Kling 9bcc168b9b Inspector: Move everything into the Inspector namespace 2020-09-25 21:18:41 +02:00
Linus Groh 2e5c434e22 Misc: Use automatic window positioning in more applications
This is a follow up to #2936 / d3e3b4ae56.

Affected programs:
- Applications: Browser (Download, View source, Inspect DOM tree, JS
  console), Terminal (Settings)
- Demos: Cube, Eyes, Fire, HelloWorld, LibGfxDemo, WebView,
  WidgetGallery
- DevTools: HackStudio, Inspector, Profiler
- Games: 2048, Minesweeper, Snake, Solitaire
- Userland: test-web

A few have been left out where manual positioning is done on purpose,
e.g. ClipboardManager (to be close to the menu bar) or VisualBuilder (to
preserve alignment of the multiple application windows).
2020-08-15 17:38:19 +02:00
Nico Weber 8126104a03 Inspector: Require horizontal scrollbars less often
Make the window a bit larger, and give the left pane a Fixed
size policy, so that it takes up less than half the window.
2020-08-14 10:29:01 +02:00
thankyouverycool 8248c74d88 DevTools: Let Inspector use ProcessChooser and new icons.
Inspector now opens ProcessChooser when no PID is supplied.
2020-07-28 16:29:36 +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
AnotherTest 7b72001667 Inspector: Expand and show properties in a TreeView
This allows the inspector to show arbitrary json structures.
2020-07-01 11:18:19 +02:00
Andreas Kling fdfda6dec2 AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature:

- int StringType::to_int(bool& ok) const

And replace it with sensible new signature:

- Optional<int> StringType::to_int() const
2020-06-12 21:28:55 +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
Tibor Nagy f347dd5c5e Applications: Use "Document - AppName" window title format
Fixes #1444
2020-03-13 23:30:12 +01:00
Andreas Kling af29dff224 Inspector: Use pledge() and unveil() 2020-03-06 09:23:07 +01:00
Andreas Kling 6d66462254 Inspector: Store remote object addresses as uintptr_t instead of String 2020-03-05 16:31:03 +01:00
Andreas Kling b2be8466fb Inspector: Make properties editable :^)
This patch makes it possible to live-edit remote object properties by
simply double clicking on them in the property table view.

This is pretty neat! :^)
2020-03-05 15:50:22 +01:00
Andreas Kling e23c5b7e83 LibGUI+Inspector: Highlight the currently remotely inspected widget
This patch adds a magenta rectangle around the currently inspected
widget. This allows you to browse an app's widget tree somewhat
visually using the Inspector. :^)
2020-03-05 14:42:05 +01:00
Andreas Kling 028c011760 LibCore: Make Core::Object::add<ChildType> return a ChildType&
Since the returned object is now owned by the callee object, we can
simply vend a ChildType&. This allows us to use "." instead of "->"
at the call site, which is quite nice. :^)
2020-03-04 21:04:06 +01:00
Andreas Kling 0f3e57a6fb LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients 2020-03-04 14:26:16 +01:00
Andreas Kling 4697195645 LibGUI: Use set_layout<LayoutType>() in lots of client code 2020-03-04 13:49:48 +01:00
Andreas Kling 4ce28c32d1 Inspector: Use Core::Object::add() 2020-02-23 12:27:53 +01:00
Andreas Kling 6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Andreas Kling 799b0a4fa8 LibGUI: Rename {H,V}BoxLayout => {Horizontal,Vertical}BoxLayout 2020-02-06 14:44:13 +01:00
Andreas Kling 6a71ba1deb LibGUI: Add HorizontalSplitter and VerticalSplitter convenience classes 2020-02-06 14:40:59 +01:00
Andreas Kling c5bd9d4ed1 LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
2020-02-02 15:15:33 +01:00
Andreas Kling d67da8c101 LibGUI: Add GHBoxLayout and GVBoxLayout convenience classes 2020-02-02 15:09:48 +01:00
Andreas Kling 94ca55cefd Meta: Add license header to source files
As suggested by Joshua, this commit adds the 2-clause BSD license as a
comment block to the top of every source file.

For the first pass, I've just added myself for simplicity. I encourage
everyone to add themselves as copyright holders of any file they've
added or modified in some significant way. If I've added myself in
error somewhere, feel free to replace it with the appropriate copyright
holder instead.

Going forward, all new source files should include a license header.
2020-01-18 09:45:54 +01:00
Andreas Kling 7584480f62 LibGUI: Convert GWindow to ObjectPtr 2019-09-21 18:34:06 +02:00
Andreas Kling ff6ce422dd LibGUI: Convert GWidget to ObjectPtr 2019-09-21 17:05:35 +02:00
Andreas Kling 4f4438c04c LibGUI: Convert GSplitter to ObjectPtr 2019-09-21 16:11:02 +02:00
Andreas Kling efb8f9d538 LibGUI: Convert GTreeView to ObjectPtr 2019-09-21 16:06:43 +02:00
Andreas Kling e7b55037f4 LibGUI: Convert GTableView to ObjectPtr 2019-09-21 16:03:59 +02:00
Andreas Kling f89944e804 Inspector+LibCore+rpcdump: Rework the RPC stuff to be request/response
RPC clients now send JSON-encoded requests to the RPC server.
The connection also stays alive instead of disconnecting automatically
after the initial CObject graph dump.

JSON payloads are preceded by a single host-order encoded 32-bit int
containing the length of the payload.

So far, we have three RPC commands:

    - Identify
    - GetAllObjects
    - Disconnect

We'll be adding more of these as we go along. :^)
2019-09-11 21:19:23 +02:00
Andreas Kling 4f3234148a Inspector: Show remote object properties in a table view
This patch expands the object model of this program quite a bit.
We now have a RemoteProcess object that contains a list of remote root
RemoteObject objects.

The RemoteProcess vends a RemoteObjectGraphModel&, and indices in that
model have internal_data() pointing to a corresponding RemoteObject.
RemoteObjects in turn vend a RemoteObjectPropertyModel&, which is what
we use to show the object properties.

This is pretty cool :^)
2019-08-19 20:29:52 +02:00
Andreas Kling 05cd178477 Inspector: Add a GUI tool for viewing a remote process's CObject graph
Here comes the foundation for a neat remote debugging tool.

Right now, it connects to a remote process's CEventLoop RPC socket and
retreives the remote object graph JSON dump. The remote object graph
is then reconstructed and exposed through a GModel subclass, which is
then displayed in a GTreeView.

It's pretty cool, I think. :^)
2019-08-18 10:19:13 +02:00