This repository has been archived by the owner on Jan 13, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge code from Selector into BrowseDialog
Adding features to the selectors would have meant copy-pasting code. This merging of code is intended to prepare the codebase for further improvements. This commit introduces more overridable functions for functionality that differs per subclass, but only Selector is modified to use them. Functions are provided to paint the background and icon required by file selectors (useful for selecting wallpapers or previewable files) and to initialise the path (for the wallpaper dialog, that would not set the path at all, and instead merge from 4 wallpaper directories), the display (row height, visible rows etc.) and the initial selection (which is intended to be overridden by Selector to preserve its last selection). The behavior is intentionally kept similar, but due to the merge, there are some differences: * Selector now has an up-arrow icon next to the ".." entry, which selects the parent directory. Previously ".." was just text, which does not clearly indicate to a newbie that ".." goes to the parent. * Selector now has a generic icon next to files, if directories are also shown. Previously there was no icon. This causes a slight loss of space for the file name. * Selector now shows file extensions, when it didn't before. * BrowseDialog and subclasses now have no big chunk of empty space at the bottom of the content area if only a partial row would fit there. The space is now redistributed to each row, as much as possible. This comes from Selector. * FileDialog, used by the Explorer link, can now show the entries of the root directory properly. Previously, they would be displayed empty and possibly crash when selected. * Selector now uses the same button as BrowseDialog and subclasses to cancel the entire dialog. * The new virtual function to fill the ButtonBox runs per file. This allows for the text prompts to adjust to the context. * BrowseDialog and subclasses now attempt to get an existing directory by removing path components at the end if the initial path doesn't exist, but only if directories are shown. If they are hidden, this path resolution is inhibited to act more like a pseudo-chroot, and "(no items)" is shown instead. This comes from Selector. * Selector does not preserve the index of the first visible entry in it anymore, preferring to force the selected item to be at the bottom of the viewport. This comes from BrowseDialog. While this is not due to the merge, the text hints for "Select" and "Confirm" are now "Enter" and "Select". Select and Confirm were quite confusing becaue they meant the same thing, but "Enter" now refers to entering a directory without selecting it, and "Select" now refers to designating the result of the selector. The following behavior was kept the same using a workaround: * DirDialog still selects the directory that the user has navigated *into*, not the one under the cursor. To keep this behavior, DirDialog::canSelect returns true for any selection, including "..", but BrowseDialog::initButtonBox checks for the selection being ".." and hides the hint for the Accept button in that case. Code-wise, BrowseDialog::setPath() always adds a slash at the end of the path, so getPath() will always have it.
- Loading branch information
Showing
12 changed files
with
393 additions
and
365 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.