Deduplicate code for showing inline messages
ClosedPublic

Authored by rkflx on May 31 2018, 7:06 PM.

Details

Summary

By adding showInlineMessage(), we can avoid duplicating code to
control showing and hiding of mMessageWidget. This also ensures
consistent use of icons and hiding timeouts.

In addition, it should be easier to add new slots for new functionality
which also needs to show inline messages, e.g. D13221.

We also introduce a way to disable automatic hiding of the inline
message, to be used in a later patch.

Depends on D13245

Test Plan

Copy to Clipboard and ExportShareImgur should show
inline messages as before.

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.May 31 2018, 7:06 PM
rkflx created this revision.
rkflx planned changes to this revision.May 31 2018, 7:29 PM

https://bugs.kde.org/show_bug.cgi?id=394181
increase the timeout for the notification

I'd vote for disabling the timeout entirely in that case, because nothing is
more annoying than clicking a split second too late (which can happen
regardless of the timeout you choose).

+10. Heck, I'd support doing that now, because it's really annoying to miss
copying the URL because you were a tiny bit too late.

Let me make the timeout configurable here.

ngraham added a subscriber: ngraham.Jun 1 2018, 4:18 AM

Do we have to make it configurable? Seems like an unnecessary extra setting. I'd just remove the timeout and make the user dismiss it manually.

Or, if you meant configurable in the function (rather then configurable by the user), then I'm cool with that.

rkflx updated this revision to Diff 35309.Jun 1 2018, 9:46 AM
rkflx edited the summary of this revision. (Show Details)

Allow to show persistent messages.

broulik added inline comments.
src/Gui/KSMainWindow.h
69

Please avoid a boolean trap for hideAutomatically, use an enum or flag instead.

Otherwise showInlineMessage("foo", Error, false); isn't very descriptive without reading documentation

rkflx updated this revision to Diff 35421.Jun 2 2018, 6:59 PM

Thanks, good point. I'm now using an enum. I wonder how I missed this obvious improvement.

rkflx added a comment.Jun 6 2018, 9:48 PM

@broulik @ngraham Any additional tips?

ngraham accepted this revision.Jun 7 2018, 7:56 PM

The whole patch chain works nicely, and in fact, I even see the notification once more when using Save and Save As... with Quit after save or copy.

This revision is now accepted and ready to land.Jun 7 2018, 7:56 PM
rkflx added a comment.Jun 7 2018, 10:54 PM

The whole patch chain works nicely, and in fact, I even see the notification once more when using Save and Save As... with Quit after save or copy.

That would be bad if my patches caused that, normally this should work as before. I guess you simply restarted your session or issued killall spectacle? Try compiling from master and see if you get notifications again (even without my stack of patches).

Ah, with a fresh master lacking these patches, the notification behavior is identical. :)

This revision was automatically updated to reflect the committed changes.