summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/FileIconProvider.cpp
AgeCommit message (Collapse)Author
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-01Everywhere: Run clang-formatIdan Horowitz
2022-03-24Userland+Tests: Convert File::read_link() from String to ErrorOr<String>Kenneth Myhra
This converts the return value of File::read_link() from String to ErrorOr<String>. The rest of the change is to support the potential of an Error being returned and subsequent release of the value when no Error is returned. Unfortunately at this stage none of the places affected can utililize our TRY() macro.
2022-03-18Userland: Change static const variables to static constexprLenny Maiorani
`static const` variables can be computed and initialized at run-time during initialization or the first time a function is called. Change them to `static constexpr` to ensure they are computed at compile-time. This allows some removal of `strlen` because the length of the `StringView` can be used which is pre-computed at compile-time.
2022-02-16LibCore+Everywhere: Return ErrorOr from ConfigFile factory methodsSam Atkins
I've attempted to handle the errors gracefully where it was clear how to do so, and simple, but a lot of this was just adding `release_value_but_fixme_should_propagate_errors()` in places.
2022-01-01LibGUI: Avoid unnecessary copies in FileIconProviderBen Wiederhake
2021-11-23LibCore+AK: Move MappedFile from AK to LibCoreAndreas Kling
MappedFile is strictly a userspace thing, so it doesn't belong in AK (which is supposed to be user/kernel agnostic.)
2021-11-21LibGfx: Make ImageDecoderPlugin::frame() return ErrorOr<>Andreas Kling
This is a first step towards better error propagation from image codecs.
2021-11-18LibGfx: Remove ImageDecoderPlugin::bitmap() in favor of frame(index)Andreas Kling
To encourage proper support for multi-frame images throughout the system, get rid of the single-frame convenience bitmap() API.
2021-11-13LibGUI: Use PNGImageDecoderPlugin for ELF icon extractionAndreas Kling
Getting rid of all the remaining calls to load_png_from_memory() and the related wrappers for each decoder.
2021-11-08LibCore: Use ErrorOr<T> for Core::File::open()Andreas Kling
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-11-08LibGfx: Use ErrorOr<T> for Bitmap::clone()Andreas Kling
2021-08-20LibGUI: Reduce amount we init for FileIconProvider::filetype_image_iconAndrew January
Instead of loading every icon, only load the filetype image icon if it hasn't been already. This icon is used by IconViews that need to lazily load thumbnails, which don't need any of the other icon types. Spending the time to load the unneeded images was causing delays to first paint in BackgroundSettings.
2021-07-21LibGfx: Use "try_" prefix for static factory functionsAndreas Kling
Also mark them as [[nodiscard]].
2021-06-30AK+Everywhere: Add and use static APIs for LexicalPathMax Wipfli
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
2021-06-03LibGUI/FileIconProvider: Return s_file_icon when stat() failsMarcus Nilsson
Previously when using icon_for_path(), without specifying t_mode, on an anonymous file it would return an empty Icon causing problems down the line. Instead return the s_file_icon when stat fails.
2021-05-21Revert "Userland: static vs non-static constexpr variables"Linus Groh
This reverts commit 800ea8ea969835297dc7e7da345a45b9dc5e751a. Booting the system no longer worked after these changes.
2021-05-21Userland: static vs non-static constexpr variablesLenny Maiorani
Problem: - `static` variables consume memory and sometimes are less optimizable. - `static const` variables can be `constexpr`, usually. - `static` function-local variables require an initialization check every time the function is run. Solution: - If a global `static` variable is only used in a single function then move it into the function and make it non-`static` and `constexpr`. - Make all global `static` variables `constexpr` instead of `const`. - Change function-local `static const[expr]` variables to be just `constexpr`.
2021-05-15LibELF: Remove sketchy use of "undefined" ELF::Image::SectionAndreas Kling
We were using ELF::Image::section(0) to indicate the "undefined" section, when what we really wanted was just Optional<Section>. So let's use Optional instead. :^)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-11LibGUI: Avoid unnecessary Gfx::Bitmap cloning in FileIconProviderAndreas Kling
2021-04-09Base+LibGUI: Add an familiar-looking icon for the desktop directoryAndreas Kling
2021-03-27LibGUI: Return symlink fallback icon if target icon cannot be determinedLinus Groh
This is the case for symlinks that point to themselves, for example - previously the returned icon would be empty. Fixes #5978. Fixes #5979.
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling