Commit Graph

150 Commits

Author SHA1 Message Date
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
a17fbd98e7 LibGUI: Add input types to GMessageBox.
Currently the two available input types are:

- GMessageBox::InputType::OK (default)
- GMessageBox::InputType::OKCancel

Based on your choice, GMessageBox::exec() will return ExecOK or ExecCancel.
2019-07-16 21:41:13 +02:00
Andreas Kling
954a0b8efe AK: Add a canonicalized_path() convenience function.
This is the same as calling FileSystemPath(foo).string(). The majority of
clients only care about canonicalizing a path, so let's have an easy way
to express that.
2019-07-15 06:50:32 +02:00
Andreas Kling
c0742e4c23 FileManager: Remove use of copy_ref(). 2019-07-11 15:59:06 +02:00
Andreas Kling
7083a0104a LibGUI: Add GActionGroup, a way to group a bunch of GActions.
This can be used to make a bunch of actions mutually exclusive.
This patch only implements the exclusivity behavior for buttons.
2019-07-09 22:10:03 +02:00
VAN BOSSUYT Nicolas
802d4dcb6b Meta: Removed all gitignore in the source tree only keeping the root one 2019-06-30 10:41:26 +02:00
Lawrence Manning
f0a6b42066 Move common Application build steps into their own Makefile.common
Further consolidation is of course possible, eg the Games/ programs
follow the same rules more or less.
2019-06-25 21:35:50 +02:00
Andreas Kling
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling
39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Andreas Kling
fd604a7c68 Applications: Run clang-format on everything. 2019-06-07 11:48:03 +02:00
Robin Burchell
7bce096afd Take StringView in more places
We should work towards a pattern where we take StringView as function
arguments, and store String as member, to push the String construction
to the last possible moment.
2019-06-02 12:55:51 +02:00
Robin Burchell
0dc9af5f7e Add clang-format file
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Christopher Dumas
50154a23cb most apps now begin in the correct directory 2019-05-27 21:40:53 +02:00
Andreas Kling
b311257098 Applications: Let's put spaces in app names
"FileManager" => "File Manager"
"FontEditor" => "Font Editor"
"ProcessManager" => "Process Manager"
"TextEditor" => "Text Editor"
2019-05-27 13:52:28 +02:00
Christopher Dumas
00075b1c8a Added functionality to make back and forward buttons work in FileManager. Also
fixed it so that directories don't get double-opened (first when they are
opened, and second when the selection changes to match in the file tree view)
2019-05-24 00:24:28 +02:00
Andreas Kling
852d648912 Fix "make clean" not deleting app binaries. 2019-05-13 14:56:18 +02:00
Andreas Kling
1ab66e4d33 FileManager: Tweak layout spacing (new default looks weird here.)
This app needs a layout rethink, but for now I'm just fixing breakage.
2019-05-11 02:35:03 +02:00
Andreas Kling
fa232ac180 LibGUI: Remove GModel activations to GAbstractView.
Now you can hook activation via GAbstractView::on_activation.
The design still isn't quite right, we should eventually move the selection
away from the model somehow.
2019-05-09 04:56:52 +02:00
Andreas Kling
bd5c79aff2 LibGUI: Start working on a file picker dialog (GFilePicker).
Have LibGUI adopt GDirectoryModel from FileManager since it fits perfectly
for the needs of a file picker.
2019-05-09 01:24:37 +02:00
Andreas Kling
d4ac9e9a8a FileManager: When mkdir() fails, show the path we passed in the message. 2019-05-08 22:41:19 +02:00
Andreas Kling
de98b2770b GMessageBox: Add icons to message boxes with 3 standard ones to choose from. 2019-05-08 20:13:39 +02:00
Andreas Kling
8f81a3f9dd LibGUI+WindowServer: Make it possible to have checkable GActions.
They show up as checkable GButtons in GToolBar, and with (or without) check
marks in menus.

There are a bunch of places to make use of this. This patch only takes
advantage of it in the FileManager for the view type actions.
2019-04-26 21:09:56 +02:00
Andreas Kling
38e1e205a5 FileManager: Add a window icon. 2019-04-23 20:42:47 +02:00
Andreas Kling
57da00b731 Include Makefile.common in all other Makefiles. 2019-04-21 04:09:39 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00
Andreas Kling
301a269ca0 Get rid of SERENITY macro since the compiler already defines __serenity__
This makes it a bit easier to use AK templates out-of-tree.
2019-04-20 12:58:49 +02:00
Andreas Kling
d8e1545783 LibCore: Move LibGUI/GLock to LibCore/CLock. 2019-04-10 22:39:59 +02:00
Andreas Kling
5e0577a042 Introduce LibCore and move GElapsedTimer => CElapsedTimer.
I need a layer somewhere between AK (usable both by userspace and kernel)
and LibGUI (usable by userspace except WindowServer.) So here's LibCore.
2019-04-10 16:14:44 +02:00
Andreas Kling
4ab0cd5d4c LibGUI: Move frame painting from GFrame to StylePainter.
This way it can be used by others who might not have a GFrame object.
2019-04-10 03:43:46 +02:00
Andreas Kling
313ac51832 LibGUI: Turn GTextBox into a wrapper around a single-line GTextEditor. 2019-04-10 03:08:29 +02:00
Andreas Kling
f8a1d2746e FileManager: Rename DirectoryTableView => DirectoryView. 2019-04-02 14:43:56 +02:00
Andreas Kling
9538c06a45 LibGUI: Add a simple GSplitter container widget.
This allows you to put multiple widgets in a container and makes the space
in between them draggable to resize the two adjacent widgets.
2019-03-30 13:53:30 +01:00
Andreas Kling
f242d6e559 FileManager: Tweak look of thumbnailing progress bar.
Since it's inside a status bar, it looks a bit better when using a panel
shape with sunken shadow.
2019-03-30 13:12:59 +01:00
Andreas Kling
2c6a597d77 FileManager: Make the tree view follow the directory view navigations. 2019-03-30 03:27:25 +01:00
Andreas Kling
f10e0d0546 FileManager: Make the directory view follow the tree view selection. 2019-03-30 02:22:38 +01:00
Andreas Kling
6b72c62c5f GFileSystemModel: Add a "DirectoriesOnly" mode. 2019-03-29 17:14:03 +01:00
Andreas Kling
4d3c5fd83e LibGUI: Start working on a GFileSystemModel and hook that up in FileManager.
This is a read-only model for the tree view, at least initially. We'll see
where we take it from there once it's more polished.
2019-03-29 17:03:30 +01:00
Andreas Kling
474340b9cd GTreeView: A bunch of work on the tree view. 2019-03-29 14:46:53 +01:00
Andreas Kling
d02238af48 LibGUI: Expand GModelIndex a bit, adding internal data and model pointers.
This will be useful for implementing more complicated models.
2019-03-29 04:58:15 +01:00
Andreas Kling
add38b3981 GModel: Add GModelIndex argument to row_count() and column_count().
This is in preparation for supporting hierarchical models.
2019-03-29 03:27:03 +01:00
Andreas Kling
9d7a513681 GTextEditor: Keep tweaking the single-line look. 2019-03-29 01:57:29 +01:00
Andreas Kling
9fa21fa585 LibGUI: Add a GPainter class that inherits from Painter.
This gets rid of the last little piece of LibGUI knowledge in Painter.
2019-03-28 17:19:56 +01:00
Andreas Kling
b6c5bd3d28 FileManager: Add back/forward buttons (placeholders.) 2019-03-28 03:38:23 +01:00
Andreas Kling
670e376e27 Tweak the look of various UI surfaces and buttons. 2019-03-27 20:48:23 +01:00
Andreas Kling
23bb276fcd LibC: Run constructors on process startup.
Cooperate with the compiler to generate and execute the _init_array list
of constructor functions on userspace program statup. This took two days
to get working, my goodness. :^)
2019-03-27 12:48:21 +01:00
Andreas Kling
be604652ae LibGUI: Add GIcon::default_icon(name).
This is a convenience helper to instantiate a GIcon like so:

    auto icon = GIcon::default_icon("filetype-image");

