Possible usabilty enhancement?

Issue #138 new
John Tompkins created an issue

I personally find it mildly problematic that when I “Save” a file, for example in JPEG, the dialog, if there is an existing JPEG file, will show the existing file with the extension highlighted (or perhaps just a highlighted “.”) and I have to press “Backspace” to delete the highlighted extension otherwise it runs into issues with file naming. For example if “DSC_1561.jpg” and “DSC_1561.jpg.out.arp” exist then when saving the processing from “DSC_1561.NEF” it will highlight the “.” after “DSC_1561” and if I don't erase the highlighted “.” it will try to save the file as “DSC_1561..jpg” (note the double “.”). Other “oddities” are possible.

So I decided to learn a bit about the code to see if I could “fix” that. After trying many things with the GTK::FileChooserWidget (I actually learned a bit about GTK) I found I could not “fix” the issue with any GTK options directly but found a solution in the SaveAsDialog::okPressed () function by adding this stuff in the two “#if 1” … “#endif” directives:

void SaveAsDialog::okPressed ()
{
#if 1
size_t lastslash, firstdot;
#endif

fname = getCurrentFilename(fchooser);

#if 1
lastslash = fname.find_last_of ("/\");
firstdot = fname.find_first_of ('.', lastslash);
fname = fname.substr (0, firstdot);
#endif

// Checking if the filename field is empty. The user have to click Cancel if he don't want to specify a filename
if (fname.empty()) {

The changes simply take whatever with GTK:FileChooserWidget selects as the chosen path and removes anything after the first “.” after the last slash. The ART code then adds the appropriate extension, in this case “.jpg”, before actually saving the file.

Note that the fname = fname.substr… does an “in place” overwrite of fname, I am not sure if this is “proper form” in C++.

You may or may not find my solution of resolving my “mildly problematic” issue worthwhile. If not, I’ll probably just create my own “local patch”. 🙂

Comments (3)

  1. agriggio repo owner

    Thanks for reporting. Somehow I missed this before the 1.6 release – sorry about that. I will have a look asap.

  2. agriggio repo owner

    Hi, I made some changes to the save dialog that should address it. It would be great if you could test and let me know, thanks!

  3. John Tompkins reporter

    I tried it out, much better! Thanks! Not a big deal but I can “trick” it. If I remove the “.jpg” extension and add just a “.” it will save as “basename..jpg” (note the two periods). But I have to work to trick it. Also, it seems to now highlight the basename of the file where before it highlighted the extension, thus if I do press backspace to delete the highlighted part, the basename gets deleted and the file gets saved as “.jpg” (no basename, just an extension).

  4. Log in to comment