Deduplicate default filename template code
ClosedPublic

Authored by rkflx on Aug 3 2018, 9:58 PM.

Details

Summary

In preparation for user-visible improvements to the default filenames,
let's move the corresponding code around so that it only has to be
touched in a single place, preventing strings getting out of sync with
time.

Ref T9252

Test Plan

ConfigureSave dialog page should look like before, and
Save with a fresh config should populate the filename as usual.

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.
rkflx requested review of this revision.Aug 3 2018, 9:58 PM
rkflx created this revision.
rkflx updated this revision to Diff 39214.EditedAug 6 2018, 5:54 PM
  • Use function instead of static const

Make all these functions rather than variables. It will speed up starting time (right now all those QStrings have to be created upfront).

Let's follow this advice for Spectacle too.

rkflx added a subscriber: ngraham.Aug 9 2018, 1:13 PM

Anybody else from Spectacle wanna review this, since @ngraham is busy? (When I asked in the task whether to commit directly, the answer was a bit ambiguous…).

ngraham accepted this revision.Aug 10 2018, 4:44 PM

+1, nice refactoring. I approve of the code changes, and the user-facing behavior isn't impacted.

This revision is now accepted and ready to land.Aug 10 2018, 4:44 PM
This revision was automatically updated to reflect the committed changes.