Properties in File Browser

  • 17 Replies
  • 2591 Views
Properties in File Browser
« on: 25 / June / 2017, 17:49:47 »
Advertisements
Following feedback from a previous attempt, I implemented a Properties box in File Browser (Source).

To alleviate size concerns, fselect.flt is down to 2005620248 bytes.

See screenshot.

Edit: Enabled properties for directories and added progress bar.
« Last Edit: 26 / June / 2017, 12:27:45 by dmitrys »
Author of CHIMP, Canon Hack Installation and Management Platform

*

Offline reyalp

  • ******
  • 11496
Re: Properties in File Browser
« Reply #1 on: 25 / June / 2017, 20:15:08 »
This makes more sense to me. I'd still argue for just one hash, probably md5 because it's shorter and md5 tools are common. Since there's no copy/paste, anyone who uses this will probably not actually be comparing every digit, never mind 3 different hashes.

Should also consider how it behaves on large files, e.g. if someone does properties on a DNG or video file, does the camera become unresponsive for a very long time or crash?

As it is now, most of the information is available directly in the file browser, although being able to see seconds in the timestamp and the exact size does have some value. File attributes could also be included.
Don't forget what the H stands for.

Re: Properties in File Browser
« Reply #2 on: 25 / June / 2017, 21:18:06 »
This makes more sense to me. I'd still argue for just one hash, probably md5 because it's shorter and md5 tools are common. Since there's no copy/paste, anyone who uses this will probably not actually be comparing every digit, never mind 3 different hashes.

Maybe make it configurable with an option for None?

Quote
Should also consider how it behaves on large files, e.g. if someone does properties on a DNG or video file, does the camera become unresponsive for a very long time or crash?

That was uncalled for ;)

Good point. I tried adding a progress bar that would only be updated when the percentage changes, but it seems to be overwritten by a display refresh. Reporting progress on every block works, but further slows things down.

A word of advice: never calculate hashes of 2GB files on your camera :)

Quote
As it is now, most of the information is available directly in the file browser, although being able to see seconds in the timestamp and the exact size does have some value. File attributes could also be included.

Which attributes would be relevant?
Author of CHIMP, Canon Hack Installation and Management Platform

Re: Properties in File Browser
« Reply #3 on: 26 / June / 2017, 12:18:33 »
I defined the following function:
Code: (modules/gui_fselect.c) [Select]
#include <stdarg.h>

static int fs_sprintf(int calc_hashes, char* str, const char* format, ...)
{
    int i, index = 0;
    va_list argptr;
    if (calc_hashes)
        for (i = 0; i < 8; i++)
            str[index++] = ' ';
    va_start(argptr, format);
    index += vsprintf(&str[index], format, argptr);
    va_end(argptr);
    return index;
}

It compiles with
Quote
warning: implicit declaration of function 'vsprintf' [-Wimplicit-function-declaration]
     index += vsprintf(&str[index], format, argptr);

and then fails to link with
Quote
(.data+0x8ec): undefined reference to `vsprintf'

It seems that the variadic functions declared in stdio.h are missing. How do I add those?

Edit: This seems to do the trick:
Code: (platform/generic/wrappers.c) [Select]
long vsprintf(char *s, const char *st, __builtin_va_list va)
{
    return _vsprintf(s, st, va);
}

Question: why is this required?
« Last Edit: 26 / June / 2017, 13:14:36 by dmitrys »
Author of CHIMP, Canon Hack Installation and Management Platform


*

Offline philmoz

  • *****
  • 3070
    • Photos
Re: Properties in File Browser
« Reply #4 on: 26 / June / 2017, 18:28:48 »
Question: why is this required?


Because CHDK does not contain every possible standard function.
To save space only what is needed is included - there is no standard library linked into the code, everything is contained somewhere in the core CHDK code itself.


No one has needed this function before - sprintf works fine for everyone else.


Phil.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)

Re: Properties in File Browser
« Reply #5 on: 26 / June / 2017, 18:34:53 »
As discussed, I created File Browser Settings and updated the Properties box accordingly (Source).

In addition to the hashes, it contains a couple more useful items, like the date/time formats in favour of the blokes across the pond :)
Author of CHIMP, Canon Hack Installation and Management Platform

*

Offline reyalp

  • ******
  • 11496
Re: Properties in File Browser
« Reply #6 on: 27 / June / 2017, 00:54:43 »
Question: why is this required?
Because wrappers are required to ensure clean arm/thumb transitions (on pre-digic 6 cameras) and we didn't previously need one for vsprintf itself.
Don't forget what the H stands for.

Re: Properties in File Browser
« Reply #7 on: 27 / June / 2017, 11:11:09 »
Because wrappers are required to ensure clean arm/thumb transitions (on pre-digic 6 cameras) and we didn't previously need one for vsprintf itself.

Thank you; that's exactly the answer I've been looking for.

Since the latest code has separate date/time/size formatting functions, it no longer requires vsprintf.
Author of CHIMP, Canon Hack Installation and Management Platform


Re: Properties in File Browser
« Reply #8 on: 27 / June / 2017, 14:17:20 »
  • Improved date and time format settings
  • Added configurable file size limit
  • Moved hash settings to dedicated submenu
  • Used nicer icons
P.S. Screenshots taken with the .NET PTP client (chakphanu's live view implementation merged).

Edit: Replaced PNGs with much smaller JPEGs.
« Last Edit: 27 / June / 2017, 14:46:58 by dmitrys »
Author of CHIMP, Canon Hack Installation and Management Platform

*

Offline reyalp

  • ******
  • 11496
Re: Properties in File Browser
« Reply #9 on: 27 / June / 2017, 22:27:48 »
This is nice, but it really seems like massive overkill.

I accept that being able to get file checksums on camera has value for a few users, but adding a bunch of configuration values and menu items to support really seems unnecessary.

I know I said I liked the properties dialog earlier, but from a usability POV, if the hash is going to be optional it should just be a separate option in the context menu, or perhaps a button in the properties dialog. Require the user to turn on/off an option in between browsing files seems less than optimal.

I would still argue that there is no real value in having more than one hash function available in the UI.

I'm really sorry to be critical of so many of your suggestions, I know you put a lot of time into this and it's really nice to see someone wanting to contribute. At the same time, as the de-facto ringleader of this circus for a number of years, I've regretted adding stuff on a number of occasions...
Don't forget what the H stands for.

 

Related Topics