on xenial help sign in
Carousel dinamic
ff0ff30Andrea Cimitan
po/tr.po+15−13
@@ -8,15 +8,15 @@ msgstr ""
8"Project-Id-Version: unity\n"
8"Project-Id-Version: unity\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
9"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
10"POT-Creation-Date: 2014-02-13 18:37+0000\n"
11−"PO-Revision-Date: 2014-01-14 19:05+0000\n"
11+"PO-Revision-Date: 2014-03-05 08:54+0000\n"
12−"Last-Translator: Osman Coşkun <Unknown>\n"
12+"Last-Translator: Muhammed Yüce <muhammedyuceee@gmail.com>\n"
13"Language-Team: Turkish <tr@li.org>\n"
13"Language-Team: Turkish <tr@li.org>\n"
14"MIME-Version: 1.0\n"
14"MIME-Version: 1.0\n"
15"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Type: text/plain; charset=UTF-8\n"
16"Content-Transfer-Encoding: 8bit\n"
16"Content-Transfer-Encoding: 8bit\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
17"Plural-Forms: nplurals=2; plural=n != 1;\n"
18−"X-Launchpad-Export-Date: 2014-02-19 05:44+0000\n"
18+"X-Launchpad-Export-Date: 2014-03-06 06:19+0000\n"
19−"X-Generator: Launchpad (build 16916)\n"
19+"X-Generator: Launchpad (build 16948)\n"
20
20
21#: plugins/Unity/Launcher/launcheritem.cpp:43
21#: plugins/Unity/Launcher/launcheritem.cpp:43
22#: plugins/Unity/Launcher/launcheritem.cpp:73
22#: plugins/Unity/Launcher/launcheritem.cpp:73
@@ -29,7 +29,7 @@ msgstr "Başlatıcıdan Ayır"
29
29
30#: qml/Components/EdgeDemoOverlay.qml:151
30#: qml/Components/EdgeDemoOverlay.qml:151
31msgid "Skip intro"
31msgid "Skip intro"
32−msgstr "İntro'yu geç"
32+msgstr "Tanıtımı geç"
33
33
34#: qml/Components/EdgeDemo.qml:113
34#: qml/Components/EdgeDemo.qml:113
35msgid "Right edge"
35msgid "Right edge"
@@ -37,7 +37,7 @@ msgstr "Sağ kenar"
37
37
38#: qml/Components/EdgeDemo.qml:114
38#: qml/Components/EdgeDemo.qml:114
39msgid "Try swiping from the right edge to unlock the phone"
39msgid "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"
41
41
42#: qml/Components/EdgeDemo.qml:145
42#: qml/Components/EdgeDemo.qml:145
43msgid "Top edge"
43msgid "Top edge"
@@ -45,7 +45,7 @@ msgstr "Üst kenar"
45
45
46#: qml/Components/EdgeDemo.qml:146
46#: qml/Components/EdgeDemo.qml:146
47msgid "Try swiping from the top edge to access the indicators"
47msgid "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"
49
49
50#: qml/Components/EdgeDemo.qml:171
50#: qml/Components/EdgeDemo.qml:171
51msgid "Close"
51msgid "Close"
@@ -73,18 +73,20 @@ msgid ""
73"You have now mastered the edge gestures and can start using the "
73"You have now mastered the edge gestures and can start using the "
74"phone<br><br>Tap on the screen to start"
74"phone<br><br>Tap on the screen to start"
75msgstr ""
75msgstr ""
76+"Kenar haraketlerini öğrendiniz ve telefonu kullanmaya "
77+"başlayabilirsiniz<br><br>Başlamak için ekrana dokunun"
76
78
77#: qml/Components/PageHeader.qml:340
79#: qml/Components/PageHeader.qml:340
78msgid "Recent searches"
80msgid "Recent searches"
79−msgstr "Son Arananlar"
81+msgstr "Son aramalar"
80
82
81#: qml/Components/SeeMore.qml:35
83#: qml/Components/SeeMore.qml:35
82msgid "See more"
84msgid "See more"
83−msgstr ""
85+msgstr "Daha fazlası"
84
86
85#: qml/Components/SeeMore.qml:57
87#: qml/Components/SeeMore.qml:57
86msgid "See less"
88msgid "See less"
87−msgstr ""
89+msgstr "Daha azını gör"
88
90
89#: qml/Dash/Apps/AppPreview.qml:136 qml/Dash/Previews/PreviewRating.qml:70
91#: qml/Dash/Apps/AppPreview.qml:136 qml/Dash/Previews/PreviewRating.qml:70
90msgid "Rate this"
92msgid "Rate this"
@@ -106,11 +108,11 @@ msgstr[1] "%1 inceleme"
106
108
107#: qml/Dash/Previews/PreviewActionCombo.qml:34
109#: qml/Dash/Previews/PreviewActionCombo.qml:34
108msgid "More..."
110msgid "More..."
109−msgstr ""
111+msgstr "Daha fazlası..."
110
112
111#: qml/Dash/Previews/PreviewActionCombo.qml:34
113#: qml/Dash/Previews/PreviewActionCombo.qml:34
112msgid "Less..."
114msgid "Less..."
113−msgstr ""
115+msgstr "Daha az.."
114
116
115#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
117#: qml/Dash/Previews/PreviewRating.qml:114 qml/Dash/Previews/Reviews.qml:74
116msgid "Add a review"
118msgid "Add a review"
@@ -167,7 +169,7 @@ msgstr "Parolayı göster"
167
169
168#: qml/Notifications/NotificationMenuItemFactory.qml:103
170#: qml/Notifications/NotificationMenuItemFactory.qml:103
169msgid "Please enter SIM PIN"
171msgid "Please enter SIM PIN"
170−msgstr ""
172+msgstr "Lütfen SIM PIN'inizi girin"
171
173
172#: qml/Panel/SearchIndicator.qml:27
174#: qml/Panel/SearchIndicator.qml:27
173msgid "Search"
175msgid "Search"
qml/Dash/CardCarousel.qml+3−11
@@ -32,14 +32,6 @@ DashRenderer {
32 height: carousel.implicitHeight + units.gu(6)
32 height: carousel.implicitHeight + units.gu(6)
33 verticalSpacing: units.gu(3)
33 verticalSpacing: units.gu(3)
34
34
35− CardTool {
36− id: cardTool
37−
38− template: cardCarousel.template
39− components: cardCarousel.components
40− viewWidth: cardCarousel.width
41− }
42−
43 Carousel {
35 Carousel {
44 id: carousel
36 id: carousel
45 anchors.fill: parent
37 anchors.fill: parent
@@ -47,7 +39,7 @@ DashRenderer {
47 // FIXME we need to "reverse" the carousel to make the selected item the size
39 // FIXME we need to "reverse" the carousel to make the selected item the size
48 // and push others back.
40 // and push others back.
49 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor
41 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor
50− selectedItemScaleFactor: 1.38
42+ selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor
51 cacheBuffer: 1404 // 18px * 13gu * 6
43 cacheBuffer: 1404 // 18px * 13gu * 6
52 model: cardCarousel.model
44 model: cardCarousel.model
53 highlightIndex: cardCarousel.highlightIndex
45 highlightIndex: cardCarousel.highlightIndex
@@ -63,8 +55,8 @@ DashRenderer {
63 objectName: "delegate" + index
55 objectName: "delegate" + index
64 headerHeight: carousel.headerHeight
56 headerHeight: carousel.headerHeight
65 cardData: model
57 cardData: model
66− template: cardCarousel.template
58+ template: cardTool.template
67− components: cardCarousel.components
59+ components: cardTool.components
68
60
69 property bool explicitlyScaled
61 property bool explicitlyScaled
70 property var model
62 property var model
qml/Dash/CardFilterGrid.qml+3−14
@@ -20,21 +20,10 @@ import Ubuntu.Components 0.1
20DashFilterGrid {
20DashFilterGrid {
21 id: genericFilterGrid
21 id: genericFilterGrid
22
22
23− minimumHorizontalSpacing: units.gu(1)
23+ minimumHorizontalSpacing: units.gu(0.5)
24 delegateWidth: cardTool.cardWidth
24 delegateWidth: cardTool.cardWidth
25 delegateHeight: cardTool.cardHeight
25 delegateHeight: cardTool.cardHeight
26 verticalSpacing: units.gu(1)
26 verticalSpacing: units.gu(1)
27− collapsedRowCount: Math.min(2, template && template["collapsed-rows"] || 2)
28−
29− CardTool {
30− id: cardTool
31−
32− template: genericFilterGrid.template
33− // We can't trust the template since it may happen it is carousel
34− // that is being should as a grid because of the lack of elements
35− categoryLayout: "grid"
36− components: genericFilterGrid.components
37− }
38
27
39 delegate: Item {
28 delegate: Item {
40 width: genericFilterGrid.cellWidth
29 width: genericFilterGrid.cellWidth
@@ -47,8 +36,8 @@ DashFilterGrid {
47 anchors.horizontalCenter: parent.horizontalCenter
36 anchors.horizontalCenter: parent.horizontalCenter
48 objectName: "delegate" + index
37 objectName: "delegate" + index
49 cardData: model
38 cardData: model
50− template: genericFilterGrid.template
39+ template: cardTool.template
51− components: genericFilterGrid.components
40+ components: cardTool.components
52
41
53 headerAlignment: cardTool.headerAlignment
42 headerAlignment: cardTool.headerAlignment
54
43
qml/Dash/CardTool.qml+44−6
@@ -28,6 +28,22 @@ import QtQuick 2.0
28
28
29Item {
29Item {
30 id: cardTool
30 id: cardTool
31+
32+ /*!
33+ \brief Number of cards.
34+ */
35+ property int count
36+
37+ /*!
38+ \brief Width of the category view.
39+ */
40+ property real viewWidth
41+
42+ /*!
43+ \brief Scaling factor of selected Carousel item.
44+ */
45+ readonly property real carouselSelectedItemScaleFactor: 1.38 // XXX assuming 1.38 carousel scaling factor for cards
46+
31 /*!
47 /*!
32 \brief Template supplied for the category.
48 \brief Template supplied for the category.
33 */
49 */
@@ -39,9 +55,15 @@ Item {
39 property var components
55 property var components
40
56
41 /*!
57 /*!
42− \brief Width of the view, based on which carousel width is calculated.
58+ \brief The category layout for this card tool.
43 */
59 */
44− property var viewWidth
60+ property string categoryLayout: {
61+ var layout = template["category-layout"];
62+
63+ // carousel fallback mode to grid
64+ if (layout === "carousel" && count <= Math.ceil(carouselTool.realPathItemCount)) layout = "grid";
65+ return layout;
66+ }
45
67
46 /*!
68 /*!
47 \brief The category layout for this card tool
69 \brief The category layout for this card tool
@@ -71,10 +93,7 @@ Item {
71 }
93 }
72 return units.gu(18.5);
94 return units.gu(18.5);
73 case "carousel":
95 case "carousel":
74− if (viewWidth === undefined) return undefined
96+ return carouselTool.minimumTileWidth;
75− if (viewWidth <= units.gu(40)) return units.gu(18)
76− if (viewWidth >= units.gu(128)) return units.gu(26)
77− return units.gu(18 + Math.round((viewWidth - units.gu(40))/ units.gu(11)))
78 case undefined:
97 case undefined:
79 case "organic-grid":
98 case "organic-grid":
80 case "journal":
99 case "journal":
@@ -128,6 +147,25 @@ Item {
128 return (template["card-layout"] === "horizontal") ? Text.AlignLeft : Text.AlignHCenter;
147 return (template["card-layout"] === "horizontal") ? Text.AlignLeft : Text.AlignHCenter;
129 }
148 }
130
149
150+ QtObject {
151+ id: carouselTool
152+
153+ property real minimumTileWidth: {
154+ if (cardTool.viewWidth === undefined) return undefined;
155+ if (cardTool.viewWidth <= units.gu(40)) return units.gu(18);
156+ if (cardTool.viewWidth >= units.gu(128)) return units.gu(26);
157+ return units.gu(18 + Math.round((cardTool.viewWidth - units.gu(40)) / units.gu(11)));
158+ }
159+
160+ readonly property real pathItemCount: 4.8457 /// (848 / 175) reference values
161+
162+ property real realPathItemCount: {
163+ var scaledMinimumTileWidth = minimumTileWidth / cardTool.carouselSelectedItemScaleFactor;
164+ var tileWidth = Math.max(cardTool.viewWidth / pathItemCount, scaledMinimumTileWidth);
165+ return Math.min(cardTool.viewWidth / tileWidth, pathItemCount);
166+ }
167+ }
168+
131 Card {
169 Card {
132 id: card
170 id: card
133 objectName: "card"
171 objectName: "card"
qml/Dash/DashRenderer.qml+5−6
@@ -50,6 +50,11 @@ Item {
50 // The model to renderer
50 // The model to renderer
51 property var model
51 property var model
52
52
53+ /*!
54+ \brief CardTool component.
55+ */
56+ property var cardTool
57+
53 /// Emitted when the user clicked on an item
58 /// Emitted when the user clicked on an item
54 /// @param index is the index of the clicked item
59 /// @param index is the index of the clicked item
55 /// @param itemY is y of the clicked delegate
60 /// @param itemY is y of the clicked delegate
@@ -62,10 +67,4 @@ Item {
62
67
63 function startFilterAnimation(filter) {
68 function startFilterAnimation(filter) {
64 }
69 }
65−
66− /// Category template definition from the scope
67− property var template
68−
69− /// Component mapping and configuration from the scope
70− property var components
71}
70}
qml/Dash/GenericScopeView.qml+18−22
@@ -138,6 +138,15 @@ FocusScope {
138 readonly property string category: categoryId
138 readonly property string category: categoryId
139 readonly property var item: rendererLoader.item
139 readonly property var item: rendererLoader.item
140
140
141+ CardTool {
142+ id: cardTool
143+
144+ count: results.count
145+ template: model.renderer
146+ components: model.components
147+ viewWidth: parent.width
148+ }
149+
141 Loader {
150 Loader {
142 id: rendererLoader
151 id: rendererLoader
143 anchors {
152 anchors {
@@ -146,7 +155,14 @@ FocusScope {
146 right: parent.right
155 right: parent.right
147 }
156 }
148
157
149− source: getRenderer(model.renderer, results)
158+ source: {
159+ switch (cardTool.categoryLayout) {
160+ case "carousel": return "CardCarousel.qml";
161+ case "running-apps": return "Apps/RunningApplicationsGrid.qml";
162+ case "grid":
163+ default: return "CardFilterGrid.qml";
164+ }
165+ }
150
166
151 onLoaded: {
167 onLoaded: {
152 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
168 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
@@ -170,9 +186,7 @@ FocusScope {
170 }
186 }
171 }
187 }
172 updateDelegateCreationRange();
188 updateDelegateCreationRange();
173− // FIXME: should be "template", not "renderer"
189+ item.cardTool = cardTool;
174− item.template = Qt.binding(function() { return model.renderer });
175− item.components = Qt.binding(function() { return model.components });
176 }
190 }
177
191
178 Component.onDestruction: {
192 Component.onDestruction: {
@@ -325,22 +339,4 @@ FocusScope {
325 }
339 }
326 }
340 }
327 }
341 }
328−
329− function getRenderer(template, results) {
330− var layout = template["category-layout"];
331−
332− if (layout == "running-apps") {
333− return "Apps/RunningApplicationsGrid.qml";
334− }
335−
336− if (layout === "carousel") {
337− // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
338− if (results.count <= 4) layout = "grid";
339− }
340− switch (layout) {
341− case "carousel": return "CardCarousel.qml";
342− case "grid":
343− default: return "CardFilterGrid.qml";
344− }
345− }
346}
342}
tests/qmltests/Dash/tst_CardTool.qml+20
@@ -93,6 +93,7 @@ Rectangle {
93 CardTool {
93 CardTool {
94 id: cardTool
94 id: cardTool
95
95
96+ count: 8
96 template: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['template'];
97 template: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['template'];
97 components: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['components'];
98 components: Helpers.update(JSON.parse(Helpers.defaultLayout), Helpers.tryParse(layoutArea.text, layoutError))['components'];
98 viewWidth: units.gu(Math.round(widthSlider.value))
99 viewWidth: units.gu(Math.round(widthSlider.value))
@@ -343,5 +344,24 @@ Rectangle {
343 tryCompare(cardTool, data.property, data.value);
344 tryCompare(cardTool, data.property, data.value);
344 }
345 }
345 }
346 }
347+
348+ function test_categoryLayout_data() {
349+ return [
350+ { tag: "Default Grid", layout_index: 0, count: 2, viewWidth: units.gu(40), layout: "grid" },
351+ { tag: "Long carousel", layout_index: 4, count: 6, viewWidth: units.gu(140), layout: "carousel" },
352+ { tag: "Long carousel fallback", layout_index: 4, count: 5, viewWidth: units.gu(140), layout: "grid" },
353+ { tag: "Short carousel", layout_index: 4, count: 4, viewWidth: units.gu(30), layout: "carousel" },
354+ { tag: "Short carousel fallback", layout_index: 4, count: 3, viewWidth: units.gu(30), layout: "grid" },
355+ { tag: "Journal", layout_index: 2, count: 8, viewWidth: units.gu(30), layout: "journal" }
356+ ]
357+ }
358+
359+ function test_categoryLayout(data) {
360+ selector.selectedIndex = 0;
361+ layoutSelector.selectedIndex = data.layout_index;
362+ cardTool.viewWidth = data.viewWidth;
363+ cardTool.count = data.count;
364+ compare(cardTool.categoryLayout, data.layout);
365+ }
346 }
366 }
347}
367}
tests/qmltests/Dash/tst_GenericScopeView.qml−15
@@ -300,21 +300,6 @@ Item {
300 tryCompare(category, "filtered", true);
300 tryCompare(category, "filtered", true);
301 }
301 }
302
302
303− function test_getRendererCarouselGridFallback() {
304− var template = new Object()
305− template["category-layout"] = "carousel"
306− var results = new Object()
307− var renderer
308−
309− results.count = 5
310− renderer = genericScopeView.getRenderer(template, results)
311− compare(renderer, "CardCarousel.qml")
312−
313− results.count = 4
314− renderer = genericScopeView.getRenderer(template, results)
315− compare(renderer, "CardFilterGrid.qml")
316− }
317−
318 function test_showPreviewCarousel() {
303 function test_showPreviewCarousel() {
319 tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);
304 tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);
320 var tile = findChild(genericScopeView, "carouselDelegate");
305 var tile = findChild(genericScopeView, "carouselDelegate");