Commit Graph

75 Commits

Author SHA1 Message Date
Andreas Kling
6e50631e35 LibGUI: Add GJsonArrayModel, a simple JSON-data-file-as-GModel helper
This makes it very easy to expose JSON files as GModels. :^)
2019-08-10 10:29:46 +02:00
Andreas Kling
0a061d4314 GLabel: Repaint immediately on icon change 2019-08-09 23:48:44 +02:00
Andreas Kling
db6ed8eebd GFilePicker: Make double-clicking actually choose/pick the file
..unless it's a directory, in which case we navigate into the directory
instead, as you would expect.
2019-08-09 23:45:04 +02:00
Andreas Kling
b5525d4ec3 GTableView: Add a mode for automatically sizing column to fit content
You can now call GTableView::set_size_columns_to_fit_content(true) and
the table columns will grow to fit the content. They will never shrink,
only grow.

This means I can spend a lot less time fidgeting with column widths :^)
2019-08-09 19:30:24 +02:00
Andreas Kling
899366da9d GTableView: Debug-log the current column width while resizing
This makes it easier to decide on a good initial width for a column.
2019-08-08 20:41:24 +02:00
Andreas Kling
fdcaf2d2b5 GComboBox: Make set_only_allow_values_from_model() actually take effect 2019-08-05 18:52:29 +02:00
Andreas Kling
6311a617be GComboBox: Include the selected index with the on_change notification
This will be useful for clients that need to fetch additional data from
the model on selection change.
2019-08-05 18:42:51 +02:00
Andreas Kling
ffff150435 LibGUI: Allow specifying the model column for GListView and GComboBox
These widgets can only display a single column from the underlying data
model, and it was previously hard-coded to use column 0. Now you can
use any column you like.
2019-08-05 18:32:04 +02:00
Andreas Kling
7c0f9ea2b9 GComboBox: Constrain the list popup window height to the desktop rect
This looks much better than allowing it to extend past the bottom of
the screen. :^)
2019-08-05 18:31:13 +02:00
Andreas Kling
47511b5930 GWidget: Implement set_backcolor() and set_forecolor()
These are set-color-from-string variants used by the VisualBuilder's
code generator.
2019-08-03 11:35:10 +02:00
Andreas Kling
54c77cb714 GVariant: Try to do color string parsing in GVariant::to_color()
If the underlying variant type is a String, try to parse out a color
when to_color() is called.

This makes VisualBuilder apply the saved colors when loading forms.
2019-08-03 11:34:02 +02:00
rhin123
c02868f000 LibGUI: Allow setting window icon before show(). 2019-08-02 21:18:21 +02:00
Andreas Kling
673a98258b GDirectoryModel: Fix redundant identical comparison.
Found by PVS-Studio.
2019-08-01 14:01:37 +02:00
Andreas Kling
db5a4c3409 GDirectoryModel: Tweak default width of permission bits column
Now that GTableView elides text content by default, this column was a
little too wide and ended up getting elided sometimes.
2019-07-31 21:21:20 +02:00
Andreas Kling
df51014834 GTableView: Elide cell content so it doesn't overflow the cell rect
I originally thought I'd have to implement text clipping in Painter for
this, but it seems like I can get away without doing that today. :^)

Fixes #390.
2019-07-31 21:18:01 +02:00
Conrad Pankoff
6b5fbad250 LibGUI: Simplify GTreeView ancestor traversal 2019-07-31 16:38:10 +02:00
Conrad Pankoff
9b6e99f17e LibGUI: Reify intermediate nodes during index traversal
In the event where you want to find the index of a deeply-nested path
with a GFileSystemModel that hasn't yet traversed most of that path, it
is possible for a false negative failure to occur. This failure is
caused by the GFileSystemModel incorrectly bailing out of the search
when it hits the first unseen path segment that is not at the very end
of the path.

This patch fixes this problem by reifying the intermediate nodes during
that search and traversal process.
2019-07-31 16:33:21 +02:00
Andreas Kling
993ab84a0d GDirectoryModel: Add "modification time" column.
Fixes #373.
2019-07-31 07:09:35 +02:00
Andreas Kling
10b4c92e21 GVariant: Add Type::UnsignedInt. 2019-07-31 07:07:59 +02:00
Andreas Kling
34db7067fa GDirectoryModel: Shrink the Permissions and Inode columns a little bit. 2019-07-31 06:50:01 +02:00
rhin123
c869d62e16 GFilePicker: Edit file name on opening window
Overlooked that you can't have two GWidgets
selected at the same time, whoops!
2019-07-30 09:19:14 +02:00
rhin123
a175e76948 TextEditor: Include extension during SaveAs
When we save-as in the text editor we now auto-populate GFilePicker /w
the current name & extension.
2019-07-29 20:46:31 +02:00
Andreas Kling
5ded77df39 Kernel+ProcessManager: Let processes have an icon and show it in the table.
Processes can now have an icon assigned, which is essentially a 16x16 RGBA32
bitmap exposed as a shared buffer ID.

You set the icon ID by calling set_process_icon(int) and the icon ID will be
exposed through /proc/all.

To make this work, I added a mechanism for making shared buffers globally
accessible. For safety reasons, each app seals the icon buffer before making
it global.

Right now the first call to GWindow::set_icon() is what determines the
process icon. We'll probably change this in the future. :^)
2019-07-29 07:26:01 +02:00
Rhin
731f91f1ab GFilePicker: Quality of life improvements (#370)
Added:
- Default to home directory on open.
- Save button focus.
- Correct title for the mode were in.
- Home directory shortcut.
2019-07-28 20:04:57 +02:00
Andreas Kling
7f82e86fb8 GTabWidget: Allow putting the tabs on the bottom of the widget.
They're still painted as if they are top tabs, but the subwidget placement
logic is all there.
2019-07-28 17:43:51 +02:00
Andreas Kling
d4892b3fdc WindowServer+LibGUI: Remove old "icon path" way of doing things.
Now that we can set icons directly "by bitmap", there's no need for passing
around the icon paths anymore, so get rid of all the IPC and API related
to that. :^)
2019-07-28 10:24:58 +02:00
Andreas Kling
841b2e5d13 WindowServer+LibGUI: Pass window icons as shared buffers rather than paths.
Now that we support more than 2 clients per shared buffer, we can use them
for window icons. I didn't do that previously since it would have made the
Taskbar process unable to access the icons.

This opens up some nice possibilities for programmatically generated icons.
2019-07-28 10:18:49 +02:00
Andreas Kling
b98c77229d TextEditor: Let's have line numbers starting at 1.
Thanks to Dan for pointing this out on IRC:

<danboid> I see TextEditor still numbers its lines from 0. You're too much of a programmer sometimes kling! :)
<  kling> that might be the most extreme form of "programmer design" I've seen in serenity
2019-07-27 21:20:38 +02:00
Andreas Kling
7cd2e739f2 LibDraw: Tweak the hover highlight color.
It was a tad too bright. Also make sure we're using the same color in
all the different places. At some point it would be nice to improve global
color settings, etc.
2019-07-27 11:16:10 +02:00
Andreas Kling
f1af5f26eb GSplitter: Explicitly set the size policies when resizing.
If we don't have the fixed size policy for the first resizee, the layout
system will just ignore the preferred sizes that we're giving it.
2019-07-27 09:36:21 +02:00
Andreas Kling
2b02deef28 GWidget: Remove unused is_widget() virtual.
This is implemented as a bool member in CObject, not a virtual.
2019-07-27 09:35:07 +02:00
Andreas Kling
7dc7f11ed8 GWidget: Add set_size_policy(Orientation, Policy).
This allows you to set the policy for a single orientation rather than
both at the same time.
2019-07-27 09:34:28 +02:00
Andreas Kling
d7ff2c5b86 LibGUI: GDialog should close its nested event loop on window close.
Make GWindow::close() so we can override it in GDialog and quit from the
internal event loop when the window manager tells us to close ourselves.

The dialog will return GDialog::ExecCancel in these situations.
2019-07-26 16:13:59 +02:00
Andreas Kling
a599317624 LibCore: Introduce a C_OBJECT macro.
This macro goes at the top of every CObject-derived class like so:

