Merge lp:~bzoltan/ubuntu-ui-toolkit/test_1 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
Status: Superseded
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/test_1
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 2837 lines (+1049/-284)
66 files modified
apicheck/apicheck.cpp (+10/-0)
components.api (+53/-51)
debian/control (+9/-0)
debian/libubuntugestures5-private-dev.install (+3/-0)
documentation/ubuntu-components.qdoc (+1/-1)
documentation/ubuntu-ui-toolkit-common.qdocconf (+1/-1)
examples/ubuntu-ui-toolkit-gallery/Buttons.qml (+2/-2)
examples/ubuntu-ui-toolkit-gallery/Label.qml (+6/-6)
examples/ubuntu-ui-toolkit-gallery/MainPage.qml (+17/-27)
examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml (+7/-3)
src/Ubuntu/Components/1.2/TextField.qml (+1/-1)
src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+1/-0)
src/Ubuntu/Components/1.3/AppHeader.qml (+5/-0)
src/Ubuntu/Components/1.3/MainView.qml (+3/-20)
src/Ubuntu/Components/1.3/TextField.qml (+19/-1)
src/Ubuntu/Components/1.3/UbuntuListView.qml (+178/-9)
src/Ubuntu/Components/1.3/UbuntuListView11.qdoc (+0/-38)
src/Ubuntu/Components/ComponentModule.pro (+0/-2)
src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml (+1/-1)
src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml (+9/-0)
src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml (+4/-2)
src/Ubuntu/Components/plugin/plugin.cpp (+3/-1)
src/Ubuntu/Components/plugin/plugin.pri (+1/-4)
src/Ubuntu/Components/plugin/quickutils.cpp (+2/-1)
src/Ubuntu/Components/plugin/quickutils.h (+7/-0)
src/Ubuntu/Components/plugin/ucaction.cpp (+114/-16)
src/Ubuntu/Components/plugin/ucaction.h (+8/-1)
src/Ubuntu/Components/plugin/ucbottomedge.cpp (+1/-1)
src/Ubuntu/Components/plugin/ucbottomedgehint.cpp (+1/-1)
src/Ubuntu/Components/plugin/ucfontutils.h (+6/-6)
src/Ubuntu/Components/plugin/ucqquickimageextension.cpp (+11/-5)
src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp (+3/-1)
src/Ubuntu/Components/qmldir (+1/-1)
src/Ubuntu/Test/plugin/plugin.pri (+2/-1)
src/Ubuntu/Test/plugin/uctestextras.cpp (+18/-0)
src/Ubuntu/Test/plugin/uctestextras.h (+2/-0)
src/Ubuntu/UbuntuGestures/UbuntuGestures.pro (+6/-0)
src/Ubuntu/UbuntuGestures/damper.cpp (+1/-1)
src/Ubuntu/UbuntuGestures/ucswipearea.cpp (+8/-8)
src/Ubuntu/UbuntuGestures/ucswipearea_p.h (+2/-3)
src/Ubuntu/UbuntuGestures/ucswipearea_p_p.h (+7/-6)
tests/api/Extinct/Animals/AnimalModule.pro (+1/-1)
tests/api/Extinct/Animals/plugin/plugin.cpp (+2/-0)
tests/api/Extinct/Animals/plugin/plugin.pri (+2/-0)
tests/api/Extinct/Animals/plugin/tarpan.cpp (+59/-0)
tests/api/Extinct/Animals/plugin/tarpan.h (+46/-0)
tests/api/Extinct/Animals/qmldir (+1/-1)
tests/api/components.api (+11/-8)
tests/autopilot/ubuntuuitoolkit/__init__.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py (+3/-1)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py (+4/-0)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py (+1/-1)
tests/uitk_test_plan.sh (+2/-0)
tests/unit/plugin_dependency.pri (+1/-1)
tests/unit/runtest.sh (+1/-1)
tests/unit/tst_components/tst_fontutils.qml (+13/-14)
tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp (+1/-1)
tests/unit_x11/tst_bottomedge/tst_bottomedge.pro (+1/-1)
tests/unit_x11/tst_components/battery-100-charging.svg (+25/-0)
tests/unit_x11/tst_components/shape.svg (+77/-0)
tests/unit_x11/tst_components/tst_imageprovider.qml (+29/-4)
tests/unit_x11/tst_components/tst_scrollbar.qml (+67/-25)
tests/unit_x11/tst_components/tst_shortcuts.qml (+58/-0)
tests/unit_x11/tst_components/tst_ubuntulistview13.qml (+105/-0)
tests/unit_x11/tst_swipearea/tst_swipearea.cpp (+2/-2)
tests/unit_x11/tst_swipearea/tst_swipearea.pro (+1/-1)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/test_1
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+281905@code.launchpad.net

This proposal has been superseded by a proposal from 2016-01-07.

Commit message

test 1

Description of the change

test 1

To post a comment you must log in.

Unmerged revisions

1799. By Zoltan Balogh

