summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Olszak <olszak.tomasz@gmail.com>2013-12-03 00:02:17 +0100
committerTomasz Olszak <olszak.tomasz@gmail.com>2013-12-03 00:34:51 +0100
commitb66e150408d511d76d1feb22ae449eb5c794683e (patch)
tree97460e10e2fa2c62ba7655c677bfd997b15b9860
parent23162e853ab7ecfdc978f80aa5a48275a2deb988 (diff)
Tizen: Added style for RadioButton. Examples adapted.
Change-Id: I89ef57cbd5a71e053707cd7804e1b355c4755a19 Reviewed-by: Jarosław Staniek <staniek@kde.org>
-rw-r--r--examples/touch/content/ConfigurationPage.qml13
-rw-r--r--src/styles/DefaultSettings.js19
-rw-r--r--src/styles/RadioButtonStyle.qml58
-rw-r--r--src/styles/SwitchStyle.qml4
-rw-r--r--src/styles/qmldir1
-rw-r--r--src/styles/styles.pro3
6 files changed, 91 insertions, 7 deletions
diff --git a/examples/touch/content/ConfigurationPage.qml b/examples/touch/content/ConfigurationPage.qml
index 8e94e05..200c7dc 100644
--- a/examples/touch/content/ConfigurationPage.qml
+++ b/examples/touch/content/ConfigurationPage.qml
@@ -138,19 +138,24 @@ Item {
checkBoxWhite.checked = TizenControls.currentTheme === "white"
checkBoxBlack.checked = TizenControls.currentTheme === "black"
}
- CheckBox {
+ ExclusiveGroup {
+ id: exclGroup
+ }
+ RadioButton {
id: checkBoxWhite
+ exclusiveGroup: exclGroup
Layout.fillWidth: true
Layout.fillHeight: true
text: "White"
- onClicked: TizenControls.changeTheme("white")
+ onCheckedChanged: if (checked) TizenControls.changeTheme("white")
}
- CheckBox {
+ RadioButton {
id: checkBoxBlack
Layout.fillWidth: true
+ exclusiveGroup: exclGroup
Layout.fillHeight: true
text: "Black"
- onClicked: TizenControls.changeTheme("black")
+ onCheckedChanged: if (checked) TizenControls.changeTheme("black")
}
}
}
diff --git a/src/styles/DefaultSettings.js b/src/styles/DefaultSettings.js
index 9b82e9b..dd94f22 100644
--- a/src/styles/DefaultSettings.js
+++ b/src/styles/DefaultSettings.js
@@ -275,6 +275,25 @@ function createCheckBox(th) {
},
onOff: {
source: {
+ normal: images.img_00_button_radio_bg,
+ disabled: images.img_00_button_radio_dim_bg,
+ pressed: images.img_00_button_radio_press_bg,
+ highlighted: images.img_00_button_radio_focus,
+ selected: images.img_00_button_radio_bg
+ },
+ indicator: {
+ source: {
+ normal: images.img_00_button_radio_activated,
+ disabled: images.img_00_button_radio_activated_dim,
+ pressed: images.img_00_button_radio_activated_press,
+ highlighted: images.img_00_button_radio_activated,
+ selected: images.img_00_button_radio_activated
+ }
+ }
+ },
+
+ onOffSliding: {
+ source: {
normal: images.img_00_button_on_off_bg,
disabled: images.img_00_button_on_off_bg_dim,
pressed: images.img_00_button_on_off_bg,
diff --git a/src/styles/RadioButtonStyle.qml b/src/styles/RadioButtonStyle.qml
new file mode 100644
index 0000000..42e7bcf
--- /dev/null
+++ b/src/styles/RadioButtonStyle.qml
@@ -0,0 +1,58 @@
+/*
+ * 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.2
+import QtQuick.Controls.Styles 1.1
+import QtQuick.Controls.Styles.Tizen 1.0
+import "private"
+
+RadioButtonStyle {
+ label: Text {
+ text: control.text
+ font.pointSize: TizenConfig.checkBox.font.pixelSize
+ color:if (control.enabled) {
+ if (control.pressed) {
+ TizenConfig.checkBox.text.color.pressed
+ } else {
+ TizenConfig.checkBox.text.color.normal
+ }
+ } else {
+ TizenConfig.checkBox.text.color.disabled
+ }
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ indicator: Image {
+ source: control.enabled ? (control.pressed? TizenConfig.checkBox.onOff.source.pressed: TizenConfig.checkBox.onOff.source.normal):TizenConfig.checkBox.onOff.source.disabled
+ Image {
+ visible: control.checked
+ source: control.enabled ? (control.pressed || !control.checked ? TizenConfig.checkBox.onOff.indicator.source.pressed: TizenConfig.checkBox.onOff.indicator.source.normal):TizenConfig.checkBox.onOff.indicator.source.disabled
+ }
+ }
+
+ background: PrivatePanel {
+ id:panel
+ pressed: control.pressed
+ property var pressedColor: control.styleHints && control.styleHints["pressedColor"] ? control.styleHints["pressedColor"]: TizenConfig.panel.color.pressed
+ property var normalColor: control.styleHints && control.styleHints["color"] ? control.styleHints["color"]: TizenConfig.panel.color.normal
+ backgroundColor: control.pressed ? pressedColor : normalColor
+ implicitWidth: 600
+ implicitHeight: 100
+ }
+}
diff --git a/src/styles/SwitchStyle.qml b/src/styles/SwitchStyle.qml
index 8221144..25eee6a 100644
--- a/src/styles/SwitchStyle.qml
+++ b/src/styles/SwitchStyle.qml
@@ -32,7 +32,7 @@ SwitchStyle {
Image {
id:icon
anchors.fill: parent
- source: control.enabled ? ( control.checked ? TizenConfig.checkBox.onOff.on.handler.source.normal : TizenConfig.checkBox.onOff.off.handler.source.normal) : ( control.checked ? TizenConfig.checkBox.onOff.on.handler.source.disabled : TizenConfig.checkBox.onOff.off.handler.source.disabled)
+ source: control.enabled ? ( control.checked ? TizenConfig.checkBox.onOffSliding.on.handler.source.normal : TizenConfig.checkBox.onOffSliding.off.handler.source.normal) : ( control.checked ? TizenConfig.checkBox.onOffSliding.on.handler.source.disabled : TizenConfig.checkBox.onOffSliding.off.handler.source.disabled)
}
}
@@ -42,7 +42,7 @@ SwitchStyle {
Image {
id:onOffBackground
anchors.fill: parent
- source: control.enabled ? TizenConfig.checkBox.onOff.source.normal : TizenConfig.checkBox.on.source.disabled
+ source: control.enabled ? TizenConfig.checkBox.onOffSliding.source.normal : TizenConfig.checkBox.on.source.disabled
}
}
}
diff --git a/src/styles/qmldir b/src/styles/qmldir
index 7362221..4c6aace 100644
--- a/src/styles/qmldir
+++ b/src/styles/qmldir
@@ -21,3 +21,4 @@ TitleBarStyle 1.0 TitleBarStyle.qml
ToolBarStyle 1.0 ToolBarStyle.qml
ToolBarButton 1.0 ToolBarButton.qml
ViewStyle 1.0 ViewStyle.qml
+RadioButtonStyle 1.0 RadioButtonStyle.qml
diff --git a/src/styles/styles.pro b/src/styles/styles.pro
index 29c4c38..ed66891 100644
--- a/src/styles/styles.pro
+++ b/src/styles/styles.pro
@@ -27,7 +27,8 @@ QML_FILES = \
TimeEditStyle.qml \
ToolBarStyle.qml \
ToolBarButton.qml \
- PanelStyle.qml
+ PanelStyle.qml \
+ RadioButtonStyle.qml
QML_FILES += \
private/DateEditField.qml\