class SomeClass : public CObject {
    C_OBJECT(SomeClass)
public:
    ...

At the moment, all it does is create an override for the class_name() getter
but in the future this will be used to automatically insert member functions
into these classes.
2019-07-25 19:49:28 +02:00
Andreas Kling
1d0b464618 AK: Make HashMap::get(Key) return an Optional<Value>.
This allows HashMap::get() to be used for value types that cannot be default
constructed (e.g NonnullOwnPtr.)
2019-07-24 10:25:43 +02:00
Andreas Kling
2196f17c10 LibGUI: Convert Vector<OwnPtr> to NonnullOwnPtrVector.
This is turning out really nice so far. :^)
2019-07-24 09:13:06 +02:00
Andreas Kling
93489fbc4c Convert HashMap<Key, OwnPtr<T>> to HashMap<Key, NonnullOwnPtr<T>>.
In every case I found, we never wanted to support null entry values.
With NonnullOwnPtr, we can encode that at the type level. :^)
2019-07-24 08:42:55 +02:00
Andreas Kling
356babaf96 LibGUI: Destroy tooltip windows when they are not used.
Cached tooltip windows were preventing the automatic event loop shutdown.
It's not like we were gaining much by caching these anyway, since we only
cached the GWindow, not anything on the WindowServer side.
2019-07-23 20:51:08 +02:00
Andreas Kling
72a3f69df7 LibGUI: Get rid of GWindow::should_exit_event_loop_on_close().
This behavior and API was extremely counter-intuitive since our default
behavior was for applications to never exit after you close all of their
windows.

Now that we exit the event loop by default when the very last GWindow is
deleted, we don't have to worry about this.
2019-07-23 18:20:00 +02:00
Andreas Kling
fbae03b737 LibGUI: Exit the main event loop when the last window is deleted.
This behavior is the new opt-out default. If you don't want your app to exit
when the last GWindow is destroyed, call this:

    - void GApplication::set_quit_set_quit_when_last_window_deleted(bool)

Also renamed "windows()" to "reified_windows" in GWindow.cpp to reflect that
it only contains GWindows that have a server-side representation. :^)
2019-07-23 18:16:25 +02:00
Andreas Kling
b312215d33 GDirectoryModel: Don't forget to drain the watch descriptor. 2019-07-22 20:12:35 +02:00
Andreas Kling
1511cac715 GDirectoryModel: Automagically update on filesystem changes.
Use the new watch_file() mechanism to monitor the currently open directory
for changes and refresh the model when notified. This makes FileManager
automagically show newly added files. :^)
2019-07-22 20:08:25 +02:00
Andreas Kling
0ef13e60b0 Libraries: Fix wrong paths to "Root" in the various install.sh scripts.
We were installing libraries into /Libraries/Root, rather than in /Root.
This made the ports system behave rather unpredictable, since I had old
versions of things in /Root and new versions of things in /Libraries/Root.
2019-07-21 21:38:30 +02:00
Andreas Kling
c7ea94697e Libraries: Remove unused "install" targets.
We've been using a per-directory "install.sh" for some time, so let's get
rid of the old way of doing things.
2019-07-21 21:28:48 +02:00
Andreas Kling
aa2224a2f0 GWidget: Add set_preferred_size(width, height) overload.
It was annoying to always write set_preferred_size({ width, height }). :^)
2019-07-20 22:39:24 +02:00
Andreas Kling
5b440a72f9 GSplitter: Implement using the orientation-based geometry helpers. 2019-07-20 22:17:46 +02:00
Andreas Kling
c59b053ad6 GSlider: Add support for vertical sliders.
You now have to pass an Orientation to the GSlider constructor. It's not
possible to change the orientation after construction.

Added some vertical GSliders to the WidgetGallery demo for testing. :^)
2019-07-20 19:32:12 +02:00
Andreas Kling
26e252b0f8 LibDraw: Move the Orientation enum to its own LibDraw header file. 2019-07-20 19:32:12 +02:00
rhin123
598715d4cc GFilePicker: OKCancel MsgBox for overwriting files
Allow the user to Overwrite/Cancel when writing to an existing file.
2019-07-18 21:04:02 +02:00
Andreas Kling
1c0669f010 LibDraw: Introduce (formerly known as SharedGraphics.)
Instead of LibGUI and WindowServer building their own copies of the drawing
and graphics code, let's it in a separate LibDraw library.

This avoids building the code twice, and will encourage better separation
of concerns. :^)
2019-07-18 10:18:16 +02:00