Merge lp:~aacid/unity8/addPaddingBetweenPreviewColumns into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2663
Merged at revision: 2679
Proposed branch: lp:~aacid/unity8/addPaddingBetweenPreviewColumns
Merge into: lp:unity8
Diff against target: 212 lines (+59/-31)
8 files modified
qml/Dash/Previews/Preview.qml (+19/-7)
qml/Dash/Previews/PreviewInlineVideo.qml (+1/-1)
qml/Dash/Previews/PreviewVideoPlayback.qml (+1/-1)
qml/Dash/Previews/PreviewWidget.qml (+2/-2)
qml/Dash/Previews/PreviewWidgetFactory.qml (+2/-2)
qml/Dash/Previews/PreviewZoomableImage.qml (+1/-1)
tests/mocks/Unity/fake_previewmodel.cpp (+15/-7)
tests/mocks/Unity/fake_previewwidgetmodel.cpp (+18/-10)
To merge this branch: bzr merge lp:~aacid/unity8/addPaddingBetweenPreviewColumns
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+307594@code.launchpad.net

Commit message

Rework Dash Preview column margins

    If there's one column
     Preview widgets have 2GU on each side
      Unless it's one of the "full screen" widgets, i.e. video/image
     This hasn't changed in this patch

    If there's two columns
     the columns have 4GU on each side and between eachother
     This has changed according to design guidelines

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
It's based on design input.

To post a comment you must log in.
2657. By Albert Astals Cid

Default is false (not that it matters but anyway)

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2657
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2312/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3046
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1693
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1693
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1693
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3074
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2931/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2931
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2931/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2312/rebuild

review: Needs Fixing (continuous-integration)
2658. By Albert Astals Cid

Put the combo preview at the end, tests want it there

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2658
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2313/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3050
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1696
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1696
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1696
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3078
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2935/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2935
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2935/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2313/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Code is fine, need to double check with design but this is as requested

Revision history for this message
Andrea Cimitan (cimi) wrote :

I jusr realised, looking at the mockups, that we should have the same 4gu padding also on the top of the columns (so probably 2 in portrait), shall we add these here or a new branch?

review: Needs Information
Revision history for this message
Andrea Cimitan (cimi) wrote :

> I jusr realised, looking at the mockups, that we should have the same 4gu
> padding also on the top of the columns (so probably 2 in portrait), shall we
> add these here or a new branch?

if needed lp:~unity-team/unity8/addPaddingBetweenPreviewColumns

Revision history for this message
Albert Astals Cid (aacid) wrote :

I'm sincerely not convinced http://bazaar.launchpad.net/~unity-team/unity8/addPaddingBetweenPreviewColumns/revision/2659 is a good idea, the problem is, you're resizing the window horizontally and suddenly not only the items are rearranged horizontally (new columns or horizontal spacing) but they also jump vertically.

I think that doesn't make sense.

2659. By Albert Astals Cid

Change topMargin based on width

I think it's not a good idea to change the vertical spacing while you do an horizontal resize, but i'm not a designer, so do what Cimi suggested

Revision history for this message
Albert Astals Cid (aacid) wrote :

Added your changeset anyway.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2659
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2369/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3122
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1766
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1766
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1766
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3150
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3006/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3006
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3006/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2369/rebuild

review: Approve (continuous-integration)
2660. By Albert Astals Cid

top&bottom margin 2gu+clip

2661. By Albert Astals Cid

No bottom margin

2662. By Albert Astals Cid

units.gu(2) on the left/right also for the 2 columns scenario

2663. By Albert Astals Cid

make it just be some margin on the top of the contents, not a fix margin

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2660
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2382/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3133
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1777
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1777
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1777
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3161
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3017/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3017
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3017/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2382/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2663
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2385/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3136
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1780
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1780
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1780
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3164
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3020/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3020
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3020/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2385/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
yes
 * Did CI run pass? If not, please explain why.
it passed

review: Approve
Revision history for this message
Andrea Cimitan (cimi) wrote :

tests seems to be a bit flaky, can you have a look at it please?
qmltestrunner.Dash::test_close_temp_scope_preview_opening_scope
qmltestrunner.Preview::test_comboEnsureVisible
qmltestrunner.Preview::test_containOnFocus

Revision history for this message
Albert Astals Cid (aacid) wrote :

As discussed last friday the flakyness doesn't seem to be introduced by this branch, right?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/Dash/Previews/Preview.qml'
--- qml/Dash/Previews/Preview.qml 2016-06-27 18:41:15 +0000
+++ qml/Dash/Previews/Preview.qml 2016-10-14 14:58:15 +0000
@@ -56,11 +56,12 @@
56 Row {56 Row {
57 id: row57 id: row
5858
59 spacing: units.gu(1)59 spacing: units.gu(4)
60 anchors { fill: parent; margins: spacing }60 anchors.fill: parent
6161
62 property int columns: width >= units.gu(80) ? 2 : 162 readonly property int columns: width >= units.gu(80) ? 2 : 1
63 property real columnWidth: width / columns63 readonly property real columnWidth: (width - (spacing * (columns - 1))) / columns
64 readonly property int singleColumnMargin: units.gu(2)
6465
65 Repeater {66 Repeater {
66 model: previewModel67 model: previewModel
@@ -72,8 +73,11 @@
72 top: parent.top73 top: parent.top
73 bottom: parent.bottom74 bottom: parent.bottom
74 }75 }
76 topMargin: units.gu(2)
75 width: row.columnWidth77 width: row.columnWidth
76 spacing: row.spacing78 spacing: units.gu(1)
79
80 readonly property int columnNumber: index
7781
78 ListViewOSKScroller {82 ListViewOSKScroller {
79 id: oskScroller83 id: oskScroller
@@ -96,8 +100,16 @@
96 anchors {100 anchors {
97 left: parent.left101 left: parent.left
98 right: parent.right102 right: parent.right
99 leftMargin: widgetMargins103 leftMargin: if (row.columns == 1) {
100 rightMargin: widgetMargins104 return singleColumnMarginless ? 0 : row.singleColumnMargin;
105 } else {
106 return column.columnNumber == 0 ? row.singleColumnMargin : 0;
107 }
108 rightMargin: if (row.columns == 1) {
109 return singleColumnMarginless ? 0 : row.singleColumnMargin;
110 } else {
111 return column.columnNumber == 1 ? row.singleColumnMargin : 0;
112 }
101 }113 }
102114
103 onTriggered: {115 onTriggered: {
104116
=== modified file 'qml/Dash/Previews/PreviewInlineVideo.qml'
--- qml/Dash/Previews/PreviewInlineVideo.qml 2016-07-27 14:25:44 +0000
+++ qml/Dash/Previews/PreviewInlineVideo.qml 2016-10-14 14:58:15 +0000
@@ -33,7 +33,7 @@
33 implicitWidth: units.gu(35)33 implicitWidth: units.gu(35)
34 implicitHeight: services.height34 implicitHeight: services.height
3535
36 widgetMargins: -units.gu(1)36 singleColumnMarginless: true
37 orientationLock: services.fullscreen37 orientationLock: services.fullscreen
3838
39 property alias rootItem: services.rootItem39 property alias rootItem: services.rootItem
4040
=== modified file 'qml/Dash/Previews/PreviewVideoPlayback.qml'
--- qml/Dash/Previews/PreviewVideoPlayback.qml 2016-05-03 09:45:41 +0000
+++ qml/Dash/Previews/PreviewVideoPlayback.qml 2016-10-14 14:58:15 +0000
@@ -30,7 +30,7 @@
30 implicitWidth: units.gu(35)30 implicitWidth: units.gu(35)
31 implicitHeight: childrenRect.height31 implicitHeight: childrenRect.height
3232
33 widgetMargins: -units.gu(1)33 singleColumnMarginless: true
3434
35 LazyImage {35 LazyImage {
36 objectName: "screenshot"36 objectName: "screenshot"
3737
=== modified file 'qml/Dash/Previews/PreviewWidget.qml'
--- qml/Dash/Previews/PreviewWidget.qml 2016-06-01 16:05:12 +0000
+++ qml/Dash/Previews/PreviewWidget.qml 2016-10-14 14:58:15 +0000
@@ -34,8 +34,8 @@
34 //! Should the orientation be locked34 //! Should the orientation be locked
35 property bool orientationLock: false35 property bool orientationLock: false
3636
37 //! Set margins width.37 //! Should it have margins when on a single columns?
38 property real widgetMargins: units.gu(1)38 property bool singleColumnMarginless: false
3939
40 /// The parent (vertical) flickable this widget is in (if any)40 /// The parent (vertical) flickable this widget is in (if any)
41 property var parentFlickable: null41 property var parentFlickable: null
4242
=== modified file 'qml/Dash/Previews/PreviewWidgetFactory.qml'
--- qml/Dash/Previews/PreviewWidgetFactory.qml 2016-06-09 14:45:57 +0000
+++ qml/Dash/Previews/PreviewWidgetFactory.qml 2016-10-14 14:58:15 +0000
@@ -40,8 +40,8 @@
40 //! Should the orientation be locked40 //! Should the orientation be locked
41 readonly property bool orientationLock: status === Loader.Ready ? item.orientationLock : false41 readonly property bool orientationLock: status === Loader.Ready ? item.orientationLock : false
4242
43 //! Set margins width.43 //! Should it have margins when on a single columns?
44 property real widgetMargins: status === Loader.Ready ? item.widgetMargins : units.gu(1)44 readonly property bool singleColumnMarginless: status === Loader.Ready ? item.singleColumnMarginless : false
4545
46 /// The parent (vertical) flickable this widget is in (if any)46 /// The parent (vertical) flickable this widget is in (if any)
47 property var parentFlickable: null47 property var parentFlickable: null
4848
=== modified file 'qml/Dash/Previews/PreviewZoomableImage.qml'
--- qml/Dash/Previews/PreviewZoomableImage.qml 2016-06-01 16:05:12 +0000
+++ qml/Dash/Previews/PreviewZoomableImage.qml 2016-10-14 14:58:15 +0000
@@ -30,7 +30,7 @@
30 implicitWidth: units.gu(35)30 implicitWidth: units.gu(35)
31 implicitHeight: lazyImage.height31 implicitHeight: lazyImage.height
3232
33 widgetMargins: -units.gu(1)33 singleColumnMarginless: true
34 orientationLock: overlay.visible34 orientationLock: overlay.visible
3535
36 property Item rootItem: QuickUtils.rootItem(root)36 property Item rootItem: QuickUtils.rootItem(root)
3737
=== modified file 'tests/mocks/Unity/fake_previewmodel.cpp'
--- tests/mocks/Unity/fake_previewmodel.cpp 2016-05-26 12:52:24 +0000
+++ tests/mocks/Unity/fake_previewmodel.cpp 2016-10-14 14:58:15 +0000
@@ -34,22 +34,30 @@
34 , m_loaded(true)34 , m_loaded(true)
35 , m_scope(scope)35 , m_scope(scope)
36{36{
37 // we have one column by default37 setWidgetColumnCount(1);
38 PreviewWidgetModel* columnModel = new PreviewWidgetModel(this);
39 m_previewWidgetModels.append(columnModel);
40 connect(this, &PreviewModel::triggered, this, &PreviewModel::triggeredSlot);38 connect(this, &PreviewModel::triggered, this, &PreviewModel::triggeredSlot);
41}39}
4240
43void PreviewModel::setWidgetColumnCount(int count)41void PreviewModel::setWidgetColumnCount(int count)
44{42{
45 if (count != 1) {43 if (count != widgetColumnCount()) {
46 qWarning("PreviewModel::setWidgetColumnCount != 1 not implemented");44 beginResetModel();
45
46 m_previewWidgetModels.clear();
47 for (int i = 0; i < count; ++i) {
48 PreviewWidgetModel* columnModel = new PreviewWidgetModel(this);
49 m_previewWidgetModels.append(columnModel);
50 }
51
52 endResetModel();
53
54 Q_EMIT widgetColumnCountChanged();
47 }55 }
48}56}
4957
50int PreviewModel::widgetColumnCount() const58int PreviewModel::widgetColumnCount() const
51{59{
52 return 1;60 return m_previewWidgetModels.size();
53}61}
5462
55bool PreviewModel::loaded() const63bool PreviewModel::loaded() const
@@ -64,7 +72,7 @@
6472
65int PreviewModel::rowCount(const QModelIndex&) const73int PreviewModel::rowCount(const QModelIndex&) const
66{74{
67 return m_previewWidgetModels.size();75 return widgetColumnCount();
68}76}
6977
70QVariant PreviewModel::data(const QModelIndex& index, int role) const78QVariant PreviewModel::data(const QModelIndex& index, int role) const
7179
=== modified file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp'
--- tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-11 17:17:20 +0000
+++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2016-10-14 14:58:15 +0000
@@ -54,18 +54,26 @@
54 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));54 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
55 }55 }
5656
57 QVariantMap attributes;57 {
58 QVariantMap buttonData;58 QVariantMap attributes;
59 buttonData["label"] = "Button";59 attributes["source"] = QVariant("qrc:///Unity/Application/screenshots/browser@12.png");
60 buttonData["id"] = "open_click";60 PreviewData* preview_data = new PreviewData(QString("widget-22"), QString("image"), attributes);
61 QVariantList buttons;61 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
62 buttons << buttonData << buttonData << buttonData;62 }
63 attributes["actions"] = QVariant::fromValue(buttons);63
64 PreviewData* preview_data = new PreviewData(QString("widget-21"), QString("actions"), attributes);64 {
65 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));65 QVariantMap attributes;
66 QVariantMap buttonData;
67 buttonData["label"] = "Button";
68 buttonData["id"] = "open_click";
69 QVariantList buttons;
70 buttons << buttonData << buttonData << buttonData;
71 attributes["actions"] = QVariant::fromValue(buttons);
72 PreviewData* preview_data = new PreviewData(QString("widget-21"), QString("actions"), attributes);
73 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
74 }
6675
67 endResetModel();76 endResetModel();
68
69}77}
7078
71int PreviewWidgetModel::rowCount(const QModelIndex&) const79int PreviewWidgetModel::rowCount(const QModelIndex&) const

Subscribers

People subscribed via source and target branches