Respect user-specified filetype for Save As... operations
ClosedPublic

Authored by ngraham on Oct 14 2018, 3:26 AM.

Details

Summary

Currently, when doing Save As... operations, Spectacle outright ignores the filetype you choose in Settings and always defaults to saving as a .png file. This patch fixes that.

BUG: 399773
FIXED-IN: 18.12.0

Test Plan
  1. Settings β†’ Save β†’ change the file type to something other than PNG
  2. Save as...

The file dialog now comes pre-populated with the correct file type, and saving file saves it as that file type.

Tested with all available file types.

Diff Detail

Repository
R166 Spectacle
Branch
saveas-selected-filetype (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4006
Build 4024: arc lint + arc unit
ngraham created this revision.Oct 14 2018, 3:26 AM
Restricted Application added a project: Spectacle. Β· View Herald TranscriptOct 14 2018, 3:26 AM
ngraham requested review of this revision.Oct 14 2018, 3:26 AM
ngraham edited the test plan for this revision. (Show Details)Oct 14 2018, 3:28 AM
aacid added a subscriber: aacid.Oct 17 2018, 5:20 PM
aacid added inline comments.
src/ExportManager.cpp
430

const

431

mimeTypeForName
and also const

ngraham updated this revision to Diff 43826.Oct 17 2018, 10:30 PM
ngraham marked 2 inline comments as done.

Address review comments

aacid added inline comments.Oct 17 2018, 10:39 PM
src/ExportManager.cpp
431

Sorry, mimeTypeForName is wrong :D

So you should go back to mimeTypeForFile but using QMimeDatabase::MatchExtension so it doesn't try to open a file that may or may not exist

ngraham updated this revision to Diff 43828.Oct 17 2018, 10:44 PM
ngraham marked an inline comment as done.

Take three :)

Thanks Albert! Interestingly enough, all three variants actually worked. But hey, why not do it right?

Compiles, works as described, no questions to those 3-6 lines of code modified πŸ˜‰

This revision is now accepted and ready to land.Oct 19 2018, 7:55 AM
This revision was automatically updated to reflect the committed changes.