Merge lp:~fboucault/ubuntu-ui-toolkit/ubuntu_colors into lp:ubuntu-ui-toolkit

Proposed by Florian Boucault
Status: Merged
Approved by: Tim Peeters
Approved revision: 595
Merged at revision: 573
Proposed branch: lp:~fboucault/ubuntu-ui-toolkit/ubuntu_colors
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~fboucault/ubuntu-ui-toolkit/simple_theming
Diff against target: 458 lines (+147/-23)
23 files modified
debian/qtdeclarative5-ubuntu-ui-toolkit-plugin.install (+1/-0)
examples/ubuntu-ui-toolkit-gallery/AnimationCircle.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Dialog.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Icons.qml (+2/-2)
examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml (+3/-3)
modules/Ubuntu/Components/Colors/Colors.pro (+9/-0)
modules/Ubuntu/Components/Colors/FIXME (+3/-0)
modules/Ubuntu/Components/Colors/UbuntuColors.qml (+63/-0)
modules/Ubuntu/Components/Components.pro (+1/-1)
modules/Ubuntu/Components/Icon.qml (+1/-1)
modules/Ubuntu/Components/Label.qml (+2/-2)
modules/Ubuntu/Components/ListItems/LabelVisual.qml (+1/-1)
modules/Ubuntu/Components/MainView.qml (+3/-3)
modules/Ubuntu/Components/PageStack.qml (+1/-1)
modules/Ubuntu/Components/Popups/ComposerSheet.qml (+1/-1)
modules/Ubuntu/Components/Popups/DefaultSheet.qml (+1/-1)
modules/Ubuntu/Components/Popups/Dialog.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml (+1/-1)
modules/Ubuntu/Components/UbuntuNumberAnimation.qml (+1/-1)
modules/Ubuntu/Components/plugin/plugin.cpp (+30/-0)
modules/Ubuntu/Components/plugin/plugin.h (+2/-0)
modules/Ubuntu/Components/plugin/quickutils.cpp (+15/-1)
modules/Ubuntu/Components/plugin/quickutils.h (+2/-0)
To merge this branch: bzr merge lp:~fboucault/ubuntu-ui-toolkit/ubuntu_colors
Reviewer Review Type Date Requested Status
Tim Peeters Approve
PS Jenkins bot continuous-integration Approve
Zsombor Egri Needs Fixing
Review via email: mp+172340@code.launchpad.net

Commit message

New UbuntuColors singleton defining the standard Ubuntu color palette.

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote :

Checkbox and Switch styles use the color #DD4814. Could you replace these by UbuntuColors.orange?

Revision history for this message
Tim Peeters (tpeeters) wrote :

UbuntuColors is in the module Ubuntu.Components, which already has Ubuntu in the name so instead of Ubuntu.Components.UbuntuColors we could rename the colors to Ubuntu.Components.Colors.

Revision history for this message
Tim Peeters (tpeeters) wrote :

367 +void UbuntuComponentsPlugin::registerQmlSingletonType(QQmlEngine *engine, const char* uri, const char* typeName, const char* qmlFile)

Is it really a singleton? You can still use UbuntuColors { } right? The qml component doesn't keep track of its instances. Also, the function name may cause some confusion with qmlRegisterSingletonType(). What about registerQmlContextProperty() as a function name?

Revision history for this message
Tim Peeters (tpeeters) wrote :

394 public:
395 void registerTypes(const char *uri);
396 void initializeEngine(QQmlEngine *engine, const char *uri);
397 + QUrl baseUrl(QStringList importPathList, const char* uri);
398 + void registerQmlSingletonType(QQmlEngine *engine, const char* uri, const char* typeName, const char* qmlFile);

Do they have to be public?

Revision history for this message
Florian Boucault (fboucault) wrote :

> 367 +void UbuntuComponentsPlugin::registerQmlSingletonType(QQmlEngine
> *engine, const char* uri, const char* typeName, const char* qmlFile)
>
>
> Is it really a singleton? You can still use UbuntuColors { } right? The qml
> component doesn't keep track of its instances. Also, the function name may
> cause some confusion with qmlRegisterSingletonType(). What about
> registerQmlContextProperty() as a function name?

You cannot import it nor instantiate it.
The idea of naming it similarly to qmlRegisterSingletonType is because it behaves similarly.

Revision history for this message
Florian Boucault (fboucault) wrote :

> Checkbox and Switch styles use the color #DD4814. Could you replace these by
> UbuntuColors.orange?

Some of the colors where not replaced (such as these ones) on purpose because a separate MR is about to introduce a theme color palette from which these colors will be taken.

Revision history for this message
Florian Boucault (fboucault) wrote :

> 394 public:
> 395 void registerTypes(const char *uri);
> 396 void initializeEngine(QQmlEngine *engine, const char *uri);
> 397 + QUrl baseUrl(QStringList importPathList, const char* uri);
> 398 + void registerQmlSingletonType(QQmlEngine *engine, const char* uri,
> const char* typeName, const char* qmlFile);
>
> Do they have to be public?

Nobody can nor will instantiate the plugin manually so it does not really matter :)

Revision history for this message
Florian Boucault (fboucault) wrote :

> UbuntuColors is in the module Ubuntu.Components, which already has Ubuntu in
> the name so instead of Ubuntu.Components.UbuntuColors we could rename the
> colors to Ubuntu.Components.Colors.

As a developer you wouldn't readily associate in your mind the Colors object with the Ubuntu color palette, hence the name. The import name is quite distant code wise (as a developer you put it at the beginning of the file and forget it) and does not really help making the connection.

Revision history for this message
Florian Boucault (fboucault) wrote :

> > UbuntuColors is in the module Ubuntu.Components, which already has Ubuntu in
> > the name so instead of Ubuntu.Components.UbuntuColors we could rename the
> > colors to Ubuntu.Components.Colors.
>
> As a developer you wouldn't readily associate in your mind the Colors object
> with the Ubuntu color palette, hence the name. The import name is quite
> distant code wise (as a developer you put it at the beginning of the file and
> forget it) and does not really help making the connection.

A similar reasoning was used for UbuntuAnimation.

Revision history for this message
Tim Peeters (tpeeters) wrote :

ok, agreed.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

When closing gallery, the qmlscene does not exit (the prompt in terminal is not retrieved).

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

> When closing gallery, the qmlscene does not exit (the prompt in terminal is
> not retrieved).

Actually the following code causes the trouble:
419 +QObject* QuickUtils::createQmlObject(const QUrl &url)
420 +{
421 + /* FIXME: if the directory pointed to by url contains a qmldir file that
422 + declares a JavaScript module then QQmlComponent::create() fails with
423 + the error "QQmlComponent: Component is not ready".
424 + */
425 + static QQmlEngine engine;
426 + QQmlComponent *component = new QQmlComponent(&engine, url, QQmlComponent::PreferSynchronous);
427 + QObject* result = component->create();
428 + delete component;
429 + return result;
430 +}

Having a quick look on the call stack seems to hang on the static QQmlEngien cleanup:

0 pthread_cond_wait@@GLIBC_2.3.2 185 0x7ffff4815ca4
1 QWaitCondition::wait(QMutex*, unsigned long) /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 0x7ffff611e4fb
2 ?? /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff75a940a
3 ?? /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff75398f9
4 QQmlEnginePrivate::~QQmlEnginePrivate() /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff74e76d3
5 QQmlEnginePrivate::~QQmlEnginePrivate() /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff74e7ab9
6 QObject::~QObject() /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 0x7ffff62c5398
7 QQmlEngine::~QQmlEngine() /usr/lib/x86_64-linux-gnu/libQt5Qml.so.5 0x7ffff74e40a9
8 __run_exit_handlers 77 0x7ffff5701121
9 __GI_exit 99 0x7ffff57011a5
10 __libc_start_main 294 0x7ffff56e6eac
11 ?? 0x40629d

So the static QQmlEngine causes the hang when closing qmlscene. I did some small prototyping with using the plugin's QmlEngine, but then a second call on createQmlObject() causes "QQmlComponent: Component not ready" error, which is somewhat anticipated as we are trying to instantiate a component in the plugin's registration stage (we had this kind of error in the early times of the plugin creation with the theming engine).

Connecting the static engine's quit() signal to the parent one's does not help either. Therefore seems we need a different way of creating the UbuntuColors component.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
595. By Florian Boucault

Fixed lockup.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

hurray :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/qtdeclarative5-ubuntu-ui-toolkit-plugin.install'
--- debian/qtdeclarative5-ubuntu-ui-toolkit-plugin.install 2013-06-27 20:59:19 +0000
+++ debian/qtdeclarative5-ubuntu-ui-toolkit-plugin.install 2013-07-02 15:41:27 +0000
@@ -7,3 +7,4 @@
7usr/lib/*/qt5/qml/Ubuntu/Components/artwork7usr/lib/*/qt5/qml/Ubuntu/Components/artwork
8usr/lib/*/qt5/qml/Ubuntu/Components/ListItems8usr/lib/*/qt5/qml/Ubuntu/Components/ListItems
9usr/lib/*/qt5/qml/Ubuntu/Components/Popups9usr/lib/*/qt5/qml/Ubuntu/Components/Popups
10usr/lib/*/qt5/qml/Ubuntu/Components/Colors
1011
=== modified file 'examples/ubuntu-ui-toolkit-gallery/AnimationCircle.qml'
--- examples/ubuntu-ui-toolkit-gallery/AnimationCircle.qml 2013-05-14 14:24:25 +0000
+++ examples/ubuntu-ui-toolkit-gallery/AnimationCircle.qml 2013-07-02 15:41:27 +0000
@@ -19,7 +19,7 @@
19Rectangle {19Rectangle {
20 id: circle20 id: circle
2121
22 color: "#dd4814"22 color: UbuntuColors.orange
23 width: radius23 width: radius
24 height: radius24 height: radius
25 radius: units.gu(12)25 radius: units.gu(12)
2626
=== modified file 'examples/ubuntu-ui-toolkit-gallery/Dialog.qml'
--- examples/ubuntu-ui-toolkit-gallery/Dialog.qml 2013-04-25 12:34:57 +0000
+++ examples/ubuntu-ui-toolkit-gallery/Dialog.qml 2013-07-02 15:41:27 +0000
@@ -47,7 +47,7 @@
47 }47 }
48 Button {48 Button {
49 text: "Delete"49 text: "Delete"
50 color: "red"50 color: UbuntuColors.orange
51 onClicked: PopupUtils.close(dialogue)51 onClicked: PopupUtils.close(dialogue)
52 }52 }
53 }53 }
5454
=== modified file 'examples/ubuntu-ui-toolkit-gallery/Icons.qml'
--- examples/ubuntu-ui-toolkit-gallery/Icons.qml 2013-04-24 17:09:29 +0000
+++ examples/ubuntu-ui-toolkit-gallery/Icons.qml 2013-07-02 15:41:27 +0000
@@ -58,7 +58,7 @@
5858
59 Icon {59 Icon {
60 name: "computer-symbolic"60 name: "computer-symbolic"
61 color: "red"61 color: UbuntuColors.orange
62 keyColor: "#bebebe"62 keyColor: "#bebebe"
63 width: 2463 width: 24
64 height: 2464 height: 24
@@ -66,7 +66,7 @@
6666
67 Icon {67 Icon {
68 name: "computer-symbolic"68 name: "computer-symbolic"
69 color: "lightblue"69 color: UbuntuColors.lightAubergine
70 keyColor: "#bebebe"70 keyColor: "#bebebe"
71 width: 2471 width: 24
72 height: 2472 height: 24
7373
=== modified file 'examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml'
--- examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml 2013-05-21 14:39:57 +0000
+++ examples/ubuntu-ui-toolkit-gallery/UbuntuShape.qml 2013-07-02 15:41:27 +0000
@@ -29,17 +29,17 @@
2929
30 UbuntuShape {30 UbuntuShape {
31 objectName: "ubuntushape_color_hex"31 objectName: "ubuntushape_color_hex"
32 color: "#5da357"32 color: UbuntuColors.orange
33 }33 }
3434
35 UbuntuShape {35 UbuntuShape {
36 objectName: "ubuntushape_color_lightblue"36 objectName: "ubuntushape_color_lightblue"
37 color: "lightblue"37 color: UbuntuColors.lightAubergine
38 }38 }
3939
40 UbuntuShape {40 UbuntuShape {
41 objectName: "ubuntushape_color_darkgray"41 objectName: "ubuntushape_color_darkgray"
42 color: "darkgray"42 color: UbuntuColors.warmGrey
43 }43 }
44 }44 }
4545
4646
=== added directory 'modules/Ubuntu/Components/Colors'
=== added file 'modules/Ubuntu/Components/Colors/Colors.pro'
--- modules/Ubuntu/Components/Colors/Colors.pro 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/Colors/Colors.pro 2013-07-02 15:41:27 +0000
@@ -0,0 +1,9 @@
1TEMPLATE = subdirs
2
3uri = Ubuntu.Components.Colors
4installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
5
6qml_files.path = $$installPath
7qml_files.files = *.qml
8
9INSTALLS += qml_files
010
=== added file 'modules/Ubuntu/Components/Colors/FIXME'
--- modules/Ubuntu/Components/Colors/FIXME 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/Colors/FIXME 2013-07-02 15:41:27 +0000
@@ -0,0 +1,3 @@
1UbuntuColors.qml is located in the Colors subdirectory because
2QuickUtils::createQmlObject() fails if the QML file is located in a
3folder that has a qmldir file with JavaScript modules.
04
=== added file 'modules/Ubuntu/Components/Colors/UbuntuColors.qml'
--- modules/Ubuntu/Components/Colors/UbuntuColors.qml 1970-01-01 00:00:00 +0000
+++ modules/Ubuntu/Components/Colors/UbuntuColors.qml 2013-07-02 15:41:27 +0000
@@ -0,0 +1,63 @@
1/*
2 Copyright 2013 Canonical Ltd.
3 *
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; version 3.
7 *
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU Lesser General Public License for more details.
12 *
13 You should have received a copy of the GNU Lesser General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.0
18
19/*!
20 \qmltype UbuntuColors
21 \inqmlmodule Ubuntu.Components 0.1
22 \ingroup theming
23 \brief Singleton defining the Ubuntu color palette.
24
25 Each color of the Ubuntu color palette is accesible from it.
26 For more information on how to appropriately use the colors according to
27 the context, please refer to the
28 \l{http://design.ubuntu.com/brand/colour-palette}{Ubuntu brand guidelines}.
29
30 Example of use:
31
32 \qml
33 Rectangle {
34 color: UbuntuColors.orange
35 }
36 \endqml
37*/
38QtObject {
39 /*!
40 Ubuntu core color: Ubuntu orange
41 */
42 readonly property color orange: "#DD4814"
43 /*!
44 Ubuntu supporting color: light aubergine
45 */
46 readonly property color lightAubergine: "#77216F"
47 /*!
48 Ubuntu supporting color: mid aubergine
49 */
50 readonly property color midAubergine: "#5E2750"
51 /*!
52 Ubuntu supporting color: dark aubergine
53 */
54 readonly property color darkAubergine: "#2C001E"
55 /*!
56 Ubuntu neutral color: warm grey
57 */
58 readonly property color warmGrey: "#AEA79F"
59 /*!
60 Ubuntu neutral color: cool grey
61 */
62 readonly property color coolGrey: "#333333"
63}
064
=== modified file 'modules/Ubuntu/Components/Components.pro'
--- modules/Ubuntu/Components/Components.pro 2013-06-30 13:04:37 +0000
+++ modules/Ubuntu/Components/Components.pro 2013-07-02 15:41:27 +0000
@@ -1,5 +1,5 @@
1TEMPLATE = subdirs1TEMPLATE = subdirs
22
3SUBDIRS += plugin Themes3SUBDIRS += plugin Themes Colors
44
5include(deployment.pri)5include(deployment.pri)
66
=== modified file 'modules/Ubuntu/Components/Icon.qml'
--- modules/Ubuntu/Components/Icon.qml 2013-04-11 01:18:01 +0000
+++ modules/Ubuntu/Components/Icon.qml 2013-07-02 15:41:27 +0000
@@ -45,7 +45,7 @@
45 width: 6445 width: 64
46 height: 6446 height: 64
47 name: "search"47 name: "search"
48 color: "red"48 color: UbuntuColors.warmGrey
49 }49 }
50 \endqml50 \endqml
5151
5252
=== modified file 'modules/Ubuntu/Components/Label.qml'
--- modules/Ubuntu/Components/Label.qml 2013-06-26 19:25:09 +0000
+++ modules/Ubuntu/Components/Label.qml 2013-07-02 15:41:27 +0000
@@ -25,7 +25,7 @@
25 Example:25 Example:
26 \qml26 \qml
27 Rectangle {27 Rectangle {
28 color: "grey"28 color: UbuntuColors.coolGrey
29 width: units.gu(30)29 width: units.gu(30)
30 height: units.gu(30)30 height: units.gu(30)
3131
@@ -56,5 +56,5 @@
5656
57 font.pixelSize: FontUtils.sizeToPixels(fontSize)57 font.pixelSize: FontUtils.sizeToPixels(fontSize)
58 font.family: "Ubuntu"58 font.family: "Ubuntu"
59 color: "#757373"59 color: UbuntuColors.coolGrey
60}60}
6161
=== modified file 'modules/Ubuntu/Components/ListItems/LabelVisual.qml'
--- modules/Ubuntu/Components/ListItems/LabelVisual.qml 2012-12-07 13:43:17 +0000
+++ modules/Ubuntu/Components/ListItems/LabelVisual.qml 2013-07-02 15:41:27 +0000
@@ -24,6 +24,6 @@
2424
25 fontSize: "medium"25 fontSize: "medium"
26 elide: Text.ElideRight26 elide: Text.ElideRight
27 color: selected ? "#f37505" : Qt.rgba(0.4, 0.4, 0.4, 1.0)27 color: selected ? UbuntuColors.orange : Qt.rgba(0.4, 0.4, 0.4, 1.0)
28 opacity: label.enabled ? 1.0 : 0.528 opacity: label.enabled ? 1.0 : 0.5
29}29}
3030
=== modified file 'modules/Ubuntu/Components/MainView.qml'
--- modules/Ubuntu/Components/MainView.qml 2013-06-27 15:20:12 +0000
+++ modules/Ubuntu/Components/MainView.qml 2013-07-02 15:41:27 +0000
@@ -99,20 +99,20 @@
99 anchors.centerIn: parent99 anchors.centerIn: parent
100 width: units.gu(20)100 width: units.gu(20)
101 height: units.gu(20)101 height: units.gu(20)
102 color: "blue"102 color: UbuntuColors.coolGrey
103 }103 }
104104
105 tools: ToolbarActions {105 tools: ToolbarActions {
106 ToolbarButton {106 ToolbarButton {
107 action: Action {107 action: Action {
108 text: "red"108 text: "red"
109 onTriggered: rectangle.color = "red"109 onTriggered: rectangle.color = UbuntuColors.orange
110 }110 }
111 }111 }
112 ToolbarButton {112 ToolbarButton {
113 action: Action {113 action: Action {
114 text: "green"114 text: "green"
115 onTriggered: rectangle.color = "green"115 onTriggered: rectangle.color = UbuntuColors.lightAubergine
116 }116 }
117 }117 }
118 }118 }
119119
=== modified file 'modules/Ubuntu/Components/PageStack.qml'
--- modules/Ubuntu/Components/PageStack.qml 2013-04-04 10:26:43 +0000
+++ modules/Ubuntu/Components/PageStack.qml 2013-07-02 15:41:27 +0000
@@ -59,7 +59,7 @@
59 anchors.fill: parent59 anchors.fill: parent
60 ListItem.Standard {60 ListItem.Standard {
61 text: i18n.tr("Page one")61 text: i18n.tr("Page one")
62 onClicked: pageStack.push(page1, {color: "red"})62 onClicked: pageStack.push(page1, {color: UbuntuColors.orange})
63 progression: true63 progression: true
64 }64 }
65 ListItem.Standard {65 ListItem.Standard {
6666
=== modified file 'modules/Ubuntu/Components/Popups/ComposerSheet.qml'
--- modules/Ubuntu/Components/Popups/ComposerSheet.qml 2012-11-29 18:13:17 +0000
+++ modules/Ubuntu/Components/Popups/ComposerSheet.qml 2013-07-02 15:41:27 +0000
@@ -84,7 +84,7 @@
8484
85 __rightButton: Button {85 __rightButton: Button {
86 text: i18n.dtr("ubuntu-sdk", "confirm")86 text: i18n.dtr("ubuntu-sdk", "confirm")
87 color: "#5da357"87 color: UbuntuColors.orange
88 /*! \internal */ // avoid warning when generating documentation88 /*! \internal */ // avoid warning when generating documentation
89 onClicked: {89 onClicked: {
90 composer.confirmClicked();90 composer.confirmClicked();
9191
=== modified file 'modules/Ubuntu/Components/Popups/DefaultSheet.qml'
--- modules/Ubuntu/Components/Popups/DefaultSheet.qml 2012-11-29 18:13:17 +0000
+++ modules/Ubuntu/Components/Popups/DefaultSheet.qml 2013-07-02 15:41:27 +0000
@@ -93,7 +93,7 @@
9393
94 __rightButton: Button {94 __rightButton: Button {
95 text: i18n.dtr("ubuntu-sdk", "done")95 text: i18n.dtr("ubuntu-sdk", "done")
96 color: "#5da357"96 color: UbuntuColors.orange
97 visible: doneButton97 visible: doneButton
98 /*! \internal */98 /*! \internal */
99 onClicked: {99 onClicked: {
100100
=== modified file 'modules/Ubuntu/Components/Popups/Dialog.qml'
--- modules/Ubuntu/Components/Popups/Dialog.qml 2013-06-27 15:20:12 +0000
+++ modules/Ubuntu/Components/Popups/Dialog.qml 2013-07-02 15:41:27 +0000
@@ -48,12 +48,12 @@
48 }48 }
49 Button {49 Button {
50 text: "overwrite previous version"50 text: "overwrite previous version"
51 color: "orange"51 color: UbuntuColors.orange
52 onClicked: PopupUtils.close(dialogue)52 onClicked: PopupUtils.close(dialogue)
53 }53 }
54 Button {54 Button {
55 text: "save a copy"55 text: "save a copy"
56 color: "orange"56 color: UbuntuColors.orange
57 onClicked: PopupUtils.close(dialogue)57 onClicked: PopupUtils.close(dialogue)
58 }58 }
59 }59 }
6060
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml 2013-06-27 18:04:07 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml 2013-07-02 15:41:27 +0000
@@ -30,7 +30,7 @@
30 Background fill color30 Background fill color
31 */31 */
32 property color backgroundColor: (styledItem.focus || styledItem.highlighted) ? "white" : Qt.rgba(0, 0, 0, 0.1)32 property color backgroundColor: (styledItem.focus || styledItem.highlighted) ? "white" : Qt.rgba(0, 0, 0, 0.1)
33 property color errorColor: "red"33 property color errorColor: UbuntuColors.orange
34 property real backgroundOpacity: styledItem.enabled ? 1.0 : 0.134 property real backgroundOpacity: styledItem.enabled ? 1.0 : 0.1
3535
36 /*!36 /*!
3737
=== modified file 'modules/Ubuntu/Components/UbuntuNumberAnimation.qml'
--- modules/Ubuntu/Components/UbuntuNumberAnimation.qml 2013-05-14 13:09:44 +0000
+++ modules/Ubuntu/Components/UbuntuNumberAnimation.qml 2013-07-02 15:41:27 +0000
@@ -33,7 +33,7 @@
3333
34 Rectangle {34 Rectangle {
35 width: 100; height: 10035 width: 100; height: 100
36 color: "red"36 color: UbuntuColors.orange
3737
38 UbuntuNumberAnimation on x { to: 50 }38 UbuntuNumberAnimation on x { to: 50 }
39 }39 }
4040
=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
--- modules/Ubuntu/Components/plugin/plugin.cpp 2013-07-01 22:13:31 +0000
+++ modules/Ubuntu/Components/plugin/plugin.cpp 2013-07-02 15:41:27 +0000
@@ -58,6 +58,33 @@
58 return clipboard;58 return clipboard;
59}59}
6060
61
62QUrl UbuntuComponentsPlugin::baseUrl(QStringList importPathList, const char* uri)
63{
64 /* FIXME: remove when migrating to Qt 5.1 and use QQmlExtensionPlugin::baseUrl()
65 http://doc-snapshot.qt-project.org/qt5-stable/qtqml/qqmlextensionplugin.html#baseUrl
66 */
67 QString pluginRelativePath = QString::fromUtf8(uri).replace(".", "/").prepend("/").append("/");
68 QString pluginPath;
69 Q_FOREACH (QString importPath, importPathList) {
70 pluginPath = importPath.append(pluginRelativePath);
71 if (QDir(pluginPath).exists()) {
72 return QUrl::fromLocalFile(pluginPath);
73 }
74 }
75
76 return QUrl();
77}
78
79void UbuntuComponentsPlugin::registerQmlSingletonType(QQmlEngine *engine, const char* uri, const char* typeName, const char* qmlFile)
80{
81 QUrl url = baseUrl(engine->importPathList(), uri).resolved(QUrl::fromLocalFile(qmlFile));
82 QObject* object = QuickUtils::instance().createQmlObject(url);
83 if (object != NULL) {
84 engine->rootContext()->setContextProperty(typeName, object);
85 }
86}
87
61void UbuntuComponentsPlugin::registerTypes(const char *uri)88void UbuntuComponentsPlugin::registerTypes(const char *uri)
62{89{
63 Q_ASSERT(uri == QLatin1String("Ubuntu.Components"));90 Q_ASSERT(uri == QLatin1String("Ubuntu.Components"));
@@ -108,6 +135,9 @@
108135
109 context->setContextProperty("bottomBarVisibilityCommunicator", &BottomBarVisibilityCommunicator::instance());136 context->setContextProperty("bottomBarVisibilityCommunicator", &BottomBarVisibilityCommunicator::instance());
110137
138 // register UbuntuColors
139 registerQmlSingletonType(engine, uri, "UbuntuColors", "Colors/UbuntuColors.qml");
140
111 engine->addImageProvider(QLatin1String("scaling"), new UCScalingImageProvider);141 engine->addImageProvider(QLatin1String("scaling"), new UCScalingImageProvider);
112142
113 // register gicon provider143 // register gicon provider
114144
=== modified file 'modules/Ubuntu/Components/plugin/plugin.h'
--- modules/Ubuntu/Components/plugin/plugin.h 2012-10-25 13:35:32 +0000
+++ modules/Ubuntu/Components/plugin/plugin.h 2013-07-02 15:41:27 +0000
@@ -30,6 +30,8 @@
30public:30public:
31 void registerTypes(const char *uri);31 void registerTypes(const char *uri);
32 void initializeEngine(QQmlEngine *engine, const char *uri);32 void initializeEngine(QQmlEngine *engine, const char *uri);
33 QUrl baseUrl(QStringList importPathList, const char* uri);
34 void registerQmlSingletonType(QQmlEngine *engine, const char* uri, const char* typeName, const char* qmlFile);
33};35};
34#endif // UBUNTU_COMPONENTS_PLUGIN_H36#endif // UBUNTU_COMPONENTS_PLUGIN_H
3537
3638
=== modified file 'modules/Ubuntu/Components/plugin/quickutils.cpp'
--- modules/Ubuntu/Components/plugin/quickutils.cpp 2013-05-27 09:48:42 +0000
+++ modules/Ubuntu/Components/plugin/quickutils.cpp 2013-07-02 15:41:27 +0000
@@ -25,13 +25,15 @@
25#include <QtCore/QAbstractProxyModel>25#include <QtCore/QAbstractProxyModel>
26#include <QtQml/QQmlPropertyMap>26#include <QtQml/QQmlPropertyMap>
27#include <QtQml/QQmlInfo>27#include <QtQml/QQmlInfo>
28#include <QtQml/QQmlEngine>
2829
29#include <private/qquicktextinput_p.h>30#include <private/qquicktextinput_p.h>
30#include <private/qquicktextedit_p.h>31#include <private/qquicktextedit_p.h>
3132
32QuickUtils::QuickUtils(QObject *parent) :33QuickUtils::QuickUtils(QObject *parent) :
33 QObject(parent),34 QObject(parent),
34 m_rootView(0)35 m_rootView(0),
36 m_engine(new QQmlEngine)
35{37{
36 QGuiApplication::instance()->installEventFilter(this);38 QGuiApplication::instance()->installEventFilter(this);
37 // connect to focusObjectChanged() to get the latest active focus object39 // connect to focusObjectChanged() to get the latest active focus object
@@ -231,3 +233,15 @@
231 }233 }
232 }234 }
233}235}
236
237QObject* QuickUtils::createQmlObject(const QUrl &url)
238{
239 /* FIXME: if the directory pointed to by url contains a qmldir file that
240 declares a JavaScript module then QQmlComponent::create() fails with
241 the error "QQmlComponent: Component is not ready".
242 */
243 QQmlComponent *component = new QQmlComponent(m_engine, url, QQmlComponent::PreferSynchronous);
244 QObject* result = component->create();
245 delete component;
246 return result;
247}
234248
=== modified file 'modules/Ubuntu/Components/plugin/quickutils.h'
--- modules/Ubuntu/Components/plugin/quickutils.h 2013-05-24 10:07:44 +0000
+++ modules/Ubuntu/Components/plugin/quickutils.h 2013-07-02 15:41:27 +0000
@@ -43,6 +43,7 @@
4343
44 Q_INVOKABLE qreal modelDelegateHeight(QQmlComponent *delegate, const QVariant &model);44 Q_INVOKABLE qreal modelDelegateHeight(QQmlComponent *delegate, const QVariant &model);
45 Q_INVOKABLE QString className(QQuickItem *item);45 Q_INVOKABLE QString className(QQuickItem *item);
46 QObject* createQmlObject(const QUrl &url);
4647
47Q_SIGNALS:48Q_SIGNALS:
48 void rootObjectChanged();49 void rootObjectChanged();
@@ -56,6 +57,7 @@
56private:57private:
57 explicit QuickUtils(QObject *parent = 0);58 explicit QuickUtils(QObject *parent = 0);
58 QQuickView *m_rootView;59 QQuickView *m_rootView;
60 QQmlEngine *m_engine;
5961
60 void lookupQuickView();62 void lookupQuickView();
61};63};

Subscribers

People subscribed via source and target branches

to status/vote changes: