Commit graph

1844 commits

Author SHA1 Message Date
Andreas Kling
f1b1558c7b Everywhere: Tweak "2020-2020" => "2020" in copyright headers 2020-12-25 12:24:05 +01:00
Andreas Kling
1e4c010643 LibELF: Remove ELF::Loader and move everyone to ELF::Image
This commit gets rid of ELF::Loader entirely since its very ambiguous
purpose was actually to load executables for the kernel, and that is
now handled by the kernel itself.

This patch includes some drive-by cleanup in LibDebug and CrashDaemon
enabled by the fact that we no longer need to keep the ref-counted
ELF::Loader around.
2020-12-25 02:14:56 +01:00
Alex McGrath
a5f4cb78cf FileManager: Add a button to open links in their real directory 2020-12-24 21:52:02 +01:00
Linus Groh
b53011a198 Terminal+LibVT: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Xavier Cooney
5f58fe1643 Spreadsheet: Prompt user before closing with unsaved changes 2020-12-23 15:41:49 +01:00
Linus Groh
488a613858 TextEditor: Rename {Main => TextEditor}Window.gml
Calling the file MainWindow.gml (and subsequently using MainWindowGML.h
for the generated file's name) suggests that's possible for every
application, but having a second one anywhere results in the following
CMake error:

    add_custom_target cannot create target "generate_MainWindowGML.h"
    because another target with the same name already exists. The
    existing target is a custom target created in source directory [...]

It's now also more consistent with the other applications already using
GML, namely "BrowserWindow.gml" and "FileManagerWindow.gml".
2020-12-23 01:33:43 +01:00
Alex McGrath
abc98dea09 FileManager: Allow creating desktop shortcut from FileManager 2020-12-22 23:35:41 +01:00
AnotherTest
ca2e7b6746 Spreadsheet: Fix invalid check in SheetGlobalObject::column_index() 2020-12-22 23:35:29 +01:00
AnotherTest
8f05e4e765 Spreadsheet: Improve sheet update efficiency
There's no need to leave the cell dirty when not updating it, and
there's definitely no need to update the cells as we're selecting them.
This makes navigating a sheet and selecting cells significantly faster
as we no longer update unrelated cells just because they appear to have
a cyclic update dependency :^)
2020-12-22 23:35:29 +01:00
AnotherTest
bfb25855cb Spreadsheet: Do not attempt to create columns with "negative" indices 2020-12-22 23:35:29 +01:00
AnotherTest
7c8d35600c Spreadsheet: Override visit_edges() and visit stored JS objects
...and don't let them leak out of their evaluation contexts.
Also keep the exceptions separate from the actual values.
This greatly reduces the number of assertions hit while entering random
data into a sheet.
2020-12-22 23:35:29 +01:00
AnotherTest
b3a9a25416 Spreadsheet: Make it possible to rename sheets 2020-12-22 23:35:29 +01:00
AnotherTest
f1f9fd1c60 Spreadsheet: struct Cell => class Cell
Hide private members, and make the odd update() -> sheet->update(cell)
-> update(Badge<Sheet>) -> update_data() less odd by removing the
update(Badge<Sheet>) step.
2020-12-22 23:35:29 +01:00
AnotherTest
28428beb5c Spreadsheet: Accept (and ignore) invalid 'columns' in json
The save functionality omits these when the names are standard, so just
ignore them if they don't exist (or are not valid).
2020-12-22 23:35:29 +01:00
Andreas Kling
ab549cf942 LibGUI+TextEditor+HackStudio: Add GML syntax highlighter :^) 2020-12-21 18:26:18 +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
Alex McGrath
f1d7d864ae LibVT+Terminal: Add the option to disable the bell 2020-12-21 00:17:12 +01:00
William Marlow
39364bdda4 Build: Embed application icons directly in the executables.
New serenity_app() targets can be defined which allows application
icons to be emedded directly into the executable. The embedded
icons will then be used when creating an icon for that file in
LibGUI.
2020-12-21 00:12:59 +01:00
Lenny Maiorani
765936ebae
Everywhere: Switch from (void) to [[maybe_unused]] (#4473)
Problem:
- `(void)` simply casts the expression to void. This is understood to
  indicate that it is ignored, but this is really a compiler trick to
  get the compiler to not generate a warning.

Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.

Note:
- Functions taking a `(void)` argument list have also been changed to
  `()` because this is not needed and shows up in the same grep
  command.
2020-12-21 00:09:48 +01:00
Andreas Kling
64ba41ea13 LibGUI: Make GUI::Label auto-sizing declarative
You can now set the "autosize" property on a GUI::Label and it will
automatically update its width preference to fit the text.
2020-12-20 12:36:32 +01:00
Andreas Kling
de08e7b8c9 LibGUI: Rename ProgressBar property caption => text and expose to GML 2020-12-20 12:29:40 +01:00
Andreas Kling
92afdd0c86 FileManager: Move the main window UI to GML
This was pretty straightforward although it does expose a bunch of
missing functionality (mostly properties.)
2020-12-20 12:17:59 +01:00
Andreas Kling
822dc56ef3 LibGUI: Introduce GML - a simple GUI Markup Language :^)
This patch replaces the UI-from-JSON mechanism with a more
human-friendly DSL.

The current implementation simply converts the GML into a JSON object
that can be consumed by GUI::Widget::load_from_json(). The parser is
not very helpful if you make a mistake.

The language offers a very simple way to instantiate any registered
Core::Object class by simply saying @ClassName

@GUI::Label {
    text: "Hello friends!"
    tooltip: ":^)"
}

Layouts are Core::Objects and can be assigned to the "layout" property:

@GUI::Widget {
    layout: @GUI::VerticalBoxLayout {
        spacing: 2
        margins: [8, 8, 8, 8]
    }
}

And finally, child objects are simply nested within their parent:

@GUI::Widget {
    layout: @GUI::HorizontalBoxLayout {
    }
    @GUI::Button {
        text: "OK"
    }
    @GUI::Button {
        text: "Cancel"
    }
}

This feels a *lot* more pleasant to write than the JSON we had. The fact
that no new code was being written with the JSON mechanism was pretty
telling, so let's approach this with developer convenience in mind. :^)
2020-12-20 11:59:40 +01:00
Andreas Kling
685d5f4e25 LibProtocol: Remove use of ByteBuffer::wrap() in protocol API 2020-12-19 13:09:02 +01:00
Andreas Kling
f0138fcb25 LibGUI: Move selection behavior from TableView up to AbstractView
Let's make SelectionBehavior a view concept where views can either
select individual items (row, index) or whole rows. Maybe some day
we'll do whole columns, but I don't think we need that now.
2020-12-17 00:54:58 +01:00
Andreas Kling
5eacf62ba3 FileManager: Fix assertion when drag&dropping a file to the desktop 2020-12-16 19:40:24 +01:00
Conrad Pankoff
ee3056ba11 IRCClient: Remove unnecessary temporary variable from connect() 2020-12-16 17:11:52 +01:00
Andreas Kling
04bc654ae7 FileManager: Make symlink icons show up nicely in properties dialog 2020-12-16 16:09:27 +01:00
Andreas Kling
2759d518b7 FileManager+LibGUI: Draw the item text for desktop icons with shadow
This makes it look nice regardless of wallpaper or background color.
2020-12-16 12:16:14 +01:00
Andreas Kling
dd9a77099f FileManager: Simplify breadcrumb bar hook callback
Now that we store each partial path with the segments, we can just
open up the path of the segment you clicked on.
2020-12-15 19:33:53 +01:00
Itamar
69b0fdd84a CrashDaemon: Show source position in backtrace 2020-12-14 23:05:53 +01:00
Itamar
706a8c05fd CrashDaemon: Add service that acts on new coredumps
Currently we only print a backtrace. In the future, we could do something nice in the GUI.
2020-12-14 23:05:53 +01:00
Itamar
efe4da57df Loader: Stabilize loader & Use shared libraries everywhere :^)
The dynamic loader is now stable enough to be used everywhere in the
system - so this commit does just that.
No More .a Files, Long Live .so's!
2020-12-14 23:05:53 +01:00
Itamar
711c42e25e Debugger: Add 'examine' command
This command outputs the memory contents of a given address as an
unsigned int.

LibDebug already had support for this, so just a matter of intergating
it in sdb.

Very useful :)
2020-12-14 23:05:53 +01:00
Itamar
a8cfb83d08 Debugger: Fix CLI parsing of breakpoint addresses
Previously, we only accepted addresses that started with digits
'0'-'9', which was not correct because we expect addresses to be in
base 16.
We now expect addresses to be written with '0x' prefix, e.g 0xdeadbeef.
2020-12-14 23:05:53 +01:00
Andreas Kling
b10255f93f FileManager: Use GUI::BreadcrumbBar :^)
FileManager windows now alternate between the old-style location text
box and a new-style breadcrumb bar. The location bar shows up when you
try to edit the location (with Ctrl+L) and disappears once the textbox
loses focus.

