Merge lp:~dandrader/unity8/multiMonitorScreenshot into lp:unity8
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Lukáš Tinkl on 2016-04-29 | ||||
| Approved revision: | 2343 | ||||
| Merged at revision: | 2376 | ||||
| Proposed branch: | lp:~dandrader/unity8/multiMonitorScreenshot | ||||
| Merge into: | lp:unity8 | ||||
| Diff against target: |
693 lines (+105/-282) 19 files modified
debian/unity8-private.install (+1/-1) plugins/CMakeLists.txt (+1/-1) plugins/ScreenGrabber/ScreenGrabber.qmltypes (+0/-17) plugins/ScreenshotDirectory/CMakeLists.txt (+5/-9) plugins/ScreenshotDirectory/ScreenshotDirectory.cpp (+18/-69) plugins/ScreenshotDirectory/ScreenshotDirectory.h (+10/-20) plugins/ScreenshotDirectory/plugin.cpp (+5/-7) plugins/ScreenshotDirectory/plugin.h (+5/-7) plugins/ScreenshotDirectory/qmldir (+2/-3) qml/Components/ItemGrabber.qml (+27/-17) qml/Components/NotificationAudio.qml (+7/-3) qml/Shell.qml (+11/-5) qml/Stages/AbstractStage.qml (+1/-0) qml/Stages/DesktopStage.qml (+6/-0) src/ShellApplication.cpp (+6/-0) tests/plugins/CMakeLists.txt (+0/-1) tests/plugins/ScreenGrabber/CMakeLists.txt (+0/-14) tests/plugins/ScreenGrabber/ScreenGrabberTest.cpp (+0/-77) tests/plugins/ScreenGrabber/grabber.qml (+0/-31) |
||||
| To merge this branch: | bzr merge lp:~dandrader/unity8/multiMonitorScreenshot | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Lukáš Tinkl (community) | 2016-04-26 | Approve on 2016-04-29 | |
| Unity8 CI Bot | continuous-integration | Needs Fixing on 2016-04-27 | |
|
Review via email:
|
|||
Commit Message
Refactor screenshotting code and make it work in multimonitor scenarios
+ Workaround bug in QWindow regrading "visible" property when moving a window between screens.
+ Implement snapshotting the focused window with Alt+PrtScn
Description of the Change
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes.
Tested on a laptop connected to an external monitor. Can't test on a phone connected to a monitor as my Slimport dongle seens to be busted.
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Not applicable.
* If you changed the UI, has there been a design review?
Not applicable.
| Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2344
https:/
Executed test runs:
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
| Gerry Boland (gerboland) wrote : | # |
+++ qml/Components/
+ root.parent.
Breaking encapsulation?
| Lukáš Tinkl (lukas-kde) wrote : | # |
Since you removed the previous plugin's CPP test, could you add a new one that checks whether a screenshot is taken when you press
a) both Volume keys
b) the dedicated PrtScr key
Thanks, otherwise the code looks alright to me (minus the issue pointed out by Gerry above)
| Daniel d'Andrada (dandrader) wrote : | # |
On 27/04/2016 04:54, Gerry Boland wrote:
> +++ qml/Components/
> + root.parent.
> Breaking encapsulation?
I didn't put a "property Item target" parameter because ItemGrabber not
only grabs an image and saves it, it also shows an effect (the white
flash) over its parent it even has an "anchors.fill: parent" so it's
meant to capture its parent.
I don't mind much adding a target parameter and have Shell do the
anchoring but just feels like a flexibility that doesn't make sense (no
use case).
Documented this component to make intent and design clear.
| Lukáš Tinkl (lukas-kde) wrote : | # |
Tested this with an external screen, works great. Still would like to see some test :)
| Daniel d'Andrada (dandrader) wrote : | # |
On 27/04/2016 05:30, Lukáš Tinkl wrote:
> Since you removed the previous plugin's CPP test, could you add a new one that checks whether a screenshot is taken when you press
>
> a) both Volume keys
> b) the dedicated PrtScr key
>
You're asking for tests different from the ones I removed.
This is what I removed:
- testGrabScreens
The screenshot-taking part is 100% done by Qt. I don't see any sense in
testing that. What's left is checking if
ScreenshotDirec
from the old ScreenGrabber) generates valid file names.
I see little value in such test as it's in the same abstraction level as
the code it's testing, which also just a couple of lines long.
- testRotatedScre
rotated by OrientedShell is still upright.
Doesn't make sense as there's no code for that anymore since screenshots
are now being taken of the Shell component (at Item level) instead of
the QQuickWindow (at window level).
The new tests you're asking for are merely testing signal-slot connections:
a)
"""
onScreenshotTri
"""
b)
"""
onTriggered: capture()
"""
In my opinition they would make for pretty useless tests. Useful tests
check emerging behavior or code interactions that are not obvious by
just looking at the code. They save the developer for unwittingly
breaking code or behavior. They shouldn't be a one-to-one mapping of the
code being tested.
I don't see anything test-worthy in ItemGrabber or ScreenshotDirec
There's little code there and it's all pretty simple and isolated.
Unless you mean high-level functional tests that press the volume keys
and check if a file lands on the correct dir, which lies out of scope of
this change (it exercises *way* more than the code I'm changing). And,
besides, I have my issues with high-level functional tests, but that's a
whole different topic.
| Lukáš Tinkl (lukas-kde) wrote : | # |
It wouldn't be much work:
QStandardPaths:
QString filename = ScreenshotDirec
QFileSystemWatc
then check output of:
QFileSystemWatc
| Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2345
https:/
Executed test runs:
UNSTABLE: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
| Nick Dedekind (nick-dedekind) wrote : | # |
> On 27/04/2016 04:54, Gerry Boland wrote:
> > +++ qml/Components/
> > + root.parent.
> > Breaking encapsulation?
>
> I didn't put a "property Item target" parameter because ItemGrabber not
> only grabs an image and saves it, it also shows an effect (the white
> flash) over its parent it even has an "anchors.fill: parent" so it's
> meant to capture its parent.
>
> I don't mind much adding a target parameter and have Shell do the
> anchoring but just feels like a flexibility that doesn't make sense (no
> use case).
>
> Documented this component to make intent and design clear.
I believe there is a use case where we would screenshot the focused surface on desktop.
| Nick Dedekind (nick-dedekind) wrote : | # |
> > On 27/04/2016 04:54, Gerry Boland wrote:
> > > +++ qml/Components/
> > > + root.parent.
> > > Breaking encapsulation?
> >
> > I didn't put a "property Item target" parameter because ItemGrabber not
> > only grabs an image and saves it, it also shows an effect (the white
> > flash) over its parent it even has an "anchors.fill: parent" so it's
> > meant to capture its parent.
> >
> > I don't mind much adding a target parameter and have Shell do the
> > anchoring but just feels like a flexibility that doesn't make sense (no
> > use case).
> >
> > Documented this component to make intent and design clear.
>
> I believe there is a use case where we would screenshot the focused surface on
> desktop.
Alt-PrtSc
I don't think we a ItemGrabber on every surface...
| Lukáš Tinkl (lukas-kde) wrote : | # |
- 2342. By Daniel d'Andrada on 2016-04-28
-
Refactor screenshotting code and make it work in multimonitor scenarios
+ Implement snapshotting the focused window with Alt+PrtScn
+ Workaround bug in QWindow regarding visibility when moving between screens
| Daniel d'Andrada (dandrader) wrote : | # |
> > > On 27/04/2016 04:54, Gerry Boland wrote:
> > > > +++ qml/Components/
> > > > + root.parent.
> > > > Breaking encapsulation?
> > >
> > > I didn't put a "property Item target" parameter because ItemGrabber not
> > > only grabs an image and saves it, it also shows an effect (the white
> > > flash) over its parent it even has an "anchors.fill: parent" so it's
> > > meant to capture its parent.
> > >
> > > I don't mind much adding a target parameter and have Shell do the
> > > anchoring but just feels like a flexibility that doesn't make sense (no
> > > use case).
> > >
> > > Documented this component to make intent and design clear.
> >
> > I believe there is a use case where we would screenshot the focused surface
> on
> > desktop.
>
> Alt-PrtSc
> I don't think we a ItemGrabber on every surface...
Right. Implemented Alt+PrtSc support. Thanks!
| Daniel d'Andrada (dandrader) wrote : | # |
> > > On 27/04/2016 04:54, Gerry Boland wrote:
> > > > +++ qml/Components/
> > > > + root.parent.
> > > > Breaking encapsulation?
> > >
> > > I didn't put a "property Item target" parameter because ItemGrabber not
> > > only grabs an image and saves it, it also shows an effect (the white
> > > flash) over its parent it even has an "anchors.fill: parent" so it's
> > > meant to capture its parent.
> > >
> > > I don't mind much adding a target parameter and have Shell do the
> > > anchoring but just feels like a flexibility that doesn't make sense (no
> > > use case).
> > >
> > > Documented this component to make intent and design clear.
> >
> > I believe there is a use case where we would screenshot the focused surface
> on
> > desktop.
>
> Alt-PrtSc
> I don't think we a ItemGrabber on every surface...
Right. Implemented Alt+PrtSc support. Thanks!
- 2343. By Daniel d'Andrada on 2016-04-29
-
s/Ctrl/Alt
| Lukáš Tinkl (lukas-kde) wrote : | # |
All good, tested on mako (both internal and external screen), no issues spotted.

FAILED: Continuous integration, rev:2343 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/1068/ /unity8- jenkins. ubuntu. com/job/ build-0- fetch/1437 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 1403 /unity8- jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1403 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1403/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1403/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1403/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1403/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 1403/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1403/console
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/1068/ rebuild
https:/