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

Proposed by Tim Peeters
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 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

cherry pick r1913 from staging

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml 2016-02-02 13:43:32 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/MainViewStyle.qml 2016-03-30 18:56:07 +0000
@@ -47,30 +47,16 @@
47 */47 */
48 property color footerColor: styledItem.footerColor48 property color footerColor: styledItem.footerColor
4949
50 Gradient {
51 id: backgroundGradient
52 GradientStop { position: 0.0; color: mainViewStyle.headerColor }
53 GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
54 GradientStop { position: 1.0; color: mainViewStyle.footerColor }
55 }
56
57 Rectangle {50 Rectangle {
58 id: backgroundColor
59 anchors.fill: parent51 anchors.fill: parent
60 color: mainViewStyle.backgroundColor52 // Hide the gradient if the style was loaded and afterwards the header
61 gradient: internals.isGradient ? backgroundGradient : null53 // and footer color are set to the same value as backgroundColor.
62 visible: internals.isGradient54 visible: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
63 }55 mainViewStyle.backgroundColor != mainViewStyle.footerColor
6456 gradient: Gradient {
65 Binding {57 GradientStop { position: 0.0; color: mainViewStyle.headerColor }
66 target: typeof window != 'undefined' ? window : null58 GradientStop { position: 0.83; color: mainViewStyle.backgroundColor }
67 property: "color"59 GradientStop { position: 1.0; color: mainViewStyle.footerColor }
68 value: mainViewStyle.backgroundColor60 }
69 }
70
71 QtObject {
72 id: internals
73 property bool isGradient: mainViewStyle.backgroundColor != mainViewStyle.headerColor ||
74 mainViewStyle.backgroundColor != mainViewStyle.footerColor
75 }61 }
76}62}
7763
=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase.cpp'
--- src/Ubuntu/Components/plugin/ucmainviewbase.cpp 2016-02-15 14:15:37 +0000
+++ src/Ubuntu/Components/plugin/ucmainviewbase.cpp 2016-03-30 18:56:07 +0000
@@ -59,6 +59,8 @@
59 // FIXME Wire this up to the application lifecycle management API instead of quit().59 // FIXME Wire this up to the application lifecycle management API instead of quit().
60 qApp->quit();60 qApp->quit();
61 });61 });
62
63 QObject::connect(q, SIGNAL(windowChanged(QQuickWindow*)), q, SLOT(_q_updateWindow()));
62}64}
6365
64void UCMainViewBasePrivate::_q_headerColorBinding(const QColor &col)66void UCMainViewBasePrivate::_q_headerColorBinding(const QColor &col)
@@ -107,6 +109,14 @@
107 d_func()->init();109 d_func()->init();
108}110}
109111
112void UCMainViewBasePrivate::_q_updateWindow()
113{
114 Q_Q(UCMainViewBase);
115 if (q->window()) {
116 q->window()->setColor(m_backgroundColor);
117 }
118}
119
110UCMainViewBase::UCMainViewBase(UCMainViewBasePrivate &dd, QQuickItem *parent)120UCMainViewBase::UCMainViewBase(UCMainViewBasePrivate &dd, QQuickItem *parent)
111 : UCPageTreeNode( dd, parent)121 : UCPageTreeNode( dd, parent)
112{122{
@@ -177,6 +187,11 @@
177{187{
178 Q_D(UCMainViewBase);188 Q_D(UCMainViewBase);
179189
190 // MainViewStyle is used to draw the gradient background.
191 if (d->styleName().isEmpty()) {
192 d->setStyleName(QStringLiteral("MainViewStyle"));
193 }
194
180 //disable binding to background color195 //disable binding to background color
181 d->m_flags |= UCMainViewBasePrivate::CustomHeaderColor;196 d->m_flags |= UCMainViewBasePrivate::CustomHeaderColor;
182 d->_q_headerColorBinding(headerColor);197 d->_q_headerColorBinding(headerColor);
@@ -220,6 +235,8 @@
220 if (!(d->m_flags & UCMainViewBasePrivate::CustomFooterColor))235 if (!(d->m_flags & UCMainViewBasePrivate::CustomFooterColor))
221 d->_q_footerColorBinding(d->m_backgroundColor);236 d->_q_footerColorBinding(d->m_backgroundColor);
222237
238 d->_q_updateWindow();
239
223 // FIXME: Define the background colors in MainViewStyle and get rid of the properties240 // FIXME: Define the background colors in MainViewStyle and get rid of the properties
224 // in MainViewBase. That removes the need for auto-theming.241 // in MainViewBase. That removes the need for auto-theming.
225 d->doAutoTheme();242 d->doAutoTheme();
@@ -235,6 +252,10 @@
235{252{
236 Q_D(UCMainViewBase);253 Q_D(UCMainViewBase);
237254
255 // MainViewStyle is used to draw the gradient background.
256 if (d->styleName().isEmpty()) {
257 d->setStyleName(QStringLiteral("MainViewStyle"));
258 }
238 //disable binding to background color259 //disable binding to background color
239 d->m_flags |= UCMainViewBasePrivate::CustomFooterColor;260 d->m_flags |= UCMainViewBasePrivate::CustomFooterColor;
240 d->_q_footerColorBinding(footerColor);261 d->_q_footerColorBinding(footerColor);
@@ -286,7 +307,6 @@
286{307{
287 Q_D(UCMainViewBase);308 Q_D(UCMainViewBase);
288 UCPageTreeNode::componentComplete();309 UCPageTreeNode::componentComplete();
289 d->setStyleName(QStringLiteral("MainViewStyle"));
290 d->doAutoTheme();310 d->doAutoTheme();
291311
292 if (d->m_actionContext)312 if (d->m_actionContext)
@@ -312,3 +332,5 @@
312 d->m_actionContext->classBegin();332 d->m_actionContext->classBegin();
313 }333 }
314}334}
335
336#include "moc_ucmainviewbase.cpp"
315337
=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase.h'
--- src/Ubuntu/Components/plugin/ucmainviewbase.h 2016-01-25 08:40:25 +0000
+++ src/Ubuntu/Components/plugin/ucmainviewbase.h 2016-03-30 18:56:07 +0000
@@ -79,6 +79,7 @@
7979
80private:80private:
81 Q_DECLARE_PRIVATE(UCMainViewBase)81 Q_DECLARE_PRIVATE(UCMainViewBase)
82 Q_PRIVATE_SLOT(d_func(), void _q_updateWindow())
82};83};
8384
84#endif // UCMAINVIEWBASE_H85#endif // UCMAINVIEWBASE_H
8586
=== modified file 'src/Ubuntu/Components/plugin/ucmainviewbase_p.h'
--- src/Ubuntu/Components/plugin/ucmainviewbase_p.h 2016-01-21 12:30:25 +0000
+++ src/Ubuntu/Components/plugin/ucmainviewbase_p.h 2016-03-30 18:56:07 +0000
@@ -40,7 +40,8 @@
4040
41 void _q_headerColorBinding (const QColor &col);41 void _q_headerColorBinding (const QColor &col);
42 void _q_footerColorBinding (const QColor &col);42 void _q_footerColorBinding (const QColor &col);
43 void doAutoTheme ();43 void doAutoTheme();
44 void _q_updateWindow();
4445
45 QString m_applicationName;46 QString m_applicationName;
46 QColor m_headerColor;47 QColor m_headerColor;
4748
=== modified file 'tests/unit/runtest.sh'
--- tests/unit/runtest.sh 2016-02-16 12:27:45 +0000
+++ tests/unit/runtest.sh 2016-03-30 18:56:07 +0000
@@ -43,8 +43,13 @@
43 fi43 fi
44 _CMD="-n $_TESTFILE -m 300"44 _CMD="-n $_TESTFILE -m 300"
4545
46 _CMD="dbus-test-runner --task gdb -p --quiet $_CMD"46 DEB_HOST_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH)
47 _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"47 if [[ ${DEB_HOST_ARCH} =~ 'arm' ]]; then
48 _CMD="dbus-test-runner --task $EXE $_CMD"
49 else
50 _CMD="dbus-test-runner --task gdb -p --quiet $_CMD"
51 _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"
52 fi
4853
49 if [ "$_MINIMAL" = "minimal" ]; then54 if [ "$_MINIMAL" = "minimal" ]; then
50 _CMD="$_CMD -p -platform -p minimal"55 _CMD="$_CMD -p -platform -p minimal"

Subscribers

People subscribed via source and target branches

to status/vote changes: