Commit Graph

628 Commits

Author SHA1 Message Date
Andreas Kling
75eb84c7e4 IRCClient: Size columns to-fit in the window and member views 2019-09-04 19:07:59 +02:00
Andreas Kling
e12bbc097f IRCClient: Add 16x16 icon 2019-09-04 18:56:39 +02:00
Andreas Kling
52f62c2d7e IRCClient: Tweak UI to look less padding-bloated 2019-09-04 18:54:43 +02:00
Andreas Kling
2216c7ecc6 IRCClient: Make the auto-join on connect feature actually do something 2019-09-04 17:37:11 +02:00
Andreas Kling
9cb4e5ac81 IRCClient: Don't auto-open new queries for NOTICE or CTCP messages
This seems to match what other IRC clients do, and it means we don't
get three separate "server" windows when connecting to Freenode. :^)
2019-09-03 21:47:43 +02:00
Andreas Kling
5c7ef5977d IRCClient: Handle incoming CTCP requests VERSION and PING
CTCP requests are client-to-client messages that are sent as either
PRIVMSG (for requests) or NOTICE (for responses) and wrapped in ASCII
character 0x01 on both sides.

This patch implements responding to the very common VERSION and PING
requests. We always get a VERSION request from freenode when connecting
there, for instance. :^)
2019-09-03 21:18:28 +02:00
Andreas Kling
841f1276e6 TextEditor: Use GAboutDialog :^) 2019-09-02 19:48:47 +02:00
Andreas Kling
aea6a28e9c Terminal: Use GAboutDialog :^) 2019-09-02 19:46:35 +02:00
Conrad Pankoff
1f56612c8a Terminal: Add -e (execute) command line option
This allows a user to specify a command to run after opening the terminal
program. By default it will still spawn an interactive shell.
2019-09-02 08:33:36 +02:00
Andreas Kling
cfe09784a4 TextEditor: Clear the dirty flag in newly opened documents 2019-08-29 18:54:06 +02:00
Andreas Kling
a71e411b27 Terminal: Use a gear icon for the "Settings" menu 2019-08-29 18:19:40 +02:00
Andreas Kling
72950f93a3 TextEditor: Move the Font menu inside the View menu
This will be our first user of the nested menus feature. :^)
2019-08-29 06:36:35 +02:00
Andreas Kling
b1763238d7 TextEditor: Ask the user before closing a dirty (modified) document
It's a little unfortunate that we have two separate code paths that can
lead to asking the user about this. Longer-term we should find a way to
unify these things.

Fixes #491.
2019-08-27 20:39:01 +02:00
Andreas Kling
ecbedda34c TextEditor: Add a "document dirty" flag and show it in the window title
This lets you know if the document has been modified since last save.
2019-08-27 20:18:19 +02:00
Andreas Kling
07933d0b46 TextEditor: Let's enable line wrapping by default 2019-08-27 17:05:01 +02:00
Andreas Kling
b6de723eb3 TextEditor: Move line wrapping setting to a new "View" menu 2019-08-27 17:01:52 +02:00
Andreas Kling
b0b94560c3 FileManager: Add "go home" action to the "Go" menu 2019-08-26 21:20:39 +02:00
Andreas Kling
08d7c86e90 FileManager: Move "File" menu entries to the app menu 2019-08-26 19:18:54 +02:00
Andreas Kling
cef2c04952 TextEditor: Move all "File" menu entries into the app menu instead
It felt weird to have both the app menu *and* a "File" menu.
2019-08-26 17:59:05 +02:00
Sergey Bugaev
d91efd4cd0 Piano: Port threading to LibThread 2019-08-26 11:31:14 +02:00
Sergey Bugaev
e1a6f8a27d LibThread: Introduce a new threading library
This library is meant to provide C++-style wrappers over lower
level APIs such as syscalls and pthread_* functions, as well as
utilities for easily running pieces of logic on different
threads.
2019-08-26 11:31:14 +02:00
Andreas Kling
d5f3487203 TextEditor: Select everything in the find textbox when pressing Ctrl+F
This allows you to press Ctrl+F and immediately start typing a new
search string, instead of having to remove the old one first. :^)
2019-08-25 21:46:39 +02:00
Andreas Kling
e8e8741c88 LibGUI+TextEditor: Make GButton activate its action if present
Previously even if you assigned a GAction to a GButton, you still had
to activate() the action manually by hooking the GButton::on_click
callback.
2019-08-25 21:46:39 +02:00
Andreas Kling
ded005500d TextEditor: Add actions for find next/previous (Ctrl+G, Ctrl+Shift+G) 2019-08-25 21:46:39 +02:00
Andreas Kling
d88c40568f TextEditor: Add search-related actions to the text editor context menu
Using the new GTextEditor::add_custom_context_menu_action() mechanism.

Fixes #478.
2019-08-25 21:46:28 +02:00
rhin123
0df7213670 Terminal: Fixed bounding issue when clearing the selection on type
We were checking the columns of the whole selection instead of the
the specfic line were modifying. Because of this, the selection
remained if the selection's column on another line was less than
the cursor.
2019-08-25 19:53:57 +02:00
Andreas Kling
97a695403b TextEditor: Add a menu action for turning line-wrapping on/off 2019-08-25 12:23:34 +02:00
rhin123
280a9a2f34 Terminal: Clear selection if we type behind/inside it 2019-08-25 10:44:31 +02:00
Andrew Weller
e75e33eb46 TextEditor: Replaced 'Find' button with 'Prev' and 'Next' buttons. 2019-08-24 21:57:42 +02:00
Andreas Kling
b1bc7a1b5d TextEditor: Don't try to load contents of files we didn't even open
If the CFile::open() call fails, we shouldn't continue with trying to
load the file.
2019-08-23 19:11:56 +02:00
Andreas Kling
d56786ccd8 TextEditor: Avoid an unnecessary whole-file copy when opening something
This was left over from before we had the StringView(const ByteBuffer&)
constructor to help us.
2019-08-23 19:05:34 +02:00
Andreas Kling
1ca6adee90 Terminal: Allow selecting words by double-clicking them
Bonus feature: also allow selecting the whitespace in-between words by
double-clicking that. :^)
2019-08-22 19:59:27 +02:00
Andreas Kling
fae379b1f0 TextEditor: Search box should find on return, close itself on escape
This patch adds basic keyboard access to the search box. We also yield
focus back gracefully to the text document when the search box is no
longer wanted.

Focus should probably move automatically when an ancestor of the
currently focused widget if made invisible..
2019-08-22 11:11:48 +02:00
Andreas Kling
96c5c9ce12 TextEditor: Hide the search bar until the user asks for it
You can get to it via Edit/Find, or by pressing Ctrl+F.
2019-08-22 11:02:03 +02:00
Andreas Kling
bb74832dd6 TextEditor: Add a search bar that allows you to search for text
If the text is not found, we show a friendly message box that says we
didn't find the text! :^)
2019-08-21 21:30:20 +02:00
Andreas Kling
c106ec4719 Terminal: Allow scrolling through terminal history with the mouse wheel
Fixes #470.
2019-08-20 20:12:31 +02:00
Andreas Kling
076827a05d GModel: Rename on_model_update(GModel&) => on_update()
Just simplifying the API of this hook a little bit.
2019-08-20 19:45:08 +02:00
Andreas Kling
f7dce05c82 LibGUI: Remove confusing GModelNotification concept
This was a bad idea and it didn't stick. Instead we should just use the
simple "on_foo" hook functions like we do for everything else. :^)
2019-08-20 19:44:02 +02:00
Andreas Kling
64f16c141d Terminal: Implement basic history scrollback
This code needs some optimization work to reduce the amount of repaints
but the history feature basically works, which is cool :^)

Fixes #431.
2019-08-19 19:15:36 +02:00
Sergey Bugaev
ccdeafdefb SystemMonitor: Add a devices tab
This tab combines info from /proc/devices with device file paths from /dev.
2019-08-18 15:59:59 +02:00
Andreas Kling
d92ba85689 Terminal: Mark window as alpha-less when starting up with 100% opacity
WindowServer was led to believe that the Terminal window had an alpha
channel that had to be respected by the compositor. This caused us to
always consider it as non-opaque when culling dirty rects in compose.
2019-08-15 15:30:11 +02:00
Andreas Kling
e0395d5ebe SystemMonitor: Paint the "used" disk space column as a progress bar
This needs to be applied consistently in the rest of this UI, but here
is a start. I can't figure out what the right look should be right now
so I'm just gonna commit it this way and we'll work it out later. :^)
2019-08-14 20:38:18 +02:00
Sergey Bugaev
f6fe56d011 SystemMonitor: Add a PCI devices tab
This is essentially a graphical version of the lspci command.
2019-08-14 14:28:45 +02:00
Sergey Bugaev
cbdda91065 ProcessManager: Rename it to SystemMonitor
This is a more appropriate name now that it does a lot
more than just manage processes ^)
2019-08-14 14:28:45 +02:00
Andreas Kling
7cc9a18c39 Terminal: Only repaint the lines that actually changed
This optimization was broken since who-knows-when. Now we once again do
our best to only repaint the lines that had the "dirty" flag set.

This dramatically reduces the amount of work done by an idle Terminal
since the cursor blinking won't redraw the whole window anymore. :^)
2019-08-13 13:57:04 +02:00
Andreas Kling
ce6463ba76 Terminal: Clip to the paint event rect
We should try to avoid painting any more than what we're asked to.
2019-08-13 13:45:58 +02:00
Andreas Kling
178788f19a Terminal: Rename Terminal => TerminalWidget
This makes it a bit less confusing which is what between TerminalWidget
and VT::Terminal.
2019-08-13 13:45:48 +02:00
Andreas Kling
4fb02c78a9 LibVT: Rename VT::BufferPosition to VT::Position and move to own file 2019-08-13 12:56:10 +02:00
Andreas Kling
b24b111298 LibVT: Factor out terminal emulation from Terminal to make it reusable
Now that we're bringing back the in-kernel virtual console, we should
move towards having a single implementation of terminal emulation.

This patch rips out the emulation code from the Terminal application
and turns it into the beginnings of LibVT.

The basic design idea is that users of VT::Terminal will implement and
provide a VT::TerminalClient subclass to handle presentation-specific
things. We'll need to iterate on this, but it's a start. :^)
2019-08-12 17:34:48 +02:00
Andreas Kling
8faeead753 ProcessManager: Hook the sort order for the file systems JSON model
..and install a GSortingProxyModel on the view. This allows you to sort
the filesystems by used space etc *numerically*. :^)
2019-08-12 11:56:30 +02:00
Andreas Kling
b07a315736 ProcessManager: Add "File systems" tab with info on mounted filesystems
This was rather nice and easy to add with the new GJsonArrayModel! :^)
2019-08-11 10:11:21 +02:00
Andreas Kling
ee83b1bcf4 LibCore: Use URL in CHttpRequest
Now there's just CHttpRequest::set_url(URL), no need to specify the
host, port and path manually anymore.

