summaryrefslogtreecommitdiff
path: root/Userland/Applications/PDFViewer/OutlineModel.cpp
AgeCommit message (Collapse)Author
2023-03-22PDFViewer: Create OutlineModel items with the correct pointerJulian Offenhäuser
This fixes a bug where we would construct a ModelIndex with a pointer to NonnullRefPtr<OutlineItem>, instead of a pointer to the underlying OutlineItem, which caused a crash later on when we would try to dereference that pointer.
2023-03-06Everywhere: Remove NonnullRefPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-01-26LibGfx: Remove `try_` prefix from bitmap creation functionsTim Schumacher
Those don't have any non-try counterpart, so we might as well just omit it.
2022-12-17PDFViewer: Inform about selections on Outline viewRodrigo Tobar
Selecting an Outline Item from the Outline view informs via callback the corresponding Destination that has been selected. This will be used to move the application to the corresponding page/section/etc.
2022-12-17PDFViewer: Show page numbers in Outline TreeViewRodrigo Tobar
This is a nice addition to the outline view, which previously simply displayed the titles of each section. Pages are shown in the first column, but the tree is expanded via the second column, where the title is.
2022-12-17PDFViewer: Fix parent_index() implementation in OutlineModelRodrigo Tobar
The previous implementation had some repeated code, and wasn't really working (because the OutlineItem.parent member was never populated). In fact, when navigating with the up/down arrows in the associted TreeView one could experience some funky behavior. Now that we store OutlineItem's parents, we are fixing the implementation for parent_index(), which was comparing the parent siblings against the item's outline item instead of to its parent.
2022-12-17PDFViewer: Propagate errors from OutlineModel constructionRodrigo Tobar
This follows the same idea that Andreas was doing in this latest videos, where construction-time TRY()s were not present but should have been. Like Andreas did, moving the initialisation of such fields to the factory function, which then returns ErrorOr solves the issue.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2021-11-08LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()Andreas Kling
This was used in a lot of places, so this patch makes liberal use of ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-08-06Everywhere: Replace Model::update() with Model::invalidate()sin-ack
Most of the models were just calling did_update anyway, which is pointless since it can be unified to the base Model class. Instead, code calling update() will now call invalidate(), which functions identically and is more obvious in what it does. Additionally, a default implementation is provided, which removes the need to add empty implementations of update() for each model subclass. Co-Authored-By: Ali Mohammad Pur <ali.mpfard@gmail.com>
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-05-25PDFViewer: Add a tab bar with outlines and thumbnailsMatthew Olsson
Outlines are in theory implemented (though I'm having trouble finding a simple PDF with outlines to test it on), and thumbnails are not.