This will give you the "filetype-image" icon in both 16x16 and 32x32 sizes.
2019-03-25 14:46:37 +01:00
Andreas Kling
500df578fe LibGUI+Kernel: Add a GLock class (userspace mutex.)
It's basically a userspace port of the kernel's Lock class.
Added gettid() and donate() syscalls to support the timeslice donation
feature we already enjoyed in the kernel.
2019-03-25 13:03:49 +01:00
Andreas Kling
614dafea32 FileManager+LibGUI: Show thumbnail generation progress in the statusbar. 2019-03-25 04:25:25 +01:00
Andreas Kling
1c67788933 FileManager: Don't use 32x32 thumbnails for the table view. 2019-03-25 02:16:47 +01:00
Andreas Kling
43f9027968 FileManager: Add toolbar buttons for switching the view mode. 2019-03-25 01:29:45 +01:00
Andreas Kling
900a3966e2 FileManager: Don't show "." and ".." in directory views. 2019-03-24 12:27:02 +01:00
Andreas Kling
86413a6f5a LibGUI+FileManager: Add a GIcon class to support multi-size icons.
A GIcon can contain any number of bitmaps internally, and will give you
the best fitting icon when you call bitmap_for_size().
2019-03-24 04:28:36 +01:00
Andreas Kling
812dc1e9ea FileManager: Add a very naive thumbnail generation thread.
This is pretty rickety since we don't have any synchronization primitives.
2019-03-24 03:00:08 +01:00
Andreas Kling
92627154a7 FileManager: Add basic thumbnailing of PNG images.
These use nearest neighbor and are computed synchronously on directory load
so it's neither fast nor very beautiful. These issues both need work on
other parts of the system to fix.
2019-03-23 12:37:33 +01:00
Andreas Kling
82ca3e58b8 FileManager: Make sure the status bar callback is hooked up. 2019-03-23 03:56:33 +01:00
Andreas Kling
19fa70c821 LibGUI: Add a GItemView class.
This is a GAbstractView subclass that implements a icon-based view onto
a GModel. It still need a bunch of work, but it's in basic usable shape.
2019-03-23 03:54:45 +01:00
Andreas Kling
994cf10b3e LibGUI: Rename GTableModel => GModel. 2019-03-23 01:42:49 +01:00
Andreas Kling
9d4b4c2689 FileManager: Add a default icon for image files. 2019-03-22 12:54:27 +01:00
Andreas Kling
5ca62f356b FileManager: Open PNG files with QuickShow when activated. 2019-03-22 12:43:29 +01:00
Andreas Kling
7c0a185970 Use the PNG loader for all images, and get rid of the .rgb files. 2019-03-22 00:21:03 +01:00
Andreas Kling
be4533717a FileManager: Add ability to create new directories. 2019-03-20 22:40:06 +01:00
Andreas Kling
1030e6b848 FileManager: Add a "Location:" label. 2019-03-20 22:01:02 +01:00
Andreas Kling
daa1dcb5e8 FileManager: Use a GTextEditor for the location bar + tweak icons. 2019-03-20 18:12:56 +01:00
Andreas Kling
f47945759b LibGUI: Make GTableModel a retainable object.
It became clear that this class needs to support multiple owners.
2019-03-20 03:27:07 +01:00
Andreas Kling
57ff293a51 LibGUI: Implement nested event loops to support dialog boxes.
This patch adds a simple GMessageBox that can run in a nested event loop.
Here's how you use it:

    GMessageBox box("Message text here", "Message window title");
    int result = box.exec();

The next step is to make the WindowServer respect the modality flag of
these windows and prevent interaction with other windows in the same
process until the modal window has been closed.
2019-03-19 00:01:02 +01:00
Andreas Kling
d466f2634d LibGUI: Add GTableModel::Role::ForegroundColor.
This makes it possible to specify the text color for each table cell.
Use this to make the IRCClient show unread window list items in red.
2019-03-18 04:54:07 +01:00
Andreas Kling
e14dd06b8c FileManager: Hook up a GSortingProxyTableModel so we get sorted files. :^)
The next step here is coming up with a nice way to always put directories
ahead of files.
2019-03-09 14:52:25 +01:00
Andreas Kling
46caa2663b LibGUI: Use a separate data role for the table model sorting order.
This allows data to be displayed nicely while sorting happens based on some
underlying raw data. :^)
2019-03-09 14:24:34 +01:00
Andreas Kling
35c6dceee0 FileManager: Don't crash if pressing Return with no selected item. 2019-03-08 16:02:00 +01:00
Andreas Kling
3ee0e82206 FileManager: Open non-executable files in TextEditor by default. 2019-03-07 14:43:12 +01:00
Andreas Kling
7df1121e1c LibGUI: GTableModel::data() should take a GModelIndex instead of int,int. 2019-03-06 19:56:47 +01:00
Andreas Kling
b0c673265a Applications: Map Alt+F4 to Quit in FileManager/ProcessManager/Terminal. 2019-03-03 02:52:22 +01:00
Andreas Kling
7c06431ff7 FileManager: Canonicalize paths when opening them. 2019-03-03 00:40:50 +01:00
Andreas Kling
d94abc4f81 FileManager+LibGUI: Add a simple location textbox.
The widget layout here is a bit off and needs work.
2019-03-03 00:34:40 +01:00
Andreas Kling
596a5ce5a4 LibGUI+WindowServer: Add app-global keyboard shortcuts.
This patch adds a GShortcut class. Each GAction can have a GShortcut which
will cause the event loop to listen for that key combination app-globally
and activate the event in case it's pressed.

The shortcut will also be displayed when the action is added to a menu.

Use this to hook up Alt+Up with the "open parent directory" action in the
FileManager app. :^)
2019-03-02 10:10:06 +01:00
Andreas Kling
5c0fca0a95 FileManager: Make the "open parent directory" action actually open ".." 2019-03-02 09:16:57 +01:00
Andreas Kling
e11c7a5df5 FileManager: Add "up to parent directory" action to toolbar.
It's not actually hooked up to anything yet, I just wanted to add
something more to the toolbar. :^)
2019-03-02 02:20:11 +01:00
Andreas Kling
0c8242dd71 FileManager: Show user/group names instead of UID/GID if available. 2019-03-02 02:05:49 +01:00
Andreas Kling
274b0260f7 Kernel: Don't send SIGCHLD to parent process if he has SA_NOCLDWAIT set.
Just transfer ownership of the dead process to the colonel and let the
scheduler reap it on next iteration.
2019-03-01 15:52:05 +01:00
Andreas Kling
5f4245789d FileManager: Allow launching processes by activating an executable file. 2019-03-01 14:57:42 +01:00
Andreas Kling
1ab995bfff FileManager: Keep the window title in sync with the current path. 2019-03-01 14:34:53 +01:00
Andreas Kling
ac8fb5da4c FileManager: Port to GTableModel/GTableView.
Replace the custom DirectoryView widget with a GTableView subclass.
This was pleasantly straightforward and it's so cool seeing the huge
increase in app quality from GTableView. :^)
2019-03-01 13:55:48 +01:00
Andreas Kling
3f29a12d90 More compat work. Rename libraries from LibFoo.a => libfoo.a
This makes it more straightforward to build a cross-compiler toolchain.
Also move math stuff from LibC to LibM.
2019-02-26 13:30:57 +01:00
Andreas Kling
51a3f20445 FileManager: Don't crash when clicking on a forbidden directory. 2019-02-26 00:59:37 +01:00
Andreas Kling
9624b54703 More moving towards using signed types.
I'm still feeling this out, but I am starting to like the general idea.
2019-02-25 22:06:55 +01:00
Andreas Kling
d7753c7c8d Move over to building all of userspace with i686-pc-serenity-g++. 2019-02-22 14:45:14 +01:00
Andreas Kling
75b100673f Switch over to building everything with i686-elf-g++. 2019-02-22 10:45:32 +01:00
Andreas Kling
0ca3112301 FileManager: Fix glitch in the alternating directory item backgrounds. 2019-02-20 22:10:28 +01:00
Andreas Kling
b704d3d295 LibGUI: Add a GToolBar class that can be populated with GActions.
The same action can be added to both a menu and a toolbar.
Use this to put a toolbar into FileManager. This is pretty neat. :^)
2019-02-20 02:39:46 +01:00
Andreas Kling
420b7bd55f FileManager: Add an icon for socket files. 2019-02-19 03:13:43 +01:00
Andreas Kling
9b71307d49 WindowServer: Support windows with alpha channels. And per-WSWindow opacity.
This patch also adds a Format concept to GraphicsBitmap. For now there are
only two formats: RGB32 and RGBA32. Windows with alpha channel have their
backing stores created in the RGBA32 format.

Use this to make Terminal windows semi-transparent for that comfy rice look.
There is one problem here, in that window compositing overdraw incurs
multiple passes of blending of the same pixels. This leads to a mismatch in
opacity which is obviously not good. I will work on this in a later patch.

The alpha blending is currently straight C++. It should be relatively easy
to optimize this using SSE instructions.

For now I'm just happy with the cute effect. :^)
2019-02-19 01:42:53 +01:00
Andreas Kling
8eedbbc9ca Prune compiler flags a bit. Let's go with -march=i686 for now. 2019-02-17 15:17:21 +01:00
Andreas Kling
4b15dd2bca LibGUI: Rename GEventLoop::exit() and GApplication::exit() to quit().
These functions don't exit immediately, but rather on the next iteration
of the event loop.

Since exit() is already used by the standard library, let's call it quit()
instead. That way, saying exit() means the same thing here as anywhere else.
2019-02-17 09:59:56 +01:00
Andreas Kling
df6aaaeeef Enable -Wimplicit-fallthrough. 2019-02-15 12:39:16 +01:00
Andreas Kling
f33f094483 FileManager: Add some menus. 2019-02-14 08:52:12 +01:00
Andreas Kling
3351f1ccc1 Port all apps to GApplication. 2019-02-11 14:56:23 +01:00
Andreas Kling
5f288014d4 WindowServer: More work on menus. 2019-02-11 10:08:54 +01:00
Andreas Kling
8313ce57dc LibGUI: Improve GScrollBar button look a bit.
The arrows look better when they're sharp. :^)
2019-02-10 11:57:19 +01:00
Andreas Kling
2def3d8d3f LibGUI: Start adding an automatic widget layout system.
My needs are really quite simple, so I'm just going to add what I need
as I go along. The first thing I needed was a simple box layout with
widgets being able to say whether they prefer fixed or fill for both
their vertical and horizontal sizes.

I also made a simple GStatusBar so FileManager can show how many bytes
worth of files are in the current directory.
2019-02-10 11:07:13 +01:00
Andreas Kling
2cf1dd5b6f Move apps into a top-level Applications/ directory. 2019-02-10 08:35:01 +01:00