The textbox and breadcrumb bar are mutually exclusive to keep it tidy.
2020-12-14 20:43:42 +01:00
Andreas Kling
b9b7b2b28a LibCore: Make IODevice::read_line() return a String
Almost everyone using this API actually wanted String instead of a
ByteBuffer anyway, and there were a bunch of slightly different ways
clients would convert to String.

Let's just cut out all the confusion and make it return String. :^)
2020-12-13 11:54:11 +01:00
Andreas Kling
4da327d650 DisplaySettings: Allow unsetting the wallpaper
It was previously not possible to unset the wallpaper once set,
since loading an image from the path "" would always fail.
2020-12-13 11:49:18 +01:00
Andreas Kling
545ed01e7d DisplaySettings: Remove a bunch of unnecessary "this->" 2020-12-13 11:49:18 +01:00
Andreas Kling
919d3dc56f DisplaySettings: Improve contrast of screen resolution label
Since we're putting this on top of the wallpaper preview, let's make
it white with a black shadow to ensure that it's always readable.
2020-12-13 11:49:18 +01:00
Linus Groh
f7bd6e2b34 Welcome: Fix reading of welcome.txt file
The buffer returned by read_line() used to be null-terminated, however
that was changed in 129a58a, resulting in some line strings containing
garbage data. Explicitly telling the String constructor the buffer's
size fixes that.

Fixes #4397.
2020-12-13 11:00:11 +01:00
Linus Groh
af80d71abc Spreadsheet: Reduce top bar default height
50px is a bit extreme, it's down to 26px high now. Still a bit larger
than a regular GUI::TextBox but enough to look decent, even with the
help button in there.

Closes #3905.
2020-12-12 20:09:55 +01:00
Zac
1851da9c93 FileManager: Added context menu for right-clicks on desktop icons.
Moved the same copy/paste/properties/delete functionality used in the
run_in_windowed_mode() method to the run_in_desktop_mode() method.
2020-12-11 09:36:44 +01:00
Zac
dea399ff08 FileManager: focus_dependent_delete_action is correctly enabled/disabled
The focus_dependent_delete_action that sits in the file manager's
toolbar would always remain enabled, even if nothing was selected,
activating it if nothing was selected would then crash the application.

The action is now correctly enabled/disabled, but due to the way
selection works in TreeViews, something is always selected, what really
matters is if the TreeView has something selected, and it has focus.
As it currently stands, there is no way to know when the TreeView's
is_focused status changes. In order for this to work I added a callback
to the Widget class which fires when a widget receives or looses focus.
In that callback, the focus_dependent_delete_action's enabled value is
recalculated.
2020-12-11 09:36:44 +01:00
Zac
df44ab8599 FileManager: TreeView accepts drags from the DirectoryView. 2020-12-11 09:36:44 +01:00
Linus Groh
bdb924522f DisplaySettings: Ensure wallpaper mode is always initialized
If loading the WindowServer config fails or we get a value other than
"simple", "center", "tile", or "scaled", DisplaySettings would crash
when changing the wallpaper image.

Fixes #4360.
2020-12-09 12:46:59 +01:00
Andreas Kling
52dbdf4245 Browser: Don't focus the bookmarks bar overflow button on click 2020-12-08 23:36:19 +01:00
Zac
eb810d14c3
FileManager: Fix TreeView collapsing on file system changes (#4348)
TreeViews using FileSystemModels collapse whenever the file system is
changed in anyway. This includes creating, dragging, deleting or
pasting any files/folders. This commit updates the refresh_tree_view()
lambda, which seems to have stopped working at some point, and calls it
whenever any of the actions mentioned above are activated.
2020-12-08 17:51:53 +01:00
Andreas Kling
867faa5d44 Browser: Don't focus bookmarks toolbar buttons when clicking them
They should only receive focus when tabbed to. This matches what we
already do for other toolbar buttons.
2020-12-07 19:49:06 +01:00
Linus Groh
99a6c4ce42 Spreadsheet: Use JS::Parser::print_errors() for reporting syntax errors 2020-12-06 18:52:52 +01:00