Merge lp:~tpeeters/ubuntu-ui-toolkit/fasterWindowColorTrunk into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters on 2016-03-30
Status: Merged
Merged at revision: 1287
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/fasterWindowColorTrunk
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 163 lines (+42/-27)
5 files modified
src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml (+9/-23)
src/Ubuntu/Components/plugin/ucmainviewbase.cpp (+23/-1)
src/Ubuntu/Components/plugin/ucmainviewbase.h (+1/-0)
src/Ubuntu/Components/plugin/ucmainviewbase_p.h (+2/-1)
tests/unit/runtest.sh (+7/-2)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/fasterWindowColorTrunk
Reviewer Review Type Date Requested Status
Ubuntu SDK team 2016-03-30 Pending
Review via email: mp+290458@code.launchpad.net

Commit message

Set the window color as soon as the window is available, to avoid a flickering background when it is updated later, plus fix runtest.sh to work for xenial on arm.

Description of the change

Applied staging r1895 and r1913 to trunk.

To post a comment you must log in.
1288. By Tim Peeters on 2016-03-30

cherry pick r1913 from staging

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml'
2--- src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml 2016-02-02 13:43:32 +0000
3+++ src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml 2016-03-30 18:56:07 +0000
4@@ -47,30 +47,16 @@
5 */
6 property color footerColor: styledItem.footerColor
7
8- Gradient {
9- id: backgroundGradient
10- GradientStop { position: 0.0; color: mainViewStyle.headerColor }
11- GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
12- GradientStop { position: 1.0; color: mainViewStyle.footerColor }
13- }
14-
15 Rectangle {
16- id: backgroundColor
17 anchors.fill: parent
18- color: mainViewStyle.backgroundColor
19- gradient: internals.isGradient ? backgroundGradient : null
20- visible: internals.isGradient
21- }
22-
23- Binding {
24- target: typeof window != 'undefined' ? window : null
25- property: "color"
26- value: mainViewStyle.backgroundColor
27- }
28-
29- QtObject {
30- id: internals
31- property bool isGradient: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
32- mainViewStyle.backgroundColor != mainViewStyle.footerColor
33+ // Hide the gradient if the style was loaded and afterwards the header
34+ // and footer color are set to the same value as backgroundColor.
35+ visible: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
36+ mainViewStyle.backgroundColor != mainViewStyle.footerColor
37+ gradient: Gradient {
38+ GradientStop { position: 0.0; color: mainViewStyle.headerColor }
39+ GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
40+ GradientStop { position: 1.0; color: mainViewStyle.footerColor }
41+ }
42 }
43 }
44
45=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase.cpp'
46--- src/Ubuntu/Components/plugin/ucmainviewbase.cpp 2016-02-15 14:15:37 +0000
47+++ src/Ubuntu/Components/plugin/ucmainviewbase.cpp 2016-03-30 18:56:07 +0000
48@@ -59,6 +59,8 @@
49 // FIXME Wire this up to the application lifecycle management API instead of quit().
50 qApp->quit();
51 });
52+
53+ QObject::connect(q, SIGNAL(windowChanged(QQuickWindow*)), q, SLOT(_q_updateWindow()));
54 }
55
56 void UCMainViewBasePrivate::_q_headerColorBinding(const QColor &col)
57@@ -107,6 +109,14 @@
58 d_func()->init();
59 }
60
61+void UCMainViewBasePrivate::_q_updateWindow()
62+{
63+ Q_Q(UCMainViewBase);
64+ if (q->window()) {
65+ q->window()->setColor(m_backgroundColor);
66+ }
67+}
68+
69 UCMainViewBase::UCMainViewBase(UCMainViewBasePrivate &dd, QQuickItem *parent)
70 : UCPageTreeNode( dd, parent)
71 {
72@@ -177,6 +187,11 @@
73 {
74 Q_D(UCMainViewBase);
75
76+ // MainViewStyle is used to draw the gradient background.
77+ if (d->styleName().isEmpty()) {
78+ d->setStyleName(QStringLiteral("MainViewStyle"));
79+ }
80+
81 //disable binding to background color
82 d->m_flags |= UCMainViewBasePrivate::CustomHeaderColor;
83 d->_q_headerColorBinding(headerColor);
84@@ -220,6 +235,8 @@
85 if (!(d->m_flags & UCMainViewBasePrivate::CustomFooterColor))
86 d->_q_footerColorBinding(d->m_backgroundColor);
87
88+ d->_q_updateWindow();
89+
90 // FIXME: Define the background colors in MainViewStyle and get rid of the properties
91 // in MainViewBase. That removes the need for auto-theming.
92 d->doAutoTheme();
93@@ -235,6 +252,10 @@
94 {
95 Q_D(UCMainViewBase);
96
97+ // MainViewStyle is used to draw the gradient background.
98+ if (d->styleName().isEmpty()) {
99+ d->setStyleName(QStringLiteral("MainViewStyle"));
100+ }
101 //disable binding to background color
102 d->m_flags |= UCMainViewBasePrivate::CustomFooterColor;
103 d->_q_footerColorBinding(footerColor);
104@@ -286,7 +307,6 @@
105 {
106 Q_D(UCMainViewBase);
107 UCPageTreeNode::componentComplete();
108- d->setStyleName(QStringLiteral("MainViewStyle"));
109 d->doAutoTheme();
110
111 if (d->m_actionContext)
112@@ -312,3 +332,5 @@
113 d->m_actionContext->classBegin();
114 }
115 }
116+
117+#include "moc_ucmainviewbase.cpp"
118
119=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase.h'
120--- src/Ubuntu/Components/plugin/ucmainviewbase.h 2016-01-25 08:40:25 +0000
121+++ src/Ubuntu/Components/plugin/ucmainviewbase.h 2016-03-30 18:56:07 +0000
122@@ -79,6 +79,7 @@
123
124 private:
125 Q_DECLARE_PRIVATE(UCMainViewBase)
126+ Q_PRIVATE_SLOT(d_func(), void _q_updateWindow())
127 };
128
129 #endif // UCMAINVIEWBASE_H
130
131=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase_p.h'
132--- src/Ubuntu/Components/plugin/ucmainviewbase_p.h 2016-01-21 12:30:25 +0000
133+++ src/Ubuntu/Components/plugin/ucmainviewbase_p.h 2016-03-30 18:56:07 +0000
134@@ -40,7 +40,8 @@
135
136 void _q_headerColorBinding (const QColor &col);
137 void _q_footerColorBinding (const QColor &col);
138- void doAutoTheme ();
139+ void doAutoTheme();
140+ void _q_updateWindow();
141
142 QString m_applicationName;
143 QColor m_headerColor;
144
145=== modified file 'tests/unit/runtest.sh'
146--- tests/unit/runtest.sh 2016-02-16 12:27:45 +0000
147+++ tests/unit/runtest.sh 2016-03-30 18:56:07 +0000
148@@ -43,8 +43,13 @@
149 fi
150 _CMD="-n $_TESTFILE -m 300"
151
152- _CMD="dbus-test-runner --task gdb -p --quiet $_CMD"
153- _CMD="$_CMD -p --batch -p -ex -p 'set print thread-events off' -p -ex -p run -p -ex -p bt -p --return-child-result -p --args -p $EXE"
154+ DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
155+ if [[ ${DEB_HOST_ARCH} =~ 'arm' ]]; then
156+ _CMD="dbus-test-runner --task $EXE $_CMD"
157+ else
158+ _CMD="dbus-test-runner --task gdb -p --quiet $_CMD"
159+ _CMD="$_CMD -p --batch -p -ex -p 'set print thread-events off' -p -ex -p run -p -ex -p bt -p --return-child-result -p --args -p $EXE"
160+ fi
161
162 if [ "$_MINIMAL" = "minimal" ]; then
163 _CMD="$_CMD -p -platform -p minimal"

Subscribers

People subscribed via source and target branches

to status/vote changes: