on xenial help sign in
merge upstream branch
commitdef438f02786c626d981dade1c05e1d75c19bf82 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 6 Mar 2014, 15:25 (13 years ago) parent5494fb64e80689
18 files changed+278−47
debian/changelog+16 plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+1 plugins/Unity/Indicators/qml/MenuItemFactory.qml+1 po/tr.po+15−13 qml/Greeter/Greeter.qml+4 qml/Greeter/GreeterContent.qml−1 qml/Panel/IndicatorItem.qml+13−21 qml/Shell.qml−2 tests/mocks/AccountsService/AccountsService.cpp+1−1 tests/mocks/Unity/Indicators/CMakeLists.txt+1 tests/mocks/Unity/Indicators/IndicatorsModel.qml+3−5 tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp+116 tests/mocks/Unity/Indicators/fakeindicatorsmodel.h+59 tests/mocks/Unity/Indicators/fakeplugin.cpp+6 tests/qmltests/Greeter/tst_Phone.qml+19 tests/qmltests/Greeter/tst_Tablet.qml+19 tests/qmltests/Panel/tst_IndicatorRow.qml+3−3 tests/qmltests/Panel/tst_MenuContent.qml+1−1
debian/changelog+16
@@ -1,3 +1,19 @@
1+unity8 (7.84+14.04.20140304-0ubuntu1) trusty; urgency=low
2+
3+ [ Michael Terry ]
4+ * Ensure that the selected() signal is emitted by the greeter on
5+ startup, fixing the background on startup for the first user in
6+ tablet mode.
7+
8+ [ Nick Dedekind ]
9+ * Remocked IndicatorModel to fix qt5.2.1 changes.
10+
11+ [ Albert Astals ]
12+ * Initialize m_distance (LP: #1285385)
13+ * import Ubuntu.Components so we can use UbuntuAnimation
14+
15+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 04 Mar 2014 11:43:04 +0000
16+
117unity8 (7.84+14.04.20140228-0ubuntu1) trusty; urgency=low
218
319 [ Michał Sawicz ]
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+1
@@ -109,6 +109,7 @@ private:
109109DirectionalDragArea::DirectionalDragArea(QQuickItem *parent)
110110 : QQuickItem(parent)
111111 , m_status(WaitingForTouch)
112+ , m_sceneDistance(0)
112113 , m_touchId(-1)
113114 , m_direction(Direction::Rightwards)
114115 , m_wideningAngle(0)
plugins/Unity/Indicators/qml/MenuItemFactory.qml+1
@@ -22,6 +22,7 @@ import Ubuntu.Settings.Menus 0.1 as Menus
2222import QMenuModel 0.1 as QMenuModel
2323import Utils 0.1 as Utils
2424import Ubuntu.Components.ListItems 0.1 as ListItems
25+import Ubuntu.Components 0.1
2526
2627Item {
2728 id: menuFactory
po/tr.po+15−13
@@ -8,15 +8,15 @@ msgstr ""
88"Project-Id-Version: unity\n"
99"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1010"POT-Creation-Date: 2014-02-13 18:37+0000\n"
11−"PO-Revision-Date: 2014-01-14 19:05+0000\n"
12−"Last-Translator: Osman Coşkun <Unknown>\n"
11+"PO-Revision-Date: 2014-03-05 08:54+0000\n"
12+"Last-Translator: Muhammed Yüce <muhammedyuceee@gmail.com>\n"
1313"Language-Team: Turkish <tr@li.org>\n"
1414"MIME-Version: 1.0\n"
1515"Content-Type: text/plain; charset=UTF-8\n"
1616"Content-Transfer-Encoding: 8bit\n"
1717"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2014-02-19 05:44+0000\n"
19−"X-Generator: Launchpad (build 16916)\n"
18+"X-Launchpad-Export-Date: 2014-03-06 06:19+0000\n"
19+"X-Generator: Launchpad (build 16948)\n"
2020
2121#: plugins/Unity/Launcher/launcheritem.cpp:43
2222#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -29,7 +29,7 @@ msgstr "Başlatıcıdan Ayır"
2929
3030#: qml/Components/EdgeDemoOverlay.qml:151
3131msgid "Skip intro"
32−msgstr "İntro'yu geç"
32+msgstr "Tanıtımı geç"
3333
3434#: qml/Components/EdgeDemo.qml:113
3535msgid "Right edge"
@@ -37,7 +37,7 @@ msgstr "Sağ kenar"
3737
3838#: qml/Components/EdgeDemo.qml:114
3939msgid "Try swiping from the right edge to unlock the phone"
40−msgstr "Kilidi açmak için sağ kenara sürüklemeyi deneyin"
40+msgstr "Kilidi açmak için sağ kenardan sürüklemeyi deneyin"
4141
4242#: qml/Components/EdgeDemo.qml:145
4343msgid "Top edge"
@@ -45,7 +45,7 @@ msgstr "Üst kenar"
4545
4646#: qml/Components/EdgeDemo.qml:146
4747msgid "Try swiping from the top edge to access the indicators"
48−msgstr "Bildiricilere erişmek için üst kenarı sürüklemeyi deneyin"
48+msgstr "Bildiricilere erişmek için üst kenarı sürükleyin"
4949
5050#: qml/Components/EdgeDemo.qml:171
5151msgid "Close"
@@ -73,18 +73,20 @@ msgid ""
7373"You have now mastered the edge gestures and can start using the "
7474"phone<br><br>Tap on the screen to start"
7575msgstr ""
76+"Kenar haraketlerini öğrendiniz ve telefonu kullanmaya "
77+"başlayabilirsiniz<br><br>Başlamak için ekrana dokunun"
7678
7779#: qml/Components/PageHeader.qml:340
7880msgid "Recent searches"
79−msgstr "Son Arananlar"
81+msgstr "Son aramalar"
8082
8183#: qml/Components/SeeMore.qml:35
8284msgid "See more"
83−msgstr ""
85+msgstr "Daha fazlası"
8486
8587#: qml/Components/SeeMore.qml:57
8688msgid "See less"
87−msgstr ""
89+msgstr "Daha azını gör"
8890
8991#: qml/Dash/Apps/AppPreview.qml:136 qml/Dash/Previews/PreviewRating.qml:70
9092msgid "Rate this"
@@ -106,11 +108,11 @@ msgstr[1] "%1 inceleme"
106108
107109#: qml/Dash/Previews/PreviewActionCombo.qml:34
108110msgid "More..."
109−msgstr ""
111+msgstr "Daha fazlası..."
110112
111113#: qml/Dash/Previews/PreviewActionCombo.qml:34
112114msgid "Less..."
113−msgstr ""
115+msgstr "Daha az.."
114116
115117#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
116118msgid "Add a review"
@@ -167,7 +169,7 @@ msgstr "Parolayı göster"
167169
168170#: qml/Notifications/NotificationMenuItemFactory.qml:103
169171msgid "Please enter SIM PIN"
170−msgstr ""
172+msgstr "Lütfen SIM PIN'inizi girin"
171173
172174#: qml/Panel/SearchIndicator.qml:27
173175msgid "Search"
qml/Greeter/Greeter.qml+4
@@ -67,6 +67,10 @@ Showable {
6767
6868 source: required ? "GreeterContent.qml" : ""
6969
70+ onLoaded: {
71+ selected(currentIndex);
72+ }
73+
7074 Connections {
7175 target: greeterContentLoader.item
7276
qml/Greeter/GreeterContent.qml−1
@@ -96,7 +96,6 @@ MouseArea {
9696
9797 onLoaded: {
9898 item.currentIndex = greeterContentLoader.currentIndex;
99− selected(item.currentIndex);
10099 item.resetAuthentication();
101100 }
102101
qml/Panel/IndicatorItem.qml+13−21
@@ -19,37 +19,29 @@ import Ubuntu.Components 0.1
1919import Unity.Indicators 0.1 as Indicators
2020import "../Components"
2121
22−Item {
23− id: indicatorItem
22+Loader {
23+ id: root
2424
25− property alias widgetSource: loader.source
25+ property alias widgetSource: root.source
2626 property bool dimmed: false
2727 property var indicatorProperties: undefined
28− property bool indicatorVisible: loader.item ? loader.item.enabled : false
28+ property bool indicatorVisible: item ? item.enabled : false
2929 property string identifier
3030
3131 opacity: dimmed ? 0.4 : 1
3232 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
3333
34− width: loader.item ? loader.item.width : 0
35−
36− Loader {
37− id: loader
38−
39− onLoaded: {
40− item.height = Qt.binding(function() { return indicatorItem.height; });
41−
42− for(var pName in indicatorProperties) {
43− if (item.hasOwnProperty(pName)) {
44− item[pName] = indicatorProperties[pName];
45− }
34+ onLoaded: {
35+ for(var pName in indicatorProperties) {
36+ if (item.hasOwnProperty(pName)) {
37+ item[pName] = indicatorProperties[pName];
4638 }
4739 }
40+ }
4841
49− Binding {
50− target: loader.item
51− property: "objectName"
52− value: identifier + "-widget"
53− }
42+ Binding {
43+ target: item
44+ property: "objectName"
45+ value: identifier + "-widget"
5446 }
5547}
qml/Shell.qml−2
@@ -419,7 +419,6 @@ FocusScope {
419419 Component.onCompleted: {
420420 if (LightDM.Users.count == 1) {
421421 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
422− greeter.selected(0)
423422 }
424423 }
425424 }
@@ -495,7 +494,6 @@ FocusScope {
495494 // If there are more users, the Greeter will handle that
496495 if (LightDM.Users.count == 1) {
497496 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
498− greeter.selected(0);
499497 }
500498 greeter.forceActiveFocus();
501499 removeApplicationFocus();
tests/mocks/AccountsService/AccountsService.cpp+1−1
@@ -20,7 +20,7 @@
2020
2121AccountsService::AccountsService(QObject* parent)
2222 : QObject(parent),
23− m_backgroundFile(TOP_SRCDIR "/graphics/phone_background.jpg"),
23+ m_backgroundFile(TOP_SRCDIR "/qml/graphics/phone_background.jpg"),
2424 m_statsWelcomeScreen(true)
2525{
2626}
tests/mocks/Unity/Indicators/CMakeLists.txt+1
@@ -16,6 +16,7 @@ set(IndicatorsFakeQml_SOURCES
1616 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/menucontentactivator.cpp
1717 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelstack.cpp
1818 ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/visibleindicatorsmodel.cpp
19+ fakeindicatorsmodel.cpp
1920)
2021
2122set(IndicatorsFakeQml_RESOURCES
tests/mocks/Unity/Indicators/IndicatorsModel.qml+3−5
@@ -17,12 +17,10 @@
1717import QtQuick 2.0
1818import Unity.Indicators 0.1 as Indicators
1919
20−ListModel {
20+Indicators.FakeIndicatorsModel {
2121
22− property var indicatorData : undefined
23−
24− function load() {
25− clear();
22+ function load(profile) {
23+ unload();
2624
2725 append({ "identifier": "indicator-fake1",
2826 "position": 0,
tests/mocks/Unity/Indicators/fakeindicatorsmodel.cppnew file+116
@@ -0,0 +1,116 @@
1+/*
2+ * Copyright 2014 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+ * Authors:
17+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+#include "fakeindicatorsmodel.h"
21+#include "indicators.h"
22+
23+FakeIndicatorsModel::FakeIndicatorsModel(QObject *parent)
24+ : QAbstractListModel(parent)
25+{
26+ QObject::connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
27+ QObject::connect(this, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SIGNAL(countChanged()));
28+ QObject::connect(this, SIGNAL(modelReset()), this, SIGNAL(countChanged()));
29+}
30+
31+/*! \internal */
32+FakeIndicatorsModel::~FakeIndicatorsModel()
33+{
34+ unload();
35+}
36+
37+int FakeIndicatorsModel::count() const
38+{
39+ return rowCount();
40+}
41+
42+void FakeIndicatorsModel::load(const QString&)
43+{
44+}
45+
46+void FakeIndicatorsModel::unload()
47+{
48+ beginResetModel();
49+
50+ qDeleteAll(m_indicators);
51+ m_indicators.clear();
52+
53+ endResetModel();
54+}
55+
56+
57+void FakeIndicatorsModel::append(const QVariantMap& row)
58+{
59+ Indicator* new_row = new QHash<int, QVariant>();
60+ for (auto iter = row.begin(); iter != row.end(); ++iter )
61+ {
62+ int key = roleNames().key(iter.key().toUtf8(), -1);
63+ if (key != -1) {
64+ new_row->insert(key, iter.value());
65+ }
66+ }
67+
68+ beginInsertRows(QModelIndex(), m_indicators.count(), m_indicators.count());
69+
70+ m_indicators.append(new_row);
71+
72+ endInsertRows();
73+}
74+
75+QHash<int, QByteArray> FakeIndicatorsModel::roleNames() const
76+{
77+ static QHash<int, QByteArray> roles;
78+ if (roles.isEmpty())
79+ {
80+ roles[IndicatorsModelRole::Identifier] = "identifier";
81+ roles[IndicatorsModelRole::Position] = "position";
82+ roles[IndicatorsModelRole::WidgetSource] = "widgetSource";
83+ roles[IndicatorsModelRole::PageSource] = "pageSource";
84+ roles[IndicatorsModelRole::IndicatorProperties] = "indicatorProperties";
85+ }
86+ return roles;
87+}
88+
89+int FakeIndicatorsModel::columnCount(const QModelIndex &) const
90+{
91+ return 1;
92+}
93+
94+Q_INVOKABLE QVariant FakeIndicatorsModel::data(int row, int role) const
95+{
96+ return data(index(row, 0), role);
97+}
98+
99+QVariant FakeIndicatorsModel::data(const QModelIndex &index, int role) const
100+{
101+ if (!index.isValid() || index.row() >= m_indicators.size())
102+ return QVariant();
103+
104+ Indicator* indicator = m_indicators[index.row()];
105+ return indicator->value(role, QVariant());
106+}
107+
108+QModelIndex FakeIndicatorsModel::parent(const QModelIndex&) const
109+{
110+ return QModelIndex();
111+}
112+
113+int FakeIndicatorsModel::rowCount(const QModelIndex&) const
114+{
115+ return m_indicators.count();
116+}
tests/mocks/Unity/Indicators/fakeindicatorsmodel.hnew file+59
@@ -0,0 +1,59 @@
1+/*
2+ * Copyright 2014 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+ * Authors:
17+ * Nick Dedekind <nick.dedekind@canonical.com>
18+ */
19+
20+#ifndef FAKE_INDICATORSMODEL_H
21+#define FAKE_INDICATORSMODEL_H
22+
23+#include <QAbstractListModel>
24+
25+class FakeIndicatorsModel : public QAbstractListModel
26+{
27+ Q_OBJECT
28+ Q_ENUMS(Roles)
29+ Q_PROPERTY(int count READ count NOTIFY countChanged)
30+public:
31+
32+ FakeIndicatorsModel(QObject *parent=0);
33+ ~FakeIndicatorsModel();
34+
35+ Q_INVOKABLE void load(const QString& profile);
36+ Q_INVOKABLE void unload();
37+
38+ Q_INVOKABLE void append(const QVariantMap& row);
39+
40+ Q_INVOKABLE QVariant data(int row, int role) const;
41+
42+ /* QAbstractItemModel */
43+ QHash<int, QByteArray> roleNames() const;
44+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
45+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
46+ QModelIndex parent (const QModelIndex &index) const;
47+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
48+
49+Q_SIGNALS:
50+ void countChanged();
51+
52+private:
53+ int count() const;
54+
55+ typedef QHash<int, QVariant> Indicator;
56+ QList<Indicator*> m_indicators;
57+};
58+
59+#endif // FAKE_INDICATORSMODEL_H
tests/mocks/Unity/Indicators/fakeplugin.cpp+6
@@ -23,6 +23,7 @@
2323#include "fakeplugin.h"
2424
2525// local
26+#include "fakeindicatorsmodel.h"
2627#include "indicators.h"
2728#include "menucontentactivator.h"
2829#include "unitymenumodelstack.h"
@@ -32,10 +33,15 @@ void IndicatorsFakePlugin::registerTypes(const char * uri)
3233{
3334 Q_INIT_RESOURCE(indicators_fake);
3435
36+ // internal
37+ qmlRegisterType<FakeIndicatorsModel>(uri, 0, 1, "FakeIndicatorsModel");
38+
39+ // external
3540 qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator");
3641 qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack");
3742 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
3843
44+ // external uncreatables
3945 qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class");
4046 qmlRegisterUncreatableType<ActionState>(uri, 0, 1, "ActionState", "Can't create ActionState class");
4147 qmlRegisterUncreatableType<NetworkActionState>(uri, 0, 1, "NetworkActionState", "Can't create NetworkActionState class");
tests/qmltests/Greeter/tst_Phone.qml+19
@@ -44,6 +44,17 @@ Item {
4444 }
4545 }
4646
47+ Component {
48+ id: greeterComponent
49+ Greeter {
50+ SignalSpy {
51+ objectName: "selectedSpy"
52+ target: parent
53+ signalName: "selected"
54+ }
55+ }
56+ }
57+
4758 SignalSpy {
4859 id: unlockSpy
4960 target: greeter
@@ -148,5 +159,13 @@ Item {
148159 tryCompareFunction(function() { return background.source.toString().indexOf(data.expected) !== -1; }, true)
149160 tryCompare(background, "status", Image.Ready)
150161 }
162+
163+ function test_initial_selected_signal() {
164+ var greeterObj = greeterComponent.createObject(this)
165+ var spy = findChild(greeterObj, "selectedSpy")
166+ spy.wait()
167+ tryCompare(spy, "count", 1)
168+ greeterObj.destroy()
169+ }
151170 }
152171}
tests/qmltests/Greeter/tst_Tablet.qml+19
@@ -31,6 +31,17 @@ Item {
3131 anchors.fill: parent
3232 }
3333
34+ Component {
35+ id: greeterComponent
36+ Greeter {
37+ SignalSpy {
38+ objectName: "selectedSpy"
39+ target: parent
40+ signalName: "selected"
41+ }
42+ }
43+ }
44+
3445 SignalSpy {
3546 id: unlockSpy
3647 target: greeter
@@ -335,5 +346,13 @@ Item {
335346 var userlist = findChild(greeter, "userList")
336347 compare(greeter.model.data(userlist.currentIndex, LightDM.UserRoles.NameRole), "has-password")
337348 }
349+
350+ function test_initial_selected_signal() {
351+ var greeterObj = greeterComponent.createObject(this)
352+ var spy = findChild(greeterObj, "selectedSpy")
353+ spy.wait()
354+ tryCompare(spy, "count", 1)
355+ greeterObj.destroy()
356+ }
338357 }
339358}
tests/qmltests/Panel/tst_IndicatorRow.qml+3−3
@@ -70,13 +70,13 @@ Item {
7070 function test_set_current_item() {
7171 init_test();
7272 indicatorRow.setCurrentItemIndex(0);
73− compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake1", "Incorrect item at position 0");
73+ compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake1", "Incorrect item at position 0");
7474
7575 indicatorRow.setCurrentItemIndex(1);
76− compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake2", "Incorrect item at position 1");
76+ compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake2", "Incorrect item at position 1");
7777
7878 indicatorRow.setCurrentItemIndex(2);
79− compare(indicatorRow.indicatorsModel.get(indicatorRow.currentItemIndex).identifier, "indicator-fake3", "Incorrect item at position 2");
79+ compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake3", "Incorrect item at position 2");
8080 }
8181
8282 function test_highlight_data() {
tests/qmltests/Panel/tst_MenuContent.qml+1−1
@@ -133,7 +133,7 @@ Item {
133133 var menuIndex = i%menuCount;
134134
135135 activate_content(menuIndex);
136− testTabObjectName = indicatorsModel.get(menuIndex).identifier;
136+ testTabObjectName = indicatorsModel.data(menuIndex, Indicators.IndicatorsModelRole.Identifier);
137137 compare(tabs.selectedTabIndex, menuIndex, "Current tab index does not match selected tab index");
138138 tryCompareFunction(selected_tab_equals_test_tab, true);
139139 }