Merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-fragment-shader-cleanup into lp:ubuntu-ui-toolkit
- ubuntu-ui-toolkit-ubuntushape-fragment-shader-cleanup
- Merge into trunk
Proposed by
Loïc Molinari
Status: | Superseded |
---|---|
Proposed branch: | lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-fragment-shader-cleanup |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
14582 lines (+9405/-1600) (has conflicts) 193 files modified
components.api (+98/-83) debian/control (+24/-0) debian/libubuntugestures-dev.install (+28/-0) debian/libubuntugestures.install (+1/-0) documentation/overview.qdoc (+7/-0) examples/ubuntu-ui-toolkit-gallery/About.qml (+2/-3) examples/ubuntu-ui-toolkit-gallery/ListItemLayouts.qml (+8/-8) examples/ubuntu-ui-toolkit-gallery/ListItemWithLabel.qml (+1/-1) examples/ubuntu-ui-toolkit-gallery/MainPage.qml (+106/-85) examples/ubuntu-ui-toolkit-gallery/Sections.qml (+7/-1) examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml (+144/-0) examples/ubuntu-ui-toolkit-gallery/Template.qml (+17/-7) examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml (+7/-2) examples/ubuntu-ui-toolkit-gallery/gallery (+1/-1) examples/ubuntu-ui-toolkit-gallery/gallery-logging.config (+4/-0) examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.pro (+2/-1) export_modules_dir.sh (+2/-0) features/ubuntu_qml_plugin.prf (+11/-0) features/ubuntu_qt_module.prf (+19/-0) src/Ubuntu/Components/1.2/DraggingArea.qml (+2/-2) src/Ubuntu/Components/1.2/MainViewBase.qml (+4/-4) src/Ubuntu/Components/1.2/Slider.qml (+0/-1) src/Ubuntu/Components/1.2/TextArea.qml (+1/-2) src/Ubuntu/Components/1.2/mathUtils.js (+0/-61) src/Ubuntu/Components/1.2/scrollbarUtils.js (+0/-129) src/Ubuntu/Components/1.3/AdaptivePageLayout.qml (+82/-6) src/Ubuntu/Components/1.3/AnimatedItem.qml (+2/-3) src/Ubuntu/Components/1.3/AppHeader.qml (+0/-1) src/Ubuntu/Components/1.3/BottomEdgeHint.qml (+0/-155) src/Ubuntu/Components/1.3/Button.qml (+0/-1) src/Ubuntu/Components/1.3/CheckBox.qml (+0/-1) src/Ubuntu/Components/1.3/OptionSelector.qml (+0/-1) src/Ubuntu/Components/1.3/Page.qdoc (+0/-132) src/Ubuntu/Components/1.3/Page.qml (+100/-5) src/Ubuntu/Components/1.3/PageHeader.qml (+24/-5) src/Ubuntu/Components/1.3/PageStack.qml (+18/-0) src/Ubuntu/Components/1.3/PageTreeNode.qml (+0/-2) src/Ubuntu/Components/1.3/PageWrapper.qml (+2/-2) src/Ubuntu/Components/1.3/ProgressBar.qml (+0/-1) src/Ubuntu/Components/1.3/PullToRefresh.qml (+0/-1) src/Ubuntu/Components/1.3/Scrollbar.qml (+0/-1) src/Ubuntu/Components/1.3/Sections.qml (+0/-1) src/Ubuntu/Components/1.3/Slider.qml (+3/-4) src/Ubuntu/Components/1.3/TabBar.qml (+0/-1) src/Ubuntu/Components/1.3/TextArea.qml (+0/-1) src/Ubuntu/Components/1.3/TextCursor.qml (+0/-1) src/Ubuntu/Components/1.3/TextField.qml (+2/-1) src/Ubuntu/Components/1.3/TextInputPopover.qml (+0/-1) src/Ubuntu/Components/1.3/Toolbar.qml (+0/-1) src/Ubuntu/Components/1.3/ToolbarButton.qml (+0/-1) src/Ubuntu/Components/1.3/mathUtils.js (+0/-61) src/Ubuntu/Components/ComponentModule.pro (+0/-5) src/Ubuntu/Components/ListItems/1.3/ItemSelector.qml (+0/-1) src/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml (+0/-1) src/Ubuntu/Components/Pickers/1.3/DatePicker.qml (+0/-1) src/Ubuntu/Components/Pickers/1.3/Dialer.qml (+0/-1) src/Ubuntu/Components/Pickers/1.3/DialerHand.qml (+0/-1) src/Ubuntu/Components/Pickers/1.3/Picker.qml (+0/-1) src/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml (+0/-1) src/Ubuntu/Components/Popups/1.3/Dialog.qml (+0/-1) src/Ubuntu/Components/Popups/1.3/Popover.qml (+0/-1) src/Ubuntu/Components/Popups/1.3/SheetBase.qml (+0/-1) src/Ubuntu/Components/Styles/Styles.pro (+0/-4) src/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml (+1/-0) src/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml (+88/-11) src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml (+2/-2) src/Ubuntu/Components/Themes/Ambiance/1.3/ActivityIndicatorStyle.qml (+1/-1) src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml (+149/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml (+1/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml (+10/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml (+2/-2) src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml (+88/-11) src/Ubuntu/Components/Themes/Ambiance/1.3/scrollbarUtils.js (+0/-139) src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro (+3/-0) src/Ubuntu/Components/Themes/Ambiance/qmldir (+0/-1) src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.cpp (+46/-0) src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.h (+52/-0) src/Ubuntu/Components/plugin/gestures/damper.cpp (+24/-0) src/Ubuntu/Components/plugin/gestures/damper.h (+89/-0) src/Ubuntu/Components/plugin/gestures/ubuntugesturesqmlglobal.h (+24/-0) src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp (+958/-0) src/Ubuntu/Components/plugin/gestures/ucswipearea.h (+98/-0) src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h (+157/-0) src/Ubuntu/Components/plugin/plugin.cpp (+6/-1) src/Ubuntu/Components/plugin/plugin.pri (+15/-4) src/Ubuntu/Components/plugin/privates/threelabelsslot_p.cpp (+3/-3) src/Ubuntu/Components/plugin/quickutils.cpp (+2/-1) src/Ubuntu/Components/plugin/quickutils.h (+8/-0) src/Ubuntu/Components/plugin/shaders/shape.frag (+2/-6) src/Ubuntu/Components/plugin/shaders/shapeoverlay.frag (+2/-6) src/Ubuntu/Components/plugin/ucbottomedgehint.cpp (+388/-0) src/Ubuntu/Components/plugin/ucbottomedgehint.h (+92/-0) src/Ubuntu/Components/plugin/ucheader.cpp (+7/-2) src/Ubuntu/Components/plugin/ucimportversionchecker_p.cpp (+58/-0) src/Ubuntu/Components/plugin/ucimportversionchecker_p.h (+34/-0) src/Ubuntu/Components/plugin/uclabel.cpp (+1/-8) src/Ubuntu/Components/plugin/uclabel.h (+1/-2) src/Ubuntu/Components/plugin/uclistitem.cpp (+64/-10) src/Ubuntu/Components/plugin/uclistitem.h (+4/-0) src/Ubuntu/Components/plugin/uclistitem_p.h (+1/-0) src/Ubuntu/Components/plugin/uclistitemlayout.cpp (+20/-11) src/Ubuntu/Components/plugin/uclistitemlayout.h (+2/-1) src/Ubuntu/Components/plugin/ucmathutils.cpp (+81/-0) src/Ubuntu/Components/plugin/ucmathutils.h (+40/-0) src/Ubuntu/Components/plugin/ucqquickimageextension.cpp (+1/-1) src/Ubuntu/Components/plugin/ucslotslayout.cpp (+10/-2) src/Ubuntu/Components/plugin/ucslotslayout.h (+3/-2) src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+22/-32) src/Ubuntu/Components/plugin/ucstyleditembase.h (+8/-4) src/Ubuntu/Components/plugin/ucstyleditembase_p.h (+5/-3) src/Ubuntu/Components/plugin/uctheme.cpp (+36/-49) src/Ubuntu/Components/plugin/uctheme.h (+7/-4) src/Ubuntu/Components/plugin/ucthemingextension.cpp (+122/-139) src/Ubuntu/Components/plugin/ucthemingextension.h (+11/-56) src/Ubuntu/Components/plugin/ucubuntushape.cpp (+2/-0) src/Ubuntu/Components/plugin/unixsignalhandler_p.cpp (+1/-1) src/Ubuntu/Components/plugin/unixsignalhandler_p.h (+1/-1) src/Ubuntu/Components/qmldir (+0/-6) src/Ubuntu/Test/UbuntuTestCase.qml (+5/-0) src/Ubuntu/Test/plugin/plugin.pri (+4/-2) src/Ubuntu/Test/plugin/testplugin.cpp (+10/-0) src/Ubuntu/Test/plugin/ucmousetouchadaptor.cpp (+198/-0) src/Ubuntu/Test/plugin/ucmousetouchadaptor.h (+60/-0) src/Ubuntu/Test/plugin/uctestcase.cpp (+2/-1) src/Ubuntu/Test/plugin/uctestcase.h (+1/-1) src/Ubuntu/Test/plugin/uctestextras.cpp (+5/-0) src/Ubuntu/Test/plugin/uctestextras.h (+7/-1) src/Ubuntu/UbuntuGestures/UbuntuGestures.pro (+31/-0) src/Ubuntu/UbuntuGestures/candidateinactivitytimer.cpp (+46/-0) src/Ubuntu/UbuntuGestures/candidateinactivitytimer.h (+51/-0) src/Ubuntu/UbuntuGestures/debughelpers.cpp (+95/-0) src/Ubuntu/UbuntuGestures/debughelpers.h (+31/-0) src/Ubuntu/UbuntuGestures/pool.h (+132/-0) src/Ubuntu/UbuntuGestures/timer.cpp (+152/-0) src/Ubuntu/UbuntuGestures/timer.h (+117/-0) src/Ubuntu/UbuntuGestures/timesource.cpp (+47/-0) src/Ubuntu/UbuntuGestures/timesource.h (+62/-0) src/Ubuntu/UbuntuGestures/touchownershipevent.cpp (+35/-0) src/Ubuntu/UbuntuGestures/touchownershipevent.h (+50/-0) src/Ubuntu/UbuntuGestures/touchregistry.cpp (+520/-0) src/Ubuntu/UbuntuGestures/touchregistry.h (+206/-0) src/Ubuntu/UbuntuGestures/ubuntugesturesglobal.h (+23/-0) src/Ubuntu/UbuntuGestures/unownedtouchevent.cpp (+39/-0) src/Ubuntu/UbuntuGestures/unownedtouchevent.h (+45/-0) src/src.pro (+18/-4) sync.profile (+29/-0) tests/apicheck/apicheck.cpp (+103/-60) tests/apicheck/test/Extinct/Animals/test.qml (+2/-1) tests/apicheck/test/components.api (+1/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+3/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py (+2/-14) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+41/-5) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_sections.py (+2/-4) tests/license/checklicense.sh (+1/-1) tests/qmlapicheck.sh (+1/-1) tests/unit/add_makecheck.pri (+1/-1) tests/unit/add_qmlmakecheck.pri (+1/-1) tests/unit/tst_components/tst_math_utils.qml (+77/-0) tests/unit_x11/add_makecheck.pri (+1/-1) tests/unit_x11/add_qmlmakecheck.pri (+1/-1) tests/unit_x11/test-include.pri (+1/-1) tests/unit_x11/tst_components/tst_bottomedgehint.qml (+188/-20) tests/unit_x11/tst_components/tst_bug1510919.qml (+75/-0) tests/unit_x11/tst_components/tst_header.qml (+54/-2) tests/unit_x11/tst_components/tst_listitem_extras.qml (+81/-0) tests/unit_x11/tst_components/tst_multicolumnheader.qml (+113/-36) tests/unit_x11/tst_components/tst_pageheader.qml (+21/-3) tests/unit_x11/tst_components/tst_pagestack.qml (+29/-20) tests/unit_x11/tst_components/tst_slotslayout.qml (+30/-1) tests/unit_x11/tst_components/tst_textinput_common13.qml (+39/-0) tests/unit_x11/tst_deprecated_theme_engine/tst_deprecated_theme_engine.cpp (+1/-1) tests/unit_x11/tst_subtheming/OtherVersion.qml (+25/-0) tests/unit_x11/tst_subtheming/StyledItemAppThemeFallback.qml (+0/-24) tests/unit_x11/tst_subtheming/StyledItemAppThemeVersioned.qml (+0/-1) tests/unit_x11/tst_subtheming/StyledItemFallback.qml (+0/-24) tests/unit_x11/tst_subtheming/StyledItemV12.qml (+4/-4) tests/unit_x11/tst_subtheming/StyledItemV13.qml (+0/-1) tests/unit_x11/tst_subtheming/tst_subtheming.cpp (+45/-33) tests/unit_x11/tst_subtheming/tst_subtheming.pro (+2/-3) tests/unit_x11/tst_swipearea/DownwardsLauncher.qml (+72/-0) tests/unit_x11/tst_swipearea/GestureTest.cpp (+140/-0) tests/unit_x11/tst_swipearea/GestureTest.h (+92/-0) tests/unit_x11/tst_swipearea/LeftwardsLauncher.qml (+76/-0) tests/unit_x11/tst_swipearea/RightwardsLauncher.qml (+76/-0) tests/unit_x11/tst_swipearea/UpwardsLauncher.qml (+76/-0) tests/unit_x11/tst_swipearea/tst_swipearea.cpp (+1305/-0) tests/unit_x11/tst_swipearea/tst_swipearea.pro (+13/-0) tests/unit_x11/tst_swipearea/tst_swipearea.qml (+77/-0) tests/unit_x11/tst_touchregistry/tst_TouchRegistry.cpp (+915/-0) tests/unit_x11/tst_touchregistry/tst_touchregistry.pro (+6/-0) tests/unit_x11/unit_x11.pro (+3/-1) ubuntu-sdk.pro (+2/-1) ubuntu-ui-toolkit-launcher/launcher.cpp (+4/-3) Conflict adding file tests/unit_x11/tst_components/tst_bug1510919.qml. Moved existing file to tests/unit_x11/tst_components/tst_bug1510919.qml.moved. |
To merge this branch: | bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntushape-fragment-shader-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Peeters | Pending | ||
Review via email: mp+278444@code.launchpad.net |
Commit message
[UbuntShape] Cleaned up fragment shaders.
Moved distance* variables to main scope and removed useless abs() calls.
Description of the change
[UbuntShape] Cleaned up fragment shaders.
Moved distance* variables to main scope and removed useless abs() calls.
To post a comment you must log in.
Unmerged revisions
- 1725. By Loïc Molinari
-
Moved distance* variables to main scope and removed useless abs().
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'components.api' |
2 | --- components.api 2015-10-15 14:17:25 +0000 |
3 | +++ components.api 2015-11-24 12:22:14 +0000 |
4 | @@ -31,7 +31,7 @@ |
5 | Real |
6 | String |
7 | Ubuntu.Components.ActionBar 1.3: StyledItem |
8 | - readonly property Action actions |
9 | + property list<Action> actions |
10 | property Component delegate |
11 | property int numberOfSlots |
12 | Ubuntu.Components.Styles.ActionBarStyle 1.3: Item |
13 | @@ -41,7 +41,7 @@ |
14 | property url overflowIconSource |
15 | property string overflowText |
16 | Ubuntu.Components.ActionContext 1.0 0.1: QtObject |
17 | - default readonly property Action actions |
18 | + default property list<Action> actions |
19 | property bool active |
20 | function addAction(Action action) |
21 | function removeAction(Action action) |
22 | @@ -54,15 +54,15 @@ |
23 | function trigger() |
24 | property string text |
25 | Ubuntu.Components.ActionList 1.0 0.1: QtObject |
26 | - readonly property Action actions |
27 | - default readonly property Action children |
28 | + property list<Action> actions |
29 | + default property list<Action> children |
30 | Ubuntu.Components.ActionList 1.3: QtObject |
31 | - readonly property Action actions |
32 | - default readonly property Action children |
33 | + property list<Action> actions |
34 | + default property list<Action> children |
35 | Ubuntu.Components.ActionManager 1.0 0.1: QtObject |
36 | - default readonly property Action actions |
37 | + default property list<Action> actions |
38 | readonly property ActionContext globalContext |
39 | - readonly property ActionContext localContexts |
40 | + property list<ActionContext> localContexts |
41 | signal quit() |
42 | function addAction(Action action) |
43 | function removeAction(Action action) |
44 | @@ -84,7 +84,7 @@ |
45 | property bool running |
46 | Ubuntu.Components.AdaptivePageLayout 1.3: PageTreeNode |
47 | readonly property int columns |
48 | - readonly property PageColumnsLayout layouts |
49 | + property list<PageColumnsLayou> layouts |
50 | function var addPageToCurrentColumn(var sourcePage, var page, var properties) |
51 | function var addPageToNextColumn(var sourcePage, var page, var properties) |
52 | function var removePages(var page) |
53 | @@ -155,7 +155,7 @@ |
54 | property bool required |
55 | property QStringList valueNames |
56 | Ubuntu.Components.Arguments 1.0 0.1: QtObject |
57 | - default readonly property Argument arguments |
58 | + default property list<Argument> arguments |
59 | property Argument defaultArgument |
60 | readonly property bool error |
61 | readonly property string errorMessage |
62 | @@ -175,11 +175,17 @@ |
63 | property var icon |
64 | property bool iconFrame |
65 | property bool progression |
66 | -Ubuntu.Components.BottomEdgeHint 1.3: Item |
67 | - property string iconName |
68 | - property url iconSource |
69 | +Ubuntu.Components.BottomEdgeHint 1.3: ActionItem |
70 | + property int deactivateTimeout |
71 | + property Flickable flickable |
72 | signal clicked() |
73 | - property string text |
74 | + property Status status |
75 | + readonly property SwipeArea swipeArea |
76 | +Ubuntu.Components.BottomEdgeHint.Status: Enum |
77 | + Active |
78 | + Hidden |
79 | + Inactive |
80 | + Locked |
81 | Ubuntu.Components.Button 1.0 0.1: AbstractButton |
82 | property color color |
83 | property QFont font |
84 | @@ -221,14 +227,14 @@ |
85 | Ubuntu.Components.ColorUtils 0.1 1.0 |
86 | Ubuntu.Components.ComboButton 1.1: Button |
87 | property double collapsedHeight |
88 | - default readonly property QtObject comboList |
89 | + default property list<QtObject> comboList |
90 | readonly property double comboListHeight |
91 | property color dropdownColor |
92 | property bool expanded |
93 | property double expandedHeight |
94 | Ubuntu.Components.ComboButton 1.3: Button |
95 | property double collapsedHeight |
96 | - default readonly property QtObject comboList |
97 | + default property list<QtObject> comboList |
98 | readonly property double comboListHeight |
99 | property color dropdownColor |
100 | property bool expanded |
101 | @@ -318,7 +324,7 @@ |
102 | signal closeClicked() |
103 | signal doneClicked() |
104 | Ubuntu.Components.Pickers.Dialer 1.0 0.1: StyledItem |
105 | - readonly property QtObject centerContent |
106 | + property list<QtObject> centerContent |
107 | readonly property Item centerItem |
108 | property double handSpace |
109 | readonly property var hands |
110 | @@ -327,7 +333,7 @@ |
111 | property double minimumValue |
112 | property double size |
113 | Ubuntu.Components.Pickers.Dialer 1.3: StyledItem |
114 | - readonly property QtObject centerContent |
115 | + property list<QtObject> centerContent |
116 | readonly property Item centerItem |
117 | property double handSpace |
118 | readonly property var hands |
119 | @@ -339,18 +345,18 @@ |
120 | readonly property Dialer dialer |
121 | property DialerHandGroup hand |
122 | readonly property int index |
123 | - default readonly property QtObject overlay |
124 | + default property list<QtObject> overlay |
125 | property double value |
126 | Ubuntu.Components.Pickers.DialerHand 1.3: StyledItem |
127 | readonly property Dialer dialer |
128 | property DialerHandGroup hand |
129 | readonly property int index |
130 | - default readonly property QtObject overlay |
131 | + default property list<QtObject> overlay |
132 | property double value |
133 | Ubuntu.Components.Popups.Dialog 1.0 0.1: PopupBase |
134 | property Item caller |
135 | property double callerMargin |
136 | - default readonly property QtObject contents |
137 | + default property list<QtObject> contents |
138 | property double edgeMargins |
139 | property bool modal |
140 | property Item pointerTarget |
141 | @@ -359,34 +365,16 @@ |
142 | Ubuntu.Components.Popups.Dialog 1.3: PopupBase |
143 | property Item caller |
144 | property double callerMargin |
145 | - default readonly property QtObject contents |
146 | + default property list<QtObject> contents |
147 | property double edgeMargins |
148 | property bool modal |
149 | property Item pointerTarget |
150 | property string text |
151 | property string title |
152 | Ubuntu.Components.ListItems.Divider 1.0 0.1: QQuickImageBase |
153 | - property FillMode fillMode |
154 | - property HAlignment horizontalAlignment |
155 | - signal horizontalAlignmentChanged(HAlignment alignment) |
156 | - signal verticalAlignmentChanged(VAlignment alignment) |
157 | - signal mipmapChanged(bool ) |
158 | - property bool mipmap |
159 | - readonly property double paintedHeight |
160 | - readonly property double paintedWidth |
161 | - property VAlignment verticalAlignment |
162 | Ubuntu.Components.ListItems.Divider 1.3: QQuickImageBase |
163 | - property FillMode fillMode |
164 | - property HAlignment horizontalAlignment |
165 | - signal horizontalAlignmentChanged(HAlignment alignment) |
166 | - signal verticalAlignmentChanged(VAlignment alignment) |
167 | - signal mipmapChanged(bool ) |
168 | - property bool mipmap |
169 | - readonly property double paintedHeight |
170 | - readonly property double paintedWidth |
171 | - property VAlignment verticalAlignment |
172 | Ubuntu.Components.ListItems.Empty 1.0 0.1: AbstractButton |
173 | - readonly property Item backgroundIndicator |
174 | + property list<Item> backgroundIndicator |
175 | property bool confirmRemoval |
176 | readonly property ThinDivider divider |
177 | property bool highlightWhenPressed |
178 | @@ -398,7 +386,7 @@ |
179 | readonly property string swipingState |
180 | readonly property bool waitingConfirmationForRemoval |
181 | Ubuntu.Components.ListItems.Empty 1.3: AbstractButton |
182 | - readonly property Item backgroundIndicator |
183 | + property list<Item> backgroundIndicator |
184 | property bool confirmRemoval |
185 | readonly property ThinDivider divider |
186 | property bool highlightWhenPressed |
187 | @@ -510,7 +498,7 @@ |
188 | XxSmall |
189 | Ubuntu.Layouts.Layouts 1.0 0.1: Item |
190 | readonly property string currentLayout |
191 | - readonly property ConditionalLayout layouts |
192 | + property list<ConditionalLayout> layouts |
193 | Ubuntu.Components.ListItem 1.3 1.2: StyledItem |
194 | property Action action |
195 | property color color |
196 | @@ -523,18 +511,19 @@ |
197 | property color highlightColor |
198 | readonly property bool highlighted |
199 | property ListItemActions leadingActions |
200 | - readonly property Item listItemChildren |
201 | - default readonly property QtObject listItemData |
202 | + property list<Item> listItemChildren |
203 | + default property list<QtObject> listItemData |
204 | signal clicked() |
205 | signal pressAndHold() |
206 | signal contentMovementStarted() |
207 | signal contentMovementEnded() |
208 | property bool selectMode |
209 | property bool selected |
210 | + property bool swipeEnabled 1.3 |
211 | property ListItemActions trailingActions |
212 | Ubuntu.Components.ListItemActions 1.2: QtObject |
213 | - readonly property Action actions |
214 | - default readonly property QtObject data |
215 | + property list<Action> actions |
216 | + default property list<QtObject> data |
217 | property Component delegate |
218 | Ubuntu.Components.ListItemDrag 1.2: QtObject |
219 | property bool accept |
220 | @@ -572,27 +561,31 @@ |
221 | Second |
222 | Ubuntu.Components.MainView 1.0 0.1: MainViewBase |
223 | property bool automaticOrientation |
224 | - default readonly property QtObject contentsItem |
225 | + default property list<QtObject> contentsItem |
226 | property bool useDeprecatedToolbar |
227 | Ubuntu.Components.MainView 1.2: MainViewBase |
228 | property bool automaticOrientation |
229 | - default readonly property QtObject contentsItem |
230 | + default property list<QtObject> contentsItem |
231 | Ubuntu.Components.MainView 1.3: MainViewBase |
232 | property bool automaticOrientation |
233 | - default readonly property QtObject contentsItem |
234 | -Ubuntu.Components.MathUtils 0.1 1.0 1.3 |
235 | + default property list<QtObject> contentsItem |
236 | +Ubuntu.Components.MathUtils 1.0 0.1: QtObject singleton |
237 | + function double clamp(double x, double min, double max) |
238 | + function double lerp(double delta, double from, double to) |
239 | + function double projectValue(double x, double xmin, double xmax, double ymin, double ymax) |
240 | + function double clampAndProject(double x, double xmin, double xmax, double ymin, double ymax) |
241 | Ubuntu.Components.MimeData 1.0 0.1: QtObject |
242 | property color color |
243 | property var data |
244 | readonly property QStringList formats |
245 | property string html |
246 | property string text |
247 | - property QList<QUrl> urls |
248 | + property list<url> urls |
249 | Ubuntu.Components.Mouse 1.0 0.1: QtObject |
250 | readonly property Qt.MouseButtons acceptedButtons |
251 | property int clickAndHoldThreshold |
252 | property bool enabled |
253 | - readonly property Item forwardTo |
254 | + property list<Item> forwardTo |
255 | readonly property bool hoverEnabled |
256 | signal pressed(QQuickMouseEvent mouse, Item host) |
257 | signal released(QQuickMouseEvent mouse, Item host) |
258 | @@ -606,12 +599,15 @@ |
259 | Ubuntu.Components.Mouse.Priority: Enum |
260 | AfterItem |
261 | BeforeItem |
262 | +Ubuntu.Test.MouseTouchAdaptor 1.0: QtObject singleton |
263 | + property bool enabled |
264 | + signal enabledChanged(bool value) |
265 | Ubuntu.Components.ListItems.MultiValue 1.0 0.1: Base |
266 | property var values |
267 | Ubuntu.Components.ListItems.MultiValue 1.3: Base |
268 | property var values |
269 | Ubuntu.Components.Object 1.0 0.1: QtObject |
270 | - default readonly property QtObject children |
271 | + default property list<QtObject> children |
272 | Ubuntu.Components.OptionSelector 1.0 0.1: Empty |
273 | property bool colourImage |
274 | property double containerHeight |
275 | @@ -665,11 +661,11 @@ |
276 | readonly property bool rotating |
277 | property bool transitionEnabled |
278 | Ubuntu.Components.Page 1.0 0.1: PageTreeNode |
279 | - readonly property Action actions |
280 | + property list<Action> actions |
281 | property Flickable flickable |
282 | property string title |
283 | property Item tools |
284 | -Ubuntu.Components.Page 1.1: Page |
285 | +Ubuntu.Components.Page 1.1: Page10 |
286 | readonly property PageHeadConfiguration head |
287 | Ubuntu.Components.Page 1.3: PageTreeNode |
288 | property Flickable flickable |
289 | @@ -682,17 +678,17 @@ |
290 | property double minimumWidth |
291 | property double preferredWidth |
292 | Ubuntu.Components.PageColumnsLayout 1.3: QtObject |
293 | - default readonly property PageColumn data |
294 | + default property list<PageColum> data |
295 | property bool when |
296 | Ubuntu.Components.PageHeadConfiguration 1.1: Object |
297 | - readonly property Action actions |
298 | + property list<Action> actions |
299 | property Action backAction |
300 | property Item contents |
301 | property color foregroundColor |
302 | property string preset |
303 | readonly property PageHeadSections sections |
304 | Ubuntu.Components.PageHeadConfiguration 1.3: Object |
305 | - readonly property Action actions |
306 | + property list<Action> actions |
307 | property Action backAction |
308 | property Item contents |
309 | property Flickable flickable |
310 | @@ -707,17 +703,17 @@ |
311 | property var model |
312 | property int selectedIndex |
313 | Ubuntu.Components.PageHeadSections 1.3: QtObject |
314 | - readonly property Action actions |
315 | + property list<Action> actions |
316 | property bool enabled |
317 | property var model |
318 | property int selectedIndex |
319 | Ubuntu.Components.PageHeadState 1.1: State |
320 | - readonly property Action actions |
321 | + property list<Action> actions |
322 | property Action backAction |
323 | property Item contents |
324 | property PageHeadConfiguration head |
325 | Ubuntu.Components.PageHeadState 1.3: State |
326 | - readonly property Action actions |
327 | + property list<Action> actions |
328 | property Action backAction |
329 | property Item contents |
330 | property PageHeadConfiguration head |
331 | @@ -743,6 +739,7 @@ |
332 | Ubuntu.Components.PageHeader 1.3: Header |
333 | property Item contents |
334 | readonly property ActionBar leadingActionBar |
335 | + property list<Action> navigationActions |
336 | readonly property Sections sections |
337 | property string title |
338 | readonly property ActionBar trailingActionBar |
339 | @@ -799,7 +796,7 @@ |
340 | property int align |
341 | property bool animate |
342 | readonly property bool animating |
343 | - default readonly property QtObject contents |
344 | + default property list<QtObject> contents |
345 | property int hideTimeout |
346 | property double hintSize |
347 | property bool locked |
348 | @@ -813,7 +810,7 @@ |
349 | property int align |
350 | property bool animate |
351 | readonly property bool animating |
352 | - default readonly property QtObject contents |
353 | + default property list<QtObject> contents |
354 | property int hideTimeout |
355 | property double hintSize |
356 | property bool locked |
357 | @@ -854,7 +851,7 @@ |
358 | property bool autoClose |
359 | property Item caller |
360 | property double callerMargin |
361 | - default readonly property QtObject container |
362 | + default property list<QtObject> container |
363 | property double contentHeight |
364 | property double contentWidth |
365 | property double edgeMargins |
366 | @@ -866,7 +863,7 @@ |
367 | property bool autoClose |
368 | property Item caller |
369 | property double callerMargin |
370 | - default readonly property QtObject container |
371 | + default property list<QtObject> container |
372 | property double contentHeight |
373 | property double contentWidth |
374 | property double edgeMargins |
375 | @@ -935,9 +932,8 @@ |
376 | Ubuntu.Components.Scrollbar 1.3: StyledItem |
377 | property int align |
378 | property Flickable flickableItem |
379 | -Ubuntu.Components.ScrollbarUtils 0.1 1.0 |
380 | Ubuntu.Components.Sections 1.3: StyledItem |
381 | - readonly property Action actions |
382 | + property list<Action> actions |
383 | property var model |
384 | property int selectedIndex |
385 | Ubuntu.Components.ServiceProperties 1.1: QtObject |
386 | @@ -958,13 +954,13 @@ |
387 | Inactive |
388 | Synchronizing |
389 | Ubuntu.Components.Popups.SheetBase 1.0 0.1: PopupBase |
390 | - default readonly property QtObject container |
391 | + default property list<QtObject> container |
392 | property double contentsHeight |
393 | property double contentsWidth |
394 | property bool modal |
395 | property string title |
396 | Ubuntu.Components.Popups.SheetBase 1.3: PopupBase |
397 | - default readonly property QtObject container |
398 | + default property list<QtObject> container |
399 | property double contentsHeight |
400 | property double contentsWidth |
401 | property bool modal |
402 | @@ -1049,6 +1045,26 @@ |
403 | property string subText |
404 | Ubuntu.Components.ListItems.Subtitled 1.3: Base |
405 | property string subText |
406 | +Ubuntu.Components.SwipeArea 1.3: Item |
407 | + property Direction direction |
408 | + readonly property double distance |
409 | + readonly property bool dragging |
410 | + property bool immediateRecognition |
411 | + signal directionChanged(Direction direction) |
412 | + signal draggingChanged(bool dragging) |
413 | + signal pressedChanged(bool pressed) |
414 | + signal distanceChanged(double distance) |
415 | + signal touchPositionChanged(QPointF position) |
416 | + signal immediateRecognitionChanged(bool immediateRecognition) |
417 | + readonly property bool pressed |
418 | + readonly property QPointF touchPosition |
419 | +Ubuntu.Components.SwipeArea.Direction: Enum |
420 | + Downwards |
421 | + Horizontal |
422 | + Leftwards |
423 | + Rightwards |
424 | + Upwards |
425 | + Vertical |
426 | Ubuntu.Components.SwipeEvent 1.2: QtObject |
427 | property QPointF content |
428 | readonly property QPointF from |
429 | @@ -1094,14 +1110,14 @@ |
430 | readonly property Tab selectedTab |
431 | property int selectedTabIndex |
432 | property TabBar tabBar |
433 | - default readonly property QtObject tabChildren |
434 | + default property list<QtObject> tabChildren |
435 | Ubuntu.Components.Tabs 1.3: PageTreeNode |
436 | readonly property int count |
437 | readonly property Item currentPage |
438 | readonly property Tab selectedTab |
439 | property int selectedTabIndex |
440 | property TabBar tabBar |
441 | - default readonly property QtObject tabChildren |
442 | + default property list<QtObject> tabChildren |
443 | Ubuntu.Test.TestExtras 1.0: QtObject singleton |
444 | function string openGLflavor() |
445 | function string cpuArchitecture() |
446 | @@ -1284,10 +1300,10 @@ |
447 | property bool persistentSelection |
448 | property string placeholderText |
449 | property var popover |
450 | - readonly property QtObject primaryItem |
451 | + property list<QtObject> primaryItem |
452 | property bool readOnly |
453 | property int renderType |
454 | - readonly property QtObject secondaryItem |
455 | + property list<QtObject> secondaryItem |
456 | property bool selectByMouse |
457 | readonly property string selectedText |
458 | property color selectedTextColor |
459 | @@ -1345,10 +1361,10 @@ |
460 | property bool persistentSelection |
461 | property string placeholderText |
462 | property var popover |
463 | - readonly property QtObject primaryItem |
464 | + property list<QtObject> primaryItem |
465 | property bool readOnly |
466 | property int renderType |
467 | - readonly property QtObject secondaryItem |
468 | + property list<QtObject> secondaryItem |
469 | property bool selectByMouse |
470 | readonly property string selectedText |
471 | property color selectedTextColor |
472 | @@ -1363,7 +1379,6 @@ |
473 | property string name |
474 | property QtObject palette |
475 | readonly property ThemeSettings parentTheme |
476 | - property ushort version |
477 | Ubuntu.Components.ListItems.ThinDivider 1.0 0.1: Rectangle |
478 | Ubuntu.Components.ListItems.ThinDivider 1.3: Rectangle |
479 | Ubuntu.Components.ToolbarButton 1.0 0.1: StyledItem |
480 | @@ -1384,13 +1399,13 @@ |
481 | property string text |
482 | Ubuntu.Components.ToolbarItems 1.0 0.1: Item |
483 | property Item back |
484 | - default readonly property QtObject contents |
485 | + default property list<QtObject> contents |
486 | property bool locked |
487 | property bool opened |
488 | property Item pageStack |
489 | Ubuntu.Components.ToolbarItems 1.3: Item |
490 | property Item back |
491 | - default readonly property QtObject contents |
492 | + default property list<QtObject> contents |
493 | property bool locked |
494 | property bool opened |
495 | property Item pageStack |
496 | @@ -1400,7 +1415,6 @@ |
497 | Ubuntu.Components.UCFontUtils 1.0 0.1: QtObject |
498 | function double sizeToPixels(string size) |
499 | function double modularScale(string size) |
500 | -UCItemAttached: QtObject |
501 | UCListItemDivider: Item |
502 | property color colorFrom |
503 | property color colorTo |
504 | @@ -1531,6 +1545,7 @@ |
505 | function var typeString(var string) |
506 | function var warningFormat(var line, var column, var message) |
507 | function var waitForHeaderAnimation(var mainView) |
508 | + readonly property QuickTestUtil testUtil |
509 | Ubuntu.Components.UriHandler 1.0 0.1: QtObject singleton |
510 | signal opened(QStringList uris) |
511 | Ubuntu.Components.ListItems.ValueSelector 1.0 0.1: Empty |
512 | @@ -1551,12 +1566,12 @@ |
513 | property var values |
514 | Ubuntu.Components.ViewItems 1.2: QtObject |
515 | property bool dragMode |
516 | - property QList<int> expandedIndices |
517 | + property list<int> expandedIndices |
518 | property int expansionFlags |
519 | signal dragUpdated(ListItemDrag event) |
520 | - signal expandedIndicesChanged(QList<int> indices) |
521 | + signal expandedIndicesChanged(list<int> indices) |
522 | property bool selectMode |
523 | - property QList<int> selectedIndices |
524 | + property list<int> selectedIndices |
525 | Ubuntu.Components.ViewItems.ExpansionFlag: Enum |
526 | CollapseOnOutsidePress |
527 | Exclusive |
528 | |
529 | === modified file 'debian/control' |
530 | --- debian/control 2015-10-09 08:23:09 +0000 |
531 | +++ debian/control 2015-11-24 12:22:14 +0000 |
532 | @@ -9,6 +9,7 @@ |
533 | python3:any, |
534 | qml-module-qtgraphicaleffects | libqt5qml-graphicaleffects, |
535 | libinput-dev, |
536 | + libxkbcommon-dev, |
537 | qtbase5-dev, |
538 | qtbase5-private-dev, |
539 | qttools5-dev-tools, |
540 | @@ -73,6 +74,7 @@ |
541 | suru-icon-theme, |
542 | ttf-ubuntu-font-family, |
543 | ubuntu-ui-toolkit-theme (= ${binary:Version}), |
544 | + libubuntugestures (= ${binary:Version}), |
545 | ${misc:Depends}, |
546 | ${shlibs:Depends}, |
547 | Conflicts: qt-components-ubuntu |
548 | @@ -84,6 +86,28 @@ |
549 | . |
550 | This package contains the Ubuntu Components QML plugin. |
551 | |
552 | + |
553 | +Package: libubuntugestures |
554 | +Architecture: any |
555 | +Multi-Arch: same |
556 | +Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends} |
557 | +Depends: ${misc:Depends}, |
558 | + ${shlibs:Depends}, |
559 | +Description: Ubuntu gestures library - SwipeArea |
560 | + Ubuntu gestures library with SwipeArea |
561 | + |
562 | +Package: libubuntugestures-dev |
563 | +Architecture: any |
564 | +Multi-Arch: same |
565 | +Pre-Depends: dpkg (>= 1.15.6~), ${misc:Pre-Depends} |
566 | +Depends: ${misc:Depends}, |
567 | + ${shlibs:Depends}, |
568 | +Description: Ubuntu gestures library development files |
569 | + This package contains the development files for |
570 | + Ubuntu gestures library with SwipeArea |
571 | + |
572 | + |
573 | + |
574 | Package: ubuntu-ui-toolkit-theme |
575 | Architecture: any |
576 | Multi-Arch: foreign |
577 | |
578 | === added file 'debian/libubuntugestures-dev.install' |
579 | --- debian/libubuntugestures-dev.install 1970-01-01 00:00:00 +0000 |
580 | +++ debian/libubuntugestures-dev.install 2015-11-24 12:22:14 +0000 |
581 | @@ -0,0 +1,28 @@ |
582 | +usr/include/*/qt5/UbuntuGestures/ubuntugesturesglobal.h |
583 | +usr/include/*/qt5/UbuntuGestures/CandidateInactivityTimer |
584 | +usr/include/*/qt5/UbuntuGestures/TouchOwnershipEvent |
585 | +usr/include/*/qt5/UbuntuGestures/UbuntuGestures |
586 | +usr/include/*/qt5/UbuntuGestures/pool.h |
587 | +usr/include/*/qt5/UbuntuGestures/unownedtouchevent.h |
588 | +usr/include/*/qt5/UbuntuGestures/DebugHelpers |
589 | +usr/include/*/qt5/UbuntuGestures/debughelpers.h |
590 | +usr/include/*/qt5/UbuntuGestures/touchownershipevent.h |
591 | +usr/include/*/qt5/UbuntuGestures/touchregistry.h |
592 | +usr/include/*/qt5/UbuntuGestures/UbuntuGesturesDepends |
593 | +usr/include/*/qt5/UbuntuGestures/timesource.h |
594 | +usr/include/*/qt5/UbuntuGestures/TimeSource |
595 | +usr/include/*/qt5/UbuntuGestures/timer.h |
596 | +usr/include/*/qt5/UbuntuGestures/UnownedTouchEvent |
597 | +usr/include/*/qt5/UbuntuGestures/TouchRegistry |
598 | +usr/include/*/qt5/UbuntuGestures/Pool |
599 | +usr/include/*/qt5/UbuntuGestures/ubuntugesturesversion.h |
600 | +usr/include/*/qt5/UbuntuGestures/Timer |
601 | +usr/include/*/qt5/UbuntuGestures/candidateinactivitytimer.h |
602 | +usr/include/*/qt5/UbuntuGestures/UbuntuGesturesVersion |
603 | +usr/lib/*/libUbuntuGestures.prl |
604 | +usr/lib/*/libUbuntuGestures.la |
605 | +usr/lib/*/libUbuntuGestures.so |
606 | +usr/lib/*/pkgconfig/UbuntuGestures.pc |
607 | +usr/lib/*/qt5/mkspecs/modules/qt_lib_UbuntuGestures.pri |
608 | +usr/lib/*/qt5/mkspecs/modules/qt_lib_UbuntuGestures_private.pri |
609 | + |
610 | |
611 | === added file 'debian/libubuntugestures.install' |
612 | --- debian/libubuntugestures.install 1970-01-01 00:00:00 +0000 |
613 | +++ debian/libubuntugestures.install 2015-11-24 12:22:14 +0000 |
614 | @@ -0,0 +1,1 @@ |
615 | +usr/lib/*/libUbuntuGestures.so.* |
616 | |
617 | === modified file 'documentation/overview.qdoc' |
618 | --- documentation/overview.qdoc 2015-04-15 06:40:40 +0000 |
619 | +++ documentation/overview.qdoc 2015-11-24 12:22:14 +0000 |
620 | @@ -37,6 +37,13 @@ |
621 | \endcode |
622 | \annotatedlist ubuntu |
623 | |
624 | + \part Gestures |
625 | + Available through: |
626 | + \code |
627 | + import Ubuntu.Components 1.3 |
628 | + \endcode |
629 | + \annotatedlist ubuntu-gestures |
630 | + |
631 | \part List views, list items |
632 | Components with standardized view items, with conditional actions, multiselect |
633 | and reordering support on scrollable views. Replaces the Ubuntu.Components.ListItems |
634 | |
635 | === modified file 'examples/ubuntu-ui-toolkit-gallery/About.qml' |
636 | --- examples/ubuntu-ui-toolkit-gallery/About.qml 2015-09-24 19:36:36 +0000 |
637 | +++ examples/ubuntu-ui-toolkit-gallery/About.qml 2015-11-24 12:22:14 +0000 |
638 | @@ -30,9 +30,8 @@ |
639 | anchors.fill: parent |
640 | color: theme.palette.normal.background |
641 | } |
642 | - head { |
643 | - title: i18n.tr('About...') |
644 | - foregroundColor: theme.palette.selected.foregroundText |
645 | + header: PageHeader { |
646 | + title: i18n.tr("About...") |
647 | } |
648 | |
649 | Column { |
650 | |
651 | === renamed file 'examples/ubuntu-ui-toolkit-gallery/BottomEdgeHint.qml' => 'examples/ubuntu-ui-toolkit-gallery/BottomEdgePage.qml' |
652 | === modified file 'examples/ubuntu-ui-toolkit-gallery/ListItemLayouts.qml' |
653 | --- examples/ubuntu-ui-toolkit-gallery/ListItemLayouts.qml 2015-09-30 21:14:25 +0000 |
654 | +++ examples/ubuntu-ui-toolkit-gallery/ListItemLayouts.qml 2015-11-24 12:22:14 +0000 |
655 | @@ -28,7 +28,7 @@ |
656 | |
657 | ListItem { |
658 | id: addressbookListItem |
659 | - height: addressbookLayout.height |
660 | + height: addressbookLayout.height + (divider.visible ? divider.height : 0) |
661 | |
662 | ListItemLayout { |
663 | id: addressbookLayout |
664 | @@ -48,7 +48,7 @@ |
665 | |
666 | ListItem { |
667 | id: addressbookDetailsListItem |
668 | - height: addressbookDetailsLayout.height + divider.height |
669 | + height: addressbookDetailsLayout.height + (divider.visible ? divider.height : 0) |
670 | ListItemLayout { |
671 | id: addressbookDetailsLayout |
672 | |
673 | @@ -73,7 +73,7 @@ |
674 | ListItem { |
675 | id: telegramContactsListItem |
676 | |
677 | - height: telegramContactsLayout.height |
678 | + height: telegramContactsLayout.height + (divider.visible ? divider.height : 0) |
679 | |
680 | ListItemLayout { |
681 | id: telegramContactsLayout |
682 | @@ -92,7 +92,7 @@ |
683 | |
684 | ListItem { |
685 | id: systemSettings1 |
686 | - height: systemSettings1_layout.height |
687 | + height: systemSettings1_layout.height + (divider.visible ? divider.height : 0) |
688 | |
689 | ListItemLayout { |
690 | id: systemSettings1_layout |
691 | @@ -110,7 +110,7 @@ |
692 | |
693 | ListItem { |
694 | id: systemSettings2 |
695 | - height: systemSettings2_layout.height |
696 | + height: systemSettings2_layout.height + (divider.visible ? divider.height : 0) |
697 | |
698 | ListItemLayout { |
699 | id: systemSettings2_layout |
700 | @@ -129,7 +129,7 @@ |
701 | |
702 | ListItem { |
703 | id: systemSettings3 |
704 | - height: systemSettings3_layout.height |
705 | + height: systemSettings3_layout.height + (divider.visible ? divider.height : 0) |
706 | |
707 | ListItemLayout { |
708 | id: systemSettings3_layout |
709 | @@ -157,7 +157,7 @@ |
710 | spacing: 0 |
711 | |
712 | ListItem { |
713 | - height: customLabelsLayout.height |
714 | + height: customLabelsLayout.height + (divider.visible ? divider.height : 0) |
715 | |
716 | ListItemLayout { |
717 | id: customLabelsLayout |
718 | @@ -220,7 +220,7 @@ |
719 | |
720 | ListItem { |
721 | id: dialerHistoryListItem |
722 | - height: dialerHistoryLayout.height |
723 | + height: dialerHistoryLayout.height + (divider.visible ? divider.height : 0) |
724 | |
725 | ListItemLayout { |
726 | id: dialerHistoryLayout |
727 | |
728 | === modified file 'examples/ubuntu-ui-toolkit-gallery/ListItemWithLabel.qml' |
729 | --- examples/ubuntu-ui-toolkit-gallery/ListItemWithLabel.qml 2015-09-28 12:26:13 +0000 |
730 | +++ examples/ubuntu-ui-toolkit-gallery/ListItemWithLabel.qml 2015-11-24 12:22:14 +0000 |
731 | @@ -20,7 +20,7 @@ |
732 | ListItem { |
733 | property alias title: layout.title |
734 | |
735 | - height: layout.height |
736 | + height: layout.height + (divider.visible ? divider.height : 0) |
737 | onPressAndHold: selectMode = !selectMode |
738 | |
739 | ListItemLayout { id: layout } |
740 | |
741 | === modified file 'examples/ubuntu-ui-toolkit-gallery/MainPage.qml' |
742 | --- examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2015-09-30 05:59:49 +0000 |
743 | +++ examples/ubuntu-ui-toolkit-gallery/MainPage.qml 2015-11-24 12:22:14 +0000 |
744 | @@ -21,37 +21,54 @@ |
745 | id: mainPage |
746 | title: "Ubuntu UI Toolkit" |
747 | |
748 | - head.actions: [ |
749 | - Action { |
750 | - text: i18n.tr('Right to Left') |
751 | - iconName: 'flash-on' |
752 | - visible: !gallery.rtl |
753 | - onTriggered: gallery.rtl = !gallery.rtl |
754 | - }, |
755 | - Action { |
756 | - text: i18n.tr('Left to Right') |
757 | - iconName: 'flash-off' |
758 | - visible: gallery.rtl |
759 | - onTriggered: gallery.rtl = !gallery.rtl |
760 | - }, |
761 | - Action { |
762 | - text: i18n.tr('Use dark theme') |
763 | - iconName: 'torch-on' |
764 | - visible: gallery.theme.name == 'Ubuntu.Components.Themes.Ambiance' |
765 | - onTriggered: gallery.theme.name = 'Ubuntu.Components.Themes.SuruDark' |
766 | - }, |
767 | - Action { |
768 | - text: i18n.tr('Use light theme') |
769 | - iconName: 'torch-off' |
770 | - visible: gallery.theme.name == 'Ubuntu.Components.Themes.SuruDark' |
771 | - onTriggered: gallery.theme.name = 'Ubuntu.Components.Themes.Ambiance' |
772 | - }, |
773 | - Action { |
774 | - text: i18n.tr('About') |
775 | - iconName: "info" |
776 | - onTriggered: mainPage.pageStack.addPageToCurrentColumn(mainPage, Qt.resolvedUrl("About.qml")) |
777 | - } |
778 | - ] |
779 | + header: PageHeader { |
780 | + title: mainPage.title |
781 | + flickable: layout.columns === 1 ? widgetList : null |
782 | + trailingActionBar.actions: [ |
783 | + Action { |
784 | + text: i18n.tr('Right to Left') |
785 | + iconName: 'flash-on' |
786 | + visible: !gallery.rtl |
787 | + onTriggered: gallery.rtl = !gallery.rtl |
788 | + }, |
789 | + Action { |
790 | + text: i18n.tr('Left to Right') |
791 | + iconName: 'flash-off' |
792 | + visible: gallery.rtl |
793 | + onTriggered: gallery.rtl = !gallery.rtl |
794 | + }, |
795 | + Action { |
796 | + text: i18n.tr('Use dark theme') |
797 | + iconName: 'torch-on' |
798 | + visible: gallery.theme.name == 'Ubuntu.Components.Themes.Ambiance' |
799 | + onTriggered: gallery.theme.name = 'Ubuntu.Components.Themes.SuruDark' |
800 | + }, |
801 | + Action { |
802 | + text: i18n.tr('Use light theme') |
803 | + iconName: 'torch-off' |
804 | + visible: gallery.theme.name == 'Ubuntu.Components.Themes.SuruDark' |
805 | + onTriggered: gallery.theme.name = 'Ubuntu.Components.Themes.Ambiance' |
806 | + }, |
807 | + Action { |
808 | + id: aboutAction |
809 | + text: i18n.tr('About') |
810 | + iconName: "info" |
811 | + onTriggered: mainPage.pageStack.addPageToCurrentColumn(mainPage, Qt.resolvedUrl("About.qml")) |
812 | + }, |
813 | + Action { |
814 | + text: i18n.tr("Deactivate mouse") |
815 | + iconName: "non-starred" |
816 | + visible: QuickUtils.mouseAttached |
817 | + onTriggered: QuickUtils.mouseAttached = false |
818 | + }, |
819 | + Action { |
820 | + text: i18n.tr("Activate mouse") |
821 | + iconName: "starred" |
822 | + visible: !QuickUtils.mouseAttached |
823 | + onTriggered: QuickUtils.mouseAttached = true |
824 | + } |
825 | + ] |
826 | + } |
827 | |
828 | onActiveChanged: { |
829 | if (layout.columns < 2) { |
830 | @@ -62,59 +79,63 @@ |
831 | } |
832 | } |
833 | |
834 | - Rectangle { |
835 | - color: Qt.rgba(0.0, 0.0, 0.0, 0.01) |
836 | - anchors.fill: parent |
837 | - |
838 | - UbuntuListView { |
839 | - id: widgetList |
840 | - objectName: "widgetList" |
841 | - anchors.fill: parent |
842 | - model: WidgetsModel {} |
843 | - currentIndex: -1 |
844 | - |
845 | - onCurrentIndexChanged: openPage() |
846 | - |
847 | - function openPage() { |
848 | - if (!mainPage.active || currentIndex < 0) return; |
849 | - var modelData = model.get(currentIndex); |
850 | - var source = Qt.resolvedUrl(modelData.source); |
851 | - mainPage.pageStack.addPageToNextColumn(mainPage, source, {title: modelData.label}); |
852 | - } |
853 | - |
854 | - delegate: ListItem { |
855 | - objectName: model.objectName |
856 | - contentItem { |
857 | - anchors.leftMargin: units.gu(2) |
858 | - anchors.rightMargin: units.gu(2) |
859 | - } |
860 | - enabled: source != "" |
861 | - // Used by Autopilot |
862 | - property string text: label |
863 | - onClicked: widgetList.currentIndex = index |
864 | - Label { |
865 | - id: labelItem |
866 | - anchors { |
867 | - fill: parent |
868 | - rightMargin: units.gu(4) |
869 | - } |
870 | - text: label |
871 | - verticalAlignment: Text.AlignVCenter |
872 | - } |
873 | - Icon { |
874 | - name: "next" |
875 | - width: units.gu(2) |
876 | - height: units.gu(2) |
877 | - anchors { |
878 | - verticalCenter: parent.verticalCenter |
879 | - right: parent.right |
880 | - } |
881 | - } |
882 | - } |
883 | - highlight: Rectangle { |
884 | - color: theme.palette.selected.background |
885 | - } |
886 | - highlightMoveDuration: 0 |
887 | - } |
888 | + UbuntuListView { |
889 | + id: widgetList |
890 | + objectName: "widgetList" |
891 | + anchors { |
892 | + fill: parent |
893 | + topMargin: mainPage.header.flickable ? 0 : mainPage.header.height |
894 | + } |
895 | + |
896 | + model: WidgetsModel {} |
897 | + currentIndex: -1 |
898 | + |
899 | + onCurrentIndexChanged: openPage() |
900 | + |
901 | + function openPage() { |
902 | + if (!mainPage.active || currentIndex < 0) return; |
903 | + var modelData = model.get(currentIndex); |
904 | + var source = Qt.resolvedUrl(modelData.source); |
905 | + mainPage.pageStack.addPageToNextColumn(mainPage, source, {title: modelData.label}); |
906 | + } |
907 | + |
908 | + delegate: ListItem { |
909 | + objectName: model.objectName |
910 | + contentItem { |
911 | + anchors.leftMargin: units.gu(2) |
912 | + anchors.rightMargin: units.gu(2) |
913 | + } |
914 | + enabled: source != "" |
915 | + // Used by Autopilot |
916 | + property string text: label |
917 | + onClicked: widgetList.currentIndex = index |
918 | + Label { |
919 | + id: labelItem |
920 | + anchors { |
921 | + fill: parent |
922 | + rightMargin: units.gu(4) |
923 | + } |
924 | + text: label |
925 | + verticalAlignment: Text.AlignVCenter |
926 | + } |
927 | + Icon { |
928 | + name: "next" |
929 | + width: units.gu(2) |
930 | + height: units.gu(2) |
931 | + anchors { |
932 | + verticalCenter: parent.verticalCenter |
933 | + right: parent.right |
934 | + } |
935 | + } |
936 | + } |
937 | + highlight: Rectangle { |
938 | + color: theme.palette.selected.background |
939 | + } |
940 | + highlightMoveDuration: 0 |
941 | + } |
942 | + |
943 | + BottomEdgeHint { |
944 | + flickable: widgetList |
945 | + action: aboutAction |
946 | } |
947 | } |
948 | |
949 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Sections.qml' |
950 | --- examples/ubuntu-ui-toolkit-gallery/Sections.qml 2015-07-03 16:19:59 +0000 |
951 | +++ examples/ubuntu-ui-toolkit-gallery/Sections.qml 2015-11-24 12:22:14 +0000 |
952 | @@ -19,7 +19,13 @@ |
953 | |
954 | Template { |
955 | objectName: "sectionsTemplate" |
956 | - head.sections.model: ["first", "second", "third"] |
957 | + id: sectionsTemplate |
958 | + |
959 | + header: PageHeader { |
960 | + title: sectionsTemplate.title |
961 | + sections.model: ["first", "second", "third"] |
962 | + } |
963 | + |
964 | TemplateSection { |
965 | title: "Sections" |
966 | className: "Sections" |
967 | |
968 | === added file 'examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml' |
969 | --- examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml 1970-01-01 00:00:00 +0000 |
970 | +++ examples/ubuntu-ui-toolkit-gallery/SwipeAreaPage.qml 2015-11-24 12:22:14 +0000 |
971 | @@ -0,0 +1,144 @@ |
972 | +/* |
973 | + * Copyright 2015 Canonical Ltd. |
974 | + * |
975 | + * This program is free software; you can redistribute it and/or modify |
976 | + * it under the terms of the GNU Lesser General Public License as published by |
977 | + * the Free Software Foundation; version 3. |
978 | + * |
979 | + * This program is distributed in the hope that it will be useful, |
980 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
981 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
982 | + * GNU Lesser General Public License for more details. |
983 | + * |
984 | + * You should have received a copy of the GNU Lesser General Public License |
985 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
986 | + */ |
987 | + |
988 | +import QtQuick 2.4 |
989 | +import Ubuntu.Components 1.3 |
990 | + |
991 | +Template { |
992 | + objectName: "SwipeAreaTemplate" |
993 | + scrollable: !(upwards.dragging | downwards.dragging | |
994 | + rightwards.dragging | leftwards.dragging) |
995 | + |
996 | + TemplateSection { |
997 | + className: "SwipeArea" |
998 | + |
999 | + TemplateRow { |
1000 | + title: i18n.tr("Upwards") |
1001 | + Rectangle { |
1002 | + width: units.gu(40) |
1003 | + height: units.gu(20) |
1004 | + color: theme.palette.normal.foreground |
1005 | + |
1006 | + SwipeArea { |
1007 | + id: upwards |
1008 | + direction: SwipeArea.Upwards |
1009 | + anchors { |
1010 | + left: parent.left |
1011 | + right: parent.right |
1012 | + bottom: parent.bottom |
1013 | + } |
1014 | + height: units.gu(4) |
1015 | + Label { |
1016 | + text: i18n.tr("Upwards") |
1017 | + color: theme.palette.normal.foregroundText |
1018 | + anchors { |
1019 | + centerIn: parent |
1020 | + verticalCenterOffset: parent.dragging ? -parent.distance : 0 |
1021 | + } |
1022 | + } |
1023 | + } |
1024 | + } |
1025 | + } |
1026 | + |
1027 | + TemplateRow { |
1028 | + title: i18n.tr("Downwards") |
1029 | + Rectangle { |
1030 | + width: units.gu(40) |
1031 | + height: units.gu(20) |
1032 | + color: theme.palette.normal.foreground |
1033 | + |
1034 | + SwipeArea { |
1035 | + id: downwards |
1036 | + direction: SwipeArea.Downwards |
1037 | + anchors { |
1038 | + left: parent.left |
1039 | + right: parent.right |
1040 | + top: parent.top |
1041 | + } |
1042 | + height: units.gu(5) |
1043 | + Label { |
1044 | + text: i18n.tr("Downwards") |
1045 | + color: theme.palette.normal.foregroundText |
1046 | + anchors { |
1047 | + centerIn: parent |
1048 | + verticalCenterOffset: parent.dragging ? parent.distance : 0 |
1049 | + } |
1050 | + } |
1051 | + } |
1052 | + } |
1053 | + } |
1054 | + |
1055 | + TemplateRow { |
1056 | + title: i18n.tr("Rightwards") |
1057 | + Rectangle { |
1058 | + width: units.gu(40) |
1059 | + height: units.gu(20) |
1060 | + color: theme.palette.normal.foreground |
1061 | + |
1062 | + SwipeArea { |
1063 | + id: rightwards |
1064 | + direction: SwipeArea.Rightwards |
1065 | + anchors { |
1066 | + left: parent.left |
1067 | + top: parent.top |
1068 | + bottom: parent.bottom |
1069 | + } |
1070 | + width: units.gu(5) |
1071 | + |
1072 | + Label { |
1073 | + text: i18n.tr("Rightwards") |
1074 | + rotation: -90 |
1075 | + color: theme.palette.normal.foregroundText |
1076 | + anchors { |
1077 | + centerIn: parent |
1078 | + horizontalCenterOffset: parent.dragging ? parent.distance : 0 |
1079 | + } |
1080 | + } |
1081 | + } |
1082 | + } |
1083 | + } |
1084 | + |
1085 | + TemplateRow { |
1086 | + title: i18n.tr("Leftwards") |
1087 | + Rectangle { |
1088 | + width: units.gu(40) |
1089 | + height: units.gu(20) |
1090 | + color: theme.palette.normal.foreground |
1091 | + |
1092 | + SwipeArea { |
1093 | + id: leftwards |
1094 | + direction: SwipeArea.Leftwards |
1095 | + anchors { |
1096 | + right: parent.right |
1097 | + top: parent.top |
1098 | + bottom: parent.bottom |
1099 | + } |
1100 | + width: units.gu(5) |
1101 | + |
1102 | + Label { |
1103 | + text: i18n.tr("Leftwards") |
1104 | + rotation: 90 |
1105 | + color: theme.palette.normal.foregroundText |
1106 | + anchors { |
1107 | + centerIn: parent |
1108 | + horizontalCenterOffset: parent.dragging ? -parent.distance : 0 |
1109 | + } |
1110 | + } |
1111 | + } |
1112 | + } |
1113 | + } |
1114 | + } |
1115 | +} |
1116 | |
1117 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Template.qml' |
1118 | --- examples/ubuntu-ui-toolkit-gallery/Template.qml 2015-07-16 09:12:55 +0000 |
1119 | +++ examples/ubuntu-ui-toolkit-gallery/Template.qml 2015-11-24 12:22:14 +0000 |
1120 | @@ -20,20 +20,30 @@ |
1121 | Page { |
1122 | id: template |
1123 | |
1124 | - default property alias content: layout.children |
1125 | - property alias spacing: layout.spacing |
1126 | + default property alias content: column.children |
1127 | + property alias spacing: column.spacing |
1128 | + property alias scrollable: flickable.interactive |
1129 | + |
1130 | + header: PageHeader { |
1131 | + title: template.title |
1132 | + flickable: layout.columns === 1 ? flickable : null |
1133 | + onFlickableChanged: exposed = true; |
1134 | + } |
1135 | |
1136 | Flickable { |
1137 | id: flickable |
1138 | objectName: "TemplateFlickable" |
1139 | - anchors.fill: parent |
1140 | - anchors.topMargin: units.gu(2) |
1141 | - anchors.bottomMargin: units.gu(2) |
1142 | - contentHeight: layout.height |
1143 | + anchors { |
1144 | + fill: parent |
1145 | + topMargin: template.header.flickable ? units.gu(2) : |
1146 | + units.gu(2) + template.header.height |
1147 | + bottomMargin: units.gu(2) |
1148 | + } |
1149 | + contentHeight: column.height |
1150 | interactive: contentHeight > height |
1151 | |
1152 | Column { |
1153 | - id: layout |
1154 | + id: column |
1155 | spacing: units.gu(6) |
1156 | anchors.left: parent.left |
1157 | anchors.right: parent.right |
1158 | |
1159 | === modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml' |
1160 | --- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2015-09-25 17:05:53 +0000 |
1161 | +++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2015-11-24 12:22:14 +0000 |
1162 | @@ -102,9 +102,14 @@ |
1163 | source: "CrossFadeImage.qml" |
1164 | } |
1165 | ListElement { |
1166 | + objectName: "swipeAreaElement" |
1167 | + label: "SwipeArea" |
1168 | + source: "SwipeAreaPage.qml" |
1169 | + } |
1170 | + ListElement { |
1171 | objectName: "bottomEdgeHintElement" |
1172 | - label: "Bottom Edge Hint" |
1173 | - source: "BottomEdgeHint.qml" |
1174 | + label: "Bottom Edge" |
1175 | + source: "BottomEdgePage.qml" |
1176 | } |
1177 | |
1178 | ListElement { |
1179 | |
1180 | === modified file 'examples/ubuntu-ui-toolkit-gallery/gallery' |
1181 | --- examples/ubuntu-ui-toolkit-gallery/gallery 2015-09-14 14:10:37 +0000 |
1182 | +++ examples/ubuntu-ui-toolkit-gallery/gallery 2015-11-24 12:22:14 +0000 |
1183 | @@ -3,4 +3,4 @@ |
1184 | . `dirname $0`/../../build_paths.inc |
1185 | |
1186 | SCRIPT_DIRECTORY=`dirname $0` |
1187 | -$BUILD_DIR/ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml |
1188 | +QT_LOGGING_CONF=$SCRIPT_DIRECTORY/gallery-logging.config $BUILD_DIR/ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml |
1189 | |
1190 | === added file 'examples/ubuntu-ui-toolkit-gallery/gallery-logging.config' |
1191 | --- examples/ubuntu-ui-toolkit-gallery/gallery-logging.config 1970-01-01 00:00:00 +0000 |
1192 | +++ examples/ubuntu-ui-toolkit-gallery/gallery-logging.config 2015-11-24 12:22:14 +0000 |
1193 | @@ -0,0 +1,4 @@ |
1194 | +[Rules] |
1195 | +libubuntugestures.TouchRegistry.debug=false |
1196 | +ubuntu.components.SwipeArea.debug=false |
1197 | +ubuntu.components.SwipeArea.ActiveTouchInfo.debug=false |
1198 | |
1199 | === modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.pro' |
1200 | --- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.pro 2015-06-15 08:53:40 +0000 |
1201 | +++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.pro 2015-11-24 12:22:14 +0000 |
1202 | @@ -10,7 +10,8 @@ |
1203 | OTHER_FILES += *.$$filetype |
1204 | } |
1205 | |
1206 | -OTHER_FILES += gallery |
1207 | +OTHER_FILES += gallery \ |
1208 | + gallery-logging.config |
1209 | |
1210 | desktop_files.path = $$[QT_INSTALL_EXAMPLES]/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery |
1211 | desktop_files.files = ubuntu-ui-toolkit-gallery.desktop |
1212 | |
1213 | === modified file 'export_modules_dir.sh' |
1214 | --- export_modules_dir.sh 2015-05-19 07:55:27 +0000 |
1215 | +++ export_modules_dir.sh 2015-11-24 12:22:14 +0000 |
1216 | @@ -19,6 +19,8 @@ |
1217 | export QML_IMPORT_PATH=$BUILD_DIR/qml |
1218 | export QML2_IMPORT_PATH=$BUILD_DIR/qml |
1219 | export UBUNTU_UI_TOOLKIT_THEMES_PATH=$BUILD_DIR/qml |
1220 | +export LD_LIBRARY_PATH=$BUILD_DIR/lib |
1221 | /sbin/initctl set-env --global QML_IMPORT_PATH=$BUILD_DIR/qml |
1222 | /sbin/initctl set-env --global QML2_IMPORT_PATH=$BUILD_DIR/qml |
1223 | /sbin/initctl set-env --global UBUNTU_UI_TOOLKIT_THEMES_PATH=$BUILD_DIR/qml |
1224 | +/sbin/initctl set-env --global LD_LIBRARY_PATH=$BUILD_DIR/lib |
1225 | |
1226 | === modified file 'features/ubuntu_qml_plugin.prf' |
1227 | --- features/ubuntu_qml_plugin.prf 2015-08-13 09:40:00 +0000 |
1228 | +++ features/ubuntu_qml_plugin.prf 2015-11-24 12:22:14 +0000 |
1229 | @@ -36,8 +36,19 @@ |
1230 | membackend.name = ALARM_BACKEND |
1231 | membackend.value = memory |
1232 | |
1233 | + #make sure qmlplugindump finds all libs |
1234 | + ld_lib_path.name = LD_LIBRARY_PATH |
1235 | + ld_lib_path.value = |
1236 | + for(qmod, QTREPOS) { |
1237 | + qmod = $$qmod/lib |
1238 | + exists($$qmod): ld_lib_path.value += $$shell_path($$qmod) |
1239 | + } |
1240 | + ld_lib_path.value += $$shell_path($$ROOT_BUILD_DIR/lib) |
1241 | + ld_lib_path.value = $$unique(ld_lib_path.value) |
1242 | + |
1243 | qtAddToolEnv(QMLPLUGINDUMP, importpath) |
1244 | qtAddToolEnv(QMLPLUGINDUMP, membackend) |
1245 | + qtAddToolEnv(QMLPLUGINDUMP, ld_lib_path) |
1246 | |
1247 | TARGETPATHBASE = $$replace(TARGETPATH, \\.\\d+\$, ) |
1248 | |
1249 | |
1250 | === added file 'features/ubuntu_qt_module.prf' |
1251 | --- features/ubuntu_qt_module.prf 1970-01-01 00:00:00 +0000 |
1252 | +++ features/ubuntu_qt_module.prf 2015-11-24 12:22:14 +0000 |
1253 | @@ -0,0 +1,19 @@ |
1254 | +!build_with_qt: { |
1255 | + #enable autocreation of include directory |
1256 | + CONFIG += git_build |
1257 | +} |
1258 | + |
1259 | +load(qt_module) |
1260 | + |
1261 | +CONFIG -= create_cmake |
1262 | + |
1263 | +# when building against the system Qt we pick up the CXX_FLAGS for a release build |
1264 | +# reset them to the default debug build flags |
1265 | +!build_with_qt: { |
1266 | + CONFIG(debug, debug|release) { |
1267 | + QMAKE_CFLAGS = $$QMAKE_CFLAGS_DEBUG |
1268 | + QMAKE_CXXFLAGS = $$QMAKE_CXXFLAGS_DEBUG |
1269 | + } |
1270 | +} |
1271 | + |
1272 | +QMAKE_CXXFLAGS += -Werror |
1273 | |
1274 | === modified file 'src/Ubuntu/Components/1.2/DraggingArea.qml' |
1275 | --- src/Ubuntu/Components/1.2/DraggingArea.qml 2015-04-30 08:32:44 +0000 |
1276 | +++ src/Ubuntu/Components/1.2/DraggingArea.qml 2015-11-24 12:22:14 +0000 |
1277 | @@ -15,7 +15,7 @@ |
1278 | */ |
1279 | |
1280 | import QtQuick 2.4 |
1281 | -import "mathUtils.js" as MathLocal |
1282 | +import Ubuntu.Components 1.2 |
1283 | |
1284 | MouseArea { |
1285 | id: draggingArea |
1286 | @@ -25,7 +25,7 @@ |
1287 | property real dragVelocity: 0 |
1288 | property real dragValue: (orientation == Qt.Vertical ? (mouseY - __pressedPosition.y) |
1289 | : (mouseX - __pressedPosition.x)) |
1290 | - property real lateralPosition: orientation == Qt.Horizontal ? MathLocal.clamp(mouseY, 0, height) : MathLocal.clamp(mouseX, 0, width) |
1291 | + property real lateralPosition: orientation == Qt.Horizontal ? MathUtils.clamp(mouseY, 0, height) : MathUtils.clamp(mouseX, 0, width) |
1292 | property point __pressedPosition: Qt.point(0, 0) |
1293 | property var __dragEvents: [] |
1294 | property bool clickValidated: true |
1295 | |
1296 | === modified file 'src/Ubuntu/Components/1.2/MainViewBase.qml' |
1297 | --- src/Ubuntu/Components/1.2/MainViewBase.qml 2015-04-30 08:32:44 +0000 |
1298 | +++ src/Ubuntu/Components/1.2/MainViewBase.qml 2015-11-24 12:22:14 +0000 |
1299 | @@ -48,12 +48,12 @@ |
1300 | |
1301 | Qt bug: https://bugreports.qt-project.org/browse/QTBUG-11712 |
1302 | */ |
1303 | - property string theme: (ColorUtils.luminance(backgroundColor) >= 0.85) ? |
1304 | + property string themeName: (ColorUtils.luminance(backgroundColor) >= 0.85) ? |
1305 | "Ambiance" : "SuruDark" |
1306 | - onThemeChanged: { |
1307 | + onThemeNameChanged: { |
1308 | // only change the theme if the current one is a system one. |
1309 | - if (theme !== "" && (Theme.name.search("Ubuntu.Components.Themes") >= 0)) { |
1310 | - Theme.name = "Ubuntu.Components.Themes.%1".arg(theme); |
1311 | + if (themeName !== "" && (Theme.name.search("Ubuntu.Components.Themes") >= 0)) { |
1312 | + Theme.name = "Ubuntu.Components.Themes.%1".arg(themeName); |
1313 | } |
1314 | } |
1315 | } |
1316 | |
1317 | === modified file 'src/Ubuntu/Components/1.2/Slider.qml' |
1318 | --- src/Ubuntu/Components/1.2/Slider.qml 2015-04-30 08:32:44 +0000 |
1319 | +++ src/Ubuntu/Components/1.2/Slider.qml 2015-11-24 12:22:14 +0000 |
1320 | @@ -17,7 +17,6 @@ |
1321 | // FIXME(loicm) Add support for keyboard shortcuts (basically left/right). |
1322 | |
1323 | import QtQuick 2.4 |
1324 | -import "mathUtils.js" as MathUtils |
1325 | import Ubuntu.Components 1.2 |
1326 | |
1327 | /*! |
1328 | |
1329 | === modified file 'src/Ubuntu/Components/1.2/TextArea.qml' |
1330 | --- src/Ubuntu/Components/1.2/TextArea.qml 2015-04-30 08:32:44 +0000 |
1331 | +++ src/Ubuntu/Components/1.2/TextArea.qml 2015-11-24 12:22:14 +0000 |
1332 | @@ -17,7 +17,6 @@ |
1333 | import QtQuick 2.4 |
1334 | import Ubuntu.Components 1.2 as Ubuntu |
1335 | import Ubuntu.Components.Popups 1.0 |
1336 | -import "mathUtils.js" as MathUtils |
1337 | |
1338 | /*! |
1339 | \qmltype TextArea |
1340 | @@ -767,7 +766,7 @@ |
1341 | var max = (control.maximumLineCount <= 0) ? |
1342 | control.lineCount : |
1343 | Math.min(control.maximumLineCount, control.lineCount); |
1344 | - control.height = linesHeight(MathUtils.clamp(control.lineCount, 1, max)); |
1345 | + control.height = linesHeight(Ubuntu.MathUtils.clamp(control.lineCount, 1, max)); |
1346 | } |
1347 | } |
1348 | } |
1349 | |
1350 | === removed file 'src/Ubuntu/Components/1.2/mathUtils.js' |
1351 | --- src/Ubuntu/Components/1.2/mathUtils.js 2015-07-17 14:42:26 +0000 |
1352 | +++ src/Ubuntu/Components/1.2/mathUtils.js 1970-01-01 00:00:00 +0000 |
1353 | @@ -1,61 +0,0 @@ |
1354 | -/* |
1355 | - * Copyright 2012 Canonical Ltd. |
1356 | - * |
1357 | - * This program is free software; you can redistribute it and/or modify |
1358 | - * it under the terms of the GNU Lesser General Public License as published by |
1359 | - * the Free Software Foundation; version 3. |
1360 | - * |
1361 | - * This program is distributed in the hope that it will be useful, |
1362 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1363 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1364 | - * GNU Lesser General Public License for more details. |
1365 | - * |
1366 | - * You should have received a copy of the GNU Lesser General Public License |
1367 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1368 | - */ |
1369 | - |
1370 | -/*! |
1371 | - \qmltype mathUtils |
1372 | - \inqmlmodule Ubuntu.Components 1.2 |
1373 | - \ingroup ubuntu |
1374 | - \brief Various mathematical utility functions. |
1375 | - */ |
1376 | - |
1377 | -.pragma library |
1378 | - |
1379 | -/*! |
1380 | - \qmlmethod clamp(x, min, max) |
1381 | - Ensure the value x is between min and max |
1382 | - */ |
1383 | -function clamp(x, min, max) { |
1384 | - if (min <= max) { |
1385 | - return Math.max(min, Math.min(x, max)); |
1386 | - } else { |
1387 | - // swap min/max if min > max |
1388 | - return clamp(x, max, min); |
1389 | - } |
1390 | -} |
1391 | - |
1392 | -/*! |
1393 | - \qmlmethod lerp(delta, from, to) |
1394 | - Get the linear interpolation |
1395 | - */ |
1396 | -function lerp(delta, from, to) { |
1397 | - return ((1.0 - delta) * from) + (delta * to); |
1398 | -} |
1399 | - |
1400 | -/*! |
1401 | - \qmlmethod getFlickableChild(item) |
1402 | - Linearly project a value x from [xmin, xmax] into [ymin, ymax] |
1403 | - */ |
1404 | -function projectValue(x, xmin, xmax, ymin, ymax) { |
1405 | - return ((x - xmin) * ymax - (x - xmax) * ymin) / (xmax - xmin) |
1406 | -} |
1407 | - |
1408 | -/*! |
1409 | - \qmlmethod clampAndProject(x, xmin, xmax, ymin, ymax) |
1410 | - Linearly project a value x, but in addition to projectValue it's clamped to xmin/xmax first |
1411 | - */ |
1412 | -function clampAndProject(x, xmin, xmax, ymin, ymax) { |
1413 | - return projectValue(clamp(x, xmin, xmax), xmin, xmax, ymin, ymax) |
1414 | -} |
1415 | |
1416 | === removed file 'src/Ubuntu/Components/1.2/scrollbarUtils.js' |
1417 | --- src/Ubuntu/Components/1.2/scrollbarUtils.js 2015-04-30 08:32:44 +0000 |
1418 | +++ src/Ubuntu/Components/1.2/scrollbarUtils.js 1970-01-01 00:00:00 +0000 |
1419 | @@ -1,129 +0,0 @@ |
1420 | -/* |
1421 | - * Copyright 2012 Canonical Ltd. |
1422 | - * |
1423 | - * This program is free software; you can redistribute it and/or modify |
1424 | - * it under the terms of the GNU Lesser General Public License as published by |
1425 | - * the Free Software Foundation; version 3. |
1426 | - * |
1427 | - * This program is distributed in the hope that it will be useful, |
1428 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1429 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1430 | - * GNU Lesser General Public License for more details. |
1431 | - * |
1432 | - * You should have received a copy of the GNU Lesser General Public License |
1433 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1434 | - */ |
1435 | - |
1436 | -.pragma library |
1437 | - |
1438 | -Qt.include("mathUtils.js") |
1439 | - |
1440 | -/*! |
1441 | - \internal |
1442 | - Object storing property names used in calculations. |
1443 | - */ |
1444 | -var _obj = { |
1445 | - scrollbar: null, |
1446 | - vertical: false, |
1447 | - propOrigin: "", |
1448 | - propContent: "", |
1449 | - propPosRatio: "", |
1450 | - propSizeRatio: "", |
1451 | - propCoordinate: "", |
1452 | - propSize: "", |
1453 | - refresh: function () { |
1454 | - _obj.vertical = (_obj.scrollbar.align === Qt.AlignLeading) || (_obj.scrollbar.align === Qt.AlignTrailing) |
1455 | - _obj.propOrigin = (_obj.vertical) ? "originY" : "originX"; |
1456 | - _obj.propContent = (_obj.vertical) ? "contentY" : "contentX"; |
1457 | - _obj.propPosRatio = (_obj.vertical) ? "yPosition" : "xPosition"; |
1458 | - _obj.propSizeRatio = (_obj.vertical) ? "heightRatio" : "widthRatio"; |
1459 | - _obj.propCoordinate = (_obj.vertical) ? "y" : "x"; |
1460 | - _obj.propSize = (_obj.vertical) ? "height" : "width"; |
1461 | - } |
1462 | -} |
1463 | - |
1464 | -/*! |
1465 | - \internal |
1466 | - Checks whether the _obj is valid or not. Must be called in every function |
1467 | - as those can be invoked prior to the host (style) component completion. |
1468 | - */ |
1469 | -function __check(sb) { |
1470 | - if (sb !== null && (_obj.scrollbar !== sb)) { |
1471 | - _obj.scrollbar = sb; |
1472 | - sb.flickableItemChanged.connect(_obj.refresh); |
1473 | - sb.alignChanged.connect(_obj.refresh); |
1474 | - _obj.refresh(); |
1475 | - } |
1476 | - |
1477 | - return _obj.scrollbar; |
1478 | -} |
1479 | - |
1480 | -/*! |
1481 | - Returns whether the scrollbar is vertical or horizontal. |
1482 | - */ |
1483 | -function isVertical(scrollbar) { |
1484 | - if (!__check(scrollbar)) return 0; |
1485 | - return _obj.vertical; |
1486 | -} |
1487 | - |
1488 | -/*! |
1489 | - Calculates the slider position based on the visible area's ratios. |
1490 | - */ |
1491 | -function sliderPos(scrollbar, min, max) { |
1492 | - if (!__check(scrollbar)) return 0; |
1493 | - return clamp(scrollbar.flickableItem.visibleArea[_obj.propPosRatio] * scrollbar.flickableItem[_obj.propSize], min, max); |
1494 | -} |
1495 | - |
1496 | -/*! |
1497 | - Calculates the slider size for ListViews based on the visible area's position |
1498 | - and size ratios, clamping it between min and max. |
1499 | - |
1500 | - The function can be used in Scrollbar styles to calculate the size of the slider. |
1501 | - */ |
1502 | -function sliderSize(scrollbar, min, max) { |
1503 | - if (!__check(scrollbar)) return 0; |
1504 | - var sizeRatio = scrollbar.flickableItem.visibleArea[_obj.propSizeRatio]; |
1505 | - var posRatio = scrollbar.flickableItem.visibleArea[_obj.propPosRatio]; |
1506 | - var sizeUnderflow = (sizeRatio * max) < min ? min - (sizeRatio * max) : 0 |
1507 | - var startPos = posRatio * (max - sizeUnderflow) |
1508 | - var endPos = (posRatio + sizeRatio) * (max - sizeUnderflow) + sizeUnderflow |
1509 | - var overshootStart = startPos < 0 ? -startPos : 0 |
1510 | - var overshootEnd = endPos > max ? endPos - max : 0 |
1511 | - |
1512 | - // overshoot adjusted start and end |
1513 | - var adjustedStartPos = startPos + overshootStart |
1514 | - var adjustedEndPos = endPos - overshootStart - overshootEnd |
1515 | - |
1516 | - // final position and size of thumb |
1517 | - var position = adjustedStartPos + min > max ? max - min : adjustedStartPos |
1518 | - var result = (adjustedEndPos - position) < min ? min : (adjustedEndPos - position) |
1519 | - |
1520 | - return result; |
1521 | -} |
1522 | - |
1523 | -/*! |
1524 | - The function calculates and clamps the position to be scrolled to the minimum |
1525 | - and maximum values. |
1526 | - |
1527 | - The scroll and drag functions require a slider that does not have any minimum |
1528 | - size set (meaning the minimum is set to 0.0). Implementations should consider |
1529 | - using an invisible cursor to drag the slider and the ListView position. |
1530 | - */ |
1531 | -function scrollAndClamp(scrollbar, amount, min, max) { |
1532 | - if (!__check(scrollbar)) return 0; |
1533 | - return scrollbar.flickableItem[_obj.propOrigin] + |
1534 | - clamp(scrollbar.flickableItem[_obj.propContent] - scrollbar.flickableItem[_obj.propOrigin] + amount, |
1535 | - min, max); |
1536 | -} |
1537 | - |
1538 | -/*! |
1539 | - The function calculates the new position of the dragged slider. The amount is |
1540 | - relative to the contentSize, which is either the flickable's contentHeight or |
1541 | - contentWidth or other calculated value, depending on its orientation. The pageSize |
1542 | - specifies the visibleArea, and it is usually the heigtht/width of the scrolling area. |
1543 | - */ |
1544 | -function dragAndClamp(scrollbar, cursor, contentSize, pageSize) { |
1545 | - if (!__check(scrollbar)) return 0; |
1546 | - scrollbar.flickableItem[_obj.propContent] = |
1547 | - scrollbar.flickableItem[_obj.propOrigin] + cursor[_obj.propCoordinate] * contentSize / pageSize; |
1548 | -} |
1549 | |
1550 | === modified file 'src/Ubuntu/Components/1.3/AdaptivePageLayout.qml' |
1551 | --- src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-10-14 15:44:15 +0000 |
1552 | +++ src/Ubuntu/Components/1.3/AdaptivePageLayout.qml 2015-11-24 12:22:14 +0000 |
1553 | @@ -166,6 +166,11 @@ |
1554 | and the preferred width is set to 40 grid units. This width is set every time |
1555 | the layout is activated. |
1556 | |
1557 | + When a \l Page with the \l Page::header property set is added to an |
1558 | + AdaptivePageLayout, the AdaptivePageLayout will synchronize the height of that |
1559 | + header with the height of the headers in other columns, i.e., the height of |
1560 | + each of the headers will be set to the maximum implicitHeight of all the headers. |
1561 | + |
1562 | \sa PageStack, PageColumnsLayout, PageColumn |
1563 | */ |
1564 | |
1565 | @@ -452,7 +457,17 @@ |
1566 | // replace page holder's child |
1567 | var holder = body.children[targetColumn]; |
1568 | holder.detachCurrentPage(); |
1569 | - holder.attachPage(pageWrapper); |
1570 | + holder.attachPage(pageWrapper); // sets pageWrapper.pageHolder |
1571 | + |
1572 | + // set the back action for Page.header: |
1573 | + var page = pageWrapper.object; |
1574 | + if (page && page.hasOwnProperty("header") && page.header && |
1575 | + page.header.hasOwnProperty("navigationActions")) { |
1576 | + // Page.header is an instance of PageHeader. |
1577 | + var backAction = backActionComponent.createObject( |
1578 | + pageWrapper, { 'wrapper': pageWrapper } ); |
1579 | + page.header.navigationActions = [ backAction ] ; |
1580 | + } |
1581 | } |
1582 | |
1583 | function getWrapper(page) { |
1584 | @@ -644,6 +659,42 @@ |
1585 | } |
1586 | } |
1587 | |
1588 | + // An instance will be added to each Page with |
1589 | + Component { |
1590 | + id: backActionComponent |
1591 | + |
1592 | + Action { |
1593 | + // used when the Page has a Page.header property set. |
1594 | + id: backAction |
1595 | + objectName: "apl_back_action" |
1596 | + iconName: "back" |
1597 | + text: "Back" |
1598 | + |
1599 | + // set when backAction is created. |
1600 | + property PageWrapper wrapper |
1601 | + onTriggered: layout.removePages(wrapper.object) |
1602 | + |
1603 | + visible: { |
1604 | + var parentWrapper; |
1605 | + try { |
1606 | + parentWrapper = d.tree.parent(wrapper); |
1607 | + } catch(err) { |
1608 | + // Root node has no parent node. |
1609 | + return false; |
1610 | + } |
1611 | + if (!wrapper.pageHolder) { |
1612 | + // columns are being re-arranged. |
1613 | + return false; |
1614 | + } |
1615 | + // wrapper.column is the virtual column, pageHolder.column the actual column. |
1616 | + var column = wrapper.pageHolder.column; |
1617 | + var nextInColumn = d.tree.top(column, column < d.columns - 1, 1); |
1618 | + return parentWrapper === nextInColumn; |
1619 | + } |
1620 | + } |
1621 | + } |
1622 | + |
1623 | + |
1624 | // Page holder component, can have only one Page as child at a time, all stacked pages |
1625 | // will be parented into hiddenPool |
1626 | Component { |
1627 | @@ -670,6 +721,15 @@ |
1628 | property var page: pageWrapper ? pageWrapper.object : null |
1629 | property bool customHeader: page && page.hasOwnProperty("header") && |
1630 | page.header |
1631 | + onPageChanged: body.updateHeaderHeight(0) |
1632 | + Connections { |
1633 | + target: page |
1634 | + onHeaderChanged: body.updateHeaderHeight(0) |
1635 | + } |
1636 | + Connections { |
1637 | + target: page ? page.header : null |
1638 | + onImplicitHeightChanged: body.updateHeaderHeight(page.header.implicitHeight) |
1639 | + } |
1640 | |
1641 | // prevent the pages from taking the app header height into account. |
1642 | __propagated: null |
1643 | @@ -692,6 +752,8 @@ |
1644 | } |
1645 | } |
1646 | |
1647 | + // subHeader is to be deprecated in UITK 1.4 and will be replaced |
1648 | + // by the Page.header property (introduced in 1.3). |
1649 | property alias head: subHeader |
1650 | StyledItem { |
1651 | id: subHeader |
1652 | @@ -703,7 +765,6 @@ |
1653 | height: body.headerHeight |
1654 | |
1655 | styleName: "PageHeadStyle" |
1656 | - theme.version: Ubuntu.toolkitVersion |
1657 | objectName: "Header" + column |
1658 | |
1659 | property real preferredHeight: subHeader.__styleInstance ? |
1660 | @@ -795,8 +856,8 @@ |
1661 | onXChanged: holder.Layout.preferredWidth = x |
1662 | } |
1663 | |
1664 | - function attachPage(page) { |
1665 | - pageWrapper = page; |
1666 | + function attachPage(wrapper) { |
1667 | + pageWrapper = wrapper; |
1668 | pageWrapper.parent = holderBody; |
1669 | pageWrapper.pageHolder = holder; |
1670 | pageWrapper.active = true; |
1671 | @@ -854,17 +915,32 @@ |
1672 | property real headerHeight: 0 |
1673 | |
1674 | function updateHeaderHeight(newHeight) { |
1675 | + var page; |
1676 | + var i; |
1677 | if (newHeight > body.headerHeight) { |
1678 | body.headerHeight = newHeight; |
1679 | } else { |
1680 | var h = 0; |
1681 | var subHeight = 0; |
1682 | - for (var i = 0; i < children.length; i++) { |
1683 | - subHeight = children[i].head.preferredHeight; |
1684 | + for (i = 0; i < children.length; i++) { |
1685 | + page = children[i].page; |
1686 | + if (page && page.hasOwnProperty("header") && page.header) { |
1687 | + subHeight = page.header.implicitHeight; |
1688 | + } else { |
1689 | + subHeight = children[i].head.preferredHeight; |
1690 | + } |
1691 | if (subHeight > h) h = subHeight; |
1692 | } |
1693 | body.headerHeight = h; |
1694 | } |
1695 | + |
1696 | + // Update all the Page.header heights. |
1697 | + for (i = 0; i < body.children.length; i++) { |
1698 | + page = body.children[i].page; |
1699 | + if (page && page.hasOwnProperty("header") && page.header) { |
1700 | + page.header.height = headerHeight; |
1701 | + } |
1702 | + } |
1703 | } |
1704 | |
1705 | onChildrenChanged: { |
1706 | |
1707 | === modified file 'src/Ubuntu/Components/1.3/AnimatedItem.qml' |
1708 | --- src/Ubuntu/Components/1.3/AnimatedItem.qml 2015-04-25 08:54:58 +0000 |
1709 | +++ src/Ubuntu/Components/1.3/AnimatedItem.qml 2015-11-24 12:22:14 +0000 |
1710 | @@ -25,14 +25,13 @@ |
1711 | */ |
1712 | |
1713 | import QtQuick 2.4 |
1714 | -import Ubuntu.Components 1.3 as Toolkit |
1715 | +import Ubuntu.Components 1.3 |
1716 | |
1717 | -Toolkit.StyledItem { |
1718 | +StyledItem { |
1719 | id: root |
1720 | /*! |
1721 | \deprecated |
1722 | Specifies whether the component is on the visible area of the Flickable or not. |
1723 | */ |
1724 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
1725 | property bool onScreen: true |
1726 | } |
1727 | |
1728 | === modified file 'src/Ubuntu/Components/1.3/AppHeader.qml' |
1729 | --- src/Ubuntu/Components/1.3/AppHeader.qml 2015-10-01 21:23:04 +0000 |
1730 | +++ src/Ubuntu/Components/1.3/AppHeader.qml 2015-11-24 12:22:14 +0000 |
1731 | @@ -151,6 +151,5 @@ |
1732 | } |
1733 | } |
1734 | |
1735 | - theme.version: Components.Ubuntu.toolkitVersion |
1736 | styleName: "PageHeadStyle" |
1737 | } |
1738 | |
1739 | === removed file 'src/Ubuntu/Components/1.3/BottomEdgeHint.qml' |
1740 | --- src/Ubuntu/Components/1.3/BottomEdgeHint.qml 2015-09-21 14:44:13 +0000 |
1741 | +++ src/Ubuntu/Components/1.3/BottomEdgeHint.qml 1970-01-01 00:00:00 +0000 |
1742 | @@ -1,155 +0,0 @@ |
1743 | -/* |
1744 | - * Copyright 2015 Canonical Ltd. |
1745 | - * |
1746 | - * This program is free software; you can redistribute it and/or modify |
1747 | - * it under the terms of the GNU Lesser General Public License as published by |
1748 | - * the Free Software Foundation; version 3. |
1749 | - * |
1750 | - * This program is distributed in the hope that it will be useful, |
1751 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1752 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1753 | - * GNU Lesser General Public License for more details. |
1754 | - * |
1755 | - * You should have received a copy of the GNU Lesser General Public License |
1756 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1757 | - */ |
1758 | - |
1759 | -import QtQuick 2.4 |
1760 | -import Ubuntu.Components 1.3 |
1761 | - |
1762 | -/*! |
1763 | - \qmlabstract BottomEdgeHint |
1764 | - \inqmlmodule Ubuntu.Components 1.3 |
1765 | - \ingroup ubuntu |
1766 | - \brief The BottomEdgeHint shows the availability of extra features |
1767 | - available from the bottom edge of the application. |
1768 | - |
1769 | - It displays either a label or an icon at the bottom of the application. |
1770 | - |
1771 | - It has 2 states: hidden or visible. When hidden, part of it is still visible |
1772 | - to hint at the existence of the bottom edge. |
1773 | - |
1774 | - When used with a mouse it acts like a button. The typical action associated |
1775 | - with clicking on it should be revealing the extra features provided by the |
1776 | - bottom edge. |
1777 | - |
1778 | - Example: |
1779 | - \qml |
1780 | - BottomEdgeHint { |
1781 | - id: bottomEdgeHint |
1782 | - text: i18n.tr("Favorites") |
1783 | - onClicked: revealBottomEdge() |
1784 | - } |
1785 | - \endqml |
1786 | - |
1787 | -*/ |
1788 | -Item { |
1789 | - id: bottomEdgeHint |
1790 | - |
1791 | - anchors { |
1792 | - bottom: parent.bottom |
1793 | - bottomMargin: bottomEdgeHint.state == "Hidden" ? -bottomEdgeHint.height + units.gu(1.5) : 0 |
1794 | - horizontalCenter: parent.horizontalCenter |
1795 | - Behavior on bottomMargin { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } } |
1796 | - } |
1797 | - |
1798 | - width: label.paintedWidth + units.gu(7) |
1799 | - height: units.gu(4) |
1800 | - |
1801 | - /*! |
1802 | - This handler is called when there is a mouse click on the BottomEdgeHint |
1803 | - and the BottomEdgeHint is not disabled. |
1804 | - */ |
1805 | - signal clicked() |
1806 | - |
1807 | - Keys.onEnterPressed: clicked() |
1808 | - Keys.onReturnPressed: clicked() |
1809 | - |
1810 | - /*! |
1811 | - The label displayed by the BottomEdgeHint. |
1812 | - */ |
1813 | - property string text |
1814 | - |
1815 | - /*! |
1816 | - The icon displayed by the BottomEdgeHint. |
1817 | - |
1818 | - This is the URL of any image file. |
1819 | - If both iconSource and iconName are defined, iconName will be ignored. |
1820 | - */ |
1821 | - property url iconSource: iconName ? "image://theme/" + iconName : "" |
1822 | - |
1823 | - /*! |
1824 | - The icon associated with the BottomEdgeHint in the icon theme. |
1825 | - |
1826 | - If both iconSource and iconName are defined, iconName will be ignored. |
1827 | - */ |
1828 | - property string iconName |
1829 | - |
1830 | - /*! |
1831 | - BottomEdgeHint can take 2 states of visibility: "Hidden" and "Visible". |
1832 | - |
1833 | - When "Visible", the full hint with its content is shown. |
1834 | - |
1835 | - When "Hidden", only part of the hint is visible leaving more space for application content. |
1836 | - */ |
1837 | - property string state: "Visible" |
1838 | - |
1839 | - MouseArea { |
1840 | - id: mouseArea |
1841 | - anchors.fill: parent |
1842 | - hoverEnabled: true |
1843 | - onEntered: bottomEdgeHint.state = "Visible" |
1844 | - onClicked: { |
1845 | - Haptics.play(); |
1846 | - bottomEdgeHint.clicked(); |
1847 | - mouse.accepted = false; |
1848 | - } |
1849 | - } |
1850 | - |
1851 | - clip: true |
1852 | - |
1853 | - UbuntuShape { |
1854 | - id: background |
1855 | - |
1856 | - anchors { |
1857 | - bottom: parent.bottom |
1858 | - horizontalCenter: bottomEdgeHint.horizontalCenter |
1859 | - bottomMargin: -units.gu(1) |
1860 | - } |
1861 | - |
1862 | - width: bottomEdgeHint.width - 2 * hoverExpansion |
1863 | - height: bottomEdgeHint.height + units.gu(1) - hoverExpansion |
1864 | - |
1865 | - property real hoverExpansion: mouseArea.containsMouse ? 0 : units.gu(0.5) |
1866 | - Behavior on hoverExpansion { UbuntuNumberAnimation { duration: UbuntuAnimation.FastDuration } } |
1867 | - |
1868 | - backgroundColor: theme.palette.normal.overlay |
1869 | - } |
1870 | - |
1871 | - Label { |
1872 | - id: label |
1873 | - |
1874 | - anchors { |
1875 | - top: parent.top |
1876 | - horizontalCenter: parent.horizontalCenter |
1877 | - } |
1878 | - text: icon.name ? "" : bottomEdgeHint.text |
1879 | - textSize: Label.Medium |
1880 | - height: bottomEdgeHint.height |
1881 | - verticalAlignment: Text.AlignVCenter |
1882 | - horizontalAlignment: Text.AlignHCenter |
1883 | - } |
1884 | - |
1885 | - Icon { |
1886 | - id: icon |
1887 | - |
1888 | - name: bottomEdgeHint.iconName |
1889 | - anchors { |
1890 | - bottom: parent.bottom |
1891 | - bottomMargin: units.gu(0.5) |
1892 | - horizontalCenter: parent.horizontalCenter |
1893 | - } |
1894 | - width: height |
1895 | - height: units.gu(2) |
1896 | - } |
1897 | -} |
1898 | |
1899 | === modified file 'src/Ubuntu/Components/1.3/Button.qml' |
1900 | --- src/Ubuntu/Components/1.3/Button.qml 2015-08-20 06:56:44 +0000 |
1901 | +++ src/Ubuntu/Components/1.3/Button.qml 2015-11-24 12:22:14 +0000 |
1902 | @@ -121,6 +121,5 @@ |
1903 | */ |
1904 | property string iconPosition: "left" |
1905 | |
1906 | - theme.version: Ubuntu.toolkitVersion |
1907 | styleName: "ButtonStyle" |
1908 | } |
1909 | |
1910 | === modified file 'src/Ubuntu/Components/1.3/CheckBox.qml' |
1911 | --- src/Ubuntu/Components/1.3/CheckBox.qml 2015-09-16 16:58:51 +0000 |
1912 | +++ src/Ubuntu/Components/1.3/CheckBox.qml 2015-11-24 12:22:14 +0000 |
1913 | @@ -49,6 +49,5 @@ |
1914 | */ |
1915 | onTriggered: checked = !checked |
1916 | |
1917 | - theme.version: Ubuntu.toolkitVersion |
1918 | styleName: "CheckBoxStyle" |
1919 | } |
1920 | |
1921 | === modified file 'src/Ubuntu/Components/1.3/OptionSelector.qml' |
1922 | --- src/Ubuntu/Components/1.3/OptionSelector.qml 2015-09-07 10:05:58 +0000 |
1923 | +++ src/Ubuntu/Components/1.3/OptionSelector.qml 2015-11-24 12:22:14 +0000 |
1924 | @@ -225,7 +225,6 @@ |
1925 | right: parent.right |
1926 | } |
1927 | state: optionSelector.expanded ? "expanded" : "collapsed" |
1928 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
1929 | styleName: "OptionSelectorStyle" |
1930 | states: [ State { |
1931 | name: "expanded" |
1932 | |
1933 | === removed file 'src/Ubuntu/Components/1.3/Page.qdoc' |
1934 | --- src/Ubuntu/Components/1.3/Page.qdoc 2015-04-25 08:54:58 +0000 |
1935 | +++ src/Ubuntu/Components/1.3/Page.qdoc 1970-01-01 00:00:00 +0000 |
1936 | @@ -1,132 +0,0 @@ |
1937 | -/* |
1938 | - * Copyright 2014 Canonical Ltd. |
1939 | - * |
1940 | - * This program is free software; you can redistribute it and/or modify |
1941 | - * it under the terms of the GNU Lesser General Public License as published by |
1942 | - * the Free Software Foundation; version 3. |
1943 | - * |
1944 | - * This program is distributed in the hope that it will be useful, |
1945 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1946 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1947 | - * GNU Lesser General Public License for more details. |
1948 | - * |
1949 | - * You should have received a copy of the GNU Lesser General Public License |
1950 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1951 | - */ |
1952 | - |
1953 | -/*! |
1954 | - \qmltype Page |
1955 | - \inqmlmodule Ubuntu.Components 1.1 |
1956 | - \ingroup ubuntu |
1957 | - \brief A page is the basic Item that must be used inside the \l MainView, |
1958 | - \l PageStack and \l Tabs. |
1959 | - Anchors and height of a Page are automatically determined to align with |
1960 | - the header of the \l MainView, but can be overridden. |
1961 | - |
1962 | - \l MainView provides a header for Pages it includes. |
1963 | - The text and actions of the header are determined by the \l title |
1964 | - and \l head properties of the page: |
1965 | - |
1966 | - \qml |
1967 | - import QtQuick 2.4 |
1968 | - import Ubuntu.Components 1.2 |
1969 | - |
1970 | - MainView { |
1971 | - width: units.gu(48) |
1972 | - height: units.gu(60) |
1973 | - |
1974 | - Page { |
1975 | - title: i18n.tr("Example page") |
1976 | - |
1977 | - Label { |
1978 | - anchors.centerIn: parent |
1979 | - text: i18n.tr("Hello world!") |
1980 | - } |
1981 | - |
1982 | - head.actions: [ |
1983 | - Action { |
1984 | - iconName: "search" |
1985 | - text: i18n.tr("Search") |
1986 | - }, |
1987 | - Action { |
1988 | - iconName: "contacts" |
1989 | - text: i18n.tr("Contacts") |
1990 | - } |
1991 | - ] |
1992 | - } |
1993 | - } |
1994 | - \endqml |
1995 | - See \l MainView for more examples on how to use the header. |
1996 | - Advanced navigation structures can be created by adding Pages to a \l PageStack or \l Tabs. |
1997 | - |
1998 | - The Page automatically anchors to the left and bottom of its parent. The width of the Page |
1999 | - will be the full width of its parent \l MainView or \l PageStack or \l Tab, |
2000 | - and the height will adapt to leave space for the header when needed. It is possible to |
2001 | - use a Page inside a Loader, but in that case do not set the anchors or size of the Loader |
2002 | - so that the Page can control its width and height. |
2003 | -*/ |
2004 | - |
2005 | -/*! |
2006 | - \qmlproperty string Page::title |
2007 | - The title of the page. Will be shown in the header of the \l MainView. |
2008 | - If the page is used inside a \l Tab, the default title is the \l Tab title. |
2009 | - For a Page not inside a \l Tab, the default title is an empty string. |
2010 | - */ |
2011 | - |
2012 | -/*! |
2013 | - \qmlproperty Item Page::tools |
2014 | - \deprecated |
2015 | - The toolbar items associated with this Page. |
2016 | - DEPRECATED. Use \b head.actions instead. |
2017 | - */ |
2018 | - |
2019 | -/*! |
2020 | - \qmlproperty PageHeadConfiguration Page::head |
2021 | - \readonly |
2022 | - Configuration of the header for this page. |
2023 | - */ |
2024 | - |
2025 | -/*! |
2026 | - \qmlproperty Flickable Page::flickable |
2027 | - Optional flickable that controls the header. This property |
2028 | - is automatically set to the first child of the page that is Flickable |
2029 | - and anchors to the top of the page or fills the page. For example: |
2030 | - \qml |
2031 | - import QtQuick 2.4 |
2032 | - import Ubuntu.Components 1.2 |
2033 | - |
2034 | - MainView { |
2035 | - width: units.gu(30) |
2036 | - height: units.gu(50) |
2037 | - Page { |
2038 | - id: page |
2039 | - title: "example" |
2040 | - //flickable: null // uncomment for a fixed header |
2041 | - Flickable { |
2042 | - id: content |
2043 | - anchors.fill: parent |
2044 | - contentHeight: units.gu(70) |
2045 | - Label { |
2046 | - text: "hello" |
2047 | - anchors.centerIn: parent |
2048 | - } |
2049 | - } |
2050 | - } |
2051 | - } |
2052 | - \endqml |
2053 | - In this example, page.flickable will automatically be set to content because it is |
2054 | - a Flickable and it fills its parent. Thus, scrolling down in the Flickable will automatically |
2055 | - hide the header. |
2056 | - |
2057 | - Set this property to null to avoid automatic flickable detection, which disables hiding |
2058 | - of the header by scrolling in the Flickable. In cases where a flickable should control the header, |
2059 | - but it is not automatically detected, the flickable property can be set. |
2060 | - */ |
2061 | - |
2062 | -/*! |
2063 | - \qmlproperty list<Action> Page::actions |
2064 | - Local actions. These actions will be made available outside the application |
2065 | - (for example, to HUD) when the Page is active. For actions that are always available |
2066 | - when the application is running, use the actions property of \l MainView. |
2067 | - For actions in the header, see \l head. |
2068 | -*/ |
2069 | |
2070 | === modified file 'src/Ubuntu/Components/1.3/Page.qml' |
2071 | --- src/Ubuntu/Components/1.3/Page.qml 2015-10-15 10:07:59 +0000 |
2072 | +++ src/Ubuntu/Components/1.3/Page.qml 2015-11-24 12:22:14 +0000 |
2073 | @@ -19,8 +19,55 @@ |
2074 | import "pageUtils.js" as Utils |
2075 | |
2076 | /*! |
2077 | - \internal |
2078 | - Documentation is in Page.qdoc |
2079 | + \qmltype Page |
2080 | + \inqmlmodule Ubuntu.Components 1.1 |
2081 | + \ingroup ubuntu |
2082 | + \brief A page is the basic Item that must be used inside the \l MainView, |
2083 | + \l PageStack and \l Tabs. |
2084 | + Anchors and height of a Page are automatically determined to align with |
2085 | + the header of the \l MainView, but can be overridden. |
2086 | + |
2087 | + |
2088 | + \l MainView provides a header for Pages it includes if no |
2089 | + \l header property was set. |
2090 | + The text and actions of the header are determined by the \l title |
2091 | + and \l head properties of the page: |
2092 | + |
2093 | + \qml |
2094 | + import QtQuick 2.4 |
2095 | + import Ubuntu.Components 1.2 |
2096 | + |
2097 | + MainView { |
2098 | + width: units.gu(48) |
2099 | + height: units.gu(60) |
2100 | + |
2101 | + Page { |
2102 | + title: i18n.tr("Example page") |
2103 | + |
2104 | + Label { |
2105 | + anchors.centerIn: parent |
2106 | + text: i18n.tr("Hello world!") |
2107 | + } |
2108 | + |
2109 | + head.actions: [ |
2110 | + Action { |
2111 | + iconName: "search" |
2112 | + text: i18n.tr("Search") |
2113 | + }, |
2114 | + Action { |
2115 | + iconName: "contacts" |
2116 | + text: i18n.tr("Contacts") |
2117 | + } |
2118 | + ] |
2119 | + } |
2120 | + } |
2121 | + \endqml |
2122 | + |
2123 | + The Page automatically anchors to the left and bottom of its parent. The width of the Page |
2124 | + will be the full width of its parent \l MainView or \l PageStack or \l Tab, |
2125 | + and the height will adapt to leave space for the header when needed. It is possible to |
2126 | + use a Page inside a Loader, but in that case do not set the anchors or size of the Loader |
2127 | + so that the Page can control its width and height. |
2128 | */ |
2129 | PageTreeNode { |
2130 | id: page |
2131 | @@ -35,13 +82,13 @@ |
2132 | |
2133 | /*! |
2134 | The header property for this page. Setting this property will reparent the |
2135 | - header to the page and disable the \l Mainview's application header. |
2136 | + header to the page and disable the \l MainView's application header. |
2137 | \qml |
2138 | Page { |
2139 | id: page |
2140 | title: "Page with header" |
2141 | header: PageHeader { |
2142 | - title: page.header |
2143 | + title: page.title |
2144 | trailingActionBar.actions: [ |
2145 | Action { iconName: "settings" }, |
2146 | Action { iconName: "info" } |
2147 | @@ -49,17 +96,65 @@ |
2148 | } |
2149 | } |
2150 | \endqml |
2151 | + \sa PageHeader |
2152 | */ |
2153 | property Item header |
2154 | onHeaderChanged: internal.updateHeader() |
2155 | Component.onCompleted: internal.updateHeader() |
2156 | |
2157 | + /*! \internal */ |
2158 | isLeaf: true |
2159 | + |
2160 | + /*! |
2161 | + The title of the page. Will be shown in the header of the \l MainView. |
2162 | + If the page is used inside a \l Tab, the default title is the \l Tab title. |
2163 | + For a Page not inside a \l Tab, the default title is an empty string. |
2164 | + */ |
2165 | property string title: parentNode && parentNode.hasOwnProperty("title") ? parentNode.title : "" |
2166 | + |
2167 | + /*! |
2168 | + Optional flickable that controls the MainView header. This property |
2169 | + is automatically set to the first child of the page that is Flickable |
2170 | + and anchors to the top of the page or fills the page. For example: |
2171 | + \qml |
2172 | + import QtQuick 2.4 |
2173 | + import Ubuntu.Components 1.2 |
2174 | + |
2175 | + MainView { |
2176 | + width: units.gu(30) |
2177 | + height: units.gu(50) |
2178 | + Page { |
2179 | + id: page |
2180 | + title: "example" |
2181 | + //flickable: null // uncomment for a fixed header |
2182 | + Flickable { |
2183 | + id: content |
2184 | + anchors.fill: parent |
2185 | + contentHeight: units.gu(70) |
2186 | + Label { |
2187 | + text: "hello" |
2188 | + anchors.centerIn: parent |
2189 | + } |
2190 | + } |
2191 | + } |
2192 | + } |
2193 | + \endqml |
2194 | + In this example, page.flickable will automatically be set to content because it is |
2195 | + a Flickable and it fills its parent. Thus, scrolling down in the Flickable will automatically |
2196 | + hide the header. |
2197 | + |
2198 | + Set this property to null to avoid automatic flickable detection, which disables hiding |
2199 | + of the header by scrolling in the Flickable. In cases where a flickable should control the header, |
2200 | + but it is not automatically detected, the flickable property can be set. |
2201 | + */ |
2202 | property Flickable flickable: Utils.getFlickableChild(page) |
2203 | |
2204 | /*! |
2205 | - \qmlproperty PageHeadConfiguration head |
2206 | + \qmlproperty PageHeadConfiguration Page::head |
2207 | + \readonly |
2208 | + \deprecated |
2209 | + Configuration of the header for this page. |
2210 | + Deprecated: This configuration will be replaced by setting the \l header property. |
2211 | */ |
2212 | readonly property alias head: headerConfig |
2213 | Toolkit13.PageHeadConfiguration { |
2214 | |
2215 | === modified file 'src/Ubuntu/Components/1.3/PageHeader.qml' |
2216 | --- src/Ubuntu/Components/1.3/PageHeader.qml 2015-10-15 14:17:25 +0000 |
2217 | +++ src/Ubuntu/Components/1.3/PageHeader.qml 2015-11-24 12:22:14 +0000 |
2218 | @@ -40,8 +40,8 @@ |
2219 | Header { |
2220 | id: header |
2221 | anchors { |
2222 | - left: parent.left |
2223 | - right: parent.right |
2224 | + left: parent ? parent.left : undefined |
2225 | + right: parent ? parent.right : undefined |
2226 | } |
2227 | |
2228 | /*! |
2229 | @@ -109,9 +109,25 @@ |
2230 | titleLoader.sourceComponent = __styleInstance.titleComponent; |
2231 | } |
2232 | } |
2233 | + |
2234 | + // When the style changes, make sure that the titleLoader loads |
2235 | + // the new titleComponent. |
2236 | + property Item styleInstance: __styleInstance |
2237 | + onStyleInstanceChanged: updateContents() |
2238 | } |
2239 | |
2240 | /*! |
2241 | + The actions to be shown in the leading action bar. |
2242 | + This property is automatically set by the |
2243 | + \l AdaptivePageLayout and other navigation components to configure the |
2244 | + back action for the \l Page. |
2245 | + Application developers should not set this property, because the |
2246 | + value may be overridden by Ubuntu components that have navigation. |
2247 | + Instead, set \l leadingActionBar's actions property. |
2248 | + */ |
2249 | + property list<Action> navigationActions |
2250 | + |
2251 | + /*! |
2252 | \qmlproperty ActionBar leadingActionBar |
2253 | The \l ActionBar for the leading navigation actions. |
2254 | Example: |
2255 | @@ -125,6 +141,9 @@ |
2256 | ] |
2257 | } |
2258 | \endqml |
2259 | + The default value of \l leadingActionBar actions is |
2260 | + \l navigationActions, but that value can be changed to show |
2261 | + different actions in front of the title. |
2262 | See \l ActionBar. |
2263 | */ |
2264 | readonly property alias leadingActionBar: leading |
2265 | @@ -138,7 +157,8 @@ |
2266 | height: header.__styleInstance.contentHeight |
2267 | numberOfSlots: 1 |
2268 | delegate: header.__styleInstance.defaultActionDelegate |
2269 | - visible: actions.length > 0 |
2270 | + actions: header.navigationActions |
2271 | + visible: leading.width > 0 // at least 1 visible action |
2272 | StyleHints { |
2273 | overflowIconName: "navigation-menu" |
2274 | } |
2275 | @@ -182,7 +202,7 @@ |
2276 | height: header.__styleInstance.contentHeight |
2277 | numberOfSlots: 3 |
2278 | delegate: header.__styleInstance.defaultActionDelegate |
2279 | - visible: actions.length > 0 |
2280 | + visible: trailing.width > 0 // at least 1 visible action |
2281 | } |
2282 | |
2283 | /*! |
2284 | @@ -203,6 +223,5 @@ |
2285 | height: visible ? implicitHeight : 0 |
2286 | } |
2287 | |
2288 | - theme.version: Ubuntu.toolkitVersion |
2289 | styleName: "PageHeaderStyle" |
2290 | } |
2291 | |
2292 | === modified file 'src/Ubuntu/Components/1.3/PageStack.qml' |
2293 | --- src/Ubuntu/Components/1.3/PageStack.qml 2015-07-10 07:42:38 +0000 |
2294 | +++ src/Ubuntu/Components/1.3/PageStack.qml 2015-11-24 12:22:14 +0000 |
2295 | @@ -16,6 +16,7 @@ |
2296 | |
2297 | import QtQuick 2.4 |
2298 | import "../1.2/stack.js" as Stack |
2299 | +import Ubuntu.Components 1.3 |
2300 | |
2301 | /*! |
2302 | \qmltype PageStack |
2303 | @@ -171,6 +172,13 @@ |
2304 | } else { |
2305 | internal.pushWrapperObject(); |
2306 | } |
2307 | + // set the back action for Page.header: |
2308 | + if (pageObject && pageObject.hasOwnProperty("header") && pageObject.header && |
2309 | + pageObject.header.hasOwnProperty("navigationActions")) { |
2310 | + // Page.header is an instance of PageHeader. |
2311 | + pageObject.header.navigationActions = [ backAction ]; |
2312 | + } |
2313 | + |
2314 | return pageObject; |
2315 | } |
2316 | |
2317 | @@ -206,6 +214,16 @@ |
2318 | internal.stackUpdated(); |
2319 | } |
2320 | |
2321 | + Action { |
2322 | + // used when the Page has a Page.header property set. |
2323 | + id: backAction |
2324 | + visible: pageStack.depth > 0 |
2325 | + iconName: "back" |
2326 | + text: "Back" |
2327 | + onTriggered: pageStack.pop() |
2328 | + objectName: "pagestack_back_action" |
2329 | + } |
2330 | + |
2331 | QtObject { |
2332 | id: internal |
2333 | property Item headStyle: (pageStack.__propagated |
2334 | |
2335 | === modified file 'src/Ubuntu/Components/1.3/PageTreeNode.qml' |
2336 | --- src/Ubuntu/Components/1.3/PageTreeNode.qml 2015-10-14 19:18:58 +0000 |
2337 | +++ src/Ubuntu/Components/1.3/PageTreeNode.qml 2015-11-24 12:22:14 +0000 |
2338 | @@ -148,6 +148,4 @@ |
2339 | node.parentNode = internal.getParentPageTreeNode(node); |
2340 | } |
2341 | } |
2342 | - |
2343 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
2344 | } |
2345 | |
2346 | === modified file 'src/Ubuntu/Components/1.3/PageWrapper.qml' |
2347 | --- src/Ubuntu/Components/1.3/PageWrapper.qml 2015-09-24 15:28:58 +0000 |
2348 | +++ src/Ubuntu/Components/1.3/PageWrapper.qml 2015-11-24 12:22:14 +0000 |
2349 | @@ -46,7 +46,7 @@ |
2350 | property bool canDestroy: false |
2351 | |
2352 | /*! |
2353 | - Column number in MultiColumnView. |
2354 | + Column number in AdaptivePageLayout. |
2355 | */ |
2356 | property int column: 0 |
2357 | |
2358 | @@ -61,7 +61,7 @@ |
2359 | property Item parentWrapper |
2360 | |
2361 | /*! |
2362 | - Page holder in MultiColumnView |
2363 | + Page holder in AdaptivePageLayout. |
2364 | */ |
2365 | property Item pageHolder |
2366 | |
2367 | |
2368 | === modified file 'src/Ubuntu/Components/1.3/ProgressBar.qml' |
2369 | --- src/Ubuntu/Components/1.3/ProgressBar.qml 2015-05-21 10:50:35 +0000 |
2370 | +++ src/Ubuntu/Components/1.3/ProgressBar.qml 2015-11-24 12:22:14 +0000 |
2371 | @@ -70,6 +70,5 @@ |
2372 | */ |
2373 | property bool showProgressPercentage: true |
2374 | |
2375 | - theme.version: Ubuntu.toolkitVersion |
2376 | styleName: "ProgressBarStyle" |
2377 | } |
2378 | |
2379 | === modified file 'src/Ubuntu/Components/1.3/PullToRefresh.qml' |
2380 | --- src/Ubuntu/Components/1.3/PullToRefresh.qml 2015-05-21 10:50:35 +0000 |
2381 | +++ src/Ubuntu/Components/1.3/PullToRefresh.qml 2015-11-24 12:22:14 +0000 |
2382 | @@ -222,7 +222,6 @@ |
2383 | */ |
2384 | signal refresh() |
2385 | |
2386 | - theme.version: Ubuntu.toolkitVersion |
2387 | styleName: "PullToRefreshStyle" |
2388 | implicitHeight: __styleInstance.implicitHeight |
2389 | anchors { |
2390 | |
2391 | === modified file 'src/Ubuntu/Components/1.3/Scrollbar.qml' |
2392 | --- src/Ubuntu/Components/1.3/Scrollbar.qml 2015-05-21 10:50:35 +0000 |
2393 | +++ src/Ubuntu/Components/1.3/Scrollbar.qml 2015-11-24 12:22:14 +0000 |
2394 | @@ -146,6 +146,5 @@ |
2395 | } |
2396 | } |
2397 | |
2398 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
2399 | styleName: "ScrollbarStyle" |
2400 | } |
2401 | |
2402 | === modified file 'src/Ubuntu/Components/1.3/Sections.qml' |
2403 | --- src/Ubuntu/Components/1.3/Sections.qml 2015-07-14 12:49:58 +0000 |
2404 | +++ src/Ubuntu/Components/1.3/Sections.qml 2015-11-24 12:22:14 +0000 |
2405 | @@ -29,7 +29,6 @@ |
2406 | StyledItem { |
2407 | id: sections |
2408 | styleName: "SectionsStyle" |
2409 | - theme.version: Ubuntu.toolkitVersion |
2410 | |
2411 | /*! |
2412 | List of actions that represent the sections. |
2413 | |
2414 | === modified file 'src/Ubuntu/Components/1.3/Slider.qml' |
2415 | --- src/Ubuntu/Components/1.3/Slider.qml 2015-05-21 10:50:35 +0000 |
2416 | +++ src/Ubuntu/Components/1.3/Slider.qml 2015-11-24 12:22:14 +0000 |
2417 | @@ -159,7 +159,7 @@ |
2418 | return Toolkit.MathUtils.clampAndProject(value, slider.minimumValue, |
2419 | slider.maximumValue, 1.0, 0.0); |
2420 | } else { |
2421 | - return MathUtils.clampAndProject(value, slider.minimumValue, |
2422 | + return Toolkit.MathUtils.clampAndProject(value, slider.minimumValue, |
2423 | slider.maximumValue, 0.0, 1.0); |
2424 | } |
2425 | |
2426 | @@ -167,10 +167,10 @@ |
2427 | |
2428 | function valueFromNormalizedValue(normalizedValue) { |
2429 | if (Qt.application.layoutDirection == Qt.RightToLeft) { |
2430 | - return MathUtils.lerp(MathUtils.clamp(normalizedValue, 0.0, 1.0), |
2431 | + return Toolkit.MathUtils.lerp(Toolkit.MathUtils.clamp(normalizedValue, 0.0, 1.0), |
2432 | slider.maximumValue, slider.minimumValue); |
2433 | } else { |
2434 | - return MathUtils.lerp(MathUtils.clamp(normalizedValue, 0.0, 1.0), |
2435 | + return Toolkit.MathUtils.lerp(Toolkit.MathUtils.clamp(normalizedValue, 0.0, 1.0), |
2436 | slider.minimumValue, slider.maximumValue); |
2437 | } |
2438 | } |
2439 | @@ -206,6 +206,5 @@ |
2440 | onLiveValueChanged: if (isPressed) slider.requestFocus(Qt.MouseFocusReason) |
2441 | } |
2442 | |
2443 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
2444 | styleName: "SliderStyle" |
2445 | } |
2446 | |
2447 | === modified file 'src/Ubuntu/Components/1.3/TabBar.qml' |
2448 | --- src/Ubuntu/Components/1.3/TabBar.qml 2015-05-21 10:50:35 +0000 |
2449 | +++ src/Ubuntu/Components/1.3/TabBar.qml 2015-11-24 12:22:14 +0000 |
2450 | @@ -97,7 +97,6 @@ |
2451 | |
2452 | implicitHeight: units.gu(7.5) |
2453 | activeFocusOnPress: true |
2454 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
2455 | styleName: "TabBarStyle" |
2456 | |
2457 | QtObject { |
2458 | |
2459 | === modified file 'src/Ubuntu/Components/1.3/TextArea.qml' |
2460 | --- src/Ubuntu/Components/1.3/TextArea.qml 2015-09-07 10:05:58 +0000 |
2461 | +++ src/Ubuntu/Components/1.3/TextArea.qml 2015-11-24 12:22:14 +0000 |
2462 | @@ -886,6 +886,5 @@ |
2463 | } |
2464 | } |
2465 | |
2466 | - theme.version: Ubuntu.Ubuntu.toolkitVersion |
2467 | styleName: "TextAreaStyle" |
2468 | } |
2469 | |
2470 | === modified file 'src/Ubuntu/Components/1.3/TextCursor.qml' |
2471 | --- src/Ubuntu/Components/1.3/TextCursor.qml 2015-10-30 13:38:52 +0000 |
2472 | +++ src/Ubuntu/Components/1.3/TextCursor.qml 2015-11-24 12:22:14 +0000 |
2473 | @@ -41,7 +41,6 @@ |
2474 | handler.main.cursorDelegate : |
2475 | __styleInstance.cursorDelegate |
2476 | |
2477 | - theme.version: Ubuntu.Ubuntu.toolkitVersion |
2478 | styleName: "TextCursorStyle" |
2479 | |
2480 | objectName: "textCursor" |
2481 | |
2482 | === modified file 'src/Ubuntu/Components/1.3/TextField.qml' |
2483 | --- src/Ubuntu/Components/1.3/TextField.qml 2015-09-07 10:05:58 +0000 |
2484 | +++ src/Ubuntu/Components/1.3/TextField.qml 2015-11-24 12:22:14 +0000 |
2485 | @@ -870,6 +870,7 @@ |
2486 | for (var i = 0; i < children.length; i++) { |
2487 | children[i].parent = leftPane; |
2488 | children[i].anchors.verticalCenter = verticalCenter; |
2489 | + children[i].activeFocusOnPress = false; |
2490 | } |
2491 | } |
2492 | } |
2493 | @@ -892,6 +893,7 @@ |
2494 | for (var i = 0; i < children.length; i++) { |
2495 | children[i].parent = rightPane; |
2496 | children[i].anchors.verticalCenter = verticalCenter; |
2497 | + children[i].activeFocusOnPress = false; |
2498 | } |
2499 | } |
2500 | } |
2501 | @@ -1013,6 +1015,5 @@ |
2502 | cursorPosition = 0; |
2503 | } |
2504 | |
2505 | - theme.version: Ubuntu.Ubuntu.toolkitVersion |
2506 | styleName: "TextFieldStyle" |
2507 | } |
2508 | |
2509 | === modified file 'src/Ubuntu/Components/1.3/TextInputPopover.qml' |
2510 | --- src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-09-16 05:28:29 +0000 |
2511 | +++ src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-11-24 12:22:14 +0000 |
2512 | @@ -86,7 +86,6 @@ |
2513 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) |
2514 | height: units.gu(6) |
2515 | action: actions[modelData] |
2516 | - theme.version: Ubuntu.toolkitVersion |
2517 | styleName: "ToolbarButtonStyle" |
2518 | } |
2519 | } |
2520 | |
2521 | === modified file 'src/Ubuntu/Components/1.3/Toolbar.qml' |
2522 | --- src/Ubuntu/Components/1.3/Toolbar.qml 2015-05-21 10:50:35 +0000 |
2523 | +++ src/Ubuntu/Components/1.3/Toolbar.qml 2015-11-24 12:22:14 +0000 |
2524 | @@ -135,7 +135,6 @@ |
2525 | property bool opened: toolbar.opened |
2526 | property bool animating: toolbar.animating |
2527 | |
2528 | - theme.version: Toolkit.Ubuntu.toolkitVersion |
2529 | styleName: "ToolbarStyle" |
2530 | } |
2531 | |
2532 | |
2533 | === modified file 'src/Ubuntu/Components/1.3/ToolbarButton.qml' |
2534 | --- src/Ubuntu/Components/1.3/ToolbarButton.qml 2015-05-21 10:50:35 +0000 |
2535 | +++ src/Ubuntu/Components/1.3/ToolbarButton.qml 2015-11-24 12:22:14 +0000 |
2536 | @@ -84,6 +84,5 @@ |
2537 | height: parent ? parent.height : undefined |
2538 | width: units.gu(5) |
2539 | |
2540 | - theme.version: Ubuntu.toolkitVersion |
2541 | styleName: "ToolbarButtonStyle" |
2542 | } |
2543 | |
2544 | === removed file 'src/Ubuntu/Components/1.3/mathUtils.js' |
2545 | --- src/Ubuntu/Components/1.3/mathUtils.js 2015-07-24 18:25:07 +0000 |
2546 | +++ src/Ubuntu/Components/1.3/mathUtils.js 1970-01-01 00:00:00 +0000 |
2547 | @@ -1,61 +0,0 @@ |
2548 | -/* |
2549 | - * Copyright 2012-2015 Canonical Ltd. |
2550 | - * |
2551 | - * This program is free software; you can redistribute it and/or modify |
2552 | - * it under the terms of the GNU Lesser General Public License as published by |
2553 | - * the Free Software Foundation; version 3. |
2554 | - * |
2555 | - * This program is distributed in the hope that it will be useful, |
2556 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2557 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2558 | - * GNU Lesser General Public License for more details. |
2559 | - * |
2560 | - * You should have received a copy of the GNU Lesser General Public License |
2561 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2562 | - */ |
2563 | - |
2564 | -/*! |
2565 | - \qmltype mathUtils |
2566 | - \inqmlmodule Ubuntu.Components 1.3 |
2567 | - \ingroup ubuntu |
2568 | - \brief Various mathematical utility functions. |
2569 | - */ |
2570 | - |
2571 | -.pragma library |
2572 | - |
2573 | -/*! |
2574 | - \qmlmethod mathUtils::clamp(x, min, max) |
2575 | - Ensure the value x is between min and max |
2576 | - */ |
2577 | -function clamp(x, min, max) { |
2578 | - if (min <= max) { |
2579 | - return Math.max(min, Math.min(x, max)); |
2580 | - } else { |
2581 | - // swap min/max if min > max |
2582 | - return clamp(x, max, min); |
2583 | - } |
2584 | -} |
2585 | - |
2586 | -/*! |
2587 | - \qmlmethod mathUtils::lerp(delta, from, to) |
2588 | - Get the linear interpolation |
2589 | - */ |
2590 | -function lerp(delta, from, to) { |
2591 | - return ((1.0 - delta) * from) + (delta * to); |
2592 | -} |
2593 | - |
2594 | -/*! |
2595 | - \qmlmethod mathUtils::projectValue(x, xmin, xmax, ymin, ymax) |
2596 | - Linearly project a value x from [xmin, xmax] into [ymin, ymax] |
2597 | - */ |
2598 | -function projectValue(x, xmin, xmax, ymin, ymax) { |
2599 | - return ((x - xmin) * ymax - (x - xmax) * ymin) / (xmax - xmin) |
2600 | -} |
2601 | - |
2602 | -/*! |
2603 | - \qmlmethod mathUtils::clampAndProject(x, xmin, xmax, ymin, ymax) |
2604 | - Linearly project a value x, but in addition to projectValue it's clamped to xmin/xmax first |
2605 | - */ |
2606 | -function clampAndProject(x, xmin, xmax, ymin, ymax) { |
2607 | - return projectValue(clamp(x, xmin, xmax), xmin, xmax, ymin, ymax) |
2608 | -} |
2609 | |
2610 | === modified file 'src/Ubuntu/Components/ComponentModule.pro' |
2611 | --- src/Ubuntu/Components/ComponentModule.pro 2015-10-02 22:48:13 +0000 |
2612 | +++ src/Ubuntu/Components/ComponentModule.pro 2015-11-24 12:22:14 +0000 |
2613 | @@ -43,7 +43,6 @@ |
2614 | 1.2/MainView12.qml \ |
2615 | 1.2/MainViewBase.qml \ |
2616 | 1.2/MainView.qml \ |
2617 | - 1.2/mathUtils.js \ |
2618 | 1.2/Object.qml \ |
2619 | 1.2/OptionSelectorDelegate.qml \ |
2620 | 1.2/OptionSelector.qml \ |
2621 | @@ -60,7 +59,6 @@ |
2622 | 1.2/Panel.qml \ |
2623 | 1.2/PullToRefresh.qml \ |
2624 | 1.2/Scrollbar.qml \ |
2625 | - 1.2/scrollbarUtils.js \ |
2626 | 1.2/Slider.qml \ |
2627 | 1.2/sliderUtils.js \ |
2628 | 1.2/stack.js \ |
2629 | @@ -96,7 +94,6 @@ |
2630 | 1.3/InputHandler.qml \ |
2631 | 1.3/MainViewBase.qml \ |
2632 | 1.3/MainView.qml \ |
2633 | - 1.3/mathUtils.js \ |
2634 | 1.3/OptionSelectorDelegate.qml \ |
2635 | 1.3/OptionSelector.qml \ |
2636 | 1.3/OrientationHelper.qml \ |
2637 | @@ -132,7 +129,6 @@ |
2638 | 1.3/UbuntuListView.qml \ |
2639 | 1.3/UbuntuNumberAnimation.qml \ |
2640 | 1.3/ListItemPopover.qml \ |
2641 | - 1.3/BottomEdgeHint.qml \ |
2642 | 1.3/PageColumn.qml \ |
2643 | 1.3/PageColumnsLayout.qml \ |
2644 | 1.3/ProgressionSlot.qml \ |
2645 | @@ -141,7 +137,6 @@ |
2646 | OTHER_FILES+= qmldir \ |
2647 | 1.3/CrossFadeImage.qdoc \ |
2648 | 1.3/UbuntuListView11.qdoc \ |
2649 | - 1.3/Page.qdoc \ |
2650 | 1.3/PageHeadConfiguration.qdoc \ |
2651 | 1.3/MainView.qdoc \ |
2652 | 1.3/Icon.qdoc |
2653 | |
2654 | === modified file 'src/Ubuntu/Components/ListItems/1.3/ItemSelector.qml' |
2655 | --- src/Ubuntu/Components/ListItems/1.3/ItemSelector.qml 2015-05-22 13:54:38 +0000 |
2656 | +++ src/Ubuntu/Components/ListItems/1.3/ItemSelector.qml 2015-11-24 12:22:14 +0000 |
2657 | @@ -216,7 +216,6 @@ |
2658 | right: parent.right |
2659 | } |
2660 | state: itemSelector.expanded ? "expanded" : "collapsed" |
2661 | - theme.version: Ubuntu.toolkitVersion |
2662 | styleName: "ListItemOptionSelectorStyle" |
2663 | |
2664 | states: [ State { |
2665 | |
2666 | === modified file 'src/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml' |
2667 | --- src/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml 2015-05-22 13:54:38 +0000 |
2668 | +++ src/Ubuntu/Components/ListItems/1.3/ProgressionVisual.qml 2015-11-24 12:22:14 +0000 |
2669 | @@ -25,6 +25,5 @@ |
2670 | property bool showSplit: false |
2671 | property real splitMargin |
2672 | |
2673 | - theme.version: Ubuntu.toolkitVersion |
2674 | styleName: "ProgressionVisualStyle" |
2675 | } |
2676 | |
2677 | === modified file 'src/Ubuntu/Components/Pickers/1.3/DatePicker.qml' |
2678 | --- src/Ubuntu/Components/Pickers/1.3/DatePicker.qml 2015-05-22 13:54:38 +0000 |
2679 | +++ src/Ubuntu/Components/Pickers/1.3/DatePicker.qml 2015-11-24 12:22:14 +0000 |
2680 | @@ -420,7 +420,6 @@ |
2681 | } |
2682 | } |
2683 | |
2684 | - theme.version: Ubuntu.toolkitVersion |
2685 | styleName: "DatePickerStyle" |
2686 | Binding { |
2687 | target: __styleInstance |
2688 | |
2689 | === modified file 'src/Ubuntu/Components/Pickers/1.3/Dialer.qml' |
2690 | --- src/Ubuntu/Components/Pickers/1.3/Dialer.qml 2015-05-22 13:54:38 +0000 |
2691 | +++ src/Ubuntu/Components/Pickers/1.3/Dialer.qml 2015-11-24 12:22:14 +0000 |
2692 | @@ -145,7 +145,6 @@ |
2693 | implicitHeight: size |
2694 | activeFocusOnPress: true |
2695 | |
2696 | - theme.version: Ubuntu.toolkitVersion |
2697 | styleName: "DialerStyle" |
2698 | |
2699 | Item { |
2700 | |
2701 | === modified file 'src/Ubuntu/Components/Pickers/1.3/DialerHand.qml' |
2702 | --- src/Ubuntu/Components/Pickers/1.3/DialerHand.qml 2015-05-22 13:54:38 +0000 |
2703 | +++ src/Ubuntu/Components/Pickers/1.3/DialerHand.qml 2015-11-24 12:22:14 +0000 |
2704 | @@ -143,7 +143,6 @@ |
2705 | width: parent.width |
2706 | height: parent.height |
2707 | activeFocusOnPress: true |
2708 | - theme.version: Ubuntu.toolkitVersion |
2709 | styleName: "DialerHandStyle" |
2710 | |
2711 | /*! \internal */ |
2712 | |
2713 | === modified file 'src/Ubuntu/Components/Pickers/1.3/Picker.qml' |
2714 | --- src/Ubuntu/Components/Pickers/1.3/Picker.qml 2015-09-24 20:05:52 +0000 |
2715 | +++ src/Ubuntu/Components/Pickers/1.3/Picker.qml 2015-11-24 12:22:14 +0000 |
2716 | @@ -165,7 +165,6 @@ |
2717 | |
2718 | activeFocusOnPress: true |
2719 | |
2720 | - theme.version: Ubuntu.toolkitVersion |
2721 | styleName: "PickerStyle" |
2722 | |
2723 | /*! \internal */ |
2724 | |
2725 | === modified file 'src/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml' |
2726 | --- src/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml 2015-09-24 20:05:52 +0000 |
2727 | +++ src/Ubuntu/Components/Pickers/1.3/PickerDelegate.qml 2015-11-24 12:22:14 +0000 |
2728 | @@ -45,7 +45,6 @@ |
2729 | internal.itemList.currentIndex = index; |
2730 | } |
2731 | |
2732 | - theme.version: Ubuntu.toolkitVersion |
2733 | styleName: "PickerDelegateStyle" |
2734 | |
2735 | QtObject { |
2736 | |
2737 | === modified file 'src/Ubuntu/Components/Popups/1.3/Dialog.qml' |
2738 | --- src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-09-21 14:44:13 +0000 |
2739 | +++ src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-11-24 12:22:14 +0000 |
2740 | @@ -213,7 +213,6 @@ |
2741 | } |
2742 | } |
2743 | |
2744 | - theme.version: Ubuntu.toolkitVersion |
2745 | styleName: "DialogForegroundStyle" |
2746 | } |
2747 | } |
2748 | |
2749 | === modified file 'src/Ubuntu/Components/Popups/1.3/Popover.qml' |
2750 | --- src/Ubuntu/Components/Popups/1.3/Popover.qml 2015-08-12 19:53:20 +0000 |
2751 | +++ src/Ubuntu/Components/Popups/1.3/Popover.qml 2015-11-24 12:22:14 +0000 |
2752 | @@ -241,7 +241,6 @@ |
2753 | signal showCompleted() |
2754 | signal hideCompleted() |
2755 | |
2756 | - theme.version: Ubuntu.toolkitVersion |
2757 | styleName: "PopoverForegroundStyle" |
2758 | } |
2759 | |
2760 | |
2761 | === modified file 'src/Ubuntu/Components/Popups/1.3/SheetBase.qml' |
2762 | --- src/Ubuntu/Components/Popups/1.3/SheetBase.qml 2015-05-22 13:54:38 +0000 |
2763 | +++ src/Ubuntu/Components/Popups/1.3/SheetBase.qml 2015-11-24 12:22:14 +0000 |
2764 | @@ -109,7 +109,6 @@ |
2765 | } |
2766 | } |
2767 | |
2768 | - theme.version: Ubuntu.toolkitVersion |
2769 | styleName: "SheetForegroundStyle" |
2770 | } |
2771 | } |
2772 | |
2773 | === modified file 'src/Ubuntu/Components/Styles/Styles.pro' |
2774 | --- src/Ubuntu/Components/Styles/Styles.pro 2015-10-08 21:19:56 +0000 |
2775 | +++ src/Ubuntu/Components/Styles/Styles.pro 2015-11-24 12:22:14 +0000 |
2776 | @@ -13,7 +13,3 @@ |
2777 | load(ubuntu_qml_module) |
2778 | |
2779 | OTHER_FILES+=qmldir |
2780 | - |
2781 | - |
2782 | - |
2783 | - |
2784 | |
2785 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml' |
2786 | --- src/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml 2015-04-24 14:52:19 +0000 |
2787 | +++ src/Ubuntu/Components/Themes/Ambiance/1.2/OptionSelectorStyle.qml 2015-11-24 12:22:14 +0000 |
2788 | @@ -20,6 +20,7 @@ |
2789 | |
2790 | Item { |
2791 | id: ambianceStyle |
2792 | + objectName: "OptionSelector12" |
2793 | |
2794 | property url chevron: Qt.resolvedUrl("../artwork/chevron_down.png") |
2795 | property url tick: Qt.resolvedUrl("../artwork/tick.png") |
2796 | |
2797 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml' |
2798 | --- src/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml 2015-04-24 14:52:19 +0000 |
2799 | +++ src/Ubuntu/Components/Themes/Ambiance/1.2/ScrollbarStyle.qml 2015-11-24 12:22:14 +0000 |
2800 | @@ -85,7 +85,7 @@ |
2801 | property Flickable flickableItem: styledItem.flickableItem |
2802 | property bool isScrollable: styledItem.__private.scrollable && pageSize > 0.0 |
2803 | && contentSize > 0.0 && contentSize > pageSize |
2804 | - property bool isVertical: ScrollbarUtils.isVertical(styledItem) |
2805 | + property bool isVertical: (styledItem.align === Qt.AlignLeading) || (styledItem.align === Qt.AlignTrailing) |
2806 | property bool frontAligned: (styledItem.align === Qt.AlignLeading) |
2807 | property bool rearAligned: (styledItem.align === Qt.AlignTrailing) |
2808 | property bool topAligned: (styledItem.align === Qt.AlignTop) |
2809 | @@ -94,6 +94,83 @@ |
2810 | property real pageSize: (isVertical) ? styledItem.height : styledItem.width |
2811 | property real contentSize: (isVertical) ? styledItem.flickableItem.contentHeight : styledItem.flickableItem.contentWidth |
2812 | |
2813 | + /*! |
2814 | + \internal |
2815 | + Object storing property names used in calculations. |
2816 | + */ |
2817 | + QtObject { |
2818 | + id: scrollbarUtils |
2819 | + |
2820 | + property string propOrigin: (isVertical) ? "originY" : "originX" |
2821 | + property string propContent: (isVertical) ? "contentY" : "contentX" |
2822 | + property string propPosRatio: (isVertical) ? "yPosition" : "xPosition" |
2823 | + property string propSizeRatio: (isVertical) ? "heightRatio" : "widthRatio" |
2824 | + property string propCoordinate: (isVertical) ? "y" : "x" |
2825 | + property string propSize: (isVertical) ? "height" : "width" |
2826 | + |
2827 | + /*! |
2828 | + \internal |
2829 | + Calculates the slider position based on the visible area's ratios. |
2830 | + */ |
2831 | + function sliderPos(min, max) { |
2832 | + return MathUtils.clamp(styledItem.flickableItem.visibleArea[propPosRatio] * styledItem.flickableItem[propSize], min, max); |
2833 | + } |
2834 | + |
2835 | + /*! |
2836 | + \internal |
2837 | + Calculates the slider size for ListViews based on the visible area's position |
2838 | + and size ratios, clamping it between min and max. |
2839 | + |
2840 | + The function can be used in Scrollbar styles to calculate the size of the slider. |
2841 | + */ |
2842 | + function sliderSize(min, max) { |
2843 | + var sizeRatio = styledItem.flickableItem.visibleArea[propSizeRatio]; |
2844 | + var posRatio = styledItem.flickableItem.visibleArea[propPosRatio]; |
2845 | + var sizeUnderflow = (sizeRatio * max) < min ? min - (sizeRatio * max) : 0 |
2846 | + var startPos = posRatio * (max - sizeUnderflow) |
2847 | + var endPos = (posRatio + sizeRatio) * (max - sizeUnderflow) + sizeUnderflow |
2848 | + var overshootStart = startPos < 0 ? -startPos : 0 |
2849 | + var overshootEnd = endPos > max ? endPos - max : 0 |
2850 | + |
2851 | + // overshoot adjusted start and end |
2852 | + var adjustedStartPos = startPos + overshootStart |
2853 | + var adjustedEndPos = endPos - overshootStart - overshootEnd |
2854 | + |
2855 | + // final position and size of thumb |
2856 | + var position = adjustedStartPos + min > max ? max - min : adjustedStartPos |
2857 | + var result = (adjustedEndPos - position) < min ? min : (adjustedEndPos - position) |
2858 | + |
2859 | + return result; |
2860 | + } |
2861 | + |
2862 | + /*! |
2863 | + \internal |
2864 | + The function calculates and clamps the position to be scrolled to the minimum |
2865 | + and maximum values. |
2866 | + |
2867 | + The scroll and drag functions require a slider that does not have any minimum |
2868 | + size set (meaning the minimum is set to 0.0). Implementations should consider |
2869 | + using an invisible cursor to drag the slider and the ListView position. |
2870 | + */ |
2871 | + function scrollAndClamp(amount, min, max) { |
2872 | + return styledItem.flickableItem[propOrigin] + |
2873 | + MathUtils.clamp(styledItem.flickableItem[propContent] - styledItem.flickableItem[propOrigin] + amount, |
2874 | + min, max); |
2875 | + } |
2876 | + |
2877 | + /*! |
2878 | + \internal |
2879 | + The function calculates the new position of the dragged slider. The amount is |
2880 | + relative to the contentSize, which is either the flickable's contentHeight or |
2881 | + contentWidth or other calculated value, depending on its orientation. The pageSize |
2882 | + specifies the visibleArea, and it is usually the heigtht/width of the scrolling area. |
2883 | + */ |
2884 | + function dragAndClamp(cursor, contentSize, pageSize) { |
2885 | + styledItem.flickableItem[propContent] = |
2886 | + styledItem.flickableItem[propOrigin] + cursor[propCoordinate] * contentSize / pageSize; |
2887 | + } |
2888 | + } |
2889 | + |
2890 | /***************************************** |
2891 | Visuals |
2892 | *****************************************/ |
2893 | @@ -231,13 +308,13 @@ |
2894 | // total size of the flickable. |
2895 | Item { |
2896 | id: scrollCursor |
2897 | - x: (isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - scrollCursor.width) |
2898 | - y: (!isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - scrollCursor.height) |
2899 | - width: (isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.width) |
2900 | - height: (!isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.height) |
2901 | + x: (isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - scrollCursor.width) |
2902 | + y: (!isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - scrollCursor.height) |
2903 | + width: (isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.width) |
2904 | + height: (!isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.height) |
2905 | |
2906 | function drag() { |
2907 | - ScrollbarUtils.dragAndClamp(styledItem, scrollCursor, contentSize, pageSize); |
2908 | + scrollbarUtils.dragAndClamp(styledItem, scrollCursor, contentSize, pageSize); |
2909 | } |
2910 | } |
2911 | |
2912 | @@ -253,10 +330,10 @@ |
2913 | bottom: (!isVertical) ? scrollbarArea.bottom : undefined |
2914 | } |
2915 | |
2916 | - x: (isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - slider.width) |
2917 | - y: (!isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - slider.height) |
2918 | - width: (isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.width) |
2919 | - height: (!isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.height) |
2920 | + x: (isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - slider.width) |
2921 | + y: (!isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - slider.height) |
2922 | + width: (isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.width) |
2923 | + height: (!isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.height) |
2924 | radius: visuals.sliderRadius |
2925 | |
2926 | Behavior on width { |
2927 | @@ -275,7 +352,7 @@ |
2928 | } |
2929 | |
2930 | function scroll(amount) { |
2931 | - scrollAnimation.to = ScrollbarUtils.scrollAndClamp(styledItem, amount, 0.0, contentSize - pageSize); |
2932 | + scrollAnimation.to = scrollbarUtils.scrollAndClamp(styledItem, amount, 0.0, contentSize - pageSize); |
2933 | scrollAnimation.restart(); |
2934 | } |
2935 | } |
2936 | |
2937 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml' |
2938 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2015-10-15 14:17:25 +0000 |
2939 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ActionBarStyle.qml 2015-11-24 12:22:14 +0000 |
2940 | @@ -34,7 +34,7 @@ |
2941 | */ |
2942 | defaultDelegate: AbstractButton { |
2943 | style: IconButtonStyle { } |
2944 | - objectName: action.objectName + "_action_button" |
2945 | + objectName: action.objectName + "_button" |
2946 | height: parent ? parent.height : undefined |
2947 | action: modelData |
2948 | } |
2949 | @@ -88,7 +88,7 @@ |
2950 | iconSource: actionBarStyle.overflowIconSource |
2951 | iconName: actionBarStyle.overflowIconName |
2952 | text: actionBarStyle.overflowText |
2953 | - objectName: "overflow" |
2954 | + objectName: "overflow_action" |
2955 | visible: numberOfSlots.requested > numberOfSlots.available |
2956 | onTriggered: { |
2957 | var overflowButton = actionsRepeater.itemAt(actionsRepeater.count - 1); |
2958 | |
2959 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ActivityIndicatorStyle.qml' |
2960 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ActivityIndicatorStyle.qml 2015-04-25 07:36:13 +0000 |
2961 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ActivityIndicatorStyle.qml 2015-11-24 12:22:14 +0000 |
2962 | @@ -22,7 +22,7 @@ |
2963 | |
2964 | anchors.fill: parent |
2965 | smooth: true |
2966 | - visible: styledItem.running |
2967 | + visible: styledItem.running && styledItem.visible |
2968 | fillMode: Image.PreserveAspectFit |
2969 | horizontalAlignment: Image.AlignHCenter |
2970 | verticalAlignment: Image.AlignVCenter |
2971 | |
2972 | === added file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml' |
2973 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 1970-01-01 00:00:00 +0000 |
2974 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2015-11-24 12:22:14 +0000 |
2975 | @@ -0,0 +1,149 @@ |
2976 | +/* |
2977 | + * Copyright 2015 Canonical Ltd. |
2978 | + * |
2979 | + * This program is free software; you can redistribute it and/or modify |
2980 | + * it under the terms of the GNU Lesser General Public License as published by |
2981 | + * the Free Software Foundation; version 3. |
2982 | + * |
2983 | + * This program is distributed in the hope that it will be useful, |
2984 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2985 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2986 | + * GNU Lesser General Public License for more details. |
2987 | + * |
2988 | + * You should have received a copy of the GNU Lesser General Public License |
2989 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2990 | + */ |
2991 | + |
2992 | +import QtQuick 2.4 |
2993 | +import Ubuntu.Components 1.3 |
2994 | +import Ubuntu.Components.ListItems 1.3 |
2995 | + |
2996 | +Item { |
2997 | + id: bottomEdgeHintStyle |
2998 | + implicitWidth: styledItem.parent.width |
2999 | + implicitHeight: units.gu(4) |
3000 | + |
3001 | + readonly property BottomEdgeHint hint: styledItem |
3002 | + |
3003 | + // translate hint status into state |
3004 | + state: { |
3005 | + switch (hint.status) { |
3006 | + case BottomEdgeHint.Hidden: return "Hidden"; |
3007 | + case BottomEdgeHint.Inactive: return "Inactive" |
3008 | + case BottomEdgeHint.Active: return "Active" |
3009 | + case BottomEdgeHint.Locked: return "Locked" |
3010 | + } |
3011 | + } |
3012 | + |
3013 | + states: [ |
3014 | + State { |
3015 | + name: "Inactive" |
3016 | + extend: "" |
3017 | + }, |
3018 | + State { |
3019 | + name: "Active" |
3020 | + PropertyChanges { |
3021 | + target: h1 |
3022 | + anchors.verticalCenterOffset: styledItem.height / 2 |
3023 | + } |
3024 | + PropertyChanges { |
3025 | + target: h2 |
3026 | + anchors.topMargin: 0 |
3027 | + } |
3028 | + }, |
3029 | + State { |
3030 | + name: "Hidden" |
3031 | + PropertyChanges { |
3032 | + target: styledItem |
3033 | + opacity: 0.0 |
3034 | + } |
3035 | + }, |
3036 | + State { |
3037 | + name: "Locked" |
3038 | + PropertyChanges { |
3039 | + target: h1 |
3040 | + anchors.verticalCenterOffset: styledItem.height / 2 |
3041 | + } |
3042 | + PropertyChanges { |
3043 | + target: h2 |
3044 | + anchors.topMargin: 0 |
3045 | + } |
3046 | + } |
3047 | + ] |
3048 | + transitions: [ |
3049 | + Transition { |
3050 | + from: "*" |
3051 | + to: "Active" |
3052 | + reversible: true |
3053 | + UbuntuNumberAnimation { |
3054 | + targets: [h1, h2] |
3055 | + properties: "anchors.verticalCenterOffset, anchors.topMargin" |
3056 | + } |
3057 | + }, |
3058 | + Transition { |
3059 | + from: "*" |
3060 | + to: "Hidden" |
3061 | + reversible: true |
3062 | + UbuntuNumberAnimation { |
3063 | + target: styledItem |
3064 | + property: "opacity" |
3065 | + duration: UbuntuAnimation.SlowDuration |
3066 | + } |
3067 | + } |
3068 | + ] |
3069 | + |
3070 | + clip: true |
3071 | + |
3072 | + Icon { |
3073 | + id: h1 |
3074 | + width: units.gu(2) |
3075 | + height: width |
3076 | + anchors { |
3077 | + centerIn: parent |
3078 | + topMargin: styledItem.height |
3079 | + } |
3080 | + name: "up" |
3081 | + } |
3082 | + |
3083 | + Rectangle { |
3084 | + id: h2 |
3085 | + anchors { |
3086 | + top: parent.top |
3087 | + left: parent.left |
3088 | + right: parent.right |
3089 | + topMargin: styledItem.height |
3090 | + } |
3091 | + height: styledItem.height |
3092 | + color: theme.palette.normal.overlay |
3093 | + ThinDivider { |
3094 | + anchors.top: parent.top |
3095 | + } |
3096 | + |
3097 | + Row { |
3098 | + anchors { |
3099 | + top: parent.top |
3100 | + bottom: parent.bottom |
3101 | + horizontalCenter: parent.horizontalCenter |
3102 | + } |
3103 | + spacing: units.gu(1) |
3104 | + Icon { |
3105 | + id: icon |
3106 | + name: styledItem.iconName |
3107 | + source: styledItem.iconSource |
3108 | + width: height |
3109 | + height: units.gu(2) |
3110 | + anchors.verticalCenter: parent.verticalCenter |
3111 | + color: theme.palette.normal.overlayText |
3112 | + } |
3113 | + Label { |
3114 | + id: label |
3115 | + text: styledItem.text |
3116 | + textSize: Label.Medium |
3117 | + color: theme.palette.normal.overlayText |
3118 | + height: styledItem.height |
3119 | + anchors.verticalCenter: parent.verticalCenter |
3120 | + verticalAlignment: Text.AlignVCenter |
3121 | + } |
3122 | + } |
3123 | + } |
3124 | +} |
3125 | |
3126 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml' |
3127 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml 2015-07-22 13:14:43 +0000 |
3128 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/OptionSelectorStyle.qml 2015-11-24 12:22:14 +0000 |
3129 | @@ -20,6 +20,7 @@ |
3130 | |
3131 | Item { |
3132 | id: ambianceStyle |
3133 | + objectName: "OptionSelector13" |
3134 | |
3135 | property url chevron: Qt.resolvedUrl("../artwork/chevron_down.png") |
3136 | property url tick: Qt.resolvedUrl("../artwork/tick.png") |
3137 | |
3138 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml' |
3139 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2015-11-02 15:27:14 +0000 |
3140 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml 2015-11-24 12:22:14 +0000 |
3141 | @@ -405,6 +405,16 @@ |
3142 | |
3143 | actions: headerStyle.config.actions |
3144 | numberOfSlots: 3 |
3145 | + |
3146 | + delegate: AbstractButton { |
3147 | + style: IconButtonStyle { } |
3148 | + objectName: action.objectName + "_button" |
3149 | + height: parent ? parent.height : undefined |
3150 | + action: modelData |
3151 | + StyleHints { |
3152 | + foregroundColor: headerStyle.buttonColor |
3153 | + } |
3154 | + } |
3155 | } |
3156 | } |
3157 | } |
3158 | |
3159 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml' |
3160 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2015-10-13 21:55:11 +0000 |
3161 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/PageHeaderStyle.qml 2015-11-24 12:22:14 +0000 |
3162 | @@ -21,7 +21,7 @@ |
3163 | id: pageHeaderStyle |
3164 | |
3165 | foregroundColor: theme.palette.selected.backgroundText |
3166 | - backgroundColor: "white" |
3167 | + backgroundColor: theme.palette.normal.background |
3168 | dividerColor: Qt.rgba(0, 0, 0, 0.1) |
3169 | property int fontWeight: Font.Light |
3170 | property int textSize: Label.Large |
3171 | @@ -31,7 +31,7 @@ |
3172 | |
3173 | defaultActionDelegate: AbstractButton { |
3174 | style: IconButtonStyle { } |
3175 | - objectName: action.objectName + "_action_button" |
3176 | + objectName: action.objectName + "_button" |
3177 | height: parent ? parent.height : undefined |
3178 | action: modelData |
3179 | StyleHints { |
3180 | |
3181 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml' |
3182 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml 2015-06-02 15:24:54 +0000 |
3183 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ScrollbarStyle.qml 2015-11-24 12:22:14 +0000 |
3184 | @@ -85,7 +85,7 @@ |
3185 | property Flickable flickableItem: styledItem.flickableItem |
3186 | property bool isScrollable: styledItem.__private.scrollable && pageSize > 0.0 |
3187 | && contentSize > 0.0 && contentSize > pageSize |
3188 | - property bool isVertical: ScrollbarUtils.isVertical(styledItem) |
3189 | + property bool isVertical: (styledItem.align === Qt.AlignLeading) || (styledItem.align === Qt.AlignTrailing) |
3190 | property bool frontAligned: (styledItem.align === Qt.AlignLeading) |
3191 | property bool rearAligned: (styledItem.align === Qt.AlignTrailing) |
3192 | property bool topAligned: (styledItem.align === Qt.AlignTop) |
3193 | @@ -94,6 +94,83 @@ |
3194 | property real pageSize: (isVertical) ? styledItem.height : styledItem.width |
3195 | property real contentSize: (isVertical) ? styledItem.flickableItem.contentHeight : styledItem.flickableItem.contentWidth |
3196 | |
3197 | + /*! |
3198 | + \internal |
3199 | + Object storing property names used in calculations. |
3200 | + */ |
3201 | + QtObject { |
3202 | + id: scrollbarUtils |
3203 | + |
3204 | + property string propOrigin: (isVertical) ? "originY" : "originX" |
3205 | + property string propContent: (isVertical) ? "contentY" : "contentX" |
3206 | + property string propPosRatio: (isVertical) ? "yPosition" : "xPosition" |
3207 | + property string propSizeRatio: (isVertical) ? "heightRatio" : "widthRatio" |
3208 | + property string propCoordinate: (isVertical) ? "y" : "x" |
3209 | + property string propSize: (isVertical) ? "height" : "width" |
3210 | + |
3211 | + /*! |
3212 | + \internal |
3213 | + Calculates the slider position based on the visible area's ratios. |
3214 | + */ |
3215 | + function sliderPos(min, max) { |
3216 | + return MathUtils.clamp(styledItem.flickableItem.visibleArea[propPosRatio] * styledItem.flickableItem[propSize], min, max); |
3217 | + } |
3218 | + |
3219 | + /*! |
3220 | + \internal |
3221 | + Calculates the slider size for ListViews based on the visible area's position |
3222 | + and size ratios, clamping it between min and max. |
3223 | + |
3224 | + The function can be used in Scrollbar styles to calculate the size of the slider. |
3225 | + */ |
3226 | + function sliderSize(min, max) { |
3227 | + var sizeRatio = styledItem.flickableItem.visibleArea[propSizeRatio]; |
3228 | + var posRatio = styledItem.flickableItem.visibleArea[propPosRatio]; |
3229 | + var sizeUnderflow = (sizeRatio * max) < min ? min - (sizeRatio * max) : 0 |
3230 | + var startPos = posRatio * (max - sizeUnderflow) |
3231 | + var endPos = (posRatio + sizeRatio) * (max - sizeUnderflow) + sizeUnderflow |
3232 | + var overshootStart = startPos < 0 ? -startPos : 0 |
3233 | + var overshootEnd = endPos > max ? endPos - max : 0 |
3234 | + |
3235 | + // overshoot adjusted start and end |
3236 | + var adjustedStartPos = startPos + overshootStart |
3237 | + var adjustedEndPos = endPos - overshootStart - overshootEnd |
3238 | + |
3239 | + // final position and size of thumb |
3240 | + var position = adjustedStartPos + min > max ? max - min : adjustedStartPos |
3241 | + var result = (adjustedEndPos - position) < min ? min : (adjustedEndPos - position) |
3242 | + |
3243 | + return result; |
3244 | + } |
3245 | + |
3246 | + /*! |
3247 | + \internal |
3248 | + The function calculates and clamps the position to be scrolled to the minimum |
3249 | + and maximum values. |
3250 | + |
3251 | + The scroll and drag functions require a slider that does not have any minimum |
3252 | + size set (meaning the minimum is set to 0.0). Implementations should consider |
3253 | + using an invisible cursor to drag the slider and the ListView position. |
3254 | + */ |
3255 | + function scrollAndClamp(amount, min, max) { |
3256 | + return styledItem.flickableItem[propOrigin] + |
3257 | + MathUtils.clamp(styledItem.flickableItem[propContent] - styledItem.flickableItem[propOrigin] + amount, |
3258 | + min, max); |
3259 | + } |
3260 | + |
3261 | + /*! |
3262 | + \internal |
3263 | + The function calculates the new position of the dragged slider. The amount is |
3264 | + relative to the contentSize, which is either the flickable's contentHeight or |
3265 | + contentWidth or other calculated value, depending on its orientation. The pageSize |
3266 | + specifies the visibleArea, and it is usually the heigtht/width of the scrolling area. |
3267 | + */ |
3268 | + function dragAndClamp(cursor, contentSize, pageSize) { |
3269 | + styledItem.flickableItem[propContent] = |
3270 | + styledItem.flickableItem[propOrigin] + cursor[propCoordinate] * contentSize / pageSize; |
3271 | + } |
3272 | + } |
3273 | + |
3274 | /***************************************** |
3275 | Visuals |
3276 | *****************************************/ |
3277 | @@ -231,13 +308,13 @@ |
3278 | // total size of the flickable. |
3279 | Item { |
3280 | id: scrollCursor |
3281 | - x: (isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - scrollCursor.width) |
3282 | - y: (!isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - scrollCursor.height) |
3283 | - width: (isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.width) |
3284 | - height: (!isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.height) |
3285 | + x: (isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - scrollCursor.width) |
3286 | + y: (!isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - scrollCursor.height) |
3287 | + width: (isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.width) |
3288 | + height: (!isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, 0.0, flickableItem.height) |
3289 | |
3290 | function drag() { |
3291 | - ScrollbarUtils.dragAndClamp(styledItem, scrollCursor, contentSize, pageSize); |
3292 | + scrollbarUtils.dragAndClamp(styledItem, scrollCursor, contentSize, pageSize); |
3293 | } |
3294 | } |
3295 | |
3296 | @@ -253,10 +330,10 @@ |
3297 | bottom: (!isVertical) ? scrollbarArea.bottom : undefined |
3298 | } |
3299 | |
3300 | - x: (isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - slider.width) |
3301 | - y: (!isVertical) ? 0 : ScrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - slider.height) |
3302 | - width: (isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.width) |
3303 | - height: (!isVertical) ? scrollbarArea.thickness : ScrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.height) |
3304 | + x: (isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.width - slider.width) |
3305 | + y: (!isVertical) ? 0 : scrollbarUtils.sliderPos(styledItem, 0.0, styledItem.height - slider.height) |
3306 | + width: (isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.width) |
3307 | + height: (!isVertical) ? scrollbarArea.thickness : scrollbarUtils.sliderSize(styledItem, minimumSliderSize, flickableItem.height) |
3308 | radius: visuals.sliderRadius |
3309 | |
3310 | Behavior on width { |
3311 | @@ -275,7 +352,7 @@ |
3312 | } |
3313 | |
3314 | function scroll(amount) { |
3315 | - scrollAnimation.to = ScrollbarUtils.scrollAndClamp(styledItem, amount, 0.0, contentSize - pageSize); |
3316 | + scrollAnimation.to = scrollbarUtils.scrollAndClamp(styledItem, amount, 0.0, contentSize - pageSize); |
3317 | scrollAnimation.restart(); |
3318 | } |
3319 | } |
3320 | |
3321 | === removed file 'src/Ubuntu/Components/Themes/Ambiance/1.3/scrollbarUtils.js' |
3322 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/scrollbarUtils.js 2015-07-23 22:12:36 +0000 |
3323 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/scrollbarUtils.js 1970-01-01 00:00:00 +0000 |
3324 | @@ -1,139 +0,0 @@ |
3325 | -/* |
3326 | - * Copyright 2012-2015 Canonical Ltd. |
3327 | - * |
3328 | - * This program is free software; you can redistribute it and/or modify |
3329 | - * it under the terms of the GNU Lesser General Public License as published by |
3330 | - * the Free Software Foundation; version 3. |
3331 | - * |
3332 | - * This program is distributed in the hope that it will be useful, |
3333 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3334 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3335 | - * GNU Lesser General Public License for more details. |
3336 | - * |
3337 | - * You should have received a copy of the GNU Lesser General Public License |
3338 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3339 | - */ |
3340 | - |
3341 | -/*! |
3342 | - \qmltype scrollbarUtils |
3343 | - \inqmlmodule Ubuntu.Components 1.3 |
3344 | - \ingroup ubuntu |
3345 | - \brief Various scrolling utility functions. |
3346 | - */ |
3347 | - |
3348 | -.pragma library |
3349 | - |
3350 | -Qt.include("mathUtils.js") |
3351 | - |
3352 | -/* |
3353 | - Object storing property names used in calculations. |
3354 | - */ |
3355 | -var _obj = { |
3356 | - scrollbar: null, |
3357 | - vertical: false, |
3358 | - propOrigin: "", |
3359 | - propContent: "", |
3360 | - propPosRatio: "", |
3361 | - propSizeRatio: "", |
3362 | - propCoordinate: "", |
3363 | - propSize: "", |
3364 | - refresh: function () { |
3365 | - _obj.vertical = (_obj.scrollbar.align === Qt.AlignLeading) || (_obj.scrollbar.align === Qt.AlignTrailing) |
3366 | - _obj.propOrigin = (_obj.vertical) ? "originY" : "originX"; |
3367 | - _obj.propContent = (_obj.vertical) ? "contentY" : "contentX"; |
3368 | - _obj.propPosRatio = (_obj.vertical) ? "yPosition" : "xPosition"; |
3369 | - _obj.propSizeRatio = (_obj.vertical) ? "heightRatio" : "widthRatio"; |
3370 | - _obj.propCoordinate = (_obj.vertical) ? "y" : "x"; |
3371 | - _obj.propSize = (_obj.vertical) ? "height" : "width"; |
3372 | - } |
3373 | -} |
3374 | - |
3375 | -/* |
3376 | - Checks whether the _obj is valid or not. Must be called in every function |
3377 | - as those can be invoked prior to the host (style) component completion. |
3378 | - */ |
3379 | -function __check(sb) { |
3380 | - if (sb !== null && (_obj.scrollbar !== sb)) { |
3381 | - _obj.scrollbar = sb; |
3382 | - sb.flickableItemChanged.connect(_obj.refresh); |
3383 | - sb.alignChanged.connect(_obj.refresh); |
3384 | - _obj.refresh(); |
3385 | - } |
3386 | - |
3387 | - return _obj.scrollbar; |
3388 | -} |
3389 | - |
3390 | -/*! |
3391 | - \qmlmethod scrollbarUtils::isVertical(scrollbar) |
3392 | - Returns whether the scrollbar is vertical or horizontal. |
3393 | - */ |
3394 | -function isVertical(scrollbar) { |
3395 | - if (!__check(scrollbar)) return 0; |
3396 | - return _obj.vertical; |
3397 | -} |
3398 | - |
3399 | -/*! |
3400 | - \qmlmethod scrollbarUtils::sliderPos(scrollbar, min, max) |
3401 | - Calculates the slider position based on the visible area's ratios. |
3402 | - */ |
3403 | -function sliderPos(scrollbar, min, max) { |
3404 | - if (!__check(scrollbar)) return 0; |
3405 | - return clamp(scrollbar.flickableItem.visibleArea[_obj.propPosRatio] * scrollbar.flickableItem[_obj.propSize], min, max); |
3406 | -} |
3407 | - |
3408 | -/*! |
3409 | - \qmlmethod scrollbarUtils::sliderSize(scrollbar, min, max) |
3410 | - Calculates the slider size for ListViews based on the visible area's position |
3411 | - and size ratios, clamping it between min and max. |
3412 | - |
3413 | - The function can be used in Scrollbar styles to calculate the size of the slider. |
3414 | - */ |
3415 | -function sliderSize(scrollbar, min, max) { |
3416 | - if (!__check(scrollbar)) return 0; |
3417 | - var sizeRatio = scrollbar.flickableItem.visibleArea[_obj.propSizeRatio]; |
3418 | - var posRatio = scrollbar.flickableItem.visibleArea[_obj.propPosRatio]; |
3419 | - var sizeUnderflow = (sizeRatio * max) < min ? min - (sizeRatio * max) : 0 |
3420 | - var startPos = posRatio * (max - sizeUnderflow) |
3421 | - var endPos = (posRatio + sizeRatio) * (max - sizeUnderflow) + sizeUnderflow |
3422 | - var overshootStart = startPos < 0 ? -startPos : 0 |
3423 | - var overshootEnd = endPos > max ? endPos - max : 0 |
3424 | - |
3425 | - // overshoot adjusted start and end |
3426 | - var adjustedStartPos = startPos + overshootStart |
3427 | - var adjustedEndPos = endPos - overshootStart - overshootEnd |
3428 | - |
3429 | - // final position and size of thumb |
3430 | - var position = adjustedStartPos + min > max ? max - min : adjustedStartPos |
3431 | - var result = (adjustedEndPos - position) < min ? min : (adjustedEndPos - position) |
3432 | - |
3433 | - return result; |
3434 | -} |
3435 | - |
3436 | -/*! |
3437 | - \qmlmethod scrollbarUtils::scrollAndClamp(scrollbar, amount, min, max) |
3438 | - The function calculates and clamps the position to be scrolled to the minimum |
3439 | - and maximum values. |
3440 | - |
3441 | - The scroll and drag functions require a slider that does not have any minimum |
3442 | - size set (meaning the minimum is set to 0.0). Implementations should consider |
3443 | - using an invisible cursor to drag the slider and the ListView position. |
3444 | - */ |
3445 | -function scrollAndClamp(scrollbar, amount, min, max) { |
3446 | - if (!__check(scrollbar)) return 0; |
3447 | - return scrollbar.flickableItem[_obj.propOrigin] + |
3448 | - clamp(scrollbar.flickableItem[_obj.propContent] - scrollbar.flickableItem[_obj.propOrigin] + amount, |
3449 | - min, max); |
3450 | -} |
3451 | - |
3452 | -/*! |
3453 | - \qmlmethod scrollbarUtils::dragAndClamp(scrollbar, cursor, contentSize, pageSize) |
3454 | - The function calculates the new position of the dragged slider. The amount is |
3455 | - relative to the contentSize, which is either the flickable's contentHeight or |
3456 | - contentWidth or other calculated value, depending on its orientation. The pageSize |
3457 | - specifies the visibleArea, and it is usually the heigtht/width of the scrolling area. |
3458 | - */ |
3459 | -function dragAndClamp(scrollbar, cursor, contentSize, pageSize) { |
3460 | - if (!__check(scrollbar)) return 0; |
3461 | - scrollbar.flickableItem[_obj.propContent] = |
3462 | - scrollbar.flickableItem[_obj.propOrigin] + cursor[_obj.propCoordinate] * contentSize / pageSize; |
3463 | -} |
3464 | |
3465 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro' |
3466 | --- src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2015-10-02 22:48:13 +0000 |
3467 | +++ src/Ubuntu/Components/Themes/Ambiance/Ambiance.pro 2015-11-24 12:22:14 +0000 |
3468 | @@ -113,6 +113,9 @@ |
3469 | 1.3/ToolbarStyle.qml \ |
3470 | 1.3/IconButtonStyle.qml \ |
3471 | 1.3/PageHeaderStyle.qml \ |
3472 | + 1.3/BottomEdgeHintStyle.qml \ |
3473 | $$ARTWORK_FILES |
3474 | |
3475 | load(ubuntu_qml_module) |
3476 | + |
3477 | +OTHER_FILES+=qmldir |
3478 | |
3479 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/qmldir' |
3480 | --- src/Ubuntu/Components/Themes/Ambiance/qmldir 2015-10-02 22:48:13 +0000 |
3481 | +++ src/Ubuntu/Components/Themes/Ambiance/qmldir 2015-11-24 12:22:14 +0000 |
3482 | @@ -82,6 +82,5 @@ |
3483 | |
3484 | ListItemStyle 1.3 ./1.3/ListItemStyle.qml |
3485 | internal SliderUtils 1.3/sliderUtils.js |
3486 | -internal ScrollbarUtils 1.3/scrollbarUtils.js |
3487 | internal ColorUtils 1.3/colorUtils.js |
3488 | PageHeaderStyle 1.3 ./1.3/PageHeaderStyle.qml |
3489 | |
3490 | === added directory 'src/Ubuntu/Components/plugin/gestures' |
3491 | === added file 'src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.cpp' |
3492 | --- src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.cpp 1970-01-01 00:00:00 +0000 |
3493 | +++ src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.cpp 2015-11-24 12:22:14 +0000 |
3494 | @@ -0,0 +1,46 @@ |
3495 | +/* |
3496 | + * Copyright (C) 2015 Canonical, Ltd. |
3497 | + * |
3498 | + * This program is free software; you can redistribute it and/or modify |
3499 | + * it under the terms of the GNU General Public License as published by |
3500 | + * the Free Software Foundation; version 3. |
3501 | + * |
3502 | + * This program is distributed in the hope that it will be useful, |
3503 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3504 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3505 | + * GNU General Public License for more details. |
3506 | + * |
3507 | + * You should have received a copy of the GNU General Public License |
3508 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3509 | + */ |
3510 | + |
3511 | +#include "CandidateInactivityTimer.h" |
3512 | + |
3513 | +namespace UbuntuGestures { |
3514 | + |
3515 | +CandidateInactivityTimer::CandidateInactivityTimer(int touchId, QQuickItem *candidate, |
3516 | + AbstractTimer *timer, QObject *parent) |
3517 | + : QObject(parent) |
3518 | + , m_timer(timer) |
3519 | + , m_touchId(touchId) |
3520 | + , m_candidate(candidate) |
3521 | +{ |
3522 | + connect(m_timer, &AbstractTimer::timeout, |
3523 | + this, &CandidateInactivityTimer::onTimeout); |
3524 | + m_timer->setInterval(durationMs); |
3525 | + m_timer->setSingleShot(true); |
3526 | + m_timer->start(); |
3527 | +} |
3528 | + |
3529 | +CandidateInactivityTimer::~CandidateInactivityTimer() |
3530 | +{ |
3531 | + delete m_timer; |
3532 | +} |
3533 | + |
3534 | +void CandidateInactivityTimer::onTimeout() |
3535 | +{ |
3536 | + qWarning("[TouchRegistry] Candidate for touch %d defaulted!", m_touchId); |
3537 | + Q_EMIT candidateDefaulted(m_touchId, m_candidate); |
3538 | +} |
3539 | + |
3540 | +} // namespace UbuntuGestures |
3541 | |
3542 | === added file 'src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.h' |
3543 | --- src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.h 1970-01-01 00:00:00 +0000 |
3544 | +++ src/Ubuntu/Components/plugin/gestures/CandidateInactivityTimer.h 2015-11-24 12:22:14 +0000 |
3545 | @@ -0,0 +1,52 @@ |
3546 | +/* |
3547 | + * Copyright 2015 Canonical Ltd. |
3548 | + * |
3549 | + * This program is free software; you can redistribute it and/or modify |
3550 | + * it under the terms of the GNU Lesser General Public License as published by |
3551 | + * the Free Software Foundation; version 3. |
3552 | + * |
3553 | + * This program is distributed in the hope that it will be useful, |
3554 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3555 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3556 | + * GNU Lesser General Public License for more details. |
3557 | + * |
3558 | + * You should have received a copy of the GNU Lesser General Public License |
3559 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3560 | + * |
3561 | + */ |
3562 | + |
3563 | +#ifndef UBUNTUGESTURES_CANDIDATE_INACTIVITY_TIMER_H |
3564 | +#define UBUNTUGESTURES_CANDIDATE_INACTIVITY_TIMER_H |
3565 | + |
3566 | +#include <QtCore/QObject> |
3567 | + |
3568 | +class QQuickItem; |
3569 | + |
3570 | +#include "Timer.h" |
3571 | + |
3572 | +namespace UbuntuGestures { |
3573 | + |
3574 | +class UBUNTUGESTURESQML_EXPORT CandidateInactivityTimer : public QObject { |
3575 | + Q_OBJECT |
3576 | +public: |
3577 | + CandidateInactivityTimer(int touchId, QQuickItem *candidate, |
3578 | + AbstractTimer *timer, |
3579 | + QObject *parent = Q_NULLPTR); |
3580 | + |
3581 | + virtual ~CandidateInactivityTimer(); |
3582 | + |
3583 | + const int durationMs = 1000; |
3584 | + |
3585 | +Q_SIGNALS: |
3586 | + void candidateDefaulted(int touchId, QQuickItem *candidate); |
3587 | +private Q_SLOTS: |
3588 | + void onTimeout(); |
3589 | +private: |
3590 | + AbstractTimer *m_timer; |
3591 | + int m_touchId; |
3592 | + QQuickItem *m_candidate; |
3593 | +}; |
3594 | + |
3595 | +} // namespace UbuntuGestures |
3596 | + |
3597 | +#endif // UBUNTUGESTURES_CANDIDATE_INACTIVITY_TIMER_H |
3598 | |
3599 | === added file 'src/Ubuntu/Components/plugin/gestures/damper.cpp' |
3600 | --- src/Ubuntu/Components/plugin/gestures/damper.cpp 1970-01-01 00:00:00 +0000 |
3601 | +++ src/Ubuntu/Components/plugin/gestures/damper.cpp 2015-11-24 12:22:14 +0000 |
3602 | @@ -0,0 +1,24 @@ |
3603 | +/* |
3604 | + * Copyright (C) 2015 Canonical, Ltd. |
3605 | + * |
3606 | + * This program is free software; you can redistribute it and/or modify |
3607 | + * it under the terms of the GNU General Public License as published by |
3608 | + * the Free Software Foundation; version 3. |
3609 | + * |
3610 | + * This program is distributed in the hope that it will be useful, |
3611 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3612 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3613 | + * GNU General Public License for more details. |
3614 | + * |
3615 | + * You should have received a copy of the GNU General Public License |
3616 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3617 | + */ |
3618 | + |
3619 | +#include "Damper.h" |
3620 | +#include <QDebug> |
3621 | + |
3622 | +QDebug operator<<(QDebug dbg, const DampedPointF &p) |
3623 | +{ |
3624 | + dbg.nospace() << "(" << p.x() << ", " << p.y() << ")"; |
3625 | + return dbg.space(); |
3626 | +} |
3627 | |
3628 | === added file 'src/Ubuntu/Components/plugin/gestures/damper.h' |
3629 | --- src/Ubuntu/Components/plugin/gestures/damper.h 1970-01-01 00:00:00 +0000 |
3630 | +++ src/Ubuntu/Components/plugin/gestures/damper.h 2015-11-24 12:22:14 +0000 |
3631 | @@ -0,0 +1,89 @@ |
3632 | +/* |
3633 | + * Copyright (C) 2013 Canonical, Ltd. |
3634 | + * |
3635 | + * This program is free software; you can redistribute it and/or modify |
3636 | + * it under the terms of the GNU General Public License as published by |
3637 | + * the Free Software Foundation; version 3. |
3638 | + * |
3639 | + * This program is distributed in the hope that it will be useful, |
3640 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3641 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3642 | + * GNU General Public License for more details. |
3643 | + * |
3644 | + * You should have received a copy of the GNU General Public License |
3645 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3646 | + */ |
3647 | + |
3648 | +#ifndef UBUNTU_GESTURES_DAMPER_H |
3649 | +#define UBUNTU_GESTURES_DAMPER_H |
3650 | + |
3651 | +#include <QtCore/QPointF> |
3652 | + |
3653 | +/* |
3654 | + Decreases the oscillations of a value along an axis. |
3655 | + */ |
3656 | +template <class Type> class Damper { |
3657 | +public: |
3658 | + Damper() : m_value(0), m_maxDelta(0) { } |
3659 | + |
3660 | + // Maximum delta between the raw value and its dampened counterpart. |
3661 | + void setMaxDelta(Type maxDelta) { |
3662 | + if (maxDelta < 0) qFatal("Damper::maxDelta must be a positive number."); |
3663 | + m_maxDelta = maxDelta; |
3664 | + } |
3665 | + Type maxDelta() const { return m_maxDelta; } |
3666 | + |
3667 | + void reset(Type value) { |
3668 | + m_value = value; |
3669 | + } |
3670 | + |
3671 | + Type update(Type value) { |
3672 | + Type delta = value - m_value; |
3673 | + if (delta > 0 && delta > m_maxDelta) { |
3674 | + m_value += delta - m_maxDelta; |
3675 | + } else if (delta < 0 && delta < -m_maxDelta) { |
3676 | + m_value += delta + m_maxDelta; |
3677 | + } |
3678 | + |
3679 | + return m_value; |
3680 | + } |
3681 | + |
3682 | + Type value() const { return m_value; } |
3683 | + |
3684 | +private: |
3685 | + Type m_value; |
3686 | + Type m_maxDelta; |
3687 | +}; |
3688 | + |
3689 | +/* |
3690 | + A point that has its movement dampened. |
3691 | + */ |
3692 | +class DampedPointF { |
3693 | +public: |
3694 | + void setMaxDelta(qreal maxDelta) { |
3695 | + m_x.setMaxDelta(maxDelta); |
3696 | + m_y.setMaxDelta(maxDelta); |
3697 | + } |
3698 | + |
3699 | + qreal maxDelta() const { return m_x.maxDelta(); } |
3700 | + |
3701 | + void reset(const QPointF &point) { |
3702 | + m_x.reset(point.x()); |
3703 | + m_y.reset(point.y()); |
3704 | + } |
3705 | + |
3706 | + void update(const QPointF &point) { |
3707 | + m_x.update(point.x()); |
3708 | + m_y.update(point.y()); |
3709 | + } |
3710 | + |
3711 | + qreal x() const { return m_x.value(); } |
3712 | + qreal y() const { return m_y.value(); } |
3713 | +private: |
3714 | + Damper<qreal> m_x; |
3715 | + Damper<qreal> m_y; |
3716 | +}; |
3717 | + |
3718 | +QDebug operator<<(QDebug dbg, const DampedPointF &p); |
3719 | + |
3720 | +#endif // UBUNTU_GESTURES_DAMPER_H |
3721 | |
3722 | === added file 'src/Ubuntu/Components/plugin/gestures/ubuntugesturesqmlglobal.h' |
3723 | --- src/Ubuntu/Components/plugin/gestures/ubuntugesturesqmlglobal.h 1970-01-01 00:00:00 +0000 |
3724 | +++ src/Ubuntu/Components/plugin/gestures/ubuntugesturesqmlglobal.h 2015-11-24 12:22:14 +0000 |
3725 | @@ -0,0 +1,24 @@ |
3726 | +/* |
3727 | + * Copyright 2015 Canonical Ltd. |
3728 | + * |
3729 | + * This program is free software; you can redistribute it and/or modify |
3730 | + * it under the terms of the GNU Lesser General Public License as published by |
3731 | + * the Free Software Foundation; version 3. |
3732 | + * |
3733 | + * This program is distributed in the hope that it will be useful, |
3734 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3735 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3736 | + * GNU Lesser General Public License for more details. |
3737 | + * |
3738 | + * You should have received a copy of the GNU Lesser General Public License |
3739 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3740 | + * |
3741 | + */ |
3742 | + |
3743 | +#include <QtCore/QtGlobal> |
3744 | + |
3745 | +#if defined(UBUNTUGESTURESQML_LIBRARY) |
3746 | +# define UBUNTUGESTURESQML_EXPORT Q_DECL_EXPORT |
3747 | +#else |
3748 | +# define UBUNTUGESTURESQML_EXPORT Q_DECL_IMPORT |
3749 | +#endif |
3750 | |
3751 | === added file 'src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp' |
3752 | --- src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp 1970-01-01 00:00:00 +0000 |
3753 | +++ src/Ubuntu/Components/plugin/gestures/ucswipearea.cpp 2015-11-24 12:22:14 +0000 |
3754 | @@ -0,0 +1,958 @@ |
3755 | +/* |
3756 | + * Copyright (C) 2015 Canonical, Ltd. |
3757 | + * |
3758 | + * This program is free software; you can redistribute it and/or modify |
3759 | + * it under the terms of the GNU General Public License as published by |
3760 | + * the Free Software Foundation; version 3. |
3761 | + * |
3762 | + * This program is distributed in the hope that it will be useful, |
3763 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3764 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3765 | + * GNU General Public License for more details. |
3766 | + * |
3767 | + * You should have received a copy of the GNU General Public License |
3768 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3769 | + * |
3770 | + */ |
3771 | + |
3772 | +#include "ucswipearea_p.h" |
3773 | + |
3774 | +#include <QQuickWindow> |
3775 | +#include <QtCore/qmath.h> |
3776 | +#include <QScreen> |
3777 | +#include <QDebug> |
3778 | + |
3779 | +#include <private/qquickwindow_p.h> |
3780 | + |
3781 | +// local |
3782 | +#include <UbuntuGestures/TouchOwnershipEvent> |
3783 | +#include <UbuntuGestures/TouchRegistry> |
3784 | +#include <UbuntuGestures/UnownedTouchEvent> |
3785 | + |
3786 | +using namespace UbuntuGestures; |
3787 | + |
3788 | +Q_LOGGING_CATEGORY(ucSwipeArea, "ubuntu.components.SwipeArea", QtMsgType::QtWarningMsg) |
3789 | +Q_LOGGING_CATEGORY(ucActiveTouchInfo, "ubuntu.components.SwipeArea.ActiveTouchInfo", QtMsgType::QtWarningMsg) |
3790 | + |
3791 | +#define SA_TRACE(params) qCDebug(ucSwipeArea).nospace() << "[SwipeArea(" << qPrintable(objectName()) << ")] " << params |
3792 | +#define TI_TRACE(params) qCDebug(ucActiveTouchInfo).nospace() << "[ActiveTouchInfo] " << params |
3793 | + |
3794 | +namespace { |
3795 | +const char *statusToString(UCSwipeAreaPrivate::Status status) |
3796 | +{ |
3797 | + if (status == UCSwipeAreaPrivate::WaitingForTouch) { |
3798 | + return "WaitingForTouch"; |
3799 | + } else if (status == UCSwipeAreaPrivate::Undecided) { |
3800 | + return "Undecided"; |
3801 | + } else { |
3802 | + return "Recognized"; |
3803 | + } |
3804 | +} |
3805 | + |
3806 | +QString touchPointStateToString(Qt::TouchPointState state) |
3807 | +{ |
3808 | + switch (state) { |
3809 | + case Qt::TouchPointPressed: |
3810 | + return QStringLiteral("pressed"); |
3811 | + case Qt::TouchPointMoved: |
3812 | + return QStringLiteral("moved"); |
3813 | + case Qt::TouchPointStationary: |
3814 | + return QStringLiteral("stationary"); |
3815 | + case Qt::TouchPointReleased: |
3816 | + return QStringLiteral("released"); |
3817 | + default: |
3818 | + return QStringLiteral("INVALID_STATE"); |
3819 | + } |
3820 | +} |
3821 | + |
3822 | +QString touchEventToString(const QTouchEvent *ev) |
3823 | +{ |
3824 | + QString message; |
3825 | + |
3826 | + switch (ev->type()) { |
3827 | + case QEvent::TouchBegin: |
3828 | + message.append("TouchBegin "); |
3829 | + break; |
3830 | + case QEvent::TouchUpdate: |
3831 | + message.append("TouchUpdate "); |
3832 | + break; |
3833 | + case QEvent::TouchEnd: |
3834 | + message.append("TouchEnd "); |
3835 | + break; |
3836 | + case QEvent::TouchCancel: |
3837 | + message.append("TouchCancel "); |
3838 | + break; |
3839 | + default: |
3840 | + message.append("INVALID_TOUCH_EVENT_TYPE "); |
3841 | + } |
3842 | + |
3843 | + Q_FOREACH(const QTouchEvent::TouchPoint& touchPoint, ev->touchPoints()) { |
3844 | + message.append( |
3845 | + QStringLiteral("(id:%1, state:%2, scenePos:(%3,%4)) ") |
3846 | + .arg(touchPoint.id()) |
3847 | + .arg(touchPointStateToString(touchPoint.state())) |
3848 | + .arg(touchPoint.scenePos().x()) |
3849 | + .arg(touchPoint.scenePos().y()) |
3850 | + ); |
3851 | + } |
3852 | + |
3853 | + return message; |
3854 | +} |
3855 | + |
3856 | +} // namespace { |
3857 | + |
3858 | +class Direction |
3859 | +{ |
3860 | +public: |
3861 | + static bool isHorizontal(UCSwipeArea::Direction type) |
3862 | + { |
3863 | + return type == UCSwipeArea::Leftwards |
3864 | + || type == UCSwipeArea::Rightwards |
3865 | + || type == UCSwipeArea::Horizontal; |
3866 | + } |
3867 | + |
3868 | + static bool isVertical(UCSwipeArea::Direction type) |
3869 | + { |
3870 | + return type == UCSwipeArea::Upwards |
3871 | + || type == UCSwipeArea::Downwards |
3872 | + || type == UCSwipeArea::Vertical; |
3873 | + } |
3874 | + |
3875 | + static bool isPositive(UCSwipeArea::Direction type) |
3876 | + { |
3877 | + return type == UCSwipeArea::Rightwards |
3878 | + || type == UCSwipeArea::Downwards |
3879 | + || type == UCSwipeArea::Horizontal |
3880 | + || type == UCSwipeArea::Vertical; |
3881 | + } |
3882 | +}; |
3883 | +/*! |
3884 | + * \qmltype SwipeArea |
3885 | + * \instantiates UCSwipeArea |
3886 | + * \inherits Item |
3887 | + * \inqmlmodule Ubuntu.Components 1.3 |
3888 | + * \since Ubuntu.Components 1.3 |
3889 | + * \ingroup ubuntu-gestures |
3890 | + * \brief An area which detects axis-aligned single-finger drag gestures. |
3891 | + * |
3892 | + * The component can be used to detect gestures of a certain direction, and can |
3893 | + * grab gestures started on a component placed behind of the SwipeArea. |
3894 | + * The gesture is detected on the SwipeArea, therefore the size must be |
3895 | + * chosen carefully so it can properly detect the gesture. |
3896 | + * |
3897 | + * The gesture direction is specified by the \l direction property. The recognized |
3898 | + * and captured gesture is reported through the \l dragging property, which becomes |
3899 | + * \c true when the gesture is detected. If there was a component under the |
3900 | + * SwipeArea, the gesture will be cancelled on that component. |
3901 | + * |
3902 | + * The drag recognition is performed within the component area in the specified |
3903 | + * direction. If the drag deviates too much from this, recognition will fail, |
3904 | + * as well as if the drag or the flick is too short. Once the drag is |
3905 | + * intercepted, the gesture will be followed even after it leaves the detection area. |
3906 | + * |
3907 | + * Example: |
3908 | + * \qml |
3909 | + * import QtQuick 2.4 |
3910 | + * import Ubuntu.Components 1.3 |
3911 | + * |
3912 | + * MainView { |
3913 | + * width: units.gu(40) |
3914 | + * height: units.gu(70) |
3915 | + * |
3916 | + * Page { |
3917 | + * title: "SwipeArea sample" |
3918 | + * SwipeArea { |
3919 | + * anchors { |
3920 | + * left: parent.left |
3921 | + * right: parent.right |
3922 | + * bottom: parent.bottom |
3923 | + * } |
3924 | + * height: units.gu(5) |
3925 | + * direction: SwipeArea.Upwards |
3926 | + * Label { |
3927 | + * text: "Drag upwards" |
3928 | + * anchors { |
3929 | + * centerIn: parent |
3930 | + * verticalOffset: parent.dragging ? parent.distance : 0 |
3931 | + * } |
3932 | + * } |
3933 | + * } |
3934 | + * } |
3935 | + * } |
3936 | + * \endqml |
3937 | + * \note When used with a Flickable (or ListView, GridView) always put the |
3938 | + * SwipeArea next to the Flickable as sibling. |
3939 | + */ |
3940 | +UCSwipeArea::UCSwipeArea(QQuickItem *parent) |
3941 | + : QQuickItem(parent) |
3942 | + , d(new UCSwipeAreaPrivate(this)) |
3943 | +{ |
3944 | + d->setRecognitionTimer(new Timer(this)); |
3945 | + d->recognitionTimer->setInterval(d->maxTime); |
3946 | + d->recognitionTimer->setSingleShot(true); |
3947 | + |
3948 | + connect(this, &QQuickItem::enabledChanged, d, &UCSwipeAreaPrivate::giveUpIfDisabledOrInvisible); |
3949 | + connect(this, &QQuickItem::visibleChanged, d, &UCSwipeAreaPrivate::giveUpIfDisabledOrInvisible); |
3950 | +} |
3951 | + |
3952 | +/*! |
3953 | + * \qmlproperty enum SwipeArea::direction |
3954 | + * The direction in which the gesture should move in order to be recognized. |
3955 | + * \table |
3956 | + * \header |
3957 | + * \li Direction |
3958 | + * \li Description |
3959 | + * \row |
3960 | + * \li Rightwards |
3961 | + * \li Along the positive direction of the X axis |
3962 | + * \row |
3963 | + * \li Leftwards |
3964 | + * \li Along the negative direction of the X axis |
3965 | + * \row |
3966 | + * \li Downwards |
3967 | + * \li Along the positive direction of the Y axis |
3968 | + * \row |
3969 | + * \li Upwards |
3970 | + * \li Along the negative direction of the Y axis |
3971 | + * \row |
3972 | + * \li Horizontal |
3973 | + * \li Along the X axis, in any direction |
3974 | + * \row |
3975 | + * \li Vertical |
3976 | + * \li Along the Y axis, in any direction |
3977 | + * \endtable |
3978 | + */ |
3979 | +UCSwipeArea::Direction UCSwipeArea::direction() const |
3980 | +{ |
3981 | + return d->direction; |
3982 | +} |
3983 | + |
3984 | +void UCSwipeArea::setDirection(Direction direction) |
3985 | +{ |
3986 | + if (direction != d->direction) { |
3987 | + d->direction = direction; |
3988 | + Q_EMIT directionChanged(d->direction); |
3989 | + } |
3990 | +} |
3991 | + |
3992 | +void UCSwipeAreaPrivate::setDistanceThreshold(qreal value) |
3993 | +{ |
3994 | + if (distanceThreshold != value) { |
3995 | + distanceThreshold = value; |
3996 | + distanceThresholdSquared = distanceThreshold * distanceThreshold; |
3997 | + } |
3998 | +} |
3999 | + |
4000 | +void UCSwipeAreaPrivate::setMaxTime(int value) |
4001 | +{ |
4002 | + if (maxTime != value) { |
4003 | + maxTime = value; |
4004 | + recognitionTimer->setInterval(maxTime); |
4005 | + } |
4006 | +} |
4007 | + |
4008 | +void UCSwipeAreaPrivate::setRecognitionTimer(UbuntuGestures::AbstractTimer *timer) |
4009 | +{ |
4010 | + int interval = 0; |
4011 | + bool timerWasRunning = false; |
4012 | + bool wasSingleShot = false; |
4013 | + |
4014 | + // can be null when called from the constructor |
4015 | + if (recognitionTimer) { |
4016 | + wasSingleShot = recognitionTimer->isSingleShot(); |
4017 | + interval = recognitionTimer->interval(); |
4018 | + timerWasRunning = recognitionTimer->isRunning(); |
4019 | + if (recognitionTimer->parent() == this) { |
4020 | + delete recognitionTimer; |
4021 | + } |
4022 | + } |
4023 | + |
4024 | + recognitionTimer = timer; |
4025 | + timer->setInterval(interval); |
4026 | + timer->setSingleShot(wasSingleShot); |
4027 | + connect(timer, &UbuntuGestures::AbstractTimer::timeout, |
4028 | + this, &UCSwipeAreaPrivate::rejectGesture); |
4029 | + if (timerWasRunning) { |
4030 | + recognitionTimer->start(); |
4031 | + } |
4032 | +} |
4033 | + |
4034 | +void UCSwipeAreaPrivate::setTimeSource(const SharedTimeSource &timeSource) |
4035 | +{ |
4036 | + this->timeSource = timeSource; |
4037 | + activeTouches.m_timeSource = timeSource; |
4038 | +} |
4039 | + |
4040 | +/*! |
4041 | + * \qmlproperty real SwipeArea::distance |
4042 | + * \readonly |
4043 | + * The property holds the distance of the swipe from the beginning of the gesture |
4044 | + * recognition to the current touch position. |
4045 | + */ |
4046 | +qreal UCSwipeArea::distance() const |
4047 | +{ |
4048 | + return d->sceneDistance; |
4049 | +} |
4050 | + |
4051 | +/*! |
4052 | + * \qmlproperty point SwipeArea::touchPosition |
4053 | + * \readonly |
4054 | + * Position of the touch point performing the drag relative to this item. |
4055 | + */ |
4056 | +QPointF UCSwipeArea::touchPosition() const |
4057 | +{ |
4058 | + return mapFromScene(d->publicScenePos); |
4059 | +} |
4060 | + |
4061 | +/*! |
4062 | + * \qmlproperty bool SwipeArea::dragging |
4063 | + * \readonly |
4064 | + * Reports whether a drag gesture is taking place. |
4065 | + */ |
4066 | +bool UCSwipeArea::dragging() const |
4067 | +{ |
4068 | + return d->status == UCSwipeAreaPrivate::Recognized; |
4069 | +} |
4070 | + |
4071 | +/*! |
4072 | + * \qmlproperty bool SwipeArea::pressed |
4073 | + * \readonly |
4074 | + * Reports whether the drag area is pressed. |
4075 | + */ |
4076 | +bool UCSwipeArea::pressed() const |
4077 | +{ |
4078 | + return d->status != UCSwipeAreaPrivate::WaitingForTouch; |
4079 | +} |
4080 | + |
4081 | +/*! |
4082 | + * \qmlproperty bool SwipeArea::immediateRecognition |
4083 | + * Drives whether the gesture should be recognized as soon as the touch lands on |
4084 | + * the area. With this property set it will work the same way as a MultiPointTouchArea, |
4085 | + * |
4086 | + * Defaults to false. In most cases this should not be set. |
4087 | + */ |
4088 | +bool UCSwipeArea::immediateRecognition() const |
4089 | +{ |
4090 | + return d->immediateRecognition; |
4091 | +} |
4092 | + |
4093 | +void UCSwipeArea::setImmediateRecognition(bool enabled) |
4094 | +{ |
4095 | + if (d->immediateRecognition != enabled) { |
4096 | + d->immediateRecognition = enabled; |
4097 | + Q_EMIT immediateRecognitionChanged(enabled); |
4098 | + } |
4099 | +} |
4100 | + |
4101 | +bool UCSwipeArea::event(QEvent *event) |
4102 | +{ |
4103 | + if (event->type() == TouchOwnershipEvent::touchOwnershipEventType()) { |
4104 | + d->touchOwnershipEvent(static_cast<TouchOwnershipEvent *>(event)); |
4105 | + return true; |
4106 | + } else if (event->type() == UnownedTouchEvent::unownedTouchEventType()) { |
4107 | + d->unownedTouchEvent(static_cast<UnownedTouchEvent *>(event)); |
4108 | + return true; |
4109 | + } else { |
4110 | + return QQuickItem::event(event); |
4111 | + } |
4112 | +} |
4113 | + |
4114 | +void UCSwipeAreaPrivate::touchOwnershipEvent(TouchOwnershipEvent *event) |
4115 | +{ |
4116 | + if (event->gained()) { |
4117 | + QVector<int> ids; |
4118 | + ids.append(event->touchId()); |
4119 | + SA_TRACE("grabbing touch"); |
4120 | + q->grabTouchPoints(ids); |
4121 | + } else { |
4122 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
4123 | + TouchRegistry::instance()->addTouchWatcher(touchId, q); |
4124 | + |
4125 | + setStatus(WaitingForTouch); |
4126 | + } |
4127 | +} |
4128 | + |
4129 | +void UCSwipeAreaPrivate::unownedTouchEvent(UnownedTouchEvent *unownedTouchEvent) |
4130 | +{ |
4131 | + QTouchEvent *event = unownedTouchEvent->touchEvent(); |
4132 | + |
4133 | + Q_ASSERT(!event->touchPointStates().testFlag(Qt::TouchPointPressed)); |
4134 | + |
4135 | + SA_TRACE("Unowned " << timeSource->msecsSinceReference() << " " << qPrintable(touchEventToString(event))); |
4136 | + |
4137 | + switch (status) { |
4138 | + case WaitingForTouch: |
4139 | + // do nothing |
4140 | + break; |
4141 | + case Undecided: |
4142 | + Q_ASSERT(q->isEnabled() && q->isVisible()); |
4143 | + unownedTouchEvent_undecided(unownedTouchEvent); |
4144 | + break; |
4145 | + default: // Recognized: |
4146 | + // do nothing |
4147 | + break; |
4148 | + } |
4149 | + |
4150 | + activeTouches.update(event); |
4151 | +} |
4152 | + |
4153 | +void UCSwipeAreaPrivate::unownedTouchEvent_undecided(UnownedTouchEvent *unownedTouchEvent) |
4154 | +{ |
4155 | + const QTouchEvent::TouchPoint *touchPoint = fetchTargetTouchPoint(unownedTouchEvent->touchEvent()); |
4156 | + if (!touchPoint) { |
4157 | + qCritical() << "UCSwipeArea[status=Undecided]: touch " << touchId |
4158 | + << "missing from UnownedTouchEvent without first reaching state Qt::TouchPointReleased. " |
4159 | + "Considering it as released."; |
4160 | + |
4161 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4162 | + setStatus(WaitingForTouch); |
4163 | + return; |
4164 | + } |
4165 | + |
4166 | + const QPointF &touchScenePosition = touchPoint->scenePos(); |
4167 | + |
4168 | + if (touchPoint->state() == Qt::TouchPointReleased) { |
4169 | + // touch has ended before recognition concluded |
4170 | + SA_TRACE("Touch has ended before recognition concluded"); |
4171 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4172 | + setStatus(WaitingForTouch); |
4173 | + return; |
4174 | + } |
4175 | + |
4176 | + previousDampedScenePos.setX(dampedScenePos.x()); |
4177 | + previousDampedScenePos.setY(dampedScenePos.y()); |
4178 | + dampedScenePos.update(touchScenePosition); |
4179 | + |
4180 | + if (!movingInRightDirection()) { |
4181 | + SA_TRACE("Rejecting gesture because touch point is moving in the wrong direction."); |
4182 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4183 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
4184 | + TouchRegistry::instance()->addTouchWatcher(touchId, q); |
4185 | + setStatus(WaitingForTouch); |
4186 | + return; |
4187 | + } |
4188 | + |
4189 | + if (isWithinTouchCompositionWindow()) { |
4190 | + // There's still time for some new touch to appear and ruin our party as it would be combined |
4191 | + // with our touchId one and therefore deny the possibility of a single-finger gesture. |
4192 | + SA_TRACE("Sill within composition window. Let's wait more."); |
4193 | + return; |
4194 | + } |
4195 | + |
4196 | + if (movedFarEnoughAlongGestureAxis()) { |
4197 | + TouchRegistry::instance()->requestTouchOwnership(touchId, q); |
4198 | + setStatus(Recognized); |
4199 | + updatePosition(touchScenePosition); |
4200 | + } else if (isPastMaxDistance()) { |
4201 | + SA_TRACE("Rejecting gesture because it went farther than maxDistance without getting recognized."); |
4202 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4203 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
4204 | + TouchRegistry::instance()->addTouchWatcher(touchId, q); |
4205 | + setStatus(WaitingForTouch); |
4206 | + } else { |
4207 | + SA_TRACE("Didn't move far enough yet. Let's wait more."); |
4208 | + } |
4209 | +} |
4210 | + |
4211 | +void UCSwipeArea::touchEvent(QTouchEvent *event) |
4212 | +{ |
4213 | + // FIXME: Consider when more than one touch starts in the same event (although it's not possible |
4214 | + // with Mir's android-input). Have to track them all. Consider it a plus/bonus. |
4215 | + |
4216 | + SA_TRACE(d->timeSource->msecsSinceReference() << " " << qPrintable(touchEventToString(event))); |
4217 | + |
4218 | + if (!isEnabled() || !isVisible()) { |
4219 | + QQuickItem::touchEvent(event); |
4220 | + return; |
4221 | + } |
4222 | + |
4223 | + switch (d->status) { |
4224 | + case UCSwipeAreaPrivate::WaitingForTouch: |
4225 | + d->touchEvent_absent(event); |
4226 | + break; |
4227 | + case UCSwipeAreaPrivate::Undecided: |
4228 | + d->touchEvent_undecided(event); |
4229 | + break; |
4230 | + default: // Recognized: |
4231 | + d->touchEvent_recognized(event); |
4232 | + break; |
4233 | + } |
4234 | + |
4235 | + d->activeTouches.update(event); |
4236 | +} |
4237 | + |
4238 | +void UCSwipeAreaPrivate::touchEvent_absent(QTouchEvent *event) |
4239 | +{ |
4240 | + // FIXME: accept/reject is for the whole event, not per touch id. See how that affects us. |
4241 | + |
4242 | + if (!event->touchPointStates().testFlag(Qt::TouchPointPressed)) { |
4243 | + // Nothing to see here. No touch starting in this event. |
4244 | + return; |
4245 | + } |
4246 | + |
4247 | + // to be proven wrong, if that's the case |
4248 | + bool allGood = true; |
4249 | + |
4250 | + if (isWithinTouchCompositionWindow()) { |
4251 | + // too close to the last touch start. So we consider them as starting roughly at the same time. |
4252 | + // Can't be a single-touch gesture. |
4253 | + SA_TRACE("A new touch point came in but we're still within time composition window. Ignoring it."); |
4254 | + allGood = false; |
4255 | + } |
4256 | + |
4257 | + const QList<QTouchEvent::TouchPoint> &touchPoints = event->touchPoints(); |
4258 | + |
4259 | + const QTouchEvent::TouchPoint *newTouchPoint = nullptr; |
4260 | + for (int i = 0; i < touchPoints.count() && allGood; ++i) { |
4261 | + const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i); |
4262 | + if (touchPoint.state() == Qt::TouchPointPressed) { |
4263 | + if (newTouchPoint) { |
4264 | + // more than one touch starting in this QTouchEvent. Can't be a single-touch gesture |
4265 | + allGood = false; |
4266 | + } else { |
4267 | + // that's our candidate |
4268 | + newTouchPoint = &touchPoint; |
4269 | + } |
4270 | + } |
4271 | + } |
4272 | + |
4273 | + if (allGood) { |
4274 | + allGood = sanityCheckRecognitionProperties(); |
4275 | + if (!allGood) { |
4276 | + qWarning("UCSwipeArea: recognition properties are wrongly set. Gesture recognition" |
4277 | + " is impossible"); |
4278 | + } |
4279 | + } |
4280 | + |
4281 | + if (allGood) { |
4282 | + Q_ASSERT(newTouchPoint); |
4283 | + |
4284 | + startScenePos = newTouchPoint->scenePos(); |
4285 | + touchId = newTouchPoint->id(); |
4286 | + dampedScenePos.reset(startScenePos); |
4287 | + updatePosition(startScenePos); |
4288 | + |
4289 | + updateSceneDirectionVector(); |
4290 | + |
4291 | + if (recognitionIsDisabled()) { |
4292 | + // Behave like a dumb TouchArea |
4293 | + SA_TRACE("Gesture recognition is disabled. Requesting touch ownership immediately."); |
4294 | + TouchRegistry::instance()->requestTouchOwnership(touchId, q); |
4295 | + setStatus(Recognized); |
4296 | + event->accept(); |
4297 | + } else { |
4298 | + // just monitor the touch points for now. |
4299 | + TouchRegistry::instance()->addCandidateOwnerForTouch(touchId, q); |
4300 | + |
4301 | + setStatus(Undecided); |
4302 | + // Let the item below have it. We will monitor it and grab it later if a gesture |
4303 | + // gets recognized. |
4304 | + event->ignore(); |
4305 | + } |
4306 | + } else { |
4307 | + watchPressedTouchPoints(touchPoints); |
4308 | + event->ignore(); |
4309 | + } |
4310 | +} |
4311 | + |
4312 | +void UCSwipeAreaPrivate::touchEvent_undecided(QTouchEvent *event) |
4313 | +{ |
4314 | + Q_ASSERT(fetchTargetTouchPoint(event) == nullptr); |
4315 | + |
4316 | + // We're not interested in new touch points. We already have our candidate (touchId). |
4317 | + // But we do want to know when those new touches end for keeping the composition time |
4318 | + // window up-to-date |
4319 | + event->ignore(); |
4320 | + watchPressedTouchPoints(event->touchPoints()); |
4321 | + |
4322 | + if (event->touchPointStates().testFlag(Qt::TouchPointPressed) && isWithinTouchCompositionWindow()) { |
4323 | + // multi-finger drags are not accepted |
4324 | + SA_TRACE("Multi-finger drags are not accepted"); |
4325 | + |
4326 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4327 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
4328 | + TouchRegistry::instance()->addTouchWatcher(touchId, q); |
4329 | + |
4330 | + setStatus(WaitingForTouch); |
4331 | + } |
4332 | +} |
4333 | + |
4334 | +void UCSwipeAreaPrivate::touchEvent_recognized(QTouchEvent *event) |
4335 | +{ |
4336 | + const QTouchEvent::TouchPoint *touchPoint = fetchTargetTouchPoint(event); |
4337 | + |
4338 | + if (!touchPoint) { |
4339 | + qCritical() << "UCSwipeArea[status=Recognized]: touch " << touchId |
4340 | + << "missing from QTouchEvent without first reaching state Qt::TouchPointReleased. " |
4341 | + "Considering it as released."; |
4342 | + setStatus(WaitingForTouch); |
4343 | + } else { |
4344 | + updatePosition(touchPoint->scenePos()); |
4345 | + |
4346 | + if (touchPoint->state() == Qt::TouchPointReleased) { |
4347 | + setStatus(WaitingForTouch); |
4348 | + } |
4349 | + } |
4350 | +} |
4351 | + |
4352 | +void UCSwipeAreaPrivate::watchPressedTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints) |
4353 | +{ |
4354 | + for (int i = 0; i < touchPoints.count(); ++i) { |
4355 | + const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i); |
4356 | + if (touchPoint.state() == Qt::TouchPointPressed) { |
4357 | + TouchRegistry::instance()->addTouchWatcher(touchPoint.id(), q); |
4358 | + } |
4359 | + } |
4360 | +} |
4361 | + |
4362 | +bool UCSwipeAreaPrivate::recognitionIsDisabled() const |
4363 | +{ |
4364 | + return immediateRecognition || (distanceThreshold <= 0 && compositionTime <= 0); |
4365 | +} |
4366 | + |
4367 | +bool UCSwipeAreaPrivate::sanityCheckRecognitionProperties() |
4368 | +{ |
4369 | + return recognitionIsDisabled() |
4370 | + || (distanceThreshold < maxDistance && compositionTime < maxTime); |
4371 | +} |
4372 | + |
4373 | +const QTouchEvent::TouchPoint *UCSwipeAreaPrivate::fetchTargetTouchPoint(QTouchEvent *event) |
4374 | +{ |
4375 | + const QList<QTouchEvent::TouchPoint> &touchPoints = event->touchPoints(); |
4376 | + const QTouchEvent::TouchPoint *touchPoint = 0; |
4377 | + for (int i = 0; i < touchPoints.size(); ++i) { |
4378 | + if (touchPoints.at(i).id() == touchId) { |
4379 | + touchPoint = &touchPoints.at(i); |
4380 | + break; |
4381 | + } |
4382 | + } |
4383 | + return touchPoint; |
4384 | +} |
4385 | + |
4386 | +bool UCSwipeAreaPrivate::movingInRightDirection() const |
4387 | +{ |
4388 | + if (direction == UCSwipeArea::Horizontal || direction == UCSwipeArea::Vertical) { |
4389 | + return true; |
4390 | + } else { |
4391 | + QPointF movementVector(dampedScenePos.x() - previousDampedScenePos.x(), |
4392 | + dampedScenePos.y() - previousDampedScenePos.y()); |
4393 | + |
4394 | + qreal scalarProjection = projectOntoDirectionVector(movementVector); |
4395 | + |
4396 | + return scalarProjection >= 0.; |
4397 | + } |
4398 | +} |
4399 | + |
4400 | +bool UCSwipeAreaPrivate::movedFarEnoughAlongGestureAxis() const |
4401 | +{ |
4402 | + if (distanceThreshold <= 0.) { |
4403 | + // distance threshold check is disabled |
4404 | + return true; |
4405 | + } else { |
4406 | + QPointF totalMovement(dampedScenePos.x() - startScenePos.x(), |
4407 | + dampedScenePos.y() - startScenePos.y()); |
4408 | + |
4409 | + qreal scalarProjection = projectOntoDirectionVector(totalMovement); |
4410 | + |
4411 | + SA_TRACE(" movedFarEnoughAlongGestureAxis: scalarProjection=" << scalarProjection |
4412 | + << ", distanceThreshold=" << distanceThreshold); |
4413 | + |
4414 | + if (direction == UCSwipeArea::Horizontal || direction == UCSwipeArea::Vertical) { |
4415 | + return qAbs(scalarProjection) > distanceThreshold; |
4416 | + } else { |
4417 | + return scalarProjection > distanceThreshold; |
4418 | + } |
4419 | + } |
4420 | +} |
4421 | + |
4422 | +bool UCSwipeAreaPrivate::isPastMaxDistance() const |
4423 | +{ |
4424 | + QPointF totalMovement(dampedScenePos.x() - startScenePos.x(), |
4425 | + dampedScenePos.y() - startScenePos.y()); |
4426 | + |
4427 | + qreal squaredDistance = totalMovement.x()*totalMovement.x() + totalMovement.y()*totalMovement.y(); |
4428 | + return squaredDistance > maxDistance*maxDistance; |
4429 | +} |
4430 | + |
4431 | +void UCSwipeAreaPrivate::giveUpIfDisabledOrInvisible() |
4432 | +{ |
4433 | + if (!q->isEnabled() || !q->isVisible()) { |
4434 | + if (status == Undecided) { |
4435 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4436 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
4437 | + TouchRegistry::instance()->addTouchWatcher(touchId, q); |
4438 | + } |
4439 | + |
4440 | + if (status != WaitingForTouch) { |
4441 | + SA_TRACE("Resetting status because got disabled or made invisible"); |
4442 | + setStatus(WaitingForTouch); |
4443 | + } |
4444 | + } |
4445 | +} |
4446 | + |
4447 | +void UCSwipeAreaPrivate::rejectGesture() |
4448 | +{ |
4449 | + if (status == Undecided) { |
4450 | + SA_TRACE("Rejecting gesture because it's taking too long to drag beyond the threshold."); |
4451 | + |
4452 | + TouchRegistry::instance()->removeCandidateOwnerForTouch(touchId, q); |
4453 | + // We still wanna know when it ends for keeping the composition time window up-to-date |
4454 | + TouchRegistry::instance()->addTouchWatcher(touchId, q); |
4455 | + |
4456 | + setStatus(WaitingForTouch); |
4457 | + } |
4458 | +} |
4459 | + |
4460 | +void UCSwipeAreaPrivate::setStatus(Status newStatus) |
4461 | +{ |
4462 | + if (newStatus == status) |
4463 | + return; |
4464 | + |
4465 | + Status oldStatus = status; |
4466 | + |
4467 | + if (oldStatus == Undecided) { |
4468 | + recognitionTimer->stop(); |
4469 | + } |
4470 | + |
4471 | + status = newStatus; |
4472 | + Q_EMIT statusChanged(status); |
4473 | + |
4474 | + SA_TRACE(statusToString(oldStatus) << " -> " << statusToString(newStatus)); |
4475 | + |
4476 | + switch (newStatus) { |
4477 | + case WaitingForTouch: |
4478 | + if (oldStatus == Recognized) { |
4479 | + Q_EMIT q->draggingChanged(false); |
4480 | + } |
4481 | + Q_EMIT q->pressedChanged(false); |
4482 | + break; |
4483 | + case Undecided: |
4484 | + recognitionTimer->start(); |
4485 | + Q_EMIT q->pressedChanged(true); |
4486 | + break; |
4487 | + case Recognized: |
4488 | + Q_EMIT q->draggingChanged(true); |
4489 | + break; |
4490 | + default: |
4491 | + // no-op |
4492 | + break; |
4493 | + } |
4494 | +} |
4495 | + |
4496 | +void UCSwipeAreaPrivate::updatePosition(const QPointF &point) |
4497 | +{ |
4498 | + bool xChanged = publicScenePos.x() != point.x(); |
4499 | + bool yChanged = publicScenePos.y() != point.y(); |
4500 | + |
4501 | + // Public position should not get updated while the gesture is still being recognized |
4502 | + // (ie, Undecided status). |
4503 | + Q_ASSERT(status == WaitingForTouch || status == Recognized); |
4504 | + |
4505 | + if (status == Recognized && !recognitionIsDisabled()) { |
4506 | + // When the gesture finally gets recognized, the finger will likely be |
4507 | + // reasonably far from the edge. If we made the contentX immediately |
4508 | + // follow the finger position it would be visually unpleasant as it |
4509 | + // would appear right next to the user's finger out of nowhere (ie, |
4510 | + // it would jump). Instead, we make contentX go towards the user's |
4511 | + // finger in several steps. ie., in an animated way. |
4512 | + QPointF delta = point - publicScenePos; |
4513 | + // the trick is not to go all the way (1.0) as it would cause a sudden jump |
4514 | + publicScenePos.rx() += 0.4 * delta.x(); |
4515 | + publicScenePos.ry() += 0.4 * delta.y(); |
4516 | + } else { |
4517 | + // no smoothing when initializing or if gesture recognition was immediate as there will |
4518 | + // be no jump. |
4519 | + publicScenePos = point; |
4520 | + } |
4521 | + |
4522 | + if (xChanged || yChanged) { |
4523 | + Q_EMIT q->touchPositionChanged(q->touchPosition()); |
4524 | + |
4525 | + // handle distance change |
4526 | + QPointF totalMovement = publicScenePos - startScenePos; |
4527 | + sceneDistance = projectOntoDirectionVector(totalMovement); |
4528 | + |
4529 | + Q_EMIT q->distanceChanged(sceneDistance); |
4530 | + } |
4531 | +} |
4532 | + |
4533 | +bool UCSwipeAreaPrivate::isWithinTouchCompositionWindow() |
4534 | +{ |
4535 | + return |
4536 | + compositionTime > 0 && |
4537 | + !activeTouches.isEmpty() && |
4538 | + timeSource->msecsSinceReference() <= |
4539 | + activeTouches.mostRecentStartTime() + (qint64)compositionTime; |
4540 | +} |
4541 | + |
4542 | +void UCSwipeArea::itemChange(ItemChange change, const ItemChangeData &value) |
4543 | +{ |
4544 | + if (change == QQuickItem::ItemSceneChange) { |
4545 | + if (value.window != nullptr) { |
4546 | + value.window->installEventFilter(TouchRegistry::instance()); |
4547 | + |
4548 | + // FIXME: Handle window->screen() changes (ie window changing screens) |
4549 | + qreal pixelsPerMm = value.window->screen()->physicalDotsPerInch() / 25.4; |
4550 | + d->setPixelsPerMm(pixelsPerMm); |
4551 | + } |
4552 | + } |
4553 | +} |
4554 | + |
4555 | +void UCSwipeAreaPrivate::setPixelsPerMm(qreal pixelsPerMm) |
4556 | +{ |
4557 | + dampedScenePos.setMaxDelta(1. * pixelsPerMm); |
4558 | + setDistanceThreshold(4. * pixelsPerMm); |
4559 | + maxDistance = 10. * pixelsPerMm; |
4560 | +} |
4561 | + |
4562 | +//************************** ActiveTouchesInfo ************************** |
4563 | + |
4564 | +ActiveTouchesInfo::ActiveTouchesInfo(const SharedTimeSource &timeSource) |
4565 | + : m_timeSource(timeSource) |
4566 | +{ |
4567 | +} |
4568 | + |
4569 | +void ActiveTouchesInfo::update(QTouchEvent *event) |
4570 | +{ |
4571 | + if (!(event->touchPointStates() & (Qt::TouchPointPressed | Qt::TouchPointReleased))) { |
4572 | + // nothing to update |
4573 | + TI_TRACE("Nothing to update"); |
4574 | + return; |
4575 | + } |
4576 | + |
4577 | + const QList<QTouchEvent::TouchPoint> &touchPoints = event->touchPoints(); |
4578 | + for (int i = 0; i < touchPoints.count(); ++i) { |
4579 | + const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i); |
4580 | + if (touchPoint.state() == Qt::TouchPointPressed) { |
4581 | + addTouchPoint(touchPoint.id()); |
4582 | + } else if (touchPoint.state() == Qt::TouchPointReleased) { |
4583 | + removeTouchPoint(touchPoint.id()); |
4584 | + } |
4585 | + } |
4586 | +} |
4587 | + |
4588 | +QString ActiveTouchesInfo::toString() |
4589 | +{ |
4590 | + QString string = "("; |
4591 | + |
4592 | + { |
4593 | + QTextStream stream(&string); |
4594 | + m_touchInfoPool.forEach([&](Pool<ActiveTouchInfo>::Iterator &touchInfo) { |
4595 | + stream << "(id=" << touchInfo->id << ",startTime=" << touchInfo->startTime << ")"; |
4596 | + return true; |
4597 | + }); |
4598 | + } |
4599 | + |
4600 | + string.append(")"); |
4601 | + |
4602 | + return string; |
4603 | +} |
4604 | + |
4605 | +void ActiveTouchesInfo::addTouchPoint(int touchId) |
4606 | +{ |
4607 | + ActiveTouchInfo &activeTouchInfo = m_touchInfoPool.getEmptySlot(); |
4608 | + activeTouchInfo.id = touchId; |
4609 | + activeTouchInfo.startTime = m_timeSource->msecsSinceReference(); |
4610 | + |
4611 | + TI_TRACE(qPrintable(toString())); |
4612 | +} |
4613 | + |
4614 | +qint64 ActiveTouchesInfo::touchStartTime(int touchId) |
4615 | +{ |
4616 | + qint64 result = -1; |
4617 | + |
4618 | + m_touchInfoPool.forEach([&](Pool<ActiveTouchInfo>::Iterator &touchInfo) { |
4619 | + if (touchId == touchInfo->id) { |
4620 | + result = touchInfo->startTime; |
4621 | + return false; |
4622 | + } else { |
4623 | + return true; |
4624 | + } |
4625 | + }); |
4626 | + |
4627 | + Q_ASSERT(result != -1); |
4628 | + return result; |
4629 | +} |
4630 | + |
4631 | +void ActiveTouchesInfo::removeTouchPoint(int touchId) |
4632 | +{ |
4633 | + m_touchInfoPool.forEach([&](Pool<ActiveTouchInfo>::Iterator &touchInfo) { |
4634 | + if (touchId == touchInfo->id) { |
4635 | + m_touchInfoPool.freeSlot(touchInfo); |
4636 | + return false; |
4637 | + } else { |
4638 | + return true; |
4639 | + } |
4640 | + }); |
4641 | + |
4642 | + TI_TRACE(qPrintable(toString())); |
4643 | +} |
4644 | + |
4645 | +qint64 ActiveTouchesInfo::mostRecentStartTime() |
4646 | +{ |
4647 | + Q_ASSERT(!m_touchInfoPool.isEmpty()); |
4648 | + |
4649 | + qint64 highestStartTime = -1; |
4650 | + |
4651 | + m_touchInfoPool.forEach([&](Pool<ActiveTouchInfo>::Iterator &activeTouchInfo) { |
4652 | + if (activeTouchInfo->startTime > highestStartTime) { |
4653 | + highestStartTime = activeTouchInfo->startTime; |
4654 | + } |
4655 | + return true; |
4656 | + }); |
4657 | + |
4658 | + return highestStartTime; |
4659 | +} |
4660 | + |
4661 | +void UCSwipeAreaPrivate::updateSceneDirectionVector() |
4662 | +{ |
4663 | + QPointF localOrigin(0., 0.); |
4664 | + QPointF localDirection; |
4665 | + switch (direction) { |
4666 | + case UCSwipeArea::Upwards: |
4667 | + localDirection.rx() = 0.; |
4668 | + localDirection.ry() = -1.; |
4669 | + break; |
4670 | + case UCSwipeArea::Downwards: |
4671 | + case UCSwipeArea::Vertical: |
4672 | + localDirection.rx() = 0.; |
4673 | + localDirection.ry() = 1; |
4674 | + break; |
4675 | + case UCSwipeArea::Leftwards: |
4676 | + localDirection.rx() = -1.; |
4677 | + localDirection.ry() = 0.; |
4678 | + break; |
4679 | + default: // UCSwipeArea::Rightwards || Direction.Horizontal |
4680 | + localDirection.rx() = 1.; |
4681 | + localDirection.ry() = 0.; |
4682 | + break; |
4683 | + } |
4684 | + QPointF sceneOrigin = q->mapToScene(localOrigin); |
4685 | + QPointF sceneDirection = q->mapToScene(localDirection); |
4686 | + sceneDirectionVector = sceneDirection - sceneOrigin; |
4687 | +} |
4688 | + |
4689 | +qreal UCSwipeAreaPrivate::projectOntoDirectionVector(const QPointF &sceneVector) const |
4690 | +{ |
4691 | + // same as dot product as sceneDirectionVector is a unit vector |
4692 | + return sceneVector.x() * sceneDirectionVector.x() + |
4693 | + sceneVector.y() * sceneDirectionVector.y(); |
4694 | +} |
4695 | + |
4696 | +UCSwipeAreaPrivate::UCSwipeAreaPrivate(UCSwipeArea *q) |
4697 | + : timeSource(new RealTimeSource) |
4698 | + , activeTouches(timeSource) |
4699 | + , q(q) |
4700 | + , recognitionTimer(nullptr) |
4701 | + , distanceThreshold(0) |
4702 | + , distanceThresholdSquared(0.) |
4703 | + , maxDistance(0.) |
4704 | + , sceneDistance(0.) |
4705 | + , touchId(-1) |
4706 | + , maxTime(400) |
4707 | + , compositionTime(60) |
4708 | + , status(WaitingForTouch) |
4709 | + , direction(UCSwipeArea::Rightwards) |
4710 | + , immediateRecognition(false) |
4711 | +{ |
4712 | +} |
4713 | |
4714 | === added file 'src/Ubuntu/Components/plugin/gestures/ucswipearea.h' |
4715 | --- src/Ubuntu/Components/plugin/gestures/ucswipearea.h 1970-01-01 00:00:00 +0000 |
4716 | +++ src/Ubuntu/Components/plugin/gestures/ucswipearea.h 2015-11-24 12:22:14 +0000 |
4717 | @@ -0,0 +1,98 @@ |
4718 | +/* |
4719 | + * Copyright (C) 2015 Canonical, Ltd. |
4720 | + * |
4721 | + * This program is free software; you can redistribute it and/or modify |
4722 | + * it under the terms of the GNU General Public License as published by |
4723 | + * the Free Software Foundation; version 3. |
4724 | + * |
4725 | + * This program is distributed in the hope that it will be useful, |
4726 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4727 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4728 | + * GNU General Public License for more details. |
4729 | + * |
4730 | + * You should have received a copy of the GNU General Public License |
4731 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4732 | + * |
4733 | + */ |
4734 | + |
4735 | +#ifndef UCSWIPEAREA_H |
4736 | +#define UCSWIPEAREA_H |
4737 | + |
4738 | +#include <QtQuick/QQuickItem> |
4739 | +#include "ubuntugesturesqmlglobal.h" |
4740 | +#include "damper.h" |
4741 | + |
4742 | +// lib UbuntuGestures |
4743 | +#include <UbuntuGestures/Pool> |
4744 | +#include <UbuntuGestures/Timer> |
4745 | + |
4746 | +// logging |
4747 | +#include <QtCore/QLoggingCategory> |
4748 | + |
4749 | +class TouchOwnershipEvent; |
4750 | +class UnownedTouchEvent; |
4751 | +class UCSwipeAreaPrivate; |
4752 | + |
4753 | +class UBUNTUGESTURESQML_EXPORT UCSwipeArea : public QQuickItem |
4754 | +{ |
4755 | + Q_OBJECT |
4756 | + |
4757 | + Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged) |
4758 | + Q_PROPERTY(qreal distance READ distance NOTIFY distanceChanged) |
4759 | + Q_PROPERTY(QPointF touchPosition READ touchPosition NOTIFY touchPositionChanged) |
4760 | + Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged) |
4761 | + Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged) |
4762 | + Q_PROPERTY(bool immediateRecognition |
4763 | + READ immediateRecognition |
4764 | + WRITE setImmediateRecognition |
4765 | + NOTIFY immediateRecognitionChanged) |
4766 | + |
4767 | + Q_ENUMS(Direction) |
4768 | +public: |
4769 | + enum Direction { |
4770 | + Rightwards, |
4771 | + Leftwards, |
4772 | + Downwards, |
4773 | + Upwards, |
4774 | + Horizontal, |
4775 | + Vertical |
4776 | + }; |
4777 | + |
4778 | + UCSwipeArea(QQuickItem *parent = 0); |
4779 | + |
4780 | + Direction direction() const; |
4781 | + void setDirection(Direction); |
4782 | + |
4783 | + qreal distance() const; |
4784 | + |
4785 | + QPointF touchPosition() const; |
4786 | + |
4787 | + bool dragging() const; |
4788 | + |
4789 | + bool pressed() const; |
4790 | + |
4791 | + bool immediateRecognition() const; |
4792 | + void setImmediateRecognition(bool enabled); |
4793 | + |
4794 | +Q_SIGNALS: |
4795 | + void directionChanged(Direction direction); |
4796 | + void draggingChanged(bool dragging); |
4797 | + void pressedChanged(bool pressed); |
4798 | + void distanceChanged(qreal distance); |
4799 | + void touchPositionChanged(const QPointF &position); |
4800 | + void immediateRecognitionChanged(bool immediateRecognition); |
4801 | + |
4802 | +protected: |
4803 | + bool event(QEvent *e) override; |
4804 | + |
4805 | + void touchEvent(QTouchEvent *event) override; |
4806 | + void itemChange(ItemChange change, const ItemChangeData &value) override; |
4807 | + |
4808 | +public: // so tests can access it |
4809 | + UCSwipeAreaPrivate *d; |
4810 | +}; |
4811 | + |
4812 | +Q_DECLARE_LOGGING_CATEGORY(ucSwipeArea) |
4813 | +Q_DECLARE_LOGGING_CATEGORY(ucActiveTouchInfo) |
4814 | + |
4815 | +#endif // UCSWIPEAREA_H |
4816 | |
4817 | === added file 'src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h' |
4818 | --- src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h 1970-01-01 00:00:00 +0000 |
4819 | +++ src/Ubuntu/Components/plugin/gestures/ucswipearea_p.h 2015-11-24 12:22:14 +0000 |
4820 | @@ -0,0 +1,157 @@ |
4821 | +/* |
4822 | + * Copyright (C) 2015 Canonical, Ltd. |
4823 | + * |
4824 | + * This program is free software; you can redistribute it and/or modify |
4825 | + * it under the terms of the GNU General Public License as published by |
4826 | + * the Free Software Foundation; version 3. |
4827 | + * |
4828 | + * This program is distributed in the hope that it will be useful, |
4829 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4830 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4831 | + * GNU General Public License for more details. |
4832 | + * |
4833 | + * You should have received a copy of the GNU General Public License |
4834 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4835 | + * |
4836 | + */ |
4837 | + |
4838 | +#ifndef UCSWIPEAREAPRIVATE_H |
4839 | +#define UCSWIPEAREAPRIVATE_H |
4840 | + |
4841 | +#include "ucswipearea.h" |
4842 | + |
4843 | +// Information about an active touch point |
4844 | +struct UBUNTUGESTURESQML_EXPORT ActiveTouchInfo { |
4845 | + ActiveTouchInfo() : id(-1), startTime(-1) {} |
4846 | + bool isValid() const { return id != -1; } |
4847 | + void reset() { id = -1; } |
4848 | + int id; |
4849 | + qint64 startTime; |
4850 | +}; |
4851 | +class UBUNTUGESTURESQML_EXPORT ActiveTouchesInfo { |
4852 | +public: |
4853 | + ActiveTouchesInfo(const UbuntuGestures::SharedTimeSource &timeSource); |
4854 | + void update(QTouchEvent *event); |
4855 | + qint64 touchStartTime(int id); |
4856 | + bool isEmpty() const { return m_touchInfoPool.isEmpty(); } |
4857 | + qint64 mostRecentStartTime(); |
4858 | + UbuntuGestures::SharedTimeSource m_timeSource; |
4859 | +private: |
4860 | + void addTouchPoint(int touchId); |
4861 | + void removeTouchPoint(int touchId); |
4862 | + QString toString(); |
4863 | + |
4864 | + Pool<ActiveTouchInfo> m_touchInfoPool; |
4865 | +}; |
4866 | + |
4867 | +class UBUNTUGESTURESQML_EXPORT UCSwipeAreaPrivate : public QObject |
4868 | +{ |
4869 | + Q_OBJECT |
4870 | + |
4871 | + Q_ENUMS(Status) |
4872 | +public: |
4873 | + UCSwipeAreaPrivate(UCSwipeArea *q); |
4874 | + |
4875 | +public Q_SLOTS: |
4876 | + void giveUpIfDisabledOrInvisible(); |
4877 | + void rejectGesture(); |
4878 | + |
4879 | +public: |
4880 | + // Describes the state of the directional drag gesture. |
4881 | + enum Status { |
4882 | + // Waiting for a new touch point to land on this area. No gesture is being processed |
4883 | + // or tracked. |
4884 | + WaitingForTouch, |
4885 | + |
4886 | + // A touch point has landed on this area but it's not know yet whether it is |
4887 | + // performing a drag in the correct direction. |
4888 | + // If it's decided that the touch point is not performing a directional drag gesture, |
4889 | + // it will be rejected/ignored and status will return to WaitingForTouch. |
4890 | + Undecided, //Recognizing, |
4891 | + |
4892 | + // There's a touch point in this area and it performed a drag in the correct |
4893 | + // direction. |
4894 | + // |
4895 | + // Once recognized, the gesture state will move back to WaitingForTouch only once |
4896 | + // that touch point ends. The gesture will remain in the Recognized state even if |
4897 | + // the touch point starts moving in other directions or halts. |
4898 | + Recognized, |
4899 | + }; |
4900 | + |
4901 | + void touchEvent_absent(QTouchEvent *event); |
4902 | + void touchEvent_undecided(QTouchEvent *event); |
4903 | + void touchEvent_recognized(QTouchEvent *event); |
4904 | + bool movingInRightDirection() const; |
4905 | + bool movedFarEnoughAlongGestureAxis() const; |
4906 | + bool isPastMaxDistance() const; |
4907 | + const QTouchEvent::TouchPoint *fetchTargetTouchPoint(QTouchEvent *event); |
4908 | + void setStatus(Status newStatus); |
4909 | + void updatePosition(const QPointF &point); |
4910 | + void setPublicScenePos(const QPointF &point); |
4911 | + bool isWithinTouchCompositionWindow(); |
4912 | + void updateSceneDirectionVector(); |
4913 | + // returns the scalar projection between the given vector (in scene coordinates) |
4914 | + // and m_sceneDirectionVector |
4915 | + qreal projectOntoDirectionVector(const QPointF &sceneVector) const; |
4916 | + void touchOwnershipEvent(TouchOwnershipEvent *event); |
4917 | + void unownedTouchEvent(UnownedTouchEvent *event); |
4918 | + void unownedTouchEvent_undecided(UnownedTouchEvent *unownedTouchEvent); |
4919 | + void watchPressedTouchPoints(const QList<QTouchEvent::TouchPoint> &touchPoints); |
4920 | + bool recognitionIsDisabled() const; |
4921 | + bool sanityCheckRecognitionProperties(); |
4922 | + void setMaxTime(int value); |
4923 | + void setDistanceThreshold(qreal value); |
4924 | + void setPixelsPerMm(qreal pixelsPerMm); |
4925 | + QString objectName() const { return q->objectName(); } |
4926 | + |
4927 | + // Replaces the existing Timer with the given one. |
4928 | + // |
4929 | + // Useful for providing a fake timer when testing. |
4930 | + void setRecognitionTimer(UbuntuGestures::AbstractTimer *timer); |
4931 | + |
4932 | + // Useful for testing, where a fake time source can be supplied |
4933 | + void setTimeSource(const UbuntuGestures::SharedTimeSource &timeSource); |
4934 | + |
4935 | + QPointF startScenePos; |
4936 | + // The touch position exposed in the public API. |
4937 | + // It only starts to move once the gesture gets recognized. |
4938 | + QPointF publicScenePos; |
4939 | + // A movement damper is used in some of the gesture recognition calculations |
4940 | + // to get rid of noise or small oscillations in the touch position. |
4941 | + DampedPointF dampedScenePos; |
4942 | + QPointF previousDampedScenePos; |
4943 | + // Unit vector in scene coordinates describing the direction of the gesture recognition |
4944 | + QPointF sceneDirectionVector; |
4945 | + UbuntuGestures::SharedTimeSource timeSource; |
4946 | + ActiveTouchesInfo activeTouches; |
4947 | + |
4948 | + UCSwipeArea *q; |
4949 | + UbuntuGestures::AbstractTimer *recognitionTimer; |
4950 | + |
4951 | + // How far a touch point has to move from its initial position along the gesture axis in order |
4952 | + // for it to be recognized as a directional drag. |
4953 | + qreal distanceThreshold; |
4954 | + qreal distanceThresholdSquared; // it's pow(distanceThreshold, 2) |
4955 | + // Maximum distance the gesture can go without crossing the axis-aligned distance threshold |
4956 | + qreal maxDistance; |
4957 | + qreal sceneDistance; |
4958 | + |
4959 | + int touchId; |
4960 | + // Maximum time (in milliseconds) the gesture can take to go beyond the distance threshold |
4961 | + int maxTime; |
4962 | + // Maximum time (in milliseconds) after the start of a given touch point where |
4963 | + // subsequent touch starts are grouped with the first one into an N-touches gesture |
4964 | + // (e.g. a two-fingers tap or drag). |
4965 | + int compositionTime; |
4966 | + |
4967 | + // The current status of the directional drag gesture area. |
4968 | + Status status; |
4969 | + UCSwipeArea::Direction direction; |
4970 | + |
4971 | + bool immediateRecognition; |
4972 | + |
4973 | +Q_SIGNALS: |
4974 | + void statusChanged(Status value); |
4975 | +}; |
4976 | + |
4977 | +#endif // UCSWIPEAREAPRIVATE_H |
4978 | |
4979 | === modified file 'src/Ubuntu/Components/plugin/plugin.cpp' |
4980 | --- src/Ubuntu/Components/plugin/plugin.cpp 2015-10-01 12:34:29 +0000 |
4981 | +++ src/Ubuntu/Components/plugin/plugin.cpp 2015-11-24 12:22:14 +0000 |
4982 | @@ -70,6 +70,9 @@ |
4983 | #include "ucheader.h" |
4984 | #include "uclabel.h" |
4985 | #include "uclistitemlayout.h" |
4986 | +#include "ucbottomedgehint.h" |
4987 | +#include "gestures/ucswipearea.h" |
4988 | +#include "ucmathutils.h" |
4989 | |
4990 | #include <sys/types.h> |
4991 | #include <unistd.h> |
4992 | @@ -194,6 +197,7 @@ |
4993 | qmlRegisterType<UCInverseMouse>(uri, major, minor, "InverseMouse"); |
4994 | qmlRegisterType<UCActionItem>(uri, major, minor, "ActionItem"); |
4995 | qmlRegisterSingletonType<UCHaptics>(uri, major, minor, "Haptics", registerHaptics); |
4996 | + qmlRegisterSingletonType<UCMathUtils>(uri, major, minor, "MathUtils", UCMathUtils::qmlRegisterTypeCallback); |
4997 | } |
4998 | |
4999 | void UbuntuComponentsPlugin::registerTypes(const char *uri) |
5000 | @@ -230,7 +234,6 @@ |
The diff has been truncated for viewing.