Merge lp:~tpeeters/ubuntu-ui-toolkit/fasterWindowColor into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters on 2016-03-10
Status: Merged
Approved by: Timo Jyrinki on 2016-03-15
Approved revision: 1895
Merged at revision: 1895
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/fasterWindowColor
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 143 lines (+35/-25)
4 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)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/fasterWindowColor
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-03-15
Zsombor Egri 2016-03-10 Approve on 2016-03-15
Review via email: mp+288661@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.

Description of the change

The MainViewStyle is only needed for drawing a gradient background now, so UCMainViewBase was adapted so that it only sets the styleName if a gradient must be drawn.

To post a comment you must log in.
Zsombor Egri (zsombi) wrote :

One comment inline

review: Needs Fixing
Zsombor Egri (zsombi) wrote :

All right, I love it now. Let's get it in.

review: Approve

FAILED: Autolanding.
More details in the following jenkins job:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-autolanding/202/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-land-mp/207/console

review: Needs Fixing (continuous-integration)
Timo Jyrinki (timo-jyrinki) wrote :

retrying without armhf, our phones are down.

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-15 10:44:41 +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-15 10:44:41 +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-15 10:44:41 +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-15 10:44:41 +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;

Subscribers

People subscribed via source and target branches