Updated ChanViewer and Downloader for the API change.
2019-08-10 19:32:03 +02:00
Andreas Kling
aaccf6ee4e ProcessManager: Use a GJsonArrayModel for the process memory maps 2019-08-10 16:08:51 +02:00
Andreas Kling
afd25679bc GJsonArrayModel: Support fields that aren't tied to a single JSON value
Change the custom data massaging callback to take a const JsonObject&.
This will allow binding together data from multiple fields into one
output in the model. :^)
2019-08-10 15:06:29 +02:00
Andreas Kling
2eead3dfc0 ProcessManager: Use a GJsonArrayModel for the process file desciptors 2019-08-10 11:07:55 +02:00
Andreas Kling
078ce97c41 GJsonArrayModel: Add an optional "massage_for_display" fieldspec hook
This allows to you install a custom callback that can do anything with
Role::Display data before it's returned by GJsonArrayModel::data().
2019-08-10 11:06:29 +02:00
Andreas Kling
0f0a528323 ProcessManager: Remove SocketModel and NetworkAdapterModel
These are trivially replaced by GJsonArrayModels :^)
2019-08-10 10:36:07 +02:00
Sergey Bugaev
ccb482d1a7 Calculator: Add a simple calculator app
Closes https://github.com/SerenityOS/serenity/issues/319
2019-08-10 08:46:22 +02:00
Andreas Kling
2c947a2c97 ProcessManager: Enable automatic column sizing for all table views
Start making use of the neat new mode in GTableView.
2019-08-09 19:32:09 +02:00
Sergey Bugaev
84a54c7cf7 ProcFS: Make a new nifty /proc/net directory
And move /proc/netadapters and /proc/net_tcp there. Now they're
/proc/net/adapters and /proc/net/tcp respectively, with more to come ^)
2019-08-09 13:15:59 +02:00
Andreas Kling
d6bce37756 ProcessManager: Add a "Network" tab with live adapter and socket stats
This fetches info from /proc/netadapters and /proc/net_tcp, updating
every second. Very cool. :^)
2019-08-08 20:43:30 +02:00
Andreas Kling
eb3c19773e ProcessManager: Tweak memory stats widget layout to fit more text
After a while, the kmalloc/kfree counts got too wide for the label.
2019-08-08 19:50:33 +02:00
Andreas Kling
351c354680 ChanViewer: Show "" instead of "undefined" for missing thread subjects
This broke due to a change in JsonValue API. JsonValue::to_string() now
returns the value serialized to a string, which may become "undefined".

You kinda want JsonValue::as_string(), but that is only callable when
the JsonValue *is* a string. Thankfully there is now as_string_or(alt).
2019-08-07 22:05:04 +02:00
Sergey Bugaev
9de48cd81a Terminal: Fix trying to free() a stack variable
GWindow::~GWindow() deletes the main widget, assuming it was
allocated with new; this is what all other applications do,
so heap-allocate the terminal widget as well even though it's
not necessary in this case.
2019-08-06 11:59:14 +02:00
Andreas Kling
cd08c8e1bf ChanViewer: Add a status bar to show loading status
Also update the window title with the current board after loading. :^)
2019-08-05 18:54:44 +02:00
Andreas Kling
7a63277115 ChanViewer: Fetch the list of boards and allow switching the board
We put the list of boards in a combo box and allow the user to switch
boards that way. :^)
2019-08-05 18:43:36 +02:00
Andreas Kling
a416390622 ChanViewer: Show thread subjects in the catalog view 2019-08-05 07:00:06 +02:00
Andreas Kling
103c2749ce ChanViewer: If catalog download fails, don't try to parse response JSON 2019-08-04 22:11:50 +02:00
Andreas Kling
d0c1724d5b ChanViewer: Give this application a simple window icon 2019-08-04 14:53:32 +02:00
Andreas Kling
e38f78faf5 ChanViewer: Show the time of each post in the thread catalog 2019-08-04 10:15:06 +02:00
Andreas Kling
030891531b ChanViewer: Start working on a simple read-only 4Chan viewer
Since they are nice enough to provide a JSON API over HTTP, this makes
for a perfect way to exercise our networking code a bit. :^)
2019-08-04 10:10:38 +02:00
Andreas Kling
f37c8f618b Terminal: Paint bold text with a bold font.
This was really straightforward since all the necessary pieces were
already in place. This patch just passes a bold font to draw_glyphs()
for buffer cells with the bold attribute set. :^)
2019-08-04 08:15:30 +02:00
Andreas Kling
8e684f0959 AudioServer: Port to the new generated IPC mechanism
Fork the IPC Connection classes into Server:: and Client::ConnectionNG.
The new IPC messages are serialized very snugly instead of using the
same generic data structure for all messages.

