summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2013-12-02 23:44:43 +0100
committerTomasz Olszak <olszak.tomasz@gmail.com>2013-12-03 00:34:34 +0100
commit23162e853ab7ecfdc978f80aa5a48275a2deb988 (patch)
tree99fca0fb286f0c6bdf03e6e3719135671676ef4d
parent8e1b31d3efbbbbca9d8ef893c9537b76d29730fd (diff)
Tizen: Adapting to new Qt Quick Controls.
Removed Switch and BusyIndicator from QtQuick Controls Tizen, now one from Qt Quick Controls are used. Change-Id: I41d6a2d36b7a50320172d0804e5348780f65568f Reviewed-by: Jarosław Staniek <staniek@kde.org>
-rw-r--r--examples/touch/content/CheckBoxPage.qml18
-rw-r--r--examples/touch/content/ConfigurationPage.qml6
-rw-r--r--src/controls/BusyIndicator.qml31
-rw-r--r--src/controls/Switch.qml184
-rw-r--r--src/controls/controls.pro2
-rw-r--r--src/controls/qmldir2
-rw-r--r--src/styles/BusyIndicatorStyle.qml31
-rw-r--r--src/styles/SwitchStyle.qml61
8 files changed, 22 insertions, 313 deletions
diff --git a/examples/touch/content/CheckBoxPage.qml b/examples/touch/content/CheckBoxPage.qml
index bdaa585..bc6f365 100644
--- a/examples/touch/content/CheckBoxPage.qml
+++ b/examples/touch/content/CheckBoxPage.qml
@@ -26,10 +26,9 @@
*/
-import QtQuick 2.1
-import QtQuick.Controls 1.0
+import QtQuick 2.2
+import QtQuick.Controls 1.1
import QtQuick.Controls.Tizen 1.0
-import QtQuick.Controls.Styles 1.0
Item {
id:root
@@ -114,18 +113,5 @@ Item {
onCheckedChanged: parent.checked = checked
}
}
- CheckBox {
- text:"V Switch"
- onCheckedChanged: mSwitch1.checked = checked
- Switch {
- id:mSwitch1
- orientation: Qt.Vertical
- checked: parent.checked
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- onCheckedChanged: parent.checked = checked
- }
- }
}
}
diff --git a/examples/touch/content/ConfigurationPage.qml b/examples/touch/content/ConfigurationPage.qml
index bd7fe81..8e94e05 100644
--- a/examples/touch/content/ConfigurationPage.qml
+++ b/examples/touch/content/ConfigurationPage.qml
@@ -26,10 +26,10 @@
*/
-import QtQuick 2.1
-import QtQuick.Controls 1.0
+import QtQuick 2.2
+import QtQuick.Controls 1.1
import QtQuick.Controls.Tizen 1.0
-import QtQuick.Layouts 1.0
+import QtQuick.Layouts 1.1
Item {
id:root
diff --git a/src/controls/BusyIndicator.qml b/src/controls/BusyIndicator.qml
deleted file mode 100644
index 6468a13..0000000
--- a/src/controls/BusyIndicator.qml
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-import QtQuick 2.1
-import QtQuick.Controls.Private 1.0
-import QtQuick.Controls.Styles.Tizen 1.0
-
-Control {
- id: root
- property bool running: false
- property int duration: 1000
-
-
- style: Qt.createComponent(Settings.style + "/BusyIndicatorStyle.qml", root)
-}
diff --git a/src/controls/Switch.qml b/src/controls/Switch.qml
deleted file mode 100644
index 66fb115..0000000
--- a/src/controls/Switch.qml
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Controls.Private 1.0
-
-/*!
- \qmltype Swicth
-
-*/
-
-Control {
- id: rootSwitch
-
- /*!
- \qmlproperty enumeration Slider::orientation
-
- This property holds the layout orientation of the switch.
- The default value is \c Qt.Horizontal.
- */
- property int orientation: Qt.Horizontal
-
- /*!
- \qmlproperty bool Switch::checked
-
- Property holds state of the switch.
-
- The default value is \c false.
- */
- property bool checked: false
-
- /*!
- \qmlproperty bool Switch::updateValueWhileDragging
-
- If set to true, switch checked property is updated while the user is moving the handle.
-
- The default value is \c false.
- */
- property bool updateValueWhileDragging: false
-
- /*!
- \qmlproperty bool Switch::pressed
-
- This property indicates if switch handle is currently being pressed.
- */
- property alias pressed: mouseArea.pressed
-
- /*!
- \qmlproperty bool Switch::activeFocusOnPress
-
- This property indicates if the Switch should receive active focus when
- pressed.
-
- The default value is \c false.
- */
- property bool activeFocusOnPress: false
-
- /*! \internal */
- readonly property bool __containsMouse: mouseArea.containsMouse
-
- /*! \internal */
- readonly property bool __horizontal: orientation === Qt.Horizontal
-
- /*! \internal */
- readonly property real __handlePos: __horizontal ? fakeHandle.x : -fakeHandle.y
-
- /*! \internal */
- readonly property real __handleDragArea: __horizontal ? rootSwitch.width - fakeHandle.width : rootSwitch.height - fakeHandle.height
-
- activeFocusOnTab: true
-
- // Accessible.role: Accessible.Slider
- // Accessible.name: value
-
- style: Qt.createComponent(Settings.style + "/SwitchStyle.qml", rootSwitch)
-
- Keys.onSpacePressed: { checked = !checked }
-
- function __updateSwitchState() {
- rootSwitch.checked = (__horizontal ? fakeHandle.x: -fakeHandle.y) > __handleDragArea/2
- }
-
- Item {
- id: fakeHandle
- anchors.verticalCenter: __horizontal ? parent.verticalCenter : undefined
- anchors.horizontalCenter: !__horizontal ? parent.horizontalCenter : undefined
- width: __horizontal ? __panel.handleWidth : __panel.handleHeight
- height: __horizontal ? __panel.handleHeight : __panel.handleWidth
- }
-
- MouseArea {
- id: mouseArea
-
- hoverEnabled: true
- anchors.fill: parent
-
- drag.target: fakeHandle
- drag.axis: __horizontal ? Drag.XAxis : Drag.YAxis
- drag.minimumX: 0
- drag.maximumX: __handleDragArea
- drag.minimumY: -__handleDragArea
- drag.maximumY: 0
- onPositionChanged: {
- if (drag.active && updateValueWhileDragging) {
- __updateSwitchState()
- }
- }
- onClicked: {
- rootSwitch.checked = !rootSwitch.checked
- }
- onReleased: {
- if (!updateValueWhileDragging) {
- __updateSwitchState()
- }
- }
- }
- StateGroup {
- id: stateGroup
- states: [
- State {
- name:"normal"
- when: !mouseArea.pressed && !checked
- PropertyChanges {
- restoreEntryValues : false
- target: fakeHandle
- x: __horizontal ? 0 : fakeHandle.x
- y: !__horizontal ? 0 : fakeHandle.y
- }
- },
- State {
- name:"checked"
- when: !mouseArea.pressed && checked
- PropertyChanges {
- restoreEntryValues : false
- target: fakeHandle
- x: __horizontal ? __handleDragArea : fakeHandle.x
- y: !__horizontal ? -__handleDragArea : fakeHandle.y
- }
- },
- State {
- name:"pressed"
- when: mouseArea.pressed
- }
-
- ]
- transitions: [
- Transition {
- to: "normal"
- NumberAnimation {
- target: fakeHandle
- properties: "x,y"
- duration: 250
- easing.type: Easing.InCubic
- }
- },
- Transition {
- to: "checked"
- NumberAnimation {
- target: fakeHandle
- properties: "x,y"
- duration: 250
- easing.type: Easing.InCubic
- }
- }
- ]
- }
-}
diff --git a/src/controls/controls.pro b/src/controls/controls.pro
index d25044d..4ba4a42 100644
--- a/src/controls/controls.pro
+++ b/src/controls/controls.pro
@@ -6,13 +6,11 @@ TARGETPATH = QtQuick/Controls/Tizen
QML_FILES += \
- Switch.qml \
DetailButton.qml\
ContextMenu.qml\
SplitView.qml\
ScrollDecorator.qml\
Popup.qml\
- BusyIndicator.qml \
DateEdit.qml\
TimeEdit.qml \
TitleBar.qml \
diff --git a/src/controls/qmldir b/src/controls/qmldir
index 164a704..81fb7f5 100644
--- a/src/controls/qmldir
+++ b/src/controls/qmldir
@@ -2,13 +2,11 @@ module QtQuick.Controls.Tizen
plugin tizencontrolsplugin
-Switch 1.0 Switch.qml
DetailButton 1.0 DetailButton.qml
ContextMenu 1.0 ContextMenu.qml
SplitView 1.0 SplitView.qml
ScrollDecorator 1.0 ScrollDecorator.qml
Popup 1.0 Popup.qml
-BusyIndicator 1.0 BusyIndicator.qml
DateEdit 1.0 DateEdit.qml
TitleBar 1.0 TitleBar.qml
TimeEdit 1.0 TimeEdit.qml
diff --git a/src/styles/BusyIndicatorStyle.qml b/src/styles/BusyIndicatorStyle.qml
index 4a1db62..9e2b63f 100644
--- a/src/styles/BusyIndicatorStyle.qml
+++ b/src/styles/BusyIndicatorStyle.qml
@@ -17,36 +17,29 @@
* Boston, MA 02110-1301, USA.
*/
-import QtQuick 2.1
-import QtQuick.Controls 1.0
+import QtQuick 2.2
+import QtQuick.Controls 1.1
import QtQuick.Controls.Private 1.0
-import QtQuick.Controls.Tizen 1.0
import QtQuick.Controls.Styles.Tizen 1.0
+import QtQuick.Controls.Styles 1.1
-Style {
+BusyIndicatorStyle {
id: style
- property BusyIndicator control: __control
-
- property Component panel: Image {
+ indicator: Image {
id:root
source: TizenConfig.busyIndicator.source
+ opacity: control.running ? 1 : 0
- Binding {
- target:control
- property: "duration"
- value: TizenConfig.busyIndicator.duration
- }
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
- RotationAnimation {
+ RotationAnimator on rotation {
running: control.running
- from:0
- to: 360
- target: root
- direction: RotationAnimation.Clockwise
- duration: control.duration
+ duration: 1000
loops: Animation.Infinite
- property: "rotation"
+ from: 0
+ to: 360
+
}
}
}
diff --git a/src/styles/SwitchStyle.qml b/src/styles/SwitchStyle.qml
index 4b4803b..8221144 100644
--- a/src/styles/SwitchStyle.qml
+++ b/src/styles/SwitchStyle.qml
@@ -18,23 +18,15 @@
*/
import QtQuick 2.1
-import QtQuick.Controls 1.0
-import QtQuick.Controls.Private 1.0
-import QtQuick.Controls.Tizen 1.0
import QtQuick.Controls.Styles.Tizen 1.0
+import QtQuick.Controls.Styles 1.1
-Style {
- id: styleitem
- /*! The \l Slider attached to this style. */
- readonly property Switch control: __control
- padding { top: 0 ; left: 0 ; right: 0 ; bottom: 0 }
+SwitchStyle {
+ id: styleitem
- /*! This property holds the item for the slider handle.
- You can access the slider through the \c control property
- */
- property Component handle: Item {
+ handle: Item {
implicitWidth: icon.implicitWidth
implicitHeight: icon.implicitHeight
Image {
@@ -44,10 +36,7 @@ Style {
}
}
- /*! This property holds the background groove of the slider.
- You can access the handle position through the \c handlePosition property.
- */
- property Component groove: Item {
+ groove: Item {
implicitWidth: onOffBackground.implicitWidth
implicitHeight: onOffBackground.implicitHeight
Image {
@@ -56,44 +45,4 @@ Style {
source: control.enabled ? TizenConfig.checkBox.onOff.source.normal : TizenConfig.checkBox.on.source.disabled
}
}
-
- /*! This property holds the slider style panel.
-
- Note that it is generally not recommended to override this.
- */
- property Component panel: Item {
- id: root
- property int handleWidth: handleLoader.implicitWidth
- property int handleHeight: handleLoader.implicitHeight
-
- property bool horizontal : control.orientation === Qt.Horizontal
- property int horizontalSize: grooveLoader.implicitWidth + padding.left + padding.right
- property int verticalSize: Math.max(handleLoader.implicitHeight, grooveLoader.implicitHeight) + padding.top + padding.bottom
-
- implicitWidth: horizontal ? horizontalSize : verticalSize
- implicitHeight: horizontal ? verticalSize : horizontalSize
-
- y: horizontal ? 0 : height
- rotation: horizontal ? 0 : -90
- transformOrigin: Item.TopLeft
-
- Item {
- anchors.fill: parent
- Loader {
- id: grooveLoader
- property int handlePosition: handleLoader.x + handleLoader.width/2
- x: padding.left
- sourceComponent: groove
- width: (horizontal ? parent.width : parent.height) - padding.left - padding.right
- height:(horizontal ? parent.height : parent.width) - padding.top - padding.bottom
- y: padding.top
- }
- Loader {
- id: handleLoader
- sourceComponent: handle
- anchors.verticalCenter: grooveLoader.verticalCenter
- x: control.__handlePos
- }
- }
- }
}