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