Merge lp:~renatofilho/mediaplayer-app/fix-theme into lp:mediaplayer-app

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Zsombor Egri
Approved revision: 72
Merged at revision: 74
Proposed branch: lp:~renatofilho/mediaplayer-app/fix-theme
Merge into: lp:mediaplayer-app
Diff against target: 292 lines (+2/-250)
3 files modified
src/qml/player/TimeLine.qml (+1/-1)
src/qml/sdk/Slider.qml (+0/-246)
src/qml/theme/VideoSlider.qml (+1/-3)
To merge this branch: bzr merge lp:~renatofilho/mediaplayer-app/fix-theme
Reviewer Review Type Date Requested Status
Zsombor Egri (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+158917@code.launchpad.net

Commit message

Removed use of deprecated functions.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/qml/player/TimeLine.qml'
2--- src/qml/player/TimeLine.qml 2013-02-22 14:52:38 +0000
3+++ src/qml/player/TimeLine.qml 2013-04-15 13:15:37 +0000
4@@ -72,7 +72,7 @@
5 }
6 }
7
8- onSliderClicked: {
9+ onTouched: {
10 _timeLine.clicked(onThumb)
11 }
12 }
13
14=== removed file 'src/qml/sdk/Slider.qml'
15--- src/qml/sdk/Slider.qml 2013-02-11 13:52:33 +0000
16+++ src/qml/sdk/Slider.qml 1970-01-01 00:00:00 +0000
17@@ -1,246 +0,0 @@
18-/*
19- * Copyright 2012-2013 Canonical Ltd.
20- *
21- * This program is free software; you can redistribute it and/or modify
22- * it under the terms of the GNU Lesser General Public License as published by
23- * the Free Software Foundation; version 3.
24- *
25- * This program is distributed in the hope that it will be useful,
26- * but WITHOUT ANY WARRANTY; without even the implied warranty of
27- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28- * GNU Lesser General Public License for more details.
29- *
30- * You should have received a copy of the GNU Lesser General Public License
31- * along with this program. If not, see <http://www.gnu.org/licenses/>.
32- */
33-
34-// FIXME(loicm) An option should be added to render the value text outside of
35-// the thumb, on top or bottom of the thumb (or left and right once we got
36-// support for vertical orientation). Moreover, having the value text inside
37-// the thumb makes it complicated to fit numbers with high values (or high
38-// number of decimals) or visually awkward since the text is hidden by the
39-// mouse cursor (or the finger) when dragged.
40-
41-// FIXME(loicm) An animation should be added when the user clicks on an area
42-// outside the thumb to smoothly move it under the mouse.
43-
44-// FIXME(loicm) Maybe add support for vertical orientation (orientation
45-// property). Don't forget to adapt the inverted property documentation
46-// accordingly. Note that UIKit doesn't have vertical sliders.
47-
48-// FIXME(loicm) Add support for keyboard shortcuts (basically left/right).
49-
50-import QtQuick 2.0
51-import Ubuntu.Components 0.1
52-import "mathUtils.js" as MathUtils
53-import "sliderUtils.js" as SliderFuncs
54-// FIXME: When a module contains QML, C++ and JavaScript elements exported,
55-// we need to use named imports otherwise namespace collision is reported
56-// by the QML engine. As workaround, we use Theming named import.
57-// Bug to watch: https://bugreports.qt-project.org/browse/QTBUG-27645
58-import Ubuntu.Components 0.1 as Theming
59-
60-/*!
61- \qmltype Slider
62- \inqmlmodule Ubuntu.Components 0.1
63- \ingroup ubuntu
64- \brief Slider is a component to select a value from a continuous range of
65- values.
66-
67- The slider's sensing area is defined by the width and height, therefore
68- delegates should take this into account when defining the visuals, and
69- alter these values to align the graphics' sizes.
70-
71- Example:
72- \qml
73- Item {
74- Slider {
75- function formatValue(v) { return v.toFixed(2) }
76- minimumValue: -3.14
77- maximumValue: 3.14
78- value: 0.0
79- live: true
80- }
81- }
82- \endqml
83-
84- \section2 Theming
85-
86- The slider's default style class is \b slider and style properties depend on
87- the actual delegate defined by the theme, except of one property which defines
88- the spacing units between the slider's bar and thumb, called \b thumbSpacing.
89- The slider uses one single touch sensing area to position the thumb within the
90- bar. Therefore However delegates must define the following properties:
91- \list
92- \li * \b bar - the slider's bar object
93- \li * \b thumb - the slider's thumb object
94- \endlist
95-
96- Beside these, the library provies functions for delegates to update liveValue and
97- normalizedValue in SliderUtils module.
98-
99- \b{This component is under heavy development.}
100-*/
101-AbstractButton {
102- id: slider
103-
104- width: units.gu(38)
105- height: units.gu(5)
106-
107- Theming.ItemStyle.class: "slider"
108-
109- // FIXME(loicm) Add Support for the inverted property. There's an ongoing
110- // debate on whether we should use that property (like every other
111- // toolkits) or add new enumerations to the orientation property and
112- // get something like LeftToRight, RightToLeft, TopToBottom and
113- // BottomToTop. The last proposition appears to have the advantage that
114- // it's not culture centric (ie inverted for LeftToRight and RightToLeft
115- // isn't natural for everybody).
116-
117- // /*!
118- // \preliminary
119- // Selects whether or not the minimum value starts from the right.
120- // */
121- // property bool inverted: false
122-
123- /*!
124- \preliminary
125- The minimum value from the continuous range of values. If this value is
126- greater than maximumValue, the component will be in an inconsistent
127- state.
128- */
129- property real minimumValue: 0.0
130-
131- /*!
132- \preliminary
133- The maximum value from the continuous range of values. If this value is
134- lesser than minimumValue, the component will be in an inconsistent state.
135- */
136- property real maximumValue: 100.0
137-
138- // FIXME(loicm) Add Support for the stepSize property.
139-
140- // /*!
141- // \preliminary
142- // The distance between two selectable values in the range defined by
143- // [minimumValue, maximumValue].
144- // */
145- // property real stepSize: 1.0
146-
147- /*!
148- \preliminary
149- The current value of the slider. This property is not changed while the
150- thumb is dragged unless the live property is set to true.
151- */
152- property real value: 0.0
153-
154- /*!
155- \preliminary
156- Defines whether the value is updated while the thumb is dragged or just
157- when the thumb is released.
158- */
159- property bool live: false
160-
161-
162- /*!
163- \preliminary
164- This handler is called when there is a click on the slider. The onThumb parameter provides information if the click, was inside of the Thumb element.
165- */
166- signal sliderClicked(bool onThumb)
167-
168-
169- /*!
170- \preliminary
171- This function is used by the value indicator to show the current value.
172- Reimplement this function if you want to show different information. By
173- default, the value v is rounded to the nearest interger value.
174-
175- \b Note: this function will be deprecated, and will be solved with particular
176- delegates for the thumb.
177- */
178- function formatValue(v) {
179- return v.toFixed(0)
180- }
181-
182- // Private symbols.
183-
184- /*! \internal */
185- onValueChanged: internals.liveValue = slider.value
186-
187- /*! \internal */
188- Component.onCompleted: internals.updateMouseArea()
189-
190- /*! \internal */
191- onPressedChanged: internals.mouseAreaPressed()
192-
193- /*! \internal */
194- property alias __internals: internals
195- QtObject {
196- id: internals
197-
198- property real thumbSpacing: ComponentUtils.style(slider, "thumbSpacing", 0.0)
199- property Item bar: ComponentUtils.delegateProperty(slider, "bar", null)
200- property Item thumb: ComponentUtils.delegateProperty(slider, "thumb", null)
201-
202- property real liveValue: 0.0
203- property real normalizedValue: MathUtils.clamp((liveValue - slider.minimumValue) /
204- (slider.maximumValue - slider.minimumValue),
205- 0.0, 1.0)
206-
207- property real dragInitMouseX: 0.0
208- property real dragInitNormalizedValue: 0.0
209- property real thumbWidth: thumb ? thumb.width - thumbSpacing : 0.0
210- property real thumbSpace: bar ? bar.width - (2.0 * thumbSpacing + thumbWidth) : 0.0
211-
212- function updateMouseArea() {
213- slider.__mouseArea.positionChanged.connect(internals.mouseAreaPositionchanged);
214- }
215-
216- function mouseAreaPressed() {
217- if (!thumb || !bar)
218- return;
219- if (slider.__mouseArea.pressedButtons == Qt.LeftButton) {
220- // Left button pressed.
221- var mouseX = slider.__mouseArea.mouseX;
222- var mouseY = slider.__mouseArea.mouseY;
223- if (mouseY >= thumb.y && mouseY <= thumb.y + thumb.height) {
224- if (mouseX >= thumb.x && mouseX <= thumb.x + thumb.width) {
225- // Button pressed inside the thumb.
226- dragInitMouseX = mouseX;
227- dragInitNormalizedValue = normalizedValue;
228- slider.sliderClicked(true);
229- } else if (mouseX > thumbSpacing &&
230- mouseX < bar.width - thumbSpacing) {
231- // Button pressed outside the thumb.
232- var normalizedPosition = (slider.__mouseArea.mouseX - thumbSpacing - thumbWidth * 0.5) / thumbSpace;
233- normalizedPosition = MathUtils.clamp(normalizedPosition, 0.0, 1.0);
234- liveValue = MathUtils.lerp(normalizedPosition, slider.minimumValue, slider.maximumValue);
235- dragInitMouseX = mouseX;
236- dragInitNormalizedValue = normalizedValue;
237- if (slider.live) {
238- slider.value = liveValue;
239- }
240- slider.sliderClicked(false);
241- }
242- }
243- } else {
244- // Button released.
245- if (!slider.live) {
246- slider.value = liveValue;
247- }
248- }
249- }
250-
251- function mouseAreaPositionchanged() {
252- // Left button dragging.
253- if (slider.pressed) {
254- var normalizedOffsetX = (slider.__mouseArea.mouseX - dragInitMouseX) / thumbSpace;
255- var v = MathUtils.clamp(dragInitNormalizedValue + normalizedOffsetX, 0.0, 1.0);
256- liveValue = MathUtils.lerp(v, slider.minimumValue, slider.maximumValue);
257- if (slider.live) {
258- slider.value = liveValue;
259- }
260- }
261- }
262- }
263-}
264
265=== modified file 'src/qml/theme/VideoSlider.qml'
266--- src/qml/theme/VideoSlider.qml 2013-02-11 17:39:58 +0000
267+++ src/qml/theme/VideoSlider.qml 2013-04-15 13:15:37 +0000
268@@ -19,7 +19,6 @@
269
270 import QtQuick 2.0
271 import Ubuntu.Components 0.1
272-import "/usr/share/themes/Ambiance/qmltheme/styleUtils.js" as StyleUtils
273
274 Item {
275 id: main
276@@ -30,7 +29,7 @@
277 property Item thumb: thumbShape
278
279 // private properties
280- property real thumbSpacing: StyleUtils.itemStyleProperty("thumbSpacing", 0)
281+ property real thumbSpacing: 0
282 property real liveValue: SliderUtils.liveValue(item)
283 property real normalizedValue: SliderUtils.normalizedValue(item)
284
285@@ -82,7 +81,6 @@
286 id: thumbShape
287
288 x: backgroundShape.x + thumbSpacing + normalizedValue * thumbSpace
289- //y: backgroundShape.y + thumbSpacing
290 anchors.verticalCenter: backgroundShape.verticalCenter
291 width: thumbWidth
292 height: thumbWidth

Subscribers

People subscribed via source and target branches