Respect the user-configured mimetype when dragging an image from the main window
ClosedPublic

Authored by ngraham on May 2 2019, 9:39 PM.

Details

Summary

Currently, ExportManager::tempSave() expects a mimetype argument but defaults to PNG.
However no users of that function actually pass it a mimetype, so drag-and-dropped files
always get the PNG file format, even if the user changed the default file format in the
settings window.

This patch changes the function to do away with the optional mimetype argument and
instead always use the mimetype that the user has specified in the settings window.

BUG: 407165
FIXED-IN: 19.04.1

Test Plan
  • Set the file format to JPEG
  • Take a new screenshot
  • Drag the image from the main window to somewhere else. It is created as a JPEG file.

Diff Detail

Repository
R166 Spectacle
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.May 2 2019, 9:39 PM
Restricted Application added a project: Spectacle. · View Herald TranscriptMay 2 2019, 9:39 PM
ngraham requested review of this revision.May 2 2019, 9:39 PM

Works, but lets's step back for a moment.
Is this behavior expected and can be anticipated by the user? I suppose if you drag and drop to Dolphin or some other filemanager it's fine. But if I have JPEG with some lower quality configured and drag the perfect pixmap from Spectacle to GIMP to edit it or do some annotations it suddenly is of lower quality which is quite surprising without knowing that a temporary file with the default settings is created in the background.

ngraham added a reviewer: VDG.May 5 2019, 4:12 PM

I think the user expectation is that whatever format has been selected in the settings window is the format that the image will be saved in no matter what method is used to get it out of Spectacle. At least, that was my expectation after I set the format to JPEG and was confused by the fact that using the DnD feature produces PNG images instead.

The fact that dragging the image from the app's main window always produced a PNG seems like it was a bug rather than an intentional feature. If you want an image in a lossless format, you stick with the default PNG format. A person who deliberately changes that to JPEG is signaling that they want their images to always be JPEGs.

We can see what VDG thinks. It would be nice to get a decision today though since tomorrow is the 19.04.1 tagging date.

filipf added a subscriber: filipf.May 5 2019, 6:31 PM

I think the user expectation is that whatever format has been selected in the settings window is the format that the image will be saved in no matter what method is used to get it out of Spectacle. At least, that was my expectation after I set the format to JPEG and was confused by the fact that using the DnD feature produces PNG images instead.

The fact that dragging the image from the app's main window always produced a PNG seems like it was a bug rather than an intentional feature. If you want an image in a lossless format, you stick with the default PNG format. A person who deliberately changes that to JPEG is signaling that they want their images to always be JPEGs.

We can see what VDG thinks. It would be nice to get a decision today though since tomorrow is the 19.04.1 tagging date.

I'm going to have to agree with this. While I do understand the argument about doing photo editing, the responsibility should be on the user to set a non-lossy format, and not to rely on Spectacle behaving inconsistently.

filipf accepted this revision.May 5 2019, 6:40 PM
This revision is now accepted and ready to land.May 5 2019, 6:40 PM
This revision was automatically updated to reflect the committed changes.