test Jenkins

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'apicheck/apicheck.cpp'
--- apicheck/apicheck.cpp 2015-12-02 09:22:28 +0000
+++ apicheck/apicheck.cpp 2016-01-07 17:36:33 +0000
@@ -484,6 +484,10 @@
484 writeMetaContent(&object, mainMeta, &knownAttributes);484 writeMetaContent(&object, mainMeta, &knownAttributes);
485485
486 object["namespace"] = nameSpace;486 object["namespace"] = nameSpace;
487 // The QML class name derived from the filename is used by AP.
488 QString className(QFileInfo(filename).baseName());
489 if (typeName != className)
490 object["className"] = className;
487 json->insert(id, object);491 json->insert(id, object);
488 }492 }
489493
@@ -552,6 +556,10 @@
552 return;556 return;
553 }557 }
554558
559 // The C++ class is used by AP.
560 QString className(meta->className());
561 if (!(isSingleton || isUncreatable || exportStrings.empty()))
562 object["className"] = className;
555 json->insert(id, object);563 json->insert(id, object);
556 }564 }
557565
@@ -1102,6 +1110,8 @@
1102 QString signature(exports);1110 QString signature(exports);
1103 if (object.contains("namespace"))1111 if (object.contains("namespace"))
1104 signature = object.take("namespace").toString() + "." + signature;1112 signature = object.take("namespace").toString() + "." + signature;
1113 if (object.contains("className"))
1114 signature += " " + object.take("className").toString();
1105 QString prototype(object.take("prototype").toString());1115 QString prototype(object.take("prototype").toString());
1106 if (!prototype.isEmpty())1116 if (!prototype.isEmpty())
1107 signature += ": " + convertToId(prototype);1117 signature += ": " + convertToId(prototype);
11081118
=== modified file 'components.api'
--- components.api 2015-12-17 09:15:45 +0000
+++ components.api 2016-01-07 17:36:33 +0000
@@ -3,12 +3,12 @@
3 signal clicked()3 signal clicked()
4 signal pressAndHold()4 signal pressAndHold()
5 property bool pressed5 property bool pressed
6Ubuntu.Components.AbstractButton 1.3: ActionItem6Ubuntu.Components.AbstractButton 1.3 UCAbstractButton: ActionItem
7 readonly property bool hovered7 readonly property bool hovered
8 signal clicked()8 signal clicked()
9 signal pressAndHold()9 signal pressAndHold()
10 readonly property bool pressed10 readonly property bool pressed
11Ubuntu.Components.Action 1.3 1.0 0.1: QtObject11Ubuntu.Components.Action 1.3 1.0 0.1 UCAction: QtObject
12 property string description12 property string description
13 property bool enabled13 property bool enabled
14 property string iconName14 property string iconName
@@ -40,12 +40,12 @@
40 property string overflowIconName40 property string overflowIconName
41 property url overflowIconSource41 property url overflowIconSource
42 property string overflowText42 property string overflowText
43Ubuntu.Components.ActionContext 1.0 0.1: QtObject43Ubuntu.Components.ActionContext 1.0 0.1 UCActionContext: QtObject
44 default property list<Action> actions44 default property list<Action> actions
45 property bool active45 property bool active
46 function addAction(Action action)46 function addAction(Action action)
47 function removeAction(Action action)47 function removeAction(Action action)
48Ubuntu.Components.ActionItem 1.0 0.1: StyledItem48Ubuntu.Components.ActionItem 1.0 0.1 UCActionItem: StyledItem
49 property Action action49 property Action action
50 property string iconName50 property string iconName
51 property url iconSource51 property url iconSource
@@ -59,7 +59,7 @@
59Ubuntu.Components.ActionList 1.3: QtObject59Ubuntu.Components.ActionList 1.3: QtObject
60 property list<Action> actions60 property list<Action> actions
61 default property list<Action> children61 default property list<Action> children
62Ubuntu.Components.ActionManager 1.0 0.1: QtObject62Ubuntu.Components.ActionManager 1.0 0.1 UCActionManager: QtObject
63 default property list<Action> actions63 default property list<Action> actions
64 readonly property ActionContext globalContext64 readonly property ActionContext globalContext
65 property list<ActionContext> localContexts65 property list<ActionContext> localContexts
@@ -90,7 +90,7 @@
90 function var removePages(var page)90 function var removePages(var page)
91 property Page primaryPage91 property Page primaryPage
92 property var primaryPageSource92 property var primaryPageSource
93Ubuntu.Components.Alarm 1.0 0.1: QtObject93Ubuntu.Components.Alarm 1.0 0.1 UCAlarm: QtObject
94 property QDateTime date94 property QDateTime date
95 property DaysOfWeek daysOfWeek95 property DaysOfWeek daysOfWeek
96 property bool enabled96 property bool enabled
@@ -144,17 +144,17 @@
144 Fail144 Fail
145 InProgress145 InProgress
146 Ready146 Ready
147Ubuntu.Components.AlarmModel 1.0 0.1: QAbstractListModel147Ubuntu.Components.AlarmModel 1.0 0.1 UCAlarmModel: QAbstractListModel
148 readonly property int count148 readonly property int count
149 function refresh() 1.0149 function refresh() 1.0
150 function UCAlarm* get(int index)150 function UCAlarm* get(int index)
151Ubuntu.Components.Argument 1.0 0.1: QtObject151Ubuntu.Components.Argument 1.0 0.1 UCArgument: QtObject
152 property string help152 property string help
153 function var at(int i)153 function var at(int i)
154 property string name154 property string name
155 property bool required155 property bool required
156 property QStringList valueNames156 property QStringList valueNames
157Ubuntu.Components.Arguments 1.0 0.1: QtObject157Ubuntu.Components.Arguments 1.0 0.1 UCArguments: QtObject
158 default property list<Argument> arguments158 default property list<Argument> arguments
159 property Argument defaultArgument159 property Argument defaultArgument
160 readonly property bool error160 readonly property bool error
@@ -175,7 +175,7 @@
175 property var icon175 property var icon
176 property bool iconFrame176 property bool iconFrame
177 property bool progression177 property bool progression
178Ubuntu.Components.BottomEdge 1.3: StyledItem178Ubuntu.Components.BottomEdge 1.3 UCBottomEdge: StyledItem
179 readonly property BottomEdgeRegion activeRegion179 readonly property BottomEdgeRegion activeRegion
180 property Component contentComponent180 property Component contentComponent
181 readonly property Item contentItem181 readonly property Item contentItem
@@ -205,7 +205,7 @@
205 Committed205 Committed
206 Hidden206 Hidden
207 Revealed207 Revealed
208Ubuntu.Components.BottomEdgeHint 1.3: ActionItem208Ubuntu.Components.BottomEdgeHint 1.3 UCBottomEdgeHint: ActionItem
209 property int deactivateTimeout209 property int deactivateTimeout
210 property Flickable flickable210 property Flickable flickable
211 signal clicked()211 signal clicked()
@@ -216,7 +216,7 @@
216 Hidden216 Hidden
217 Inactive217 Inactive
218 Locked218 Locked
219Ubuntu.Components.BottomEdgeRegion 1.3: QtObject219Ubuntu.Components.BottomEdgeRegion 1.3 UCBottomEdgeRegion: QtObject
220 property Component contentComponent220 property Component contentComponent
221 property url contentUrl221 property url contentUrl
222 property bool enabled222 property bool enabled
@@ -225,7 +225,7 @@
225 signal exited()225 signal exited()
226 signal dragEnded()226 signal dragEnded()
227 property double to227 property double to
228Ubuntu.Components.Styles.BottomEdgeStyle 1.3: Item228Ubuntu.Components.Styles.BottomEdgeStyle 1.3 UCBottomEdgeStyle: Item
229 property Item contentItem229 property Item contentItem
230 property Item panel230 property Item panel
231 property Animation panelAnimation231 property Animation panelAnimation
@@ -299,22 +299,22 @@
299Ubuntu.Components.Popups.ComposerSheet 1.3: SheetBase299Ubuntu.Components.Popups.ComposerSheet 1.3: SheetBase
300 signal cancelClicked()300 signal cancelClicked()
301 signal confirmClicked()301 signal confirmClicked()
302Ubuntu.Layouts.ConditionalLayout 1.0 0.1: QtObject302Ubuntu.Layouts.ConditionalLayout 1.0 0.1 ULConditionalLayout: QtObject
303 default property Component layout303 default property Component layout
304 property string name304 property string name
305 property QQmlBinding when305 property QQmlBinding when
306Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1: Item306Ubuntu.PerformanceMetrics.CpuUsage 1.0 0.1 UPMCpuUsage: Item
307 readonly property UPMGraphModel graphModel307 readonly property UPMGraphModel graphModel
308 property int period308 property int period
309 property int samplingInterval309 property int samplingInterval
310Ubuntu.Components.CrossFadeImage 1.0 0.1: Item310Ubuntu.Components.CrossFadeImage 1.0 0.1 CrossFadeImage10: Item
311 property int fadeDuration311 property int fadeDuration
312 property int fillMode312 property int fillMode
313 readonly property bool running313 readonly property bool running
314 property url source314 property url source
315 property QSizeF sourceSize315 property QSizeF sourceSize
316 readonly property int status316 readonly property int status
317Ubuntu.Components.CrossFadeImage 1.1: Item317Ubuntu.Components.CrossFadeImage 1.1 CrossFadeImage11: Item
318 property int fadeDuration318 property int fadeDuration
319 property string fadeStyle319 property string fadeStyle
320 property int fillMode320 property int fillMode
@@ -468,7 +468,7 @@
468 readonly property bool enabled468 readonly property bool enabled
469 function play(var customEffect)469 function play(var customEffect)
470 function play()470 function play()
471Ubuntu.Components.ListItems.Header 1.0 0.1: Item471Ubuntu.Components.ListItems.Header 1.0 0.1 ListItemHeader: Item
472 property string text472 property string text
473Ubuntu.Components.Header 1.0 0.1: AppHeader473Ubuntu.Components.Header 1.0 0.1: AppHeader
474 property string _for_autopilot474 property string _for_autopilot
@@ -486,9 +486,9 @@
486 property var tabsModel486 property var tabsModel
487 property string title487 property string title
488 property bool useDeprecatedToolbar488 property bool useDeprecatedToolbar
489Ubuntu.Components.ListItems.Header 1.3: Item489Ubuntu.Components.ListItems.Header 1.3 ListItemHeader: Item
490 property string text490 property string text
491Ubuntu.Components.Header 1.3: StyledItem491Ubuntu.Components.Header 1.3 UCHeader: StyledItem
492 property bool exposed492 property bool exposed
493 property Flickable flickable493 property Flickable flickable
494 readonly property bool moving494 readonly property bool moving
@@ -498,12 +498,12 @@
498 property string name498 property string name
499Ubuntu.Components.Icon 1.1: Icon499Ubuntu.Components.Icon 1.1: Icon
500 property url source500 property url source
501Ubuntu.Components.InverseMouse 1.0 0.1: Mouse501Ubuntu.Components.InverseMouse 1.0 0.1 UCInverseMouse: Mouse
502Ubuntu.Components.InverseMouseArea 1.0 0.1: MouseArea502Ubuntu.Components.InverseMouseArea 1.0 0.1 InverseMouseAreaType: MouseArea
503 function bool contains(QPointF point)503 function bool contains(QPointF point)
504 property Item sensingArea504 property Item sensingArea
505 property bool topmostItem505 property bool topmostItem
506Ubuntu.Layouts.ItemLayout 1.0 0.1: Item506Ubuntu.Layouts.ItemLayout 1.0 0.1 ULItemLayout: Item
507 property string item507 property string item
508Ubuntu.Components.ListItems.ItemSelector 1.0 0.1: Empty508Ubuntu.Components.ListItems.ItemSelector 1.0 0.1: Empty
509 property bool colourImage509 property bool colourImage
@@ -531,7 +531,7 @@
531 property int selectedIndex531 property int selectedIndex
532Ubuntu.Components.Label 1.0 0.1: Text532Ubuntu.Components.Label 1.0 0.1: Text
533 property string fontSize533 property string fontSize
534Ubuntu.Components.Label 1.3: Text534Ubuntu.Components.Label 1.3 UCLabel: Text
535 property string fontSize535 property string fontSize
536 property TextSize textSize536 property TextSize textSize
537Ubuntu.Components.Label.TextSize: Enum537Ubuntu.Components.Label.TextSize: Enum
@@ -541,10 +541,10 @@
541 XLarge541 XLarge
542 XSmall542 XSmall
543 XxSmall543 XxSmall
544Ubuntu.Layouts.Layouts 1.0 0.1: Item544Ubuntu.Layouts.Layouts 1.0 0.1 ULLayouts: Item
545 readonly property string currentLayout545 readonly property string currentLayout
546 property list<ConditionalLayout> layouts546 property list<ConditionalLayout> layouts
547Ubuntu.Components.ListItem 1.3 1.2: StyledItem547Ubuntu.Components.ListItem 1.3 1.2 UCListItem: StyledItem
548 property Action action548 property Action action
549 property color color549 property color color
550 readonly property Item contentItem550 readonly property Item contentItem
@@ -567,7 +567,7 @@
567 property bool swipeEnabled 1.3567 property bool swipeEnabled 1.3
568 readonly property bool swiped 1.3568 readonly property bool swiped 1.3
569 property ListItemActions trailingActions569 property ListItemActions trailingActions
570Ubuntu.Components.ListItemActions 1.2: QtObject570Ubuntu.Components.ListItemActions 1.2 UCListItemActions: QtObject
571 property list<Action> actions571 property list<Action> actions
572 default property list<QtObject> data572 default property list<QtObject> data
573 property Component delegate573 property Component delegate
@@ -582,11 +582,11 @@
582 Dropped582 Dropped
583 Moving583 Moving
584 Started584 Started
585Ubuntu.Components.ListItemLayout 1.3: SlotsLayout585Ubuntu.Components.ListItemLayout 1.3 UCListItemLayout: SlotsLayout
586 readonly property Label subtitle586 readonly property Label subtitle
587 readonly property Label summary587 readonly property Label summary
588 readonly property Label title588 readonly property Label title
589Ubuntu.Components.Styles.ListItemStyle 1.3 1.2: Item589Ubuntu.Components.Styles.ListItemStyle 1.3 1.2 UCListItemStyle: Item
590 readonly property bool animatePanels590 readonly property bool animatePanels
591 property Item dragPanel591 property Item dragPanel
592 property PropertyAnimation dropAnimation592 property PropertyAnimation dropAnimation
@@ -595,7 +595,7 @@
595 function swipeEvent(SwipeEvent event)595 function swipeEvent(SwipeEvent event)
596 function rebound()596 function rebound()
597 property Animation snapAnimation597 property Animation snapAnimation
598Ubuntu.Components.LiveTimer 1.3: QtObject598Ubuntu.Components.LiveTimer 1.3 LiveTimer: QtObject
599 property Frequency frequency599 property Frequency frequency
600 signal trigger()600 signal trigger()
601 property QDateTime relativeTime601 property QDateTime relativeTime
@@ -609,7 +609,7 @@
609 property bool automaticOrientation609 property bool automaticOrientation
610 default property list<QtObject> contentsItem610 default property list<QtObject> contentsItem
611 property bool useDeprecatedToolbar611 property bool useDeprecatedToolbar
612Ubuntu.Components.MainView 1.2: MainViewBase612Ubuntu.Components.MainView 1.2 MainView12: MainViewBase
613 property bool automaticOrientation613 property bool automaticOrientation
614 default property list<QtObject> contentsItem614 default property list<QtObject> contentsItem
615Ubuntu.Components.MainView 1.3: MainViewBase615Ubuntu.Components.MainView 1.3: MainViewBase
@@ -620,14 +620,14 @@
620 function double lerp(double delta, double from, double to)620 function double lerp(double delta, double from, double to)
621 function double projectValue(double x, double xmin, double xmax, double ymin, double ymax)621 function double projectValue(double x, double xmin, double xmax, double ymin, double ymax)
622 function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax)622 function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax)
623Ubuntu.Components.MimeData 1.0 0.1: QtObject623Ubuntu.Components.MimeData 1.0 0.1 QQuickMimeData: QtObject
624 property color color624 property color color
625 property var data625 property var data
626 readonly property QStringList formats626 readonly property QStringList formats
627 property string html627 property string html
628 property string text628 property string text
629 property list<url> urls629 property list<url> urls
630Ubuntu.Components.Mouse 1.0 0.1: QtObject630Ubuntu.Components.Mouse 1.0 0.1 UCMouse: QtObject
631 readonly property Qt.MouseButtons acceptedButtons631 readonly property Qt.MouseButtons acceptedButtons
632 property int clickAndHoldThreshold632 property int clickAndHoldThreshold
633 property bool enabled633 property bool enabled
@@ -707,12 +707,12 @@
707 property int orientationAngle707 property int orientationAngle
708 readonly property bool rotating708 readonly property bool rotating
709 property bool transitionEnabled709 property bool transitionEnabled
710Ubuntu.Components.Page 1.0 0.1: PageTreeNode710Ubuntu.Components.Page 1.0 0.1 Page10: PageTreeNode
711 property list<Action> actions711 property list<Action> actions
712 property Flickable flickable712 property Flickable flickable
713 property string title713 property string title
714 property Item tools714 property Item tools
715Ubuntu.Components.Page 1.1: Page10715Ubuntu.Components.Page 1.1 Page11: Page10
716 readonly property PageHeadConfiguration head716 readonly property PageHeadConfiguration head
717Ubuntu.Components.Page 1.3: PageTreeNode717Ubuntu.Components.Page 1.3: PageTreeNode
718 property Flickable flickable718 property Flickable flickable
@@ -810,7 +810,7 @@
810 function var push(var page, var properties)810 function var push(var page, var properties)
811 function var pop()811 function var pop()
812 function var clear()812 function var clear()
813Ubuntu.Components.PageTreeNode 1.3: StyledItem813Ubuntu.Components.PageTreeNode 1.3 UCPageTreeNode: StyledItem
814 property bool active814 property bool active
815 readonly property Item activeLeafNode815 readonly property Item activeLeafNode
816 property bool isLeaf816 property bool isLeaf
@@ -965,7 +965,7 @@
965 property double value965 property double value
966Ubuntu.Components.ProgressionSlot 1.3: Icon966Ubuntu.Components.ProgressionSlot 1.3: Icon
967 property url source967 property url source
968Ubuntu.Components.ProportionalShape 1.3: UbuntuShape968Ubuntu.Components.ProportionalShape 1.3 UCProportionalShape: UbuntuShape
969Ubuntu.Components.PullToRefresh 1.1: StyledItem969Ubuntu.Components.PullToRefresh 1.1: StyledItem
970 property Component content970 property Component content
971 signal refresh()971 signal refresh()
@@ -984,7 +984,7 @@
984 property double activationThreshold984 property double activationThreshold
985 property Component defaultContent985 property Component defaultContent
986 property bool releaseToRefresh986 property bool releaseToRefresh
987Ubuntu.PerformanceMetrics.RenderingTimes 1.0 0.1: Item987Ubuntu.PerformanceMetrics.RenderingTimes 1.0 0.1 UPMRenderingTimes: Item
988 readonly property UPMGraphModel graphModel988 readonly property UPMGraphModel graphModel
989 signal frameRendered(qlonglong renderTime)989 signal frameRendered(qlonglong renderTime)
990 property int period990 property int period
@@ -1004,7 +1004,7 @@
1004 property list<Action> actions1004 property list<Action> actions
1005 property var model1005 property var model
1006 property int selectedIndex1006 property int selectedIndex
1007Ubuntu.Components.ServiceProperties 1.1: QtObject1007Ubuntu.Components.ServiceProperties 1.1 UCServiceProperties: QtObject
1008 property string adaptorInterface 1.11008 property string adaptorInterface 1.1
1009 readonly property string error 1.11009 readonly property string error 1.1
1010 property string path 1.11010 property string path 1.1
@@ -1062,7 +1062,7 @@
1062 property bool overrideVerticalPositioning1062 property bool overrideVerticalPositioning
1063 readonly property SlotsLayoutPadding padding1063 readonly property SlotsLayoutPadding padding
1064 property SlotsLayout.UCSlotPosition position1064 property SlotsLayout.UCSlotPosition position
1065Ubuntu.Components.SlotsLayout 1.3: Item1065Ubuntu.Components.SlotsLayout 1.3 UCSlotsLayout: Item
1066 property Item mainSlot1066 property Item mainSlot
1067 readonly property SlotsLayoutPadding padding1067 readonly property SlotsLayoutPadding padding
1068Ubuntu.Components.SlotsLayout.UCSlotPosition: Enum1068Ubuntu.Components.SlotsLayout.UCSlotPosition: Enum
@@ -1078,7 +1078,7 @@
1078Ubuntu.Components.SortBehavior 1.1: QtObject1078Ubuntu.Components.SortBehavior 1.1: QtObject
1079 property Qt.SortOrder order1079 property Qt.SortOrder order
1080 property string property1080 property string property
1081Ubuntu.Components.SortFilterModel 1.1: QSortFilterProxyModel1081Ubuntu.Components.SortFilterModel 1.1 QSortFilterProxyModelQML: QSortFilterProxyModel
1082 readonly property int count1082 readonly property int count
1083 readonly property FilterBehavior filter1083 readonly property FilterBehavior filter
1084 function QVariantMap get(int row)1084 function QVariantMap get(int row)
@@ -1099,10 +1099,10 @@
1099 property var icon1099 property var icon
1100 property bool iconFrame1100 property bool iconFrame
1101 property bool progression1101 property bool progression
1102Ubuntu.Components.StateSaver 1.0 0.1: QtObject1102Ubuntu.Components.StateSaver 1.0 0.1 UCStateSaver: QtObject
1103Ubuntu.Components.StyleHints 1.3: QtObject1103Ubuntu.Components.StyleHints 1.3 UCStyleHints: QtObject
1104 property bool ignoreUnknownProperties1104 property bool ignoreUnknownProperties
1105Ubuntu.Components.StyledItem 1.3 1.3 1.1 1.0 0.1: Item1105Ubuntu.Components.StyledItem 1.3 1.3 1.1 1.0 0.1 UCStyledItemBase: Item
1106 property bool activeFocusOnPress 1.31106 property bool activeFocusOnPress 1.3
1107 readonly property bool keyNavigationFocus 1.31107 readonly property bool keyNavigationFocus 1.3
1108 signal activeFocusOnTabChanged2() 1.31108 signal activeFocusOnTabChanged2() 1.3
@@ -1115,7 +1115,7 @@
1115 property string subText1115 property string subText
1116Ubuntu.Components.ListItems.Subtitled 1.3: Base1116Ubuntu.Components.ListItems.Subtitled 1.3: Base
1117 property string subText1117 property string subText
1118Ubuntu.Components.SwipeArea 1.3: Item1118Ubuntu.Components.SwipeArea 1.3 UCSwipeArea: Item
1119 property Direction direction1119 property Direction direction
1120 readonly property double distance1120 readonly property double distance
1121 readonly property bool dragging1121 readonly property bool dragging
@@ -1205,6 +1205,7 @@
1205 function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button, Qt.KeyboardModifiers stateKey, int steps)1205 function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button, Qt.KeyboardModifiers stateKey, int steps)
1206 function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button, Qt.KeyboardModifiers stateKey)1206 function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button, Qt.KeyboardModifiers stateKey)
1207 function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button)1207 function mouseDrag(Item item, Qt.point from, Qt.point delta, Qt.MouseButton button)
1208 function removeTimeConstraintsFromSwipeArea(Item item)
1208 readonly property bool touchPresent1209 readonly property bool touchPresent
1209Ubuntu.Components.TextArea 1.0 0.1: StyledItem1210Ubuntu.Components.TextArea 1.0 0.1: StyledItem
1210 property bool autoExpand1211 property bool autoExpand
@@ -1447,9 +1448,9 @@
1447 readonly property int selectionStart1448 readonly property int selectionStart
1448 property QValidator validator1449 property QValidator validator
1449 property int verticalAlignment1450 property int verticalAlignment
1450Ubuntu.PerformanceMetrics.TextureFromImage 1.0 0.1: Item1451Ubuntu.PerformanceMetrics.TextureFromImage 1.0 0.1 UPMTextureFromImage: Item
1451 property QImage image1452 property QImage image
1452Ubuntu.Components.ThemeSettings 1.3: QtObject1453Ubuntu.Components.ThemeSettings 1.3 UCTheme: QtObject
1453 property string name1454 property string name
1454 property QtObject palette1455 property QtObject palette
1455 readonly property ThemeSettings parentTheme1456 readonly property ThemeSettings parentTheme
@@ -1559,13 +1560,14 @@
1559 readonly property color warmGrey1560 readonly property color warmGrey
1560Ubuntu.Components.UbuntuListView 1.0 0.1: ListView1561Ubuntu.Components.UbuntuListView 1.0 0.1: ListView
1561 property int expandedIndex1562 property int expandedIndex
1562Ubuntu.Components.UbuntuListView 1.1: UbuntuListView1563Ubuntu.Components.UbuntuListView 1.1 UbuntuListView11: UbuntuListView
1563 readonly property PullToRefresh pullToRefresh1564 readonly property PullToRefresh pullToRefresh
1564Ubuntu.Components.UbuntuListView 1.3: UbuntuListView1565Ubuntu.Components.UbuntuListView 1.3: ListView
1566 property int expandedIndex
1565 readonly property PullToRefresh pullToRefresh1567 readonly property PullToRefresh pullToRefresh
1566Ubuntu.Components.UbuntuNumberAnimation 1.0 0.1: PropertyAnimation1568Ubuntu.Components.UbuntuNumberAnimation 1.0 0.1: PropertyAnimation
1567Ubuntu.Components.UbuntuNumberAnimation 1.3: PropertyAnimation1569Ubuntu.Components.UbuntuNumberAnimation 1.3: PropertyAnimation
1568Ubuntu.Components.UbuntuShape 1.3 1.2 1.0 0.1 Shape 1.0 0.1: Item1570Ubuntu.Components.UbuntuShape 1.3 1.2 1.0 0.1 Shape 1.0 0.1 UCUbuntuShape: Item
1569 property Aspect aspect 1.31571 property Aspect aspect 1.3
1570 property color backgroundColor 1.31572 property color backgroundColor 1.3
1571 property BackgroundMode backgroundMode 1.31573 property BackgroundMode backgroundMode 1.3
@@ -1611,7 +1613,7 @@
1611Ubuntu.Components.UbuntuShape.WrapMode: Enum1613Ubuntu.Components.UbuntuShape.WrapMode: Enum
1612 Repeat1614 Repeat
1613 Transparent1615 Transparent
1614Ubuntu.Components.UbuntuShapeOverlay 1.2: UbuntuShape1616Ubuntu.Components.UbuntuShapeOverlay 1.2 UCUbuntuShapeOverlay: UbuntuShape
1615 property color overlayColor1617 property color overlayColor
1616 property QRectF overlayRect1618 property QRectF overlayRect
1617Ubuntu.Test.UbuntuTestCase 1.0 0.1: TestCase1619Ubuntu.Test.UbuntuTestCase 1.0 0.1: TestCase
16181620
=== modified file 'debian/control'
--- debian/control 2015-12-16 09:55:02 +0000
+++ debian/control 2016-01-07 17:36:33 +0000
@@ -107,6 +107,15 @@
107 This package contains the development files for 107 This package contains the development files for
108 Ubuntu gestures library with SwipeArea108 Ubuntu gestures library with SwipeArea
109109
110Package: libubuntugestures5-private-dev
111Architecture: any
112Multi-Arch: same
113Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends}
114Depends: ${misc:Depends},
115 ${shlibs:Depends},
116Description: Ubuntu gestures library private development files
117 This package contains the private development files for
118 Ubuntu gestures library with SwipeArea
110119
111120
112Package: ubuntu-ui-toolkit-theme121Package: ubuntu-ui-toolkit-theme
113122
=== added file 'debian/libubuntugestures5-private-dev.install'
--- debian/libubuntugestures5-private-dev.install 1970-01-01 00:00:00 +0000
+++ debian/libubuntugestures5-private-dev.install 2016-01-07 17:36:33 +0000
@@ -0,0 +1,3 @@
1usr/include/*/qt5/UbuntuGestures/*/UbuntuGestures/private/ucswipearea_p.h
2usr/include/*/qt5/UbuntuGestures/*/UbuntuGestures/private/ucswipearea_p_p.h
3usr/include/*/qt5/UbuntuGestures/*/UbuntuGestures/private/damper_p.h
04
=== modified file 'documentation/ubuntu-components.qdoc'
--- documentation/ubuntu-components.qdoc 2015-03-03 13:47:48 +0000
+++ documentation/ubuntu-components.qdoc 2016-01-07 17:36:33 +0000
@@ -15,7 +15,7 @@
15 */15 */
1616
17/*!17/*!
18 \qmlmodule Ubuntu.Components 1.218 \qmlmodule Ubuntu.Components 1.3
19 \title Basic QML Types19 \title Basic QML Types
20 \nextpage {Ubuntu User Interface Toolkit}20 \nextpage {Ubuntu User Interface Toolkit}
21*/21*/
2222
=== modified file 'documentation/ubuntu-ui-toolkit-common.qdocconf'
--- documentation/ubuntu-ui-toolkit-common.qdocconf 2015-09-01 11:59:13 +0000
+++ documentation/ubuntu-ui-toolkit-common.qdocconf 2016-01-07 17:36:33 +0000
@@ -29,7 +29,7 @@
29excludefiles += $BLD/../src/Ubuntu/Components/1.3/PageWrapperUtils.js29excludefiles += $BLD/../src/Ubuntu/Components/1.3/PageWrapperUtils.js
30outputdir = $BLD/html30outputdir = $BLD/html
31outputformats = HTML31outputformats = HTML
32version = 1.232version = 1.3
33syntaxhighlighting = true33syntaxhighlighting = true
34sourceencoding = UTF-834sourceencoding = UTF-8
35outputencoding = UTF-835outputencoding = UTF-8
3636
=== modified file 'examples/ubuntu-ui-toolkit-gallery/Buttons.qml'
--- examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2015-06-19 05:14:00 +0000
+++ examples/ubuntu-ui-toolkit-gallery/Buttons.qml 2016-01-07 17:36:33 +0000
@@ -50,8 +50,8 @@
50 objectName: "button_color"50 objectName: "button_color"
51 width: units.gu(20)51 width: units.gu(20)
52 action: Action {52 action: Action {
53 text: i18n.tr("Call %1").arg(shortcut)53 text: i18n.tr("C&all %1").arg(shortcut)
54 shortcut: 'Ctrl+C'54 shortcut: 'Ctrl+L'
55 property bool flipped55 property bool flipped
56 onTriggered: flipped = !flipped56 onTriggered: flipped = !flipped
57 }57 }
5858
=== modified file 'examples/ubuntu-ui-toolkit-gallery/Label.qml'
--- examples/ubuntu-ui-toolkit-gallery/Label.qml 2015-09-21 14:44:13 +0000
+++ examples/ubuntu-ui-toolkit-gallery/Label.qml 2016-01-07 17:36:33 +0000
@@ -28,27 +28,27 @@
2828
29 Label {29 Label {
30 textSize: Label.XxSmall30 textSize: Label.XxSmall
31 text: "xx-small"31 text: "Label.XxSmall"
32 }32 }
33 Label {33 Label {
34 textSize: Label.XSmall34 textSize: Label.XSmall
35 text: "x-small"35 text: "Label.XSmall"
36 }36 }
37 Label {37 Label {
38 textSize: Label.Small38 textSize: Label.Small
39 text: "small"39 text: "Label.Small"
40 }40 }
41 Label {41 Label {
42 textSize: Label.Medium42 textSize: Label.Medium
43 text: "medium"43 text: "Label.Medium"
44 }44 }
45 Label {45 Label {
46 textSize: Label.Large46 textSize: Label.Large
47 text: "large"47 text: "Label.Large"
48 }48 }
49 Label {49 Label {
50 textSize: Label.XLarge50 textSize: Label.XLarge
51 text: "x-large"51 text: "Label.XLarge"
52 }52 }
53 }53 }
54 }54 }
5555
=== modified file 'examples/ubuntu-ui-toolkit-gallery/MainPage.qml'
--- examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2015-12-15 14:20:33 +0000
+++ examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2016-01-07 17:36:33 +0000
@@ -66,6 +66,18 @@
66 iconName: "starred"66 iconName: "starred"
67 visible: !QuickUtils.mouseAttached67 visible: !QuickUtils.mouseAttached
68 onTriggered: QuickUtils.mouseAttached = true68 onTriggered: QuickUtils.mouseAttached = true
69 },
70 Action {
71 text: i18n.tr("Detach keyboard")
72 iconName: "non-starred"
73 visible: QuickUtils.keyboardAttached
74 onTriggered: QuickUtils.keyboardAttached = false
75 },
76 Action {
77 text: i18n.tr("Attach keyboard")
78 iconName: "starred"
79 visible: !QuickUtils.keyboardAttached
80 onTriggered: QuickUtils.keyboardAttached = true
69 }81 }
70 ]82 ]
71 }83 }
@@ -101,36 +113,14 @@
101113
102 delegate: ListItem {114 delegate: ListItem {
103 objectName: model.objectName115 objectName: model.objectName
104 contentItem {
105 anchors.leftMargin: units.gu(2)
106 anchors.rightMargin: units.gu(2)
107 }
108 enabled: source != ""116 enabled: source != ""
109 // Used by Autopilot117 // Used by Autopilot
110 property string text: label118 property string text: label
111 onClicked: widgetList.currentIndex = index119 onClicked: widgetList.currentIndex = index
112 Label {120 ListItemLayout {
113 id: labelItem121 title.text: label
114 anchors {122 ProgressionSlot {}
115 fill: parent123 }
116 rightMargin: units.gu(4)124 }
117 }
118 text: label
119 verticalAlignment: Text.AlignVCenter
120 }
121 Icon {
122 name: "next"
123 width: units.gu(2)
124 height: units.gu(2)
125 anchors {
126 verticalCenter: parent.verticalCenter
127 right: parent.right
128 }
129 }
130 }
131 highlight: Rectangle {
132 color: theme.palette.selected.background
133 }
134 highlightMoveDuration: 0
135 }125 }
136}126}
137127
=== modified file 'examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml'
--- examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml 2015-04-29 07:21:29 +0000
+++ examples/ubuntu-ui-toolkit-gallery/UbuntuListViews.qml 2016-01-07 17:36:33 +0000
@@ -16,7 +16,6 @@
1616
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.3
19import Ubuntu.Components.ListItems 1.3 as ListItem
2019
21Template {20Template {
22 objectName: "ubuntuListViewTemplate"21 objectName: "ubuntuListViewTemplate"
@@ -52,9 +51,14 @@
52 height: units.gu(36)51 height: units.gu(36)
53 model: fruitModel52 model: fruitModel
54 clip: true53 clip: true
54 currentIndex: -1
5555
56 delegate: ListItem.Standard {56 delegate: ListItem {
57 text: name57 ListItemLayout {
58 title.text: name
59 }
60 // to enable highlight
61 onClicked: ListView.view.currentIndex = index
58 }62 }
5963
60 pullToRefresh {64 pullToRefresh {
6165
=== modified file 'src/Ubuntu/Components/1.2/TextField.qml'
--- src/Ubuntu/Components/1.2/TextField.qml 2015-12-14 15:47:03 +0000
+++ src/Ubuntu/Components/1.2/TextField.qml 2016-01-07 17:36:33 +0000
@@ -929,7 +929,7 @@
929 width: units.gu(2.5)929 width: units.gu(2.5)
930 height: width930 height: width
931 // use icon from icon-theme931 // use icon from icon-theme
932 name: control.hasClearButton && !control.readOnly ? "clear-search" : ""932 name: control.hasClearButton && !control.readOnly ? "edit-clear" : ""
933 }933 }
934934
935 onClicked: editor.text = ""935 onClicked: editor.text = ""
936936
=== modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml'
--- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-29 10:03:14 +0000
+++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2016-01-07 17:36:33 +0000
@@ -777,6 +777,7 @@
777777
778 property color dividerColor: layout.__propagated.header.dividerColor778 property color dividerColor: layout.__propagated.header.dividerColor
779 property color panelColor: layout.__propagated.header.panelColor779 property color panelColor: layout.__propagated.header.panelColor
780 property color backgroundColor: layout.__propagated.header.backgroundColor
780781
781 visible: !customHeader && holder.pageWrapper && holder.pageWrapper.active782 visible: !customHeader && holder.pageWrapper && holder.pageWrapper.active
782783
783784
=== modified file 'src/Ubuntu/Components/1.3/AppHeader.qml'
--- src/Ubuntu/Components/1.3/AppHeader.qml 2015-12-14 20:38:59 +0000
+++ src/Ubuntu/Components/1.3/AppHeader.qml 2016-01-07 17:36:33 +0000
@@ -32,6 +32,11 @@
32 }32 }
3333
34 /*!34 /*!
35 The background color of the header. Value set by MainView.
36 */
37 property color backgroundColor
38
39 /*!
35 The background color of the divider. Value set by MainView.40 The background color of the divider. Value set by MainView.
36 */41 */
37 property color dividerColor42 property color dividerColor
3843
=== modified file 'src/Ubuntu/Components/1.3/MainView.qml'
--- src/Ubuntu/Components/1.3/MainView.qml 2015-10-13 13:37:43 +0000
+++ src/Ubuntu/Components/1.3/MainView.qml 2016-01-07 17:36:33 +0000
@@ -121,28 +121,10 @@
121 UbuntuApplication.inputMethod.keyboardRectangle.height : 0121 UbuntuApplication.inputMethod.keyboardRectangle.height : 0
122 }122 }
123123
124 // clip the contents so that it does not overlap the header
125 Item {124 Item {
126 id: contentsClipper125 id: contents
127 anchors {126 anchors {
128 left: parent.left127 fill: parent
129 right: parent.right
130 top: headerItem.bottom
131 bottom: parent.bottom
132 }
133 // only clip when necessary
134 // ListView headers may be positioned at the top, independent from
135 // flickable.contentY, so do not clip depending on activePage.flickable.contentY.
136 clip: headerItem.bottomY > 0 && internal.activePage && internal.activePage.flickable
137
138 Item {
139 id: contents
140 anchors {
141 fill: parent
142
143 // compensate so that the actual y is always 0
144 topMargin: -parent.y
145 }
146 }128 }
147 }129 }
148130
@@ -159,6 +141,7 @@
159 property real bottomY: headerItem.y + headerItem.height141 property real bottomY: headerItem.y + headerItem.height
160 dividerColor: Qt.darker(mainView.headerColor, 1.1)142 dividerColor: Qt.darker(mainView.headerColor, 1.1)
161 panelColor: Qt.lighter(mainView.headerColor, 1.1)143 panelColor: Qt.lighter(mainView.headerColor, 1.1)
144 backgroundColor: mainView.headerColor
162145
163 title: internal.activePage ? internal.activePage.title : ""146 title: internal.activePage ? internal.activePage.title : ""
164 pageStack: internal.activePage ? internal.activePage.pageStack : null147 pageStack: internal.activePage ? internal.activePage.pageStack : null
165148
=== modified file 'src/Ubuntu/Components/1.3/TextField.qml'
--- src/Ubuntu/Components/1.3/TextField.qml 2015-12-15 19:31:38 +0000
+++ src/Ubuntu/Components/1.3/TextField.qml 2016-01-07 17:36:33 +0000
@@ -329,6 +329,11 @@
329 inputs. See QLineEdit::inputMask for further details, as the exact same mask strings329 inputs. See QLineEdit::inputMask for further details, as the exact same mask strings
330 are used by TextField.330 are used by TextField.
331331
332 Note that when using an inputMask together with echoMode to hide the input
333 the empty TextField may still show masked characters - consider \l validator instead.
334
335 \sa acceptableInput, validator
336
332 \qmlproperty string inputMask337 \qmlproperty string inputMask
333 */338 */
334 property alias inputMask: editor.inputMask339 property alias inputMask: editor.inputMask
@@ -534,6 +539,19 @@
534 }539 }
535 \endqml540 \endqml
536541
542 The next example is for a use case of typing a PIN with masked characters.
543
544 \qml
545 import QtQuick 2.4
546 import Ubuntu.Components 1.3
547
548 TextField {
549 echoMode: TextInput.Password
550 validator: RegExpValidator { regExp: /^\d{4}$/ }
551 inputMethodHints: Qt.ImhDigitsOnly
552 }
553 \endqml
554
537 \sa acceptableInput, inputMask555 \sa acceptableInput, inputMask
538556
539 \qmlproperty Validator validator557 \qmlproperty Validator validator
@@ -939,7 +957,7 @@
939 width: units.gu(2.5)957 width: units.gu(2.5)
940 height: width958 height: width
941 // use icon from icon-theme959 // use icon from icon-theme
942 name: control.hasClearButton && !control.readOnly ? "clear-search" : ""960 name: control.hasClearButton && !control.readOnly ? "edit-clear" : ""
943 }961 }
944962
945 onClicked: editor.text = ""963 onClicked: editor.text = ""
946964
=== removed file 'src/Ubuntu/Components/1.3/UbuntuListView.qml'
--- src/Ubuntu/Components/1.3/UbuntuListView.qml 2015-04-29 07:21:29 +0000
+++ src/Ubuntu/Components/1.3/UbuntuListView.qml 1970-01-01 00:00:00 +0000
@@ -1,143 +0,0 @@
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
17import QtQuick 2.4
18import Ubuntu.Components 1.3 as Toolkit
19
20/*!
21 \qmltype UbuntuListView
22 \inqmlmodule Ubuntu.Components 1.1
23 \ingroup ubuntu
24 \brief A ListView with special features tailored for a look and feel fitting the
25 Ubuntu Touch platform.
26 The UbuntuListView works just like a regular ListView, but it adds special features
27 such as expanding/collapsing items (when used together with the Expandable item).
28 It provides features like automatically positioning the expanding item when it
29 expands and collapsing it again when the user taps outside of it.
30
31 Examples:
32 \qml
33 import Ubuntu.Components 1.3
34 import Ubuntu.Components.ListItems 1.3 as ListItem
35
36 Item {
37 ListModel {
38 id: listModel
39 }
40
41 UbuntuListView {
42 id: ubuntuListView
43 anchors { left: parent.left; right: parent.right }
44 height: units.gu(24)
45 model: listModel
46
47 delegate: ListItem.Expandable {
48 id: expandingItem
49
50 expandedHeight: units.gu(30)
51
52 onClicked: {
53 ubuntuListView.expandedIndex = index;
54 }
55 }
56 }
57 }
58 \endqml
59*/
60
61ListView {
62 id: root
63
64 /*!
65 The index of the currently expanded item. -1 if no item is expanded.
66 */
67 property int expandedIndex: -1
68
69 QtObject {
70 id: priv
71
72 function positionViewAtIndexAnimated(expandedIndex) {
73 animation.from = root.contentY;
74 root.currentIndex = expandedIndex;
75 if (expandedIndex == root.count - 1) {
76 root.positionViewAtIndex(expandedIndex, ListView.End);
77 } else {
78 root.positionViewAtIndex(expandedIndex + 1, ListView.End);
79 }
80
81 var effectiveExpandedHeight = Math.min(root.currentItem.expandedHeight, root.height - root.currentItem.collapsedHeight);
82 if (root.contentY - root.originY == 0) {
83 if (((root.currentIndex + 1) * root.currentItem.collapsedHeight) + effectiveExpandedHeight > root.height) {
84 animation.to = ((root.currentIndex + 1) * root.currentItem.collapsedHeight + effectiveExpandedHeight) - root.height + root.originY
85 } else {
86 animation.to = root.originY
87 }
88 } else {
89 animation.to = root.contentY + (effectiveExpandedHeight - root.currentItem.collapsedHeight);
90 }
91 animation.start();
92 }
93
94 function requestFocus(reason) {
95 // lookup for the currentItem, and if it is a FocusScope, focus the view
96 // this will also focus the currentItem
97 if (root.currentItem && root.currentItem.hasOwnProperty("activeFocusOnPress")) {
98 root.forceActiveFocus(reason);
99 }
100 }
101 }
102
103 focus: true
104
105 /*!
106 \internal
107 Grab focus when moved, flicked or clicked
108 */
109 onMovementStarted: priv.requestFocus(Qt.MouseFocusReason)
110 onFlickStarted: priv.requestFocus(Qt.MouseFocusReason)
111 Toolkit.Mouse.onClicked: priv.requestFocus(Qt.MouseFocusReason)
112
113 /*!
114 Expand the item at the given index.
115 */
116 onExpandedIndexChanged: {
117 if (expandedIndex < 0) {
118 return;
119 }
120 priv.positionViewAtIndexAnimated(expandedIndex, ListView.End)
121 }
122
123 UbuntuNumberAnimation {
124 id: animation
125 target: root
126 property: "contentY"
127 }
128
129 MouseArea {
130 parent: contentItem
131 anchors.fill: parent
132 z: 2
133 enabled: root.expandedIndex != -1
134 onClicked: root.expandedIndex = -1;
135 }
136
137 // animate move displaced
138 moveDisplaced: Transition {
139 UbuntuNumberAnimation {
140 properties: "x,y"
141 }
142 }
143}
1440
=== renamed file 'src/Ubuntu/Components/1.3/UbuntuListView11.qml' => 'src/Ubuntu/Components/1.3/UbuntuListView.qml'
--- src/Ubuntu/Components/1.3/UbuntuListView11.qml 2015-04-25 08:54:58 +0000
+++ src/Ubuntu/Components/1.3/UbuntuListView.qml 2016-01-07 17:36:33 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2014 Canonical Ltd.2 * Copyright 2015 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * 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 by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -15,19 +15,188 @@
15 */15 */
1616
17import QtQuick 2.417import QtQuick 2.4
1818import Ubuntu.Components 1.3 as Toolkit
19// documentation in UbuntuListView11.qdoc19
20UbuntuListView {20/*!
2121 \qmltype UbuntuListView
22 /*!22 \inqmlmodule Ubuntu.Components 1.1
23 \internal23 \ingroup ubuntu
24 \qmlproperty PullToRefresh pullToRefresh24 \inherits ListView
25 \brief A ListView with special features tailored for a look and feel fitting the
26 Ubuntu Touch platform.
27 The UbuntuListView works just like a regular ListView, but it adds special features
28 such as expanding/collapsing items (when used together with the Expandable item).
29 It provides features like automatically positioning the expanding item when it
30 expands and collapsing it again when the user taps outside of it.
31
32 Examples:
33 \qml
34 import Ubuntu.Components 1.3
35 import Ubuntu.Components.ListItems 1.3 as ListItem
36
37 Item {
38 ListModel {
39 id: listModel
40 }
41
42 UbuntuListView {
43 id: ubuntuListView
44 anchors { left: parent.left; right: parent.right }
45 height: units.gu(24)
46 model: listModel
47
48 delegate: ListItem.Expandable {
49 id: expandingItem
50
51 expandedHeight: units.gu(30)
52
53 onClicked: {
54 ubuntuListView.expandedIndex = index;
55 }
56 }
57 }
58 }
59 \endqml
60*/
61
62ListView {
63 id: root
64
65 /*!
66 \deprecated
67 The index of the currently expanded item. -1 if no item is expanded.
68 \b {THIS PROPERTY IS DEPRECATED. USE THE NEW ListItem TO HANDLE EXPANSION}
69 */
70 property int expandedIndex: -1
71
72 /*!
73 \qmlproperty pullToRefresh UbuntuListView::pullToRefresh
74 \readonly
75 \since Ubuntu.Components 1.1
76
77 Attached PullToRefresh to control manual model refresh. The component is disabled
78 by default.
79
80 \qml
81 import QtQuick 2.4
82 import Ubuntu.Components 1.3
83
84 UbuntuListView {
85 width: units.gu(40)
86 height: units.gu(71)
87 model: XmlListModel {
88 source: "http://feeds.reuters.com/reuters/topNews"
89 query: "/rss/channel/item"
90 XmlRole { name: "title"; query: "title/string()" }
91 }
92 // let refresh control know when the refresh gets completed
93 pullToRefresh {
94 enable: true
95 refreshing: model.status === XmlListModel.Loading
96 onRefresh: model.reload()
97 }
98 delegate: ListItem {
99 ListItemLayout {
100 title.text: modelData
101 }
102 onClicked: {
103 ListView.view.model.reload();
104 }
105 }
106 }
107 \endqml
25 */108 */
26 property alias pullToRefresh: refreshItem109 readonly property alias pullToRefresh: refreshItem
27110
28 PullToRefresh {111 PullToRefresh {
29 objectName: "listview_pulltorefresh"112 objectName: "listview_pulltorefresh"
30 id: refreshItem113 id: refreshItem
31 enabled: false114 enabled: false
32 }115 }
116
117 QtObject {
118 id: priv
119
120 function positionViewAtIndexAnimated(expandedIndex) {
121 animation.from = root.contentY;
122 root.currentIndex = expandedIndex;
123 if (expandedIndex == root.count - 1) {
124 root.positionViewAtIndex(expandedIndex, ListView.End);
125 } else {
126 root.positionViewAtIndex(expandedIndex + 1, ListView.End);
127 }
128
129 var effectiveExpandedHeight = Math.min(root.currentItem.expandedHeight, root.height - root.currentItem.collapsedHeight);
130 if (root.contentY - root.originY == 0) {
131 if (((root.currentIndex + 1) * root.currentItem.collapsedHeight) + effectiveExpandedHeight > root.height) {
132 animation.to = ((root.currentIndex + 1) * root.currentItem.collapsedHeight + effectiveExpandedHeight) - root.height + root.originY
133 } else {
134 animation.to = root.originY
135 }
136 } else {
137 animation.to = root.contentY + (effectiveExpandedHeight - root.currentItem.collapsedHeight);
138 }
139 animation.start();
140 }
141
142 function requestFocus(reason) {
143 // lookup for the currentItem, and if it is a FocusScope, focus the view
144 // this will also focus the currentItem
145 if (root.currentItem && root.currentItem.hasOwnProperty("activeFocusOnPress")) {
146 // is the currentItem a ListItem?
147 if (QuickUtils.inherits(root.currentItem, "UCListItem")) {
148 root.currentItem.requestFocus(reason);
149 } else {
150 root.forceActiveFocus(reason);
151 }
152 }
153 }
154 }
155
156 focus: true
157
158 /*!
159 \internal
160 Grab focus when moved, flicked or clicked
161 */
162 onMovementStarted: priv.requestFocus(Qt.MouseFocusReason)
163 onFlickStarted: priv.requestFocus(Qt.MouseFocusReason)
164 Toolkit.Mouse.onClicked: priv.requestFocus(Qt.MouseFocusReason)
165
166 /*!
167 Expand the item at the given index.
168 */
169 onExpandedIndexChanged: {
170 if (expandedIndex < 0) {
171 return;
172 }
173 priv.positionViewAtIndexAnimated(expandedIndex, ListView.End)
174 }
175
176 UbuntuNumberAnimation {
177 id: animation
178 target: root
179 property: "contentY"
180 }
181
182 MouseArea {
183 parent: contentItem
184 anchors.fill: parent
185 z: 2
186 enabled: root.expandedIndex != -1
187 onClicked: root.expandedIndex = -1;
188 }
189
190 // animate move displaced
191 moveDisplaced: Transition {
192 UbuntuNumberAnimation {
193 properties: "x,y"
194 }
195 }
196
197 // highlight current item
198 highlight: Rectangle {
199 color: theme.palette.selected.background
200 }
201 highlightMoveDuration: 0
33}202}
34203
=== removed file 'src/Ubuntu/Components/1.3/UbuntuListView11.qdoc'
--- src/Ubuntu/Components/1.3/UbuntuListView11.qdoc 2015-04-25 08:54:58 +0000
+++ src/Ubuntu/Components/1.3/UbuntuListView11.qdoc 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1/*!
2 \qmlproperty pullToRefresh UbuntuListView::pullToRefresh
3 \readonly
4 \since Ubuntu.Components 1.1
5
6 Attached PullToRefresh to control manual model refresh. The component is disabled
7 by default.
8
9 \qml
10 import QtQuick 2.4
11 import Ubuntu.Components 1.2
12 import Ubuntu.Components.ListItems 1.0
13
14 UbuntuListView {
15 width: units.gu(40)
16 height: units.gu(71)
17 model: XmlListModel {
18 source: "http://feeds.reuters.com/reuters/topNews"
19 query: "/rss/channel/item"
20 XmlRole { name: "title"; query: "title/string()" }
21 }
22 // let refresh control know when the refresh gets completed
23 pullToRefresh {
24 enable: true
25 refreshing: model.status === XmlListModel.Loading
26 onRefresh: model.reload()
27 }
28 delegate: ListItem.Standard {
29 width: ListView.view.width
30 height: units.gu(5)
31 text: modelData
32 onClicked: {
33 ListView.view.model.reload();
34 }
35 }
36 }
37 \endqml
38 */
390
=== modified file 'src/Ubuntu/Components/ComponentModule.pro'
--- src/Ubuntu/Components/ComponentModule.pro 2015-12-17 09:13:29 +0000
+++ src/Ubuntu/Components/ComponentModule.pro 2016-01-07 17:36:33 +0000
@@ -124,7 +124,6 @@
124 1.3/ToolbarItems.qml \124 1.3/ToolbarItems.qml \
125 1.3/tree.js \125 1.3/tree.js \
126 1.3/UbuntuColors.qml \126 1.3/UbuntuColors.qml \
127 1.3/UbuntuListView11.qml \
128 1.3/UbuntuListView.qml \127 1.3/UbuntuListView.qml \
129 1.3/UbuntuNumberAnimation.qml \128 1.3/UbuntuNumberAnimation.qml \
130 1.3/ListItemPopover.qml \129 1.3/ListItemPopover.qml \
@@ -136,7 +135,6 @@
136135
137OTHER_FILES+= qmldir \136OTHER_FILES+= qmldir \
138 1.3/CrossFadeImage.qdoc \137 1.3/CrossFadeImage.qdoc \
139 1.3/UbuntuListView11.qdoc \
140 1.3/PageHeadConfiguration.qdoc \138 1.3/PageHeadConfiguration.qdoc \
141 1.3/MainView.qdoc \139 1.3/MainView.qdoc \
142 1.3/Icon.qdoc140 1.3/Icon.qdoc
143141
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2015-12-16 07:59:19 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/FocusShape.qml 2016-01-07 17:36:33 +0000
@@ -24,7 +24,7 @@
2424
25 anchors.fill: parent25 anchors.fill: parent
26 anchors.margins: -units.gu(0.4)26 anchors.margins: -units.gu(0.4)
27 backgroundColor: Qt.rgba(focusColor.r, focusColor.g, focusColor.b, 0.8)27 backgroundColor: Qt.rgba(focusColor.r, focusColor.g, focusColor.b, 1.0)
28 visible: styledItem.keyNavigationFocus28 visible: styledItem.keyNavigationFocus
29 z: styledItem.z - 129 z: styledItem.z - 1
3030
3131
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2015-12-08 22:05:42 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2016-01-07 17:36:33 +0000
@@ -44,6 +44,15 @@
44 */44 */
45 property color titleColor: headerStyle.config.foregroundColor45 property color titleColor: headerStyle.config.foregroundColor
4646
47 /*!
48 The background color of the header.
49 */
50 property color backgroundColor: styledItem.backgroundColor
51 Rectangle {
52 anchors.fill: parent
53 color: headerStyle.backgroundColor
54 }
55
47 // FIXME: When the three panel color properties below are removed,56 // FIXME: When the three panel color properties below are removed,
48 // update unity8/Dash/PageHeader to use the new theming (currently57 // update unity8/Dash/PageHeader to use the new theming (currently
49 // in progress) to set these colors.58 // in progress) to set these colors.
5059
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml 2015-12-11 08:38:42 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/PullToRefreshStyle.qml 2016-01-07 17:36:33 +0000
@@ -92,8 +92,10 @@
92 }92 }
9393
94 Component.onDestruction: {94 Component.onDestruction: {
95 rootItem.__propagated.header.visibleChanged.disconnect(fixTopMargin);95 if (rootItem && rootItem.__propagated && rootItem.__propagated.header) {
96 rootItem.__propagated.header.heightChanged.disconnect(fixTopMargin);96 rootItem.__propagated.header.visibleChanged.disconnect(fixTopMargin);
97 rootItem.__propagated.header.heightChanged.disconnect(fixTopMargin);
98 }
97 }99 }
98100
99 function fixTopMargin() {101 function fixTopMargin() {
100102
=== modified file 'src/Ubuntu/Components/plugin/plugin.cpp'
--- src/Ubuntu/Components/plugin/plugin.cpp 2015-12-08 10:54:31 +0000
+++ src/Ubuntu/Components/plugin/plugin.cpp 2016-01-07 17:36:33 +0000
@@ -71,13 +71,15 @@
71#include "uclabel.h"71#include "uclabel.h"
72#include "uclistitemlayout.h"72#include "uclistitemlayout.h"
73#include "ucbottomedgehint.h"73#include "ucbottomedgehint.h"
74#include "gestures/ucswipearea.h"
75#include "ucmathutils.h"74#include "ucmathutils.h"
76#include "ucbottomedge.h"75#include "ucbottomedge.h"
77#include "ucbottomedgeregion.h"76#include "ucbottomedgeregion.h"
78#include "ucbottomedgestyle.h"77#include "ucbottomedgestyle.h"
79#include "ucpagetreenode.h"78#include "ucpagetreenode.h"
8079
80// From UbuntuGestures
81#include "private/ucswipearea_p.h"
82
81#include <sys/types.h>83#include <sys/types.h>
82#include <unistd.h>84#include <unistd.h>
83#include <stdexcept>85#include <stdexcept>
8486
=== modified file 'src/Ubuntu/Components/plugin/plugin.pri'
--- src/Ubuntu/Components/plugin/plugin.pri 2015-12-15 15:58:54 +0000
+++ src/Ubuntu/Components/plugin/plugin.pri 2016-01-07 17:36:33 +0000
@@ -3,7 +3,7 @@
3 PKGCONFIG += gio-2.0 dbus-1 libnih-dbus3 PKGCONFIG += gio-2.0 dbus-1 libnih-dbus
4}4}
55
6QT *= core-private qml qml-private quick quick-private gui-private dbus svg UbuntuGestures6QT *= core-private qml qml-private quick quick-private gui-private dbus svg UbuntuGestures UbuntuGestures_private
77
8equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) {8equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) {
9 QT += v8-private9 QT += v8-private
@@ -98,8 +98,6 @@
98 $$PWD/ucimportversionchecker_p.h \98 $$PWD/ucimportversionchecker_p.h \
99 $$PWD/ucbottomedgehint.h \99 $$PWD/ucbottomedgehint.h \
100 $$PWD/ucbottomedgehint_p.h \100 $$PWD/ucbottomedgehint_p.h \
101 $$PWD/gestures/ucswipearea.h \
102 $$PWD/gestures/ucswipearea_p.h \
103 $$PWD/gestures/damper.h \101 $$PWD/gestures/damper.h \
104 $$PWD/gestures/ubuntugesturesqmlglobal.h \102 $$PWD/gestures/ubuntugesturesqmlglobal.h \
105 $$PWD/ucmathutils.h \103 $$PWD/ucmathutils.h \
@@ -174,7 +172,6 @@
174 $$PWD/privates/threelabelsslot_p.cpp \172 $$PWD/privates/threelabelsslot_p.cpp \
175 $$PWD/ucimportversionchecker_p.cpp \173 $$PWD/ucimportversionchecker_p.cpp \
176 $$PWD/ucbottomedgehint.cpp \174 $$PWD/ucbottomedgehint.cpp \
177 $$PWD/gestures/ucswipearea.cpp \
178 $$PWD/ucmathutils.cpp \175 $$PWD/ucmathutils.cpp \
179 $$PWD/ucbottomedge.cpp \176 $$PWD/ucbottomedge.cpp \
180 $$PWD/ucbottomedgestyle.cpp \177 $$PWD/ucbottomedgestyle.cpp \
181178
=== modified file 'src/Ubuntu/Components/plugin/quickutils.cpp'
--- src/Ubuntu/Components/plugin/quickutils.cpp 2015-12-07 09:07:00 +0000
+++ src/Ubuntu/Components/plugin/quickutils.cpp 2016-01-07 17:36:33 +0000
@@ -33,7 +33,8 @@
33QuickUtils::QuickUtils(QObject *parent) :33QuickUtils::QuickUtils(QObject *parent) :
34 QObject(parent),34 QObject(parent),
35 m_rootView(0),35 m_rootView(0),
36 m_mouseAttached(false)36 m_mouseAttached(false),
37 m_keyboardAttached(false)
37{38{
38 QGuiApplication::instance()->installEventFilter(this);39 QGuiApplication::instance()->installEventFilter(this);
39 m_omitIM << "ibus" << "none" << "compose";40 m_omitIM << "ibus" << "none" << "compose";
4041
=== modified file 'src/Ubuntu/Components/plugin/quickutils.h'
--- src/Ubuntu/Components/plugin/quickutils.h 2015-11-05 13:41:35 +0000
+++ src/Ubuntu/Components/plugin/quickutils.h 2016-01-07 17:36:33 +0000
@@ -32,6 +32,7 @@
32 Q_PROPERTY(QString inputMethodProvider READ inputMethodProvider)32 Q_PROPERTY(QString inputMethodProvider READ inputMethodProvider)
33 Q_PROPERTY(bool touchScreenAvailable READ touchScreenAvailable NOTIFY touchScreenAvailableChanged)33 Q_PROPERTY(bool touchScreenAvailable READ touchScreenAvailable NOTIFY touchScreenAvailableChanged)
34 Q_PROPERTY(bool mouseAttached MEMBER m_mouseAttached NOTIFY mouseAttachedChanged)34 Q_PROPERTY(bool mouseAttached MEMBER m_mouseAttached NOTIFY mouseAttachedChanged)
35 Q_PROPERTY(bool keyboardAttached MEMBER m_keyboardAttached NOTIFY keyboardAttachedChanged)
35public:36public:
36 static QuickUtils& instance()37 static QuickUtils& instance()
37 {38 {
@@ -53,6 +54,10 @@
53 {54 {
54 return m_mouseAttached;55 return m_mouseAttached;
55 }56 }
57 bool keyboardAttached()
58 {
59 return m_keyboardAttached;
60 }
5661
57Q_SIGNALS:62Q_SIGNALS:
58 void rootObjectChanged();63 void rootObjectChanged();
@@ -60,6 +65,7 @@
60 void deactivated();65 void deactivated();
61 void touchScreenAvailableChanged();66 void touchScreenAvailableChanged();
62 void mouseAttachedChanged();67 void mouseAttachedChanged();
68 void keyboardAttachedChanged();
6369
64protected:70protected:
65 bool eventFilter(QObject *, QEvent *);71 bool eventFilter(QObject *, QEvent *);
@@ -69,6 +75,7 @@
69 QPointer<QQuickView> m_rootView;75 QPointer<QQuickView> m_rootView;
70 QStringList m_omitIM;76 QStringList m_omitIM;
71 bool m_mouseAttached;77 bool m_mouseAttached;
78 bool m_keyboardAttached;
7279
73 void lookupQuickView();80 void lookupQuickView();
74};81};
7582
=== modified file 'src/Ubuntu/Components/plugin/ucaction.cpp'
--- src/Ubuntu/Components/plugin/ucaction.cpp 2015-12-13 07:48:56 +0000
+++ src/Ubuntu/Components/plugin/ucaction.cpp 2016-01-07 17:36:33 +0000
@@ -15,6 +15,7 @@
15 */15 */
1616
17#include "ucaction.h"17#include "ucaction.h"
18#include "quickutils.h"
1819
19#include <QtDebug>20#include <QtDebug>
20#include <QtQml/QQmlInfo>21#include <QtQml/QQmlInfo>
@@ -22,6 +23,30 @@
22#include <QtQuick/qquickwindow.h>23#include <QtQuick/qquickwindow.h>
23#include <private/qguiapplication_p.h>24#include <private/qguiapplication_p.h>
2425
26bool shortcutContextMatcher(QObject* object, Qt::ShortcutContext context)
27{
28 UCAction* action = static_cast<UCAction*>(object);
29 // Can't access member here because it's not public
30 if (!action->property("enabled").toBool())
31 return false;
32
33 switch (context) {
34 case Qt::ApplicationShortcut:
35 return true;
36 case Qt::WindowShortcut: {
37 QObject* window = object;
38 while (window && !window->isWindowType()) {
39 window = window->parent();
40 if (QQuickItem* item = qobject_cast<QQuickItem*>(window))
41 window = item->window();
42 }
43 return window && window == QGuiApplication::focusWindow();
44 }
45 default: break;
46 }
47 return false;
48}
49
25/*!50/*!
26 * \qmltype Action51 * \qmltype Action
27 * \instantiates UCAction52 * \instantiates UCAction
@@ -74,6 +99,20 @@
74 * as well as to define actions for pages, or when defining options in \c ListItemOptions.99 * as well as to define actions for pages, or when defining options in \c ListItemOptions.
75 *100 *
76 * Examples: See \l Page101 * Examples: See \l Page
102 *
103 * \section2 Mnemonics
104 * Since Ubuntu.Components 1.3 Action supports mnemonics. Mnemonics are shortcuts
105 * defined in the \l text property, prefixed the shortcut letter with \&. For instance
106 * \c "\&Call" will bint the \c "Alt-C" shortcut to the action. When a mnemonic
107 * is detected on the Action and a keyboard is attached to the device, the \l text
108 * property will provide a formatted text having the mnemonic letter underscored.
109 * \qml
110 * Action {
111 * id: call
112 * iconName: "call"
113 * text: "&Call"
114 * }
115 * \endqml
77 */116 */
78117
79/*!118/*!
@@ -94,7 +133,69 @@
94/*!133/*!
95 * \qmlproperty string Action::text134 * \qmlproperty string Action::text
96 * The user visible primary label of the action.135 * The user visible primary label of the action.
136 *
137 * Mnemonics are shortcuts prefixed in the text with \&. If the text has multiple
138 * occurences of the \& character, the first one will be considered for the shortcut.
139 * The \& character cannot be used as shortcut.
97 */140 */
141QString UCAction::text()
142{
143 // if we have a mnemonic, underscore it
144 if (!m_mnemonic.isEmpty()) {
145
146 QString mnemonic = "&" + m_mnemonic.toString().remove("Alt+");
147 // patch special cases
148 mnemonic.replace("Space", " ");
149 int mnemonicIndex = m_text.indexOf(mnemonic);
150 if (mnemonicIndex < 0) {
151 // try lower case
152 mnemonic = mnemonic.toLower();
153 mnemonicIndex = m_text.indexOf(mnemonic);
154 }
155 QString displayText(m_text);
156 // FIXME: we need QInputDeviceInfo to detect the keyboard attechment
157 // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276808
158 if (QuickUtils::instance().keyboardAttached()) {
159 // underscore the character
160 displayText.replace(mnemonicIndex, mnemonic.length(), "<u>" + mnemonic[1] + "</u>");
161 } else {
162 displayText.remove(mnemonicIndex, 1);
163 }
164 return displayText;
165 }
166 return m_text;
167}
168void UCAction::setText(const QString &text)
169{
170 if (m_text == text) {
171 return;
172 }
173 m_text = text;
174 setMnemonicFromText(m_text);
175 Q_EMIT textChanged();
176}
177void UCAction::resetText()
178{
179 setText(QString());
180}
181
182void UCAction::setMnemonicFromText(const QString &text)
183{
184 QKeySequence sequence = QKeySequence::mnemonic(text);
185 if (sequence == m_mnemonic) {
186 return;
187 }
188 if (!m_mnemonic.isEmpty()) {
189 QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, m_mnemonic);
190 }
191
192 m_mnemonic = sequence;
193
194 if (!m_mnemonic.isEmpty()) {
195 Qt::ShortcutContext context = Qt::WindowShortcut;
196 QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, m_mnemonic, context, shortcutContextMatcher);
197 }
198}
98199
99/*!200/*!
100 * \qmlproperty string Action::keywords201 * \qmlproperty string Action::keywords
@@ -158,11 +259,16 @@
158 , m_published(false)259 , m_published(false)
159{260{
160 generateName();261 generateName();
262 // FIXME: we need QInputDeviceInfo to detect the keyboard attechment
263 // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1276808
264 connect(&QuickUtils::instance(), &QuickUtils::keyboardAttachedChanged,
265 this, &UCAction::onKeyboardAttached);
161}266}
162267
163UCAction::~UCAction()268UCAction::~UCAction()
164{269{
165 resetShortcut();270 resetShortcut();
271 resetText();
166}272}
167273
168bool UCAction::isValidType(QVariant::Type valueType)274bool UCAction::isValidType(QVariant::Type valueType)
@@ -249,22 +355,6 @@
249 qWarning() << "Action.itemHint is a DEPRECATED property. Use ActionItems to specify the representation of an Action.";355 qWarning() << "Action.itemHint is a DEPRECATED property. Use ActionItems to specify the representation of an Action.";
250}356}
251357
252bool shortcutContextMatcher(QObject* object, Qt::ShortcutContext)
253{
254 UCAction* action = static_cast<UCAction*>(object);
255 // Can't access member here because it's not public
256 if (!action->property("enabled").toBool())
257 return false;
258
259 QObject* window = object;
260 while (window && !window->isWindowType()) {
261 window = window->parent();
262 if (QQuickItem* item = qobject_cast<QQuickItem*>(window))
263 window = item->window();
264 }
265 return window && window == QGuiApplication::focusWindow();
266}
267
268QKeySequence sequenceFromVariant(const QVariant& variant) {358QKeySequence sequenceFromVariant(const QVariant& variant) {
269 if (variant.type() == QVariant::Int)359 if (variant.type() == QVariant::Int)
270 return static_cast<QKeySequence::StandardKey>(variant.toInt());360 return static_cast<QKeySequence::StandardKey>(variant.toInt());
@@ -320,6 +410,14 @@
320 return true;410 return true;
321}411}
322412
413// trigger text changes whenever HW keyboad is attached/detached
414void UCAction::onKeyboardAttached()
415{
416 if (!m_mnemonic.isEmpty()) {
417 Q_EMIT textChanged();
418 }
419}
420
323/*!421/*!
324 * \qmlmethod Action::trigger(var value)422 * \qmlmethod Action::trigger(var value)
325 * Checks the \c value against the action \l parameterType and triggers the action.423 * Checks the \c value against the action \l parameterType and triggers the action.
326424
=== modified file 'src/Ubuntu/Components/plugin/ucaction.h'
--- src/Ubuntu/Components/plugin/ucaction.h 2015-12-14 06:15:16 +0000
+++ src/Ubuntu/Components/plugin/ucaction.h 2016-01-07 17:36:33 +0000
@@ -20,6 +20,7 @@
20#include <QtCore/QObject>20#include <QtCore/QObject>
21#include <QtCore/QVariant>21#include <QtCore/QVariant>
22#include <QtCore/QUrl>22#include <QtCore/QUrl>
23#include <QtGui/QKeySequence>
2324
24// the function detects whether QML has an overridden trigger() slot available25// the function detects whether QML has an overridden trigger() slot available
25// and invokes the one with the appropriate signature26// and invokes the one with the appropriate signature
@@ -51,7 +52,7 @@
51 // transferred from Unity Actions52 // transferred from Unity Actions
52 Q_ENUMS(Type)53 Q_ENUMS(Type)
53 Q_PROPERTY(QString name MEMBER m_name WRITE setName NOTIFY nameChanged)54 Q_PROPERTY(QString name MEMBER m_name WRITE setName NOTIFY nameChanged)
54 Q_PROPERTY(QString text MEMBER m_text NOTIFY textChanged)55 Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged)
55 Q_PROPERTY(QString iconName MEMBER m_iconName WRITE setIconName NOTIFY iconNameChanged)56 Q_PROPERTY(QString iconName MEMBER m_iconName WRITE setIconName NOTIFY iconNameChanged)
56 Q_PROPERTY(QString description MEMBER m_description NOTIFY descriptionChanged)57 Q_PROPERTY(QString description MEMBER m_description NOTIFY descriptionChanged)
57 Q_PROPERTY(QString keywords MEMBER m_keywords NOTIFY keywordsChanged)58 Q_PROPERTY(QString keywords MEMBER m_keywords NOTIFY keywordsChanged)
@@ -84,6 +85,9 @@
84 }85 }
8586
86 void setName(const QString &name);87 void setName(const QString &name);
88 QString text();
89 void setText(const QString &text);
90 void resetText();
87 void setIconName(const QString &name);91 void setIconName(const QString &name);
88 void setIconSource(const QUrl &url);92 void setIconSource(const QUrl &url);
89 void setItemHint(QQmlComponent *);93 void setItemHint(QQmlComponent *);
@@ -114,6 +118,7 @@
114 QString m_description;118 QString m_description;
115 QString m_keywords;119 QString m_keywords;
116 QVariant m_shortcut;120 QVariant m_shortcut;
121 QKeySequence m_mnemonic;
117 QQmlComponent *m_itemHint;122 QQmlComponent *m_itemHint;
118 Type m_parameterType;123 Type m_parameterType;
119 bool m_factoryIconSource:1;124 bool m_factoryIconSource:1;
@@ -130,7 +135,9 @@
130135
131 bool isValidType(QVariant::Type valueType);136 bool isValidType(QVariant::Type valueType);
132 void generateName();137 void generateName();
138 void setMnemonicFromText(const QString &text);
133 bool event(QEvent *event);139 bool event(QEvent *event);
140 void onKeyboardAttached();
134};141};
135142
136#endif // UCACTION_H143#endif // UCACTION_H
137144
=== modified file 'src/Ubuntu/Components/plugin/ucbottomedge.cpp'
--- src/Ubuntu/Components/plugin/ucbottomedge.cpp 2015-12-14 07:21:44 +0000
+++ src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-01-07 17:36:33 +0000
@@ -34,7 +34,7 @@
34#include "ucheader.h"34#include "ucheader.h"
35#include "ucaction.h"35#include "ucaction.h"
36#include "quickutils.h"36#include "quickutils.h"
37#include "gestures/ucswipearea.h"37#include "private/ucswipearea_p.h"
38#include <QtQuick/private/qquickanimation_p.h>38#include <QtQuick/private/qquickanimation_p.h>
3939
40Q_LOGGING_CATEGORY(ucBottomEdge, "ubuntu.components.BottomEdge", QtMsgType::QtWarningMsg)40Q_LOGGING_CATEGORY(ucBottomEdge, "ubuntu.components.BottomEdge", QtMsgType::QtWarningMsg)
4141
=== modified file 'src/Ubuntu/Components/plugin/ucbottomedgehint.cpp'
--- src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2015-12-14 16:05:03 +0000
+++ src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2016-01-07 17:36:33 +0000
@@ -23,7 +23,7 @@
23#include "ucnamespace.h"23#include "ucnamespace.h"
24#include "ucunits.h"24#include "ucunits.h"
25#include "ucaction.h"25#include "ucaction.h"
26#include "gestures/ucswipearea.h"26#include "private/ucswipearea_p.h"
27#include "propertychange_p.h"27#include "propertychange_p.h"
28#include <QtQml/private/qqmlproperty_p.h>28#include <QtQml/private/qqmlproperty_p.h>
29#include <QtQuick/private/qquickflickable_p.h>29#include <QtQuick/private/qquickflickable_p.h>
3030
=== modified file 'src/Ubuntu/Components/plugin/ucfontutils.h'
--- src/Ubuntu/Components/plugin/ucfontutils.h 2015-09-22 14:39:47 +0000
+++ src/Ubuntu/Components/plugin/ucfontutils.h 2016-01-07 17:36:33 +0000
@@ -26,12 +26,12 @@
2626
27public:27public:
28 static constexpr float fontUnits = 14.0f;28 static constexpr float fontUnits = 14.0f;
29 static constexpr float xxSmallScale = 0.677f;29 static constexpr float xxSmallScale = 0.606f;
30 static constexpr float xSmallScale = 0.804f;30 static constexpr float xSmallScale = 0.707f;
31 static constexpr float smallScale = 0.931f;31 static constexpr float smallScale = 0.857f;
32 static constexpr float mediumScale = 1.079f;32 static constexpr float mediumScale = 1.0f;
33 static constexpr float largeScale = 1.291f;33 static constexpr float largeScale = 1.414f;
34 static constexpr float xLargeScale = 1.714f;34 static constexpr float xLargeScale = 1.905f;
3535
36 static UCFontUtils& instance()36 static UCFontUtils& instance()
37 {37 {
3838
=== modified file 'src/Ubuntu/Components/plugin/ucqquickimageextension.cpp'
--- src/Ubuntu/Components/plugin/ucqquickimageextension.cpp 2015-10-15 08:43:17 +0000
+++ src/Ubuntu/Components/plugin/ucqquickimageextension.cpp 2016-01-07 17:36:33 +0000
@@ -77,16 +77,19 @@
77 int separatorPosition = resolved.indexOf("/");77 int separatorPosition = resolved.indexOf("/");
78 QString scaleFactor = resolved.left(separatorPosition);78 QString scaleFactor = resolved.left(separatorPosition);
79 QString selectedFilePath = resolved.mid(separatorPosition+1);79 QString selectedFilePath = resolved.mid(separatorPosition+1);
80 QString fragment(m_source.hasFragment() ? "#" + m_source.fragment() : QString(""));
8081
81 if (scaleFactor == "1") {82 if (scaleFactor == "1") {
82 if (qFuzzyCompare(qGuiApp->devicePixelRatio(), (qreal)1.0)83 if (qFuzzyCompare(qGuiApp->devicePixelRatio(), (qreal)1.0)
83 || selectedFilePath.endsWith(".svg") || selectedFilePath.endsWith(".svgz")) {84 || selectedFilePath.endsWith(".svg") || selectedFilePath.endsWith(".svgz")) {
84 // No scaling necessary. Just pass the file as is.85 // Take care to pass the original fragment
85 m_image->setSource(QUrl::fromLocalFile(selectedFilePath));86 QUrl selectedFileUrl(QUrl::fromLocalFile(selectedFilePath));
87 selectedFileUrl.setFragment(fragment);
88 m_image->setSource(selectedFileUrl);
86 } else {89 } else {
87 // Need to scale the pixel-based image to suit the devicePixelRatio setting ourselves.90 // Need to scale the pixel-based image to suit the devicePixelRatio setting ourselves.
88 // If we let Qt do it, Qt will not choose the UITK-supported "@gu" scaled images.91 // If we let Qt do it, Qt will not choose the UITK-supported "@gu" scaled images.
89 m_image->setSource(QUrl("image://scaling/1/" + selectedFilePath));92 m_image->setSource(QUrl("image://scaling/1/" + selectedFilePath + fragment));
90 // explicitly set the source size in the QQuickImageBase, this persuades it that the93 // explicitly set the source size in the QQuickImageBase, this persuades it that the
91 // supplied image is suitable for the current devicePixelRatio.94 // supplied image is suitable for the current devicePixelRatio.
92 m_image->setSourceSize(m_image->sourceSize());95 m_image->setSourceSize(m_image->sourceSize());
@@ -95,7 +98,7 @@
95 // Prepend "image://scaling" for the image to be loaded by UCScalingImageProvider.98 // Prepend "image://scaling" for the image to be loaded by UCScalingImageProvider.
96 if (!m_source.path().endsWith(".sci")) {99 if (!m_source.path().endsWith(".sci")) {
97 // Regular image file100 // Regular image file
98 m_image->setSource(QUrl("image://scaling/" + resolved));101 m_image->setSource(QUrl("image://scaling/" + resolved + fragment));
99 } else {102 } else {
100 // .sci image file. Rewrite the .sci file into a temporary file.103 // .sci image file. Rewrite the .sci file into a temporary file.
101 bool rewritten = true;104 bool rewritten = true;
@@ -124,7 +127,10 @@
124 }127 }
125128
126 if (rewritten) {129 if (rewritten) {
127 m_image->setSource(QUrl::fromLocalFile(rewrittenSciFile->fileName()));130 // Take care to pass the original fragment
131 QUrl rewrittenSciFileUrl(QUrl::fromLocalFile(rewrittenSciFile->fileName()));
132 rewrittenSciFileUrl.setFragment(fragment);
133 m_image->setSource(rewrittenSciFileUrl);
128 } else {134 } else {
129 m_image->setSource(m_source);135 m_image->setSource(m_source);
130 }136 }
131137
=== modified file 'src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp'
--- src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-09-30 12:10:46 +0000
+++ src/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2016-01-07 17:36:33 +0000
@@ -40,7 +40,9 @@
40{40{
41 int separatorPosition = id.indexOf("/");41 int separatorPosition = id.indexOf("/");
42 float scaleFactor = id.left(separatorPosition).toFloat();42 float scaleFactor = id.left(separatorPosition).toFloat();
43 QString path = id.mid(separatorPosition+1);43 int fragmentPosition = id.lastIndexOf("#");
44 int pathLength = fragmentPosition > -1 ? fragmentPosition - separatorPosition - 1 : -1;
45 QString path = id.mid(separatorPosition + 1, pathLength);
44 QFile file(path);46 QFile file(path);
4547
46 if (file.open(QIODevice::ReadOnly)) {48 if (file.open(QIODevice::ReadOnly)) {
4749
=== modified file 'src/Ubuntu/Components/qmldir'
--- src/Ubuntu/Components/qmldir 2015-12-17 09:13:29 +0000
+++ src/Ubuntu/Components/qmldir 2016-01-07 17:36:33 +0000
@@ -130,7 +130,7 @@
130OrientationHelper 1.3 1.3/OrientationHelper.qml130OrientationHelper 1.3 1.3/OrientationHelper.qml
131UbuntuNumberAnimation 1.3 1.3/UbuntuNumberAnimation.qml131UbuntuNumberAnimation 1.3 1.3/UbuntuNumberAnimation.qml
132PullToRefresh 1.3 1.3/PullToRefresh.qml132PullToRefresh 1.3 1.3/PullToRefresh.qml
133UbuntuListView 1.3 1.3/UbuntuListView11.qml133UbuntuListView 1.3 1.3/UbuntuListView.qml
134Captions 1.3 1.3/Captions.qml134Captions 1.3 1.3/Captions.qml
135internal ColorUtils 1.3/colorUtils.js135internal ColorUtils 1.3/colorUtils.js
136DateUtils 1.3 1.3/dateUtils.js136DateUtils 1.3 1.3/dateUtils.js
137137
=== modified file 'src/Ubuntu/Test/plugin/plugin.pri'
--- src/Ubuntu/Test/plugin/plugin.pri 2015-10-21 08:33:21 +0000
+++ src/Ubuntu/Test/plugin/plugin.pri 2016-01-07 17:36:33 +0000
@@ -1,4 +1,4 @@
1QT *= core-private qml qml-private quick quick-private gui-private testlib1QT *= core-private qml qml-private quick quick-private gui-private testlib UbuntuGestures
22
3equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) {3equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) {
4 QT *= v8-private4 QT *= v8-private
@@ -7,6 +7,7 @@
7CONFIG += no_keywords7CONFIG += no_keywords
8DEFINES += UBUNTU_QML_IMPORT_PATH='\\"$${ROOT_BUILD_DIR}/qml\\"'8DEFINES += UBUNTU_QML_IMPORT_PATH='\\"$${ROOT_BUILD_DIR}/qml\\"'
9DEFINES += QT_USE_QSTRINGBUILDER9DEFINES += QT_USE_QSTRINGBUILDER
10INCLUDEPATH += ../UbuntuGestures
1011
11TARGET = $$qtLibraryTarget($$TARGET)12TARGET = $$qtLibraryTarget($$TARGET)
12uri = Ubuntu.Test13uri = Ubuntu.Test
1314
=== modified file 'src/Ubuntu/Test/plugin/uctestextras.cpp'
--- src/Ubuntu/Test/plugin/uctestextras.cpp 2015-11-25 07:44:10 +0000
+++ src/Ubuntu/Test/plugin/uctestextras.cpp 2016-01-07 17:36:33 +0000
@@ -17,7 +17,11 @@
17#include "uctestextras.h"17#include "uctestextras.h"
18#include "uctestcase.h"18#include "uctestcase.h"
1919
20#include "ucswipearea_p.h"
21#include "ucswipearea_p_p.h"
22
20#include <qpa/qwindowsysteminterface.h>23#include <qpa/qwindowsysteminterface.h>
24#include <private/qobject_p.h>
21#include <QSysInfo>25#include <QSysInfo>
2226
23const char *DEVICE_MISSING_MSG = "No touch device registered. Register one using registerTouchDevice() before using %1";27const char *DEVICE_MISSING_MSG = "No touch device registered. Register one using registerTouchDevice() before using %1";
@@ -375,3 +379,17 @@
375 }379 }
376 QTest::mouseRelease(item->window(), button, stateKey, movePoint, delay);380 QTest::mouseRelease(item->window(), button, stateKey, movePoint, delay);
377}381}
382
383
384void UCTestExtras::removeTimeConstraintsFromSwipeArea(QQuickItem *item)
385{
386 UCSwipeArea *swipeArea = dynamic_cast<UCSwipeArea*>(item);
387 if (!swipeArea) {
388 qWarning() << item << "is not a SwipeArea";
389 return;
390 }
391
392 UCSwipeAreaPrivate *priv = static_cast<UCSwipeAreaPrivate *>(QObjectPrivate::get(swipeArea));
393 priv->setMaxTime(60 * 60 * 1000);
394 priv->setCompositionTime(0);
395}
378396
=== modified file 'src/Ubuntu/Test/plugin/uctestextras.h'
--- src/Ubuntu/Test/plugin/uctestextras.h 2015-11-24 15:23:02 +0000
+++ src/Ubuntu/Test/plugin/uctestextras.h 2016-01-07 17:36:33 +0000
@@ -46,6 +46,8 @@
4646
47 static void mouseDrag(QQuickItem *item, const QPoint &from, const QPoint &delta, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, int steps = -1, int delay = -1);47 static void mouseDrag(QQuickItem *item, const QPoint &from, const QPoint &delta, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, int steps = -1, int delay = -1);
4848
49 static void removeTimeConstraintsFromSwipeArea(QQuickItem *item);
50
49public: // yet for cpp use51public: // yet for cpp use
50 static void touchDragWithPoints(int touchId, QQuickItem *item, QList<QPoint> points, int delay = -1);52 static void touchDragWithPoints(int touchId, QQuickItem *item, QList<QPoint> points, int delay = -1);
51 static void mouseDragWithPoints(QQuickItem *item, QList<QPoint> points, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, int delay = -1);53 static void mouseDragWithPoints(QQuickItem *item, QList<QPoint> points, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, int delay = -1);
5254
=== modified file 'src/Ubuntu/UbuntuGestures/UbuntuGestures.pro'
--- src/Ubuntu/UbuntuGestures/UbuntuGestures.pro 2015-11-17 13:01:00 +0000
+++ src/Ubuntu/UbuntuGestures/UbuntuGestures.pro 2016-01-07 17:36:33 +0000
@@ -21,6 +21,10 @@
21 unownedtouchevent.h \21 unownedtouchevent.h \
22 ubuntugesturesglobal.h \22 ubuntugesturesglobal.h \
23 pool.h \23 pool.h \
24 ucswipearea_p.h \
25 ucswipearea_p_p.h \
26 damper.h \
27
2428
25SOURCES += candidateinactivitytimer.cpp \29SOURCES += candidateinactivitytimer.cpp \
26 debughelpers.cpp \30 debughelpers.cpp \
@@ -29,3 +33,5 @@
29 touchownershipevent.cpp \33 touchownershipevent.cpp \
30 touchregistry.cpp \34 touchregistry.cpp \
31 unownedtouchevent.cpp \35 unownedtouchevent.cpp \
36 ucswipearea.cpp \
37 damper.cpp \
32\ No newline at end of file38\ No newline at end of file
3339
=== renamed file 'src/Ubuntu/Components/plugin/gestures/damper.cpp' => 'src/Ubuntu/UbuntuGestures/damper.cpp'
--- src/Ubuntu/Components/plugin/gestures/damper.cpp 2015-10-21 08:33:21 +0000
+++ src/Ubuntu/UbuntuGestures/damper.cpp 2016-01-07 17:36:33 +0000
@@ -14,7 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */15 */
1616
17#include "Damper.h"17#include "damper_p.h"
18#include <QDebug>18#include <QDebug>
1919
20QDebug operator<<(QDebug dbg, const DampedPointF &p)20QDebug operator<<(QDebug dbg, const DampedPointF &p)
2121
=== renamed file 'src/Ubuntu/Components/plugin/gestures/damper.h' => 'src/Ubuntu/UbuntuGestures/damper_p.h'
=== renamed file 'src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp' => 'src/Ubuntu/UbuntuGestures/ucswipearea.cpp'
--- src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp 2015-12-16 09:52:31 +0000
+++ src/Ubuntu/UbuntuGestures/ucswipearea.cpp 2016-01-07 17:36:33 +0000
@@ -15,7 +15,7 @@
15 *15 *
16 */16 */
1717
18#include "ucswipearea_p.h"18#include "ucswipearea_p_p.h"
1919
20#include <QQuickWindow>20#include <QQuickWindow>
21#include <QtCore/qmath.h>21#include <QtCore/qmath.h>
@@ -71,19 +71,19 @@
7171
72 switch (ev->type()) {72 switch (ev->type()) {
73 case QEvent::TouchBegin:73 case QEvent::TouchBegin:
74 message.append("TouchBegin ");74 message.append(QStringLiteral("TouchBegin "));
75 break;75 break;
76 case QEvent::TouchUpdate:76 case QEvent::TouchUpdate:
77 message.append("TouchUpdate ");77 message.append(QStringLiteral("TouchUpdate "));
78 break;78 break;
79 case QEvent::TouchEnd:79 case QEvent::TouchEnd:
80 message.append("TouchEnd ");80 message.append(QStringLiteral("TouchEnd "));
81 break;81 break;
82 case QEvent::TouchCancel:82 case QEvent::TouchCancel:
83 message.append("TouchCancel ");83 message.append(QStringLiteral("TouchCancel "));
84 break;84 break;
85 default:85 default:
86 message.append("INVALID_TOUCH_EVENT_TYPE ");86 message.append(QStringLiteral("INVALID_TOUCH_EVENT_TYPE "));
87 }87 }
8888
89 Q_FOREACH(const QTouchEvent::TouchPoint& touchPoint, ev->touchPoints()) {89 Q_FOREACH(const QTouchEvent::TouchPoint& touchPoint, ev->touchPoints()) {
@@ -859,7 +859,7 @@
859859
860QString ActiveTouchesInfo::toString()860QString ActiveTouchesInfo::toString()
861{861{
862 QString string = "(";862 QString string = QStringLiteral("(");
863863
864 {864 {
865 QTextStream stream(&string);865 QTextStream stream(&string);
@@ -869,7 +869,7 @@
869 });869 });
870 }870 }
871871
872 string.append(")");872 string.append(QStringLiteral(")"));
873873
874 return string;874 return string;
875}875}
876876
=== renamed file 'src/Ubuntu/Components/plugin/gestures/ucswipearea.h' => 'src/Ubuntu/UbuntuGestures/ucswipearea_p.h'
--- src/Ubuntu/Components/plugin/gestures/ucswipearea.h 2015-12-10 08:03:24 +0000
+++ src/Ubuntu/UbuntuGestures/ucswipearea_p.h 2016-01-07 17:36:33 +0000
@@ -19,8 +19,7 @@
19#define UCSWIPEAREA_H19#define UCSWIPEAREA_H
2020
21#include <QtQuick/QQuickItem>21#include <QtQuick/QQuickItem>
22#include "ubuntugesturesqmlglobal.h"22#include "ubuntugesturesglobal.h"
23#include "damper.h"
2423
25// lib UbuntuGestures24// lib UbuntuGestures
26#include <UbuntuGestures/Pool>25#include <UbuntuGestures/Pool>
@@ -34,7 +33,7 @@
34class UCSwipeAreaPrivate;33class UCSwipeAreaPrivate;
3534
36class UCSwipeAreaPrivate;35class UCSwipeAreaPrivate;
37class UBUNTUGESTURESQML_EXPORT UCSwipeArea : public QQuickItem36class UBUNTUGESTURES_EXPORT UCSwipeArea : public QQuickItem
38{37{
39 Q_OBJECT38 Q_OBJECT
4039
4140
=== renamed file 'src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h' => 'src/Ubuntu/UbuntuGestures/ucswipearea_p_p.h'
--- src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h 2015-12-16 09:52:31 +0000
+++ src/Ubuntu/UbuntuGestures/ucswipearea_p_p.h 2016-01-07 17:36:33 +0000
@@ -18,18 +18,20 @@
18#ifndef UCSWIPEAREAPRIVATE_H18#ifndef UCSWIPEAREAPRIVATE_H
19#define UCSWIPEAREAPRIVATE_H19#define UCSWIPEAREAPRIVATE_H
2020
21#include "ucswipearea.h"21#include "ucswipearea_p.h"
22#include <QtQuick/private/qquickitem_p.h>22#include <QtQuick/private/qquickitem_p.h>
2323
24#include "damper_p.h"
25
24// Information about an active touch point26// Information about an active touch point
25struct UBUNTUGESTURESQML_EXPORT ActiveTouchInfo {27struct UBUNTUGESTURES_EXPORT ActiveTouchInfo {
26 ActiveTouchInfo() : id(-1), startTime(-1) {}28 ActiveTouchInfo() : id(-1), startTime(-1) {}
27 bool isValid() const { return id != -1; }29 bool isValid() const { return id != -1; }
28 void reset() { id = -1; }30 void reset() { id = -1; }
29 int id;31 int id;
30 qint64 startTime;32 qint64 startTime;
31};33};
32class UBUNTUGESTURESQML_EXPORT ActiveTouchesInfo {34class UBUNTUGESTURES_EXPORT ActiveTouchesInfo {
33public:35public:
34 ActiveTouchesInfo(const UbuntuGestures::SharedTimeSource &timeSource);36 ActiveTouchesInfo(const UbuntuGestures::SharedTimeSource &timeSource);
35 void update(QTouchEvent *event);37 void update(QTouchEvent *event);
@@ -46,7 +48,7 @@
46};48};
4749
48class UCSwipeAreaStatusListener;50class UCSwipeAreaStatusListener;
49class UBUNTUGESTURESQML_EXPORT UCSwipeAreaPrivate : public QQuickItemPrivate51class UBUNTUGESTURES_EXPORT UCSwipeAreaPrivate : public QQuickItemPrivate
50{52{
51 Q_DECLARE_PUBLIC(UCSwipeArea)53 Q_DECLARE_PUBLIC(UCSwipeArea)
5254
@@ -71,7 +73,6 @@
71 // Useful for testing, where a fake time source can be supplied73 // Useful for testing, where a fake time source can be supplied
72 void setTimeSource(const UbuntuGestures::SharedTimeSource &timeSource);74 void setTimeSource(const UbuntuGestures::SharedTimeSource &timeSource);
7375
74public:
75 // Describes the state of the directional drag gesture.76 // Describes the state of the directional drag gesture.
76 enum Status {77 enum Status {
77 // Waiting for a new touch point to land on this area. No gesture is being processed78 // Waiting for a new touch point to land on this area. No gesture is being processed
@@ -163,7 +164,7 @@
163 bool immediateRecognition;164 bool immediateRecognition;
164};165};
165166
166class UBUNTUGESTURESQML_EXPORT UCSwipeAreaStatusListener167class UBUNTUGESTURES_EXPORT UCSwipeAreaStatusListener
167{168{
168public:169public:
169 virtual void swipeStatusChanged(UCSwipeAreaPrivate::Status /*old*/, UCSwipeAreaPrivate::Status /*new*/) {}170 virtual void swipeStatusChanged(UCSwipeAreaPrivate::Status /*old*/, UCSwipeAreaPrivate::Status /*new*/) {}
170171
=== modified file 'tests/api/Extinct/Animals/AnimalModule.pro'
--- tests/api/Extinct/Animals/AnimalModule.pro 2015-11-30 15:39:52 +0000
+++ tests/api/Extinct/Animals/AnimalModule.pro 2016-01-07 17:36:33 +0000
@@ -8,7 +8,7 @@
8QML_FILES += \8QML_FILES += \
9 Andrewsarchus.qml \9 Andrewsarchus.qml \
10 Paratriisodon.qml \10 Paratriisodon.qml \
11 gigantophis.qml \11 Gigantophis.qml \
12 test.qml \12 test.qml \
13 digger.js \13 digger.js \
1414
1515
=== renamed file 'tests/api/Extinct/Animals/gigantophis.qml' => 'tests/api/Extinct/Animals/Gigantophis.qml'
=== modified file 'tests/api/Extinct/Animals/plugin/plugin.cpp'
--- tests/api/Extinct/Animals/plugin/plugin.cpp 2015-12-11 10:38:46 +0000
+++ tests/api/Extinct/Animals/plugin/plugin.cpp 2016-01-07 17:36:33 +0000
@@ -17,6 +17,7 @@
17 */17 */
1818
19#include "plugin.h"19#include "plugin.h"
20#include "tarpan.h"
20#include "smilodon.h"21#include "smilodon.h"
21#include "pangaea.h"22#include "pangaea.h"
22#include "rune.h"23#include "rune.h"
@@ -50,6 +51,7 @@
50{51{
51 Q_ASSERT(uri == QLatin1String("Extinct.Animals"));52 Q_ASSERT(uri == QLatin1String("Extinct.Animals"));
5253
54 qmlRegisterType<EATarpan>();
53 qmlRegisterType<EASmilodon>(uri, 1, 0, "Smilodon");55 qmlRegisterType<EASmilodon>(uri, 1, 0, "Smilodon");
54 qmlRegisterType<EASmilodon>(uri, 0, 1, "ScimitarCat");56 qmlRegisterType<EASmilodon>(uri, 0, 1, "ScimitarCat");
5557
5658
=== modified file 'tests/api/Extinct/Animals/plugin/plugin.pri'
--- tests/api/Extinct/Animals/plugin/plugin.pri 2015-12-02 09:22:28 +0000
+++ tests/api/Extinct/Animals/plugin/plugin.pri 2016-01-07 17:36:33 +0000
@@ -13,6 +13,7 @@
1313
14HEADERS += \14HEADERS += \
15 $$PWD/plugin.h \15 $$PWD/plugin.h \
16 $$PWD/tarpan.h \
16 $$PWD/smilodon.h \17 $$PWD/smilodon.h \
17 $$PWD/pangaea.h \18 $$PWD/pangaea.h \
18 $$PWD/rune.h \19 $$PWD/rune.h \
@@ -21,6 +22,7 @@
2122
22SOURCES += \23SOURCES += \
23 $$PWD/plugin.cpp \24 $$PWD/plugin.cpp \
25 $$PWD/tarpan.cpp \
24 $$PWD/smilodon.cpp \26 $$PWD/smilodon.cpp \
25 $$PWD/pangaea.cpp \27 $$PWD/pangaea.cpp \
26 $$PWD/rune.cpp \28 $$PWD/rune.cpp \
2729
=== added file 'tests/api/Extinct/Animals/plugin/tarpan.cpp'
--- tests/api/Extinct/Animals/plugin/tarpan.cpp 1970-01-01 00:00:00 +0000
+++ tests/api/Extinct/Animals/plugin/tarpan.cpp 2016-01-07 17:36:33 +0000
@@ -0,0 +1,59 @@
1/*
2 * Copyright 2015 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 * Author: Christian Dywan <christian.dywan@canonical.com>
17 */
18
19#include "tarpan.h"
20
21/*!
22 * \qmltype EATarpan
23 * \instantiates EATarpan
24 * \inqmlmodule Extinct.Animals 1.0
25 * \ingroup ubuntu-commandline
26 * \brief The Tarpan class specifies the behavior of a Eurasian wild horse.
27 */
28
29EATarpan::EATarpan(QObject *parent) :
30 QObject(parent)
31{
32}
33
34/*!
35 * \qmlproperty string EATarpan::name
36 *
37 * Name identifying the wild horse.
38 *
39 */
40QString EATarpan::name() const
41{
42 return m_name;
43}
44
45void EATarpan::setName(const QString &name)
46{
47 m_name = name;
48 Q_EMIT(nameChanged());
49}
50
51/*!
52 * \qmlmethod string EATarpan::kick()
53 *
54 * A generous kick, commonly towards someone's groin area.
55 *
56 */
57void EATarpan::kick() const
58{
59}
060
=== added file 'tests/api/Extinct/Animals/plugin/tarpan.h'
--- tests/api/Extinct/Animals/plugin/tarpan.h 1970-01-01 00:00:00 +0000
+++ tests/api/Extinct/Animals/plugin/tarpan.h 2016-01-07 17:36:33 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2015 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 * Author: Christian Dywan <christian.dywan@canonical.com>
17 */
18
19#ifndef UCTARPAN_H
20#define UCTARPAN_H
21
22#include <QtCore/QObject>
23#include <QtCore/QString>
24
25class EATarpan : public QObject
26{
27 Q_OBJECT
28
29 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
30
31public:
32 explicit EATarpan(QObject *parent = 0);
33
34 QString name() const;
35 void setName(const QString &name);
36
37 Q_INVOKABLE void kick() const;
38
39Q_SIGNALS:
40 void nameChanged();
41
42private:
43 QString m_name;
44};
45
46#endif // UCTARPAN_H
047
=== modified file 'tests/api/Extinct/Animals/qmldir'
--- tests/api/Extinct/Animals/qmldir 2015-12-02 09:22:28 +0000
+++ tests/api/Extinct/Animals/qmldir 2016-01-07 17:36:33 +0000
@@ -1,7 +1,7 @@
1module Extinct.Animals1module Extinct.Animals
2plugin ExtinctAnimals2plugin ExtinctAnimals
3Titanoboa 4.2 test.qml3Titanoboa 4.2 test.qml
4Gigantophis 4.3 gigantophis.qml4Gigantophis 4.3 Gigantophis.qml
5internal WoollyMammoth mammoth.qml5internal WoollyMammoth mammoth.qml
6MonsterSnake 3.1 test.qml6MonsterSnake 3.1 test.qml
7Excavator 1.0 digger.js7Excavator 1.0 digger.js
88
=== modified file 'tests/api/components.api'
--- tests/api/components.api 2015-12-11 10:38:46 +0000
+++ tests/api/components.api 2016-01-07 17:36:33 +0000
@@ -1,9 +1,12 @@
1Extinct.Animals.Andrewsarchus 2.0: Item1Extinct.Animals.Andrewsarchus 2.0 Paratriisodon: Item
2 property double saggitalCrestSize2 property double saggitalCrestSize
3 property double skullSize3 property double skullSize
4Extinct.Animals.AndrewsarchusMongoliensis 2.5: Item4Extinct.Animals.AndrewsarchusMongoliensis 2.5 Paratriisodon: Item
5 property double saggitalCrestSize5 property double saggitalCrestSize
6 property double skullSize6 property double skullSize
7EATarpan: QtObject
8 function kick()
9 property string name
7Extinct.Animals.Europe 4.1: QtObject10Extinct.Animals.Europe 4.1: QtObject
8Extinct.Animals.Europe 4.2: Europe11Extinct.Animals.Europe 4.2: Europe
9 readonly property ushort era 4.212 readonly property ushort era 4.2
@@ -23,10 +26,10 @@
23Extinct.Animals.Pangaea.ModernContinent: Enum26Extinct.Animals.Pangaea.ModernContinent: Enum
24 America27 America
25 Europe28 Europe
26Extinct.Animals.Smilodon 1.0 ScimitarCat 0.1: QtObject29Extinct.Animals.Smilodon 1.0 ScimitarCat 0.1 EASmilodon: QtObject
27 function string paw(int i)30 function string paw(int i)
28 property string name31 property string name
29Extinct.Animals.Titanoboa 4.2 MonsterSnake 3.1: Item32Extinct.Animals.Titanoboa 4.2 MonsterSnake 3.1 test: Item
30 property string bar33 property string bar
31 property var basket34 property var basket
32 property url bazz35 property url bazz
3336
=== modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/__init__.py 2015-05-28 15:23:13 +0000
+++ tests/autopilot/ubuntuuitoolkit/__init__.py 2016-01-07 17:36:33 +0000
@@ -48,6 +48,7 @@
48 'ToolkitException',48 'ToolkitException',
49 'ubuntu_scenarios',49 'ubuntu_scenarios',
50 'UbuntuListView11',50 'UbuntuListView11',
51 'UbuntuListView',
51 'UbuntuUIToolkitCustomProxyObjectBase',52 'UbuntuUIToolkitCustomProxyObjectBase',
52]53]
5354
@@ -86,4 +87,5 @@
86 ToolkitException,87 ToolkitException,
87 UbuntuUIToolkitCustomProxyObjectBase,88 UbuntuUIToolkitCustomProxyObjectBase,
88 UbuntuListView11,89 UbuntuListView11,
90 UbuntuListView,
89)91)
9092
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2015-09-30 14:46:48 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/__init__.py 2016-01-07 17:36:33 +0000
@@ -44,6 +44,7 @@
44 'Toolbar',44 'Toolbar',
45 'ToolkitException',45 'ToolkitException',
46 'UbuntuListView11',46 'UbuntuListView11',
47 'UbuntuListView',
47 'UbuntuUIToolkitCustomProxyObjectBase',48 'UbuntuUIToolkitCustomProxyObjectBase',
48]49]
4950
@@ -90,5 +91,6 @@
90from ubuntuuitoolkit._custom_proxy_objects._textfield import TextField91from ubuntuuitoolkit._custom_proxy_objects._textfield import TextField
91from ubuntuuitoolkit._custom_proxy_objects._toolbar import Toolbar92from ubuntuuitoolkit._custom_proxy_objects._toolbar import Toolbar
92from ubuntuuitoolkit._custom_proxy_objects._ubuntulistview import (93from ubuntuuitoolkit._custom_proxy_objects._ubuntulistview import (
93 UbuntuListView1194 UbuntuListView11,
95 UbuntuListView,
94)96)
9597
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py 2015-09-22 15:56:35 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_ubuntulistview.py 2016-01-07 17:36:33 +0000
@@ -45,3 +45,7 @@
45 refresh.wait_for_refresh()45 refresh.wait_for_refresh()
46 return True46 return True
47 return False47 return False
48
49
50class UbuntuListView(UbuntuListView11):
51 """Autopilot helper for the UbuntuListView 1.3."""
4852
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2015-12-09 14:34:55 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2016-01-07 17:36:33 +0000
@@ -34,7 +34,7 @@
34 text="Call")),34 text="Call")),
35 ('button with color', dict(35 ('button with color', dict(
36 button_name="button_color", is_enabled=True,36 button_name="button_color", is_enabled=True,
37 color=[0, 161, 50, 255], icon=None, text="Call Ctrl+C")),37 color=[0, 161, 50, 255], icon=None, text="C&all Ctrl+L")),
38 ('button with icon', dict(38 ('button with icon', dict(
39 button_name="button_iconsource", is_enabled=True, color=None,39 button_name="button_iconsource", is_enabled=True, color=None,
40 icon="call.png", text=None)),40 icon="call.png", text=None)),
4141
=== modified file 'tests/uitk_test_plan.sh'
--- tests/uitk_test_plan.sh 2015-12-16 09:50:40 +0000
+++ tests/uitk_test_plan.sh 2016-01-07 17:36:33 +0000
@@ -552,3 +552,5 @@
552 echo "Comparing results with the archive tests" > $MAINFILE552 echo "Comparing results with the archive tests" > $MAINFILE
553 compare_results553 compare_results
554fi554fi
555
556
555557
=== modified file 'tests/unit/plugin_dependency.pri'
--- tests/unit/plugin_dependency.pri 2015-12-16 12:57:21 +0000
+++ tests/unit/plugin_dependency.pri 2016-01-07 17:36:33 +0000
@@ -8,7 +8,7 @@
8PRE_TARGETDEPS += $$PLUGIN_BLD/Test/libUbuntuTest.so8PRE_TARGETDEPS += $$PLUGIN_BLD/Test/libUbuntuTest.so
9LIBS += -L$$PLUGIN_BLD/Components -lUbuntuComponents9LIBS += -L$$PLUGIN_BLD/Components -lUbuntuComponents
10LIBS += -L$$PLUGIN_BLD/Test -lUbuntuTest10LIBS += -L$$PLUGIN_BLD/Test -lUbuntuTest
11LIBS += -L$$PWD/../../lib -lUbuntuGestures11LIBS += -L$${ROOT_BUILD_DIR}/lib -lUbuntuGestures
12DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$_PRO_FILE_PWD_\\\"\"12DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$_PRO_FILE_PWD_\\\"\"
13QMAKE_CXXFLAGS += -Werror13QMAKE_CXXFLAGS += -Werror
1414
1515
=== modified file 'tests/unit/runtest.sh'
--- tests/unit/runtest.sh 2015-12-16 09:52:31 +0000
+++ tests/unit/runtest.sh 2016-01-07 17:36:33 +0000
@@ -70,7 +70,7 @@
70 $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'70 $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'
71 if [ "x$UITK_TEST_KEEP_RUNNING" != "x1" ]; then71 if [ "x$UITK_TEST_KEEP_RUNNING" != "x1" ]; then
72 ${BUILD_DIR}/tests/checkresults.sh $_XML72 ${BUILD_DIR}/tests/checkresults.sh $_XML
73 RESULT=$*73 RESULT=$?
74 fi74 fi
75 else75 else
76 echo "Skipped because no DISPLAY available"76 echo "Skipped because no DISPLAY available"
7777
=== modified file 'tests/unit/tst_components/tst_fontutils.qml'
--- tests/unit/tst_components/tst_fontutils.qml 2015-03-03 13:20:06 +0000
+++ tests/unit/tst_components/tst_fontutils.qml 2016-01-07 17:36:33 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2012 Canonical Ltd.2 * Copyright 2012-2015 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * 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 by5 * it under the terms of the GNU Lesser General Public License as published by
@@ -22,12 +22,12 @@
22 name: "FontUtilsAPI"22 name: "FontUtilsAPI"
2323
24 function test_modularScale() {24 function test_modularScale() {
25 compare(FontUtils.modularScale("xx-small"), 0.677, "xx-small scale");25 compare(FontUtils.modularScale("xx-small"), 0.606, "xx-small scale");
26 compare(FontUtils.modularScale("x-small"), 0.804, "x-small scale");26 compare(FontUtils.modularScale("x-small"), 0.707, "x-small scale");
27 compare(FontUtils.modularScale("small"), 0.931, "small scale");27 compare(FontUtils.modularScale("small"), 0.857, "small scale");
28 compare(FontUtils.modularScale("medium"), 1.079, "medium scale");28 compare(FontUtils.modularScale("medium"), 1.0, "medium scale");
29 compare(FontUtils.modularScale("large"), 1.291, "large scale");29 compare(FontUtils.modularScale("large"), 1.414, "large scale");
30 compare(FontUtils.modularScale("x-large"), 1.714, "x-large scale");30 compare(FontUtils.modularScale("x-large"), 1.905, "x-large scale");
31 }31 }
3232
33 function test_modularScale_failures() {33 function test_modularScale_failures() {
@@ -36,17 +36,16 @@
36 }36 }
3737
38 function test_sizeToPixels() {38 function test_sizeToPixels() {
39 compare(FontUtils.sizeToPixels("xx-small"), 0.677 * units.dp(14), "xx-small scale");39 compare(FontUtils.sizeToPixels("xx-small"), 0.606 * units.dp(14), "xx-small scale");
40 compare(FontUtils.sizeToPixels("x-small"), 0.804 * units.dp(14), "x-small scale");40 compare(FontUtils.sizeToPixels("x-small"), 0.707 * units.dp(14), "x-small scale");
41 compare(FontUtils.sizeToPixels("small"), 0.931 * units.dp(14), "small scale");41 compare(FontUtils.sizeToPixels("small"), 0.857 * units.dp(14), "small scale");
42 compare(FontUtils.sizeToPixels("medium"), 1.079 * units.dp(14), "medium scale");42 compare(FontUtils.sizeToPixels("medium"), 1.0 * units.dp(14), "medium scale");
43 compare(FontUtils.sizeToPixels("large"), 1.291 * units.dp(14), "large scale");43 compare(FontUtils.sizeToPixels("large"), 1.414 * units.dp(14), "large scale");
44 compare(FontUtils.sizeToPixels("x-large"), 1.714 * units.dp(14), "x-large scale");44 compare(FontUtils.sizeToPixels("x-large"), 1.905 * units.dp(14), "x-large scale");
45 }45 }
4646
47 function test_sizeToPixels_failures() {47 function test_sizeToPixels_failures() {
48 compare(FontUtils.sizeToPixels("xxsmall"), 0.0, "xxsmall not defined");48 compare(FontUtils.sizeToPixels("xxsmall"), 0.0, "xxsmall not defined");
49 compare(FontUtils.sizeToPixels("undefined"), 0.0, "undefined scale");49 compare(FontUtils.sizeToPixels("undefined"), 0.0, "undefined scale");
50 }50 }
51
52}51}
5352
=== modified file 'tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp'
--- tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2015-12-12 08:25:22 +0000
+++ tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2016-01-07 17:36:33 +0000
@@ -20,7 +20,7 @@
20#include "ucbottomedgeregion.h"20#include "ucbottomedgeregion.h"
21#include "ucbottomedge_p.h"21#include "ucbottomedge_p.h"
22#include "ucbottomedgehint.h"22#include "ucbottomedgehint.h"
23#include "gestures/ucswipearea.h"23#include "private/ucswipearea_p.h"
24#include "ucunits.h"24#include "ucunits.h"
25#include "ucheader.h"25#include "ucheader.h"
26#include "ucaction.h"26#include "ucaction.h"
2727
=== modified file 'tests/unit_x11/tst_bottomedge/tst_bottomedge.pro'
--- tests/unit_x11/tst_bottomedge/tst_bottomedge.pro 2015-12-12 08:25:22 +0000
+++ tests/unit_x11/tst_bottomedge/tst_bottomedge.pro 2016-01-07 17:36:33 +0000
@@ -1,5 +1,5 @@
1include(../test-include.pri)1include(../test-include.pri)
2QT += core-private qml-private quick-private gui-private UbuntuGestures2QT += core-private qml-private quick-private gui-private UbuntuGestures UbuntuGestures_private
33
4SOURCES += \4SOURCES += \
5 tst_bottomedge.cpp5 tst_bottomedge.cpp
66
=== added file 'tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png'
7Binary files tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png 1970-01-01 00:00:00 +0000 and tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png 2016-01-07 17:36:33 +0000 differ7Binary files tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png 1970-01-01 00:00:00 +0000 and tests/unit_x11/tst_components/PageHeaderBaseDividerBottom@18.png 2016-01-07 17:36:33 +0000 differ
=== added file 'tests/unit_x11/tst_components/battery-100-charging.svg'
--- tests/unit_x11/tst_components/battery-100-charging.svg 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/battery-100-charging.svg 2016-01-07 17:36:33 +0000
@@ -0,0 +1,25 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3<svg id="svg4966" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="90" viewBox="0 0 139.00489 90.000001" width="139" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
4 <metadata id="metadata4971">
5 <rdf:RDF>
6 <cc:Work rdf:about="">
7 <dc:format>image/svg+xml</dc:format>
8 <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
9 <dc:title/>
10 </cc:Work>
11 </rdf:RDF>
12 </metadata>
13 <g id="layer1" transform="translate(-149.78 -484.51)">
14 <g id="g5120" transform="translate(-433.79 125.71)">
15 <g id="g5124" transform="translate(409.57 223.43)">
16 <g id="g5126" style="fill:none" transform="matrix(2.1875 0 0 1.875 -456 -1657.8)">
17 <rect id="rect5128" style="opacity:.21171;fill:none" transform="translate(0 804.36)" height="48" width="48" y="152" x="288"/>
18 </g>
19 <path id="path5130" style="fill:#808080" transform="translate(174 135.36)" d="m86 15-75.156 0.012c-7.844-0.012-10.844 1.988-10.844 11.988v18 18c0 10 3 12 10.844 11.988l75.156 0.012c7.8438 0.01172 11-2.3633 11-12v-4.0117h8v-13.988-13.988h-8v-4.012c0-9.637-3.156-12.012-11-12zm-75 6c21.619 0.0096 48.956 0.0081 75 0 4 0 5 1 5 6v18 18c0 5-1 6-5 6-26.044-0.008-53.381-0.01-75 0-4 0-5-1-5-6v-18-18c0-5 1-6 5-6z"/>
20 <path id="path5132" style="fill:#38b44a" d="m1051 697c-3 0-4 0-4 5v26c0 5 1 5 4 5h65c3 0 4 0 4-5v-26c0-5-1-5-4-5z" transform="translate(-861 -534.64)"/>
21 <path id="path3847-0" style="fill:#808080" d="m299 150.36-13.996 35h14v25l14.005-35h-14z"/>
22 </g>
23 </g>
24 </g>
25</svg>
026
=== added file 'tests/unit_x11/tst_components/shape.svg'
--- tests/unit_x11/tst_components/shape.svg 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/shape.svg 2016-01-07 17:36:33 +0000
@@ -0,0 +1,77 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="64"
13 height="64"
14 id="svg3336"
15 version="1.1"
16 inkscape:version="0.48.5 r10040"
17 sodipodi:docname="ushape.svg">
18 <defs
19 id="defs3338" />
20 <sodipodi:namedview
21 id="base"
22 pagecolor="#ffffff"
23 bordercolor="#666666"
24 borderopacity="1.0"
25 inkscape:pageopacity="0.0"
26 inkscape:pageshadow="2"
27 inkscape:zoom="4"
28 inkscape:cx="113.3337"
29 inkscape:cy="-31.239507"
30 inkscape:document-units="px"
31 inkscape:current-layer="layer1"
32 showgrid="false"
33 inkscape:window-width="1871"
34 inkscape:window-height="1056"
35 inkscape:window-x="49"
36 inkscape:window-y="24"
37 inkscape:window-maximized="1"
38 inkscape:showpageshadow="false"
39 borderlayer="false"
40 showborder="true" />
41 <metadata
42 id="metadata3341">
43 <rdf:RDF>
44 <cc:Work
45 rdf:about="">
46 <dc:format>image/svg+xml</dc:format>
47 <dc:type
48 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
49 <dc:title />
50 </cc:Work>
51 </rdf:RDF>
52 </metadata>
53 <g
54 inkscape:label="Layer 1"
55 inkscape:groupmode="layer"
56 id="layer1"
57 transform="translate(0,-988.36218)">
58 <g
59 transform="matrix(0.92774742,0,0,0.92677598,0,190.60819)"
60 id="layer1-3"
61 inkscape:label="Layer 1"
62 style="fill:#000000;display:inline">
63 <g
64 style="fill:#000000"
65 inkscape:label="Layer 1"
66 id="layer1-2"
67 transform="translate(0,9.99998)">
68 <path
69 sodipodi:nodetypes="sssssssss"
70 inkscape:connector-curvature="0"
71 id="path3774"
72 d="m 66.770269,850.78408 72.334451,0 c 58.42399,0 66.77028,8.34623 66.77028,66.77022 l 0,58.03793 c 0,58.42377 -8.34629,66.76997 -66.77028,66.76997 l -72.334451,0 C 8.3462835,1042.3622 0,1034.016 0,975.59223 L 0,917.5543 c 0,-58.42399 8.3462835,-66.77022 66.770269,-66.77022 z"
73 style="fill:#000000;fill-opacity:1;stroke:none;display:inline" />
74 </g>
75 </g>
76 </g>
77</svg>
078
=== modified file 'tests/unit_x11/tst_components/tst_imageprovider.qml'
--- tests/unit_x11/tst_components/tst_imageprovider.qml 2015-03-03 13:20:06 +0000
+++ tests/unit_x11/tst_components/tst_imageprovider.qml 2016-01-07 17:36:33 +0000
@@ -53,16 +53,41 @@
53 signalName: "visibleChanged"53 signalName: "visibleChanged"
54 }54 }
5555
56 function test_sourceChanged() {56 function cleanup() {
57 sourceChangeSpy.clear();
58 visibleChangedSpy.clear();
59 }
60
61 // tests adjusted to reproduce bug #1401920
62 function test_sourceChanged_bug1401920_data() {
63 return [
64 {tag: "Bitmap file", file: 'tst_icon-select.png'},
65 {tag: "Bitmap file(18gu)", gu: 18, file: 'tst_icon-select.png'},
66 {tag: "Bitmap with fragment", file: 'tst_icon-select.png#' + Date.now()},
67 {tag: "Bitmap with fragment(18gu)", gu: 18, file: 'PageHeaderBaseDividerBottom@18.png#' + Date.now()},
68 {tag: "Bitmap file with gu", file: 'tst_icon-select@18.png'},
69 {tag: "Bitmap file with gu(18gu)", gu: 18, file: 'PageHeaderBaseDividerBottom@18.png'},
70 {tag: "Bitmap with gu/ fragment", file: 'tst_icon-select@18.png#' + Date.now()},
71 {tag: "Bitmap with gu/ fragment(18gu)", gu: 18, file: 'PageHeaderBaseDividerBottom@18.png#' + Date.now()},
72 {tag: "Scalable file", file: 'battery-100-charging.svg'},
73 {tag: "Scalable file(18gu)", gu: 18, file: 'shape.svg'},
74 {tag: "Scalable with fragment", file: 'shape.svg#' + Date.now()},
75 {tag: "Scalable with fragment(18gu)", gu: 18, file: 'battery-100-charging.svg#' + Date.now()},
76 ];
77 }
78
79 function test_sourceChanged_bug1401920(data) {
80 units.gridUnit = data.gu ? data.gu : 8;
57 sourceChangeSpy.target = test;81 sourceChangeSpy.target = test;
58 test.source = "/usr/share/icons/ubuntu-mobile/actions/scalable/delete.svg";82 test.source = Qt.resolvedUrl(data.file);
59 sourceChangeSpy.wait();83 sourceChangeSpy.wait(400);
84 compare(test.source, Qt.resolvedUrl(data.file));
60 }85 }
6186
62 function test_sourceNOTIFYable() {87 function test_sourceNOTIFYable() {
63 /* Test source through visible to cover NOTIFYable errors */88 /* Test source through visible to cover NOTIFYable errors */
64 visibleChangedSpy.target = bindingTest;89 visibleChangedSpy.target = bindingTest;
65 bindingTest.source = "/usr/share/icons/ubuntu-mobile/actions/scalable/help.svg";90 bindingTest.source = Qt.resolvedUrl('battery-100-charging.svg');
66 visibleChangedSpy.wait();91 visibleChangedSpy.wait();
67 }92 }
68 }93 }
6994
=== modified file 'tests/unit_x11/tst_components/tst_scrollbar.qml'
--- tests/unit_x11/tst_components/tst_scrollbar.qml 2015-12-16 16:33:22 +0000
+++ tests/unit_x11/tst_components/tst_scrollbar.qml 2016-01-07 17:36:33 +0000
@@ -46,7 +46,9 @@
46 Rectangle {46 Rectangle {
47 id: content47 id: content
48 width: units.gu(40)48 width: units.gu(40)
49 height: units.gu(50)49 //make this much taller than the flickable to avoid timing issues when
50 //detecting if the flickable is flicking in the tests
51 height: units.gu(200)
50 color: "blue"52 color: "blue"
51 }53 }
52 }54 }
@@ -60,6 +62,9 @@
60 SignalSpy {62 SignalSpy {
61 id: signalSpy63 id: signalSpy
62 }64 }
65 SignalSpy {
66 id: anotherSignalSpy
67 }
6368
64 Flickable {69 Flickable {
65 anchors.fill: parent70 anchors.fill: parent
@@ -126,6 +131,8 @@
126 }131 }
127 function setupSignalSpy(spy, target, signalName) {132 function setupSignalSpy(spy, target, signalName) {
128 spy.clear()133 spy.clear()
134 //reset signalName otherwise it will look for the old signalName in the new target
135 spy.signalName = ""
129 spy.target = target136 spy.target = target
130 spy.signalName = signalName137 spy.signalName = signalName
131 }138 }
@@ -176,46 +183,81 @@
176 scrollbar_trailingAlign_anchors.flickableItem.top, "top anchor")183 scrollbar_trailingAlign_anchors.flickableItem.top, "top anchor")
177 }184 }
178185
179 function test_indicatorWhileFlicking() {186 function test_indicatorStyleWhileFlicking_shortContent() {
180 var freshTestItem = getFreshFlickable()187 var freshTestItem = getFreshFlickable()
181 if (!freshTestItem) return188 if (!freshTestItem) return
182189
183 var flickable = freshTestItem.flickable190 var flickable = freshTestItem.flickable
184 var scrollbar = freshTestItem.scrollbar191 var scrollbar = freshTestItem.scrollbar
185192
186 setupSignalSpy(signalSpy, flickable, "movementEnded")193 compare(scrollbar.__styleInstance.veryLongContentItem, false, "Scrollable item should be short.")
187194
188 flick(flickable, 1, 2, units.gu(2), units.gu(3))195 setupSignalSpy(signalSpy, flickable, "movingChanged")
189 compare(flickable.moving, true, "not moving")196
190 compare(scrollbar.__styleInstance.state, "indicator", "wrong style while flicking")197 flick(flickable, 1, 2, units.gu(2), -units.gu(10))
191198
192 signalSpy.wait()199 signalSpy.wait()
193 compare(signalSpy.count, 1, "flick not completed")200 compare(signalSpy.count, 1, "No movingChanged signal after simulating a flick.")
194201 compare(flickable.moving, true, "Flickable not moving after simulating a flick.")
195 compare(scrollbar.__styleInstance.state, "hidden", "wrong style while flicking short item")202 compare(scrollbar.__styleInstance.state, "indicator", "Wrong style while flicking.")
203
204 //we don't set it up before because the hinting feature already changes the style to thumb
205 //at the beginning
206 setupSignalSpy(anotherSignalSpy, scrollbar.__styleInstance, "stateChanged")
207
208 //make sure the flickable stops
209 mousePress(flickable, 0, 0)
210 mouseMove(flickable, 0, 0)
211 mouseRelease(flickable, 0, 0)
212
213 signalSpy.wait()
214 compare(flickable.moving, false, "Flickable still moving after simulating mouse click.")
215 compare(signalSpy.count, 2, "No movingChanged signal after Flickable stopped moving.")
216
217 anotherSignalSpy.wait()
218 compare(anotherSignalSpy.count, 1, "State unchanged after Flickable stopped moving.")
219 compare(scrollbar.__styleInstance.state, "hidden", "Wrong style after the item stopped moving.")
220
196 freshTestItem.destroy()221 freshTestItem.destroy()
197 }222 }
198223
199 function test_thumbStyleVeryLongContent() {224 function test_thumbStyleWhileFlicking_veryLongContent() {
200 var freshTestItem = getFreshFlickable()225 var freshTestItem = getFreshFlickable()
201 if (!freshTestItem) return226 if (!freshTestItem) return
202227
203 var flickable = freshTestItem.flickable228 var flickable = freshTestItem.flickable
204 var scrollbar = freshTestItem.scrollbar229 var scrollbar = freshTestItem.scrollbar
205230
231 setupSignalSpy(signalSpy, scrollbar.__styleInstance, "veryLongContentItemChanged")
206 setVeryLongContentItem(flickable)232 setVeryLongContentItem(flickable)
207 compare(scrollbar.__styleInstance.veryLongContentItem, true, "very long content item not detected")233 signalSpy.wait()
208234
209 setupSignalSpy(signalSpy, flickable, "movementEnded")235 compare(scrollbar.__styleInstance.veryLongContentItem, true, "Very long content item not detected")
210236
211 flick(flickable, 1, 2, units.gu(2), units.gu(3))237 setupSignalSpy(signalSpy, flickable, "movingChanged")
212 compare(flickable.moving, true, "not moving")238 flick(flickable, 1, 2, units.gu(2), -units.gu(10))
213 compare(scrollbar.__styleInstance.state, "thumb", "wrong style while flicking a very long item")239
214240 signalSpy.wait()
215 signalSpy.wait()241 compare(signalSpy.count, 1, "No movingChanged signal after simulating a flick.")
216 compare(signalSpy.count, 1, "flick not completed")242 compare(flickable.moving, true, "Flickable not moving after simulating a flick.")
217243 compare(scrollbar.__styleInstance.state, "thumb", "Wrong style while flicking a very long item")
218 compare(scrollbar.__styleInstance.state, "hidden", "wrong style while flicking a very long item")244
245 //we don't set it up before because the hinting feature already changes the style to thumb
246 //at the beginning
247 setupSignalSpy(anotherSignalSpy, scrollbar.__styleInstance, "stateChanged")
248
249 //make sure the flickable stops
250 mousePress(flickable, 0, 0)
251 mouseMove(flickable, 0, 0)
252 mouseRelease(flickable, 0, 0)
253
254 signalSpy.wait()
255 compare(flickable.moving, false, "Flickable still moving after simulating mouse click.")
256 compare(signalSpy.count, 2, "No movingChanged signal after Flickable stopped moving.")
257
258 anotherSignalSpy.wait()
259 compare(anotherSignalSpy.count, 1, "State unchanged after Flickable stopped moving.")
260 compare(scrollbar.__styleInstance.state, "hidden", "Wrong style after a the item stopped moving.")
219 freshTestItem.destroy()261 freshTestItem.destroy()
220 }262 }
221 }263 }
222264
=== modified file 'tests/unit_x11/tst_components/tst_shortcuts.qml'
--- tests/unit_x11/tst_components/tst_shortcuts.qml 2015-12-06 11:48:53 +0000
+++ tests/unit_x11/tst_components/tst_shortcuts.qml 2016-01-07 17:36:33 +0000
@@ -46,6 +46,10 @@
4646
47 function init() {47 function init() {
48 }48 }
49 function cleanup() {
50 spy.clear();
51 shortcutSpy.clear();
52 }
4953
50 SignalSpy {54 SignalSpy {
51 id: spy55 id: spy
@@ -102,6 +106,60 @@
102 shortcutSpy.clear();106 shortcutSpy.clear();
103 action.shortcut = undefined;107 action.shortcut = undefined;
104 shortcutSpy.wait(200);108 shortcutSpy.wait(200);
109 shortcutSpy.target = null;
110 }
111
112 function test_mnemonic_data() {
113 return [
114 {tag: "HW keyboard, valid 'C&all'", kbd: true, text: "C&all", displayText: "C<u>a</u>ll", key: Qt.Key_A, xfail: false},
115 {tag: "HW keyboard, valid '&Save & Exit", kbd: true, text: "&Save & Exit", displayText: "<u>S</u>ave & Exit", key: Qt.Key_S, xfail: false},
116 {tag: "HW keyboard, valid 'Hide &Seek'", kbd: true, text: "Hide&Seek", displayText: "Hide<u>S</u>eek", key: Qt.Key_S, xfail: false},
117 {tag: "HW keyboard, valid 'Save & Exit'", kbd: true, text: "Save & Exit", displayText: "Save <u> </u>Exit", key: Qt.Key_Space, xfail: false},
118 {tag: "HW keyboard, valid 'Paste &&&Proceed'", kbd: true, text: "Paste &&&Proceed", displayText: "Paste &&<u>P</u>roceed", key: Qt.Key_P, xfail: false},
119 {tag: "HW keyboard, valid 'Cut &$'", kbd: true, text: "Cut &$", displayText: "Cut <u>$</u>", key: Qt.Key_Dollar, xfail: false},
120 {tag: "HW keyboard, valid 'At &@'", kbd: true, text: "At &@", displayText: "At <u>@</u>", key: Qt.Key_At, xfail: false},
121 {tag: "HW keyboard, valid '&_'", kbd: true, text: "&_", displayText: "<u>_</u>", key: Qt.Key_Underscore, xfail: false},
122
123 {tag: "HW keyboard, invalid '&&Call'", kbd: true, text: "&&Call", displayText: "&&Call", key: Qt.Key_Asterisk, xfail: true},
124 {tag: "HW keyboard, invalid 'Jump &'", kbd: true, text: "Jump &", displayText: "Jump &", key: Qt.Key_Asterisk, xfail: true},
125 {tag: "HW keyboard, invalid '&&'", kbd: true, text: "&&", displayText: "&&", key: Qt.Key_Asterisk, xfail: true},
126
127 {tag: "no HW keyboard", kbd: false, text: "&Call", displayText: "Call", key: Qt.Key_C, xfail: false},
128 ];
129 }
130 function test_mnemonic(data) {
131 QuickUtils.keyboardAttached = data.kbd;
132 action.text = data.text;
133 if (!data.kbd && QuickUtils.keyboardAttached) {
134 skip("Cannot test this case: " + data.tag);
135 }
136 compare(action.text, data.displayText);
137 // shortcut
138 keyClick(data.key, Qt.AltModifier);
139 if (data.xfail) {
140 expectFail(data.tag, "invalid mnemonic");
141 }
142 spy.wait(200);
143 }
144
145 SignalSpy {
146 id: textSpy
147 target: action
148 signalName: "textChanged"
149 }
150
151 function test_mnemonic_displaytext() {
152 QuickUtils.keyboardAttached = false;
153 if (QuickUtils.keyboardAttached) {
154 skip("the test needs to be able to detach the keyboard");
155 }
156 action.text = "&Call";
157 textSpy.clear();
158 QuickUtils.keyboardAttached = true;
159 if (!QuickUtils.keyboardAttached) {
160 skip("the test needs to be able to attach the keyboard");
161 }
162 textSpy.wait(200);
105 }163 }
106 }164 }
107}165}
108166
=== added file 'tests/unit_x11/tst_components/tst_ubuntulistview13.qml'
--- tests/unit_x11/tst_components/tst_ubuntulistview13.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_ubuntulistview13.qml 2016-01-07 17:36:33 +0000
@@ -0,0 +1,105 @@
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
17import QtQuick 2.4
18import QtTest 1.0
19import Ubuntu.Test 1.0
20import Ubuntu.Components 1.3
21
22Item {
23 width: units.gu(40)
24 height: units.gu(60)
25
26 ListModel {
27 id: dummyModel
28 Component.onCompleted: {
29 reload();
30 }
31 function reload() {
32 clear();
33 for (var i = 0; i < 20; ++i) {
34 dummyModel.append({idx: i});
35 }
36 }
37 }
38
39 // timer used to simulate the model refresh
40 Timer {
41 id: refreshTimer
42 interval: 500
43 onTriggered: {
44 dummyModel.reload();
45 }
46 }
47
48 UbuntuListView {
49 id: ubuntuListView
50 anchors.fill: parent
51 clip: true
52 model: dummyModel
53
54 pullToRefresh {
55 refreshing: refreshTimer.running
56 onRefresh: refreshTimer.restart()
57 }
58
59 delegate: ListItem {
60 id: expandable
61 Label { text: "item " + index }
62 }
63 }
64
65 UbuntuTestCase {
66 name: "UbuntuListView"
67 when: windowShown
68
69 SignalSpy {
70 id: refreshSpy
71 signalName: "onRefresh"
72 }
73
74 function initTestCase() {
75 tryCompare(dummyModel, "count", 20);
76 }
77
78 function init() {
79 waitForRendering(ubuntuListView, 1000);
80 }
81
82 function cleanup() {
83 // scroll the ListView back to top
84 ubuntuListView.positionViewAtIndex(0, ListView.Beginning);
85 refreshSpy.clear();
86 refreshSpy.target = null;
87 ubuntuListView.pullToRefresh.enabled = false;
88 }
89
90 function test_0_defaults() {
91 verify(ubuntuListView.hasOwnProperty("pullToRefresh"), "PullToRefresh is missing");
92 compare(ubuntuListView.pullToRefresh.enabled, false, "PullToRefresh functionality is disabled by default");
93 }
94
95 function test_pullToRefresh_manual_refresh() {
96 ubuntuListView.pullToRefresh.enabled = true;
97 refreshSpy.target = ubuntuListView.pullToRefresh
98 var x = ubuntuListView.width / 2;
99 mouseDrag(ubuntuListView, x, units.gu(1), 0, ubuntuListView.height);
100 refreshSpy.wait();
101 tryCompareFunction(function() { return ubuntuListView.pullToRefresh.refreshing; }, false, 1000);
102 waitForRendering(ubuntuListView, 1000);
103 }
104 }
105}
0106
=== modified file 'tests/unit_x11/tst_swipearea/tst_swipearea.cpp'
--- tests/unit_x11/tst_swipearea/tst_swipearea.cpp 2015-12-16 09:52:31 +0000
+++ tests/unit_x11/tst_swipearea/tst_swipearea.cpp 2016-01-07 17:36:33 +0000
@@ -23,8 +23,8 @@
23#include <private/qquickmousearea_p.h>23#include <private/qquickmousearea_p.h>
24#include <private/qquickwindow_p.h>24#include <private/qquickwindow_p.h>
2525
26#include "gestures/ucswipearea.h"26#include "private/ucswipearea_p.h"
27#include "gestures/ucswipearea_p.h"27#include "private/ucswipearea_p_p.h"
28#define protected public28#define protected public
29#define private public29#define private public
30#include <UbuntuGestures/TouchRegistry>30#include <UbuntuGestures/TouchRegistry>
3131
=== modified file 'tests/unit_x11/tst_swipearea/tst_swipearea.pro'
--- tests/unit_x11/tst_swipearea/tst_swipearea.pro 2015-11-06 14:05:07 +0000
+++ tests/unit_x11/tst_swipearea/tst_swipearea.pro 2016-01-07 17:36:33 +0000
@@ -1,5 +1,5 @@
1include(../test-include.pri)1include(../test-include.pri)
2QT += core-private qml-private quick-private gui-private UbuntuGestures2QT += core-private qml-private quick-private gui-private UbuntuGestures UbuntuGestures_private
3SOURCES += \3SOURCES += \
4 GestureTest.cpp \4 GestureTest.cpp \
5 tst_swipearea.cpp5 tst_swipearea.cpp

Subscribers

People subscribed via source and target branches

to status/vote changes: