Commit graph

5 commits

Author SHA1 Message Date
William Wilgus
58462184d1 folder_select.c partial rewrite -- remove static, add full notification
| with some code refactoring we can eliminate the static
  char buffer in get_full_path()

  I'm guessing making the functions recursive prompted the static buffer
  I don't see any reason we can't just pass the same buffer
|
  During tested I noted failure after buffer was full
   -- splash added for buffer full notification

  added some logic to not add partial entries and try to find a
| selected item that will fit in the remaing buffer
------------------------------------------------------------------------

While looking through the source I noticed a few potential
pitfalls with the current code.

Namely the stack allocated temporary buffer
sized to setting_len.

I also noted the rigid vect[32] with the timeless --
/* 32 separate folders should be Enough For Everybody(TM) */
and decided to make it a bit more robust

The saved items are hashed with crc32 on all the paths
and a hashed_len is kept to aid in the buffer full message before the
user actually goes to save the changes
(assuming they even get the message)

In the old code, buffer might be the same since it ran out of
space and didn't get their later selections

the hashed_len could easily be turned into a way to get a needed buffer
size as well for someone in the future just pass a really large maxlen

I made get_full_path non recursive since it liked to blow the stack
while embedded in all the other recursive calls making it a pain to debug
(the real reason the buffer was static?)
traverse first from the current folder to root mutating the
parent pointers to point at the previous child
next traverse back to the folder unmutating & taking names on the way

Folder depth is now uint16 65535 levels is probably excessive
children_count is also uint16 as well
I made the first folders below root '/' stay below root
instead of shifting since the horizontal real estate is limited

slightly smaller than it began but hopefully faster & more reliable

Change-Id: I348f61baf865cccdeacddfd9d50641a882e890fc
2021-11-10 02:34:06 -05:00
William Wilgus
93c9d675af folder_select prevent directory handle leak on error
Change-Id: If1617dc92683d7de3d7709b363a593e40fbc5bc8
2021-08-03 03:01:14 +00:00
Thomas Martitz
5d9b26f6a2 folder_select: fix problem when selecting / as folder.
Change-Id: Id4880267e8478cebe073b958a58fef1ac22dd336
2012-08-15 23:10:28 +02:00
Jonathan Gordon
bd6e6ed403 folder selector: handle long press to invert selection/select all.
Doing a LONG PRESS on a:
- unopened folder will select all its sub-folders
- opened folder will invert the selection of its sub-folders

Change-Id: Ia7fd8dc3b940f60adee3f0314bf6bba5eb2c7b3b
2012-08-13 15:03:12 +10:00
Thomas Martitz
8c655cfdc0 New GUI browser to select one (or more) folders.
The browser lets the user pick one or more directories in a convinient
GUI browser. The initial directory list is read from a string
(separated by colons) and the resulting list is written back to the same
string (again separated by colons).

Note: The work was initially done by Jonathan Gordon, however I changed
it substantially so I claim autorship.

This selector is going to be used for autoresume and database scan folders.

Change-Id: Id1d3186dad783411eb5c6056ce93f5b6123c7aa0
2012-07-30 21:20:51 +02:00