Remove ASAPI.h since we now generate all of it from AudioServer.ipc :^)
2019-08-03 19:49:19 +02:00
Andreas Kling
69281c22d4 FontEditor(UI): Update the groupbox to have the right background color 2019-08-03 11:39:34 +02:00
Andreas Kling
f511421aaa Kernel+ProcessManager: Add some more info to /proc/PID/fds
- "seekable": whether the fd is seekable or sequential.
- "class": which kernel C++ class implements this File.
- "offset": the current implicit POSIX API file offset.
2019-08-03 08:42:40 +02:00
Andreas Kling
7f25959fa2 LibCore: Make get_current_user_home_path() return String & close passwd
This API was returning a "const char*" and it was unclear who took care
of the underlying memory. Returning a String makes that obvious.

Also make sure we close the /etc/passwd file when we're done with it.
2019-08-03 08:32:07 +02:00
Andreas Kling
8a703c0076 ProcessManager: Add a new per-proces "open files" view showing open FDs
This uses the data from /proc/PID/fds with ease now that it's JSON. :^)
2019-08-03 08:26:45 +02:00
Conrad Pankoff
45c5a91afc Piano: Add mouse support for playing notes
Fixes #332
2019-08-03 07:59:41 +02:00
Andreas Kling
e8b3a539b4 ProcessManager: Fix timer leak in ProcessStacksWidget
CObjects should really be reference-counted instead of this error-prone
(but convenient) model.

Found by PVS-Studio.
2019-08-01 11:12:35 +02:00
Conrad Pankoff
fed0133109 FileManager: Show home directory by default, or command line argument
FileManager used to open up with the root directory loaded by default.
Now it will try to load either 1) the first argument specified on the
command line, 2) the user's home directory, or 3) the root directory.

Fixes #389
2019-07-31 16:33:21 +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
Andreas Kling
cf57d64481 ProcessManager: Add a "Memory map" view to show a process's VM layout.
Fetch all the data from /proc/PID/vm for the selected process and show it
in a nice GTableView. :^)
2019-07-28 12:15:24 +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
eda272eec8 TextEditor: Add back lost "Save as..." action. 2019-07-27 20:32:19 +02:00
Andreas Kling
34ccc7b4a7 ProcessManager: Oops, the process-specific view should not be global.
It should only be visible when we have the process table open.
2019-07-27 11:11:49 +02:00
Andreas Kling
fd4ae0d25b Piano: Add an (empty) menubar so the app looks a little more complete. 2019-07-27 11:06:00 +02:00
Andreas Kling
9b7e1eb287 ProcessManager: Add a process-specific tab view below the process table.
To start out, add a "Stacks" view where we see what the selected process is
currently doing (via /proc/PID/stack) :^)
2019-07-27 09:39:43 +02:00
Andreas Kling
c452528952 ProcessManager: Add ProcessTableView::on_process_selected() callback.
This will be useful for doing something in response to the user selecting
a different process.
2019-07-27 09:37:26 +02:00
Andreas Kling
185ba4dc3f ProcessManager: Move the memory stats widget under "Graphs" instead.
Making space for some new thingy under the process table view.
2019-07-27 08:43:32 +02:00
Andreas Kling
cd3463d2e3 ProcessManager: Rename "widget" to "process_table_container". 2019-07-27 08:42:15 +02:00
Rhin
d6cd98cfa1 TextEditor: Fix nullptr refrence to save action & m_path (#364)
We forgot to persist our actions in the constructor for later reference, whoops.
Also use the correct path in the "open" action.
2019-07-26 06:48:39 +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
31a2a6ca2d Terminal: Convert Vector<OwnPtr> to NonnullOwnPtrVector. 2019-07-24 09:36:58 +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
442256b5f8 TextEditor: Add "Save as..." action.
Add a basic "save as" action to the TextEditor app, and make "save" fall
back to using "save as" if there's no name already set.

Fixes #282.
2019-07-24 06:32:30 +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