import QtQuick 2.1
import QtQuick.Controls.Styles.Tizen 1.0
import QtQuick.Controls.Tizen 1.0
+import QtQuick.Controls 1.0
Item {
id: root
visible: detailButton.pressed
}
- Text {
+ Label {
id: textitem
color: TizenConfig.colors.foreground
font.pixelSize: 32
- text: modelData
+ font.family: TizenConfig.fonts.defaultFamily
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 30
id: mouse
anchors.fill: parent
onClicked: root.clicked()
-
}
Button {
anchors.margins: 20
text: "Press me"
- styleHints:( {color:"yellow",pressedColor:"red"})
+ styleHints:( {color:"orange",pressedColor:"red"})
}
Button {
--- /dev/null
+/*
+ * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Tizen 1.0
+import QtQuick.Controls.Styles.Tizen 1.0
+import QtQuick.Layouts 1.0
+
+Item {
+ id:root
+ width: parent.width
+ height: parent.height
+ VisualItemModel {
+ id: itemModel
+ Panel {
+ x: 15
+ width: root.width - 30
+ Label {
+ id: pageEffectLabel
+ anchors.margins: 10
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.right: pageEffectSwitch.left
+ text: "Page effect "+ ((pageEffectSwitch.checked) ? "on" : "off")
+ color: TizenConfig.colors.foreground
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ font.family: TizenConfig.fonts.defaultFamily
+ font.pixelSize: parent.height/2
+ fontSizeMode: Text.Fit
+ }
+ Switch {
+ id: pageEffectSwitch
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ checked: appWindow.pageCurlEffectEnabled
+ onCheckedChanged: {
+ appWindow.pageCurlEffectEnabled = checked
+ }
+ }
+ }
+ Panel {
+ id: themePanel
+ x:15
+ width: root.width-30
+ onPressedChanged: {
+ if (pressed)
+ themeCheckBoxPanel.show()
+ else
+ themeCheckBoxPanel.hide()
+ }
+ Label {
+ id: themeLabel
+ anchors.margins: 10
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height:parent.implicitHeight
+ text: "Theme: "+ TizenConfig.theme
+ color: TizenConfig.colors.foreground
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ font.family: TizenConfig.fonts.defaultFamily
+ font.pixelSize: parent.height/2
+ fontSizeMode: Text.Fit
+ MouseArea {
+ anchors.fill: parent
+ onClicked: themePanel.pressed = !themePanel.pressed
+ }
+ }
+ }
+ ColumnLayout {
+ id: themeCheckBoxPanel
+ x: 15
+ spacing:0
+ width:0
+ height:0
+ visible: height > 0
+ states: [
+ State {
+ name:"visible"
+ PropertyChanges {
+ target: themeCheckBoxPanel
+ //visible: true
+ width: root.width -30
+ height: checkBoxWhite.implicitHeight + spacing + checkBoxBlack.implicitHeight
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ from: "*"
+ to: "*"
+ NumberAnimation {
+ target: themeCheckBoxPanel
+ properties: "width,height"
+ duration: 200
+ }
+ }
+ ]
+ function show() {
+ state = "visible"
+ }
+ function hide() {
+ state = ""
+ }
+
+ property string theme: TizenConfig.theme
+ onThemeChanged: {
+ checkBoxWhite.checked = TizenConfig.theme === "white"
+ checkBoxBlack.checked = TizenConfig.theme === "black"
+ }
+ CheckBox {
+ id: checkBoxWhite
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ text: "White"
+ onClicked: TizenConfig.theme = "white"
+ }
+ CheckBox {
+ id: checkBoxBlack
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ text: "Black"
+ onClicked: TizenConfig.theme = "black"
+ }
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: itemModel
+ spacing: 5
+ }
+}
import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Tizen 1.0
+import QtQuick.Controls.Styles.Tizen 1.0
Item {
id:root
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WordWrap
+ color: TizenConfig.colors.foreground
Rectangle {
anchors.fill: parent
border.width: 1
property double curlExtent
fragmentShader: "
+#ifndef highp
precision lowp float;
+#endif
uniform lowp float curlExtent;
uniform lowp sampler2D source;
uniform lowp float qt_Opacity;
icons are from the Tango Desktop project(http://tango.freedesktop.org/Tango_Desktop_Project):
internet-mail.png
internet-web-browser.png
+
+================
+mainmenu.png icon contains modified Components Icon icon from
+Artist: Double-J Design (Available for custom work - http://www.doublejdesign.co.uk/)
+Iconset: Ravenna 3D Icons (90 icons)
+Licensed under CC Attribution 3.0 (http://creativecommons.org/licenses/by/3.0/)
#include <QtDebug>
#include <QtGlobal>
#include <QQmlApplicationEngine>
+#include <QScreen>
extern "C" int OspMain(int argc, char *argv[])
{
QQmlApplicationEngine engine(QUrl("qrc:///main.qml"));
QQuickWindow *window = qobject_cast<QQuickWindow *>(engine.rootObjects().at(0));
if (window) {
+ window->setIcon(QIcon(":/images/mainmenu.png"));
+ window->screen()->setOrientationUpdateMask(Qt::PortraitOrientation | Qt::LandscapeOrientation |
+ Qt::InvertedPortraitOrientation | Qt::InvertedLandscapeOrientation);
+#ifdef Q_OS_TIZEN
+ window->setProperty("contentFollowsContentOrientation",true);
+#endif
window->show();
return app.exec();
} else {
ApplicationWindow {
id: appWindow
- y: 60
+ y: isPortrait ? 60 : 0
width: 720
- height: 1220
+ height: isPortrait? 1220 : 1280
property real curlValue: 0.05
+ property bool isPortrait: contentOrientation === Qt.PortraitOrientation || contentOrientation === Qt.InvertedPortraitOrientation
- View {
- id: content
+ contentOrientation: Screen.orientation
+ property bool pageCurlEffectEnabled: false
+
+ Item {
+ id: rotatedItem
anchors.fill: parent
- titleBar.text: "Controls Gallery (Theme: " + TizenConfig.theme+")"
- titleBar.subText: pageStack.depth > 1 ? pageStack.currentItem: "Main Page"
+ View {
+ id: content
+ anchors.fill: parent
- backAction.onTriggered: pageStack.depth > 1 ? pageStack.pop() : Qt.quit()
+ titleBar.text: "Controls Gallery (Theme: " + TizenConfig.theme+")"
+ titleBar.subText: pageStack.depth > 1 ? pageStack.currentItem: "Main Page"
- ListModel {
- id: pageModel
- ListElement {
- title: "Buttons"
- page: "content/ButtonPage.qml"
- }
- ListElement {
- title: "Sliders"
- page: "content/SliderPage.qml"
- }
- ListElement {
- title: "ProgressBar"
- page: "content/ProgressBarPage.qml"
- }
- ListElement {
- title: "Tabs"
- page: "content/TabBarPage.qml"
- }
- ListElement {
- title: "CheckBoxes"
- page: "content/CheckBoxPage.qml"
- }
- ListElement {
- title: "ContextMenu"
- page: "content/ContextMenuPage.qml"
- }
- ListElement {
- title: "SplitView"
- page: "content/SplitViewPage.qml"
- }
- ListElement {
- title: "DateTimeEdit"
- page: "content/DateTimeEditPage.qml"
+ backAction.onTriggered: pageStack.depth > 1 ? pageStack.pop() : Qt.quit()
+
+ ListModel {
+ id: pageModel
+ ListElement {
+ title: "Configuration"
+ page: "content/ConfigurationPage.qml"
+ }
+ ListElement {
+ title: "Buttons"
+ page: "content/ButtonPage.qml"
+ }
+ ListElement {
+ title: "Sliders"
+ page: "content/SliderPage.qml"
+ }
+ ListElement {
+ title: "ProgressBar"
+ page: "content/ProgressBarPage.qml"
+ }
+ ListElement {
+ title: "Tabs"
+ page: "content/TabBarPage.qml"
+ }
+ ListElement {
+ title: "CheckBoxes"
+ page: "content/CheckBoxPage.qml"
+ }
+ ListElement {
+ title: "ContextMenu"
+ page: "content/ContextMenuPage.qml"
+ }
+ ListElement {
+ title: "SplitView"
+ page: "content/SplitViewPage.qml"
+ }
+ ListElement {
+ title: "DateTimeEdit"
+ page: "content/DateTimeEditPage.qml"
+ }
}
- }
- StackView {
- id: pageStack
- anchors.fill: parent
+ StackView {
+ id: pageStack
+ anchors.fill: parent
- initialItem: Item {
- width: parent.width
- height: parent.height
+ initialItem: Item {
+ width: parent.width
+ height: parent.height
- ListView {
- id:listView
- model: pageModel
- anchors.fill: parent
- clip:true
+ ListView {
+ id:listView
+ model: pageModel
+ anchors.fill: parent
+ clip:true
- delegate: AndroidDelegate {
- text: title
- onClicked: {
- content.titleBar.subText = Qt.binding(function() {return pageStack.depth > 1 ? title: "Main Page"})
- pageStack.push(Qt.resolvedUrl(page))
+ delegate: AndroidDelegate {
+ text: title
+ onClicked: {
+ content.titleBar.subText = Qt.binding(function() {return pageStack.depth > 1 ? title: "Main Page"})
+ pageStack.push(Qt.resolvedUrl(page))
+ }
}
+ ScrollDecorator {flickableItem: listView}
}
- ScrollDecorator {flickableItem: listView}
}
}
}
- }
- Rectangle {
- id: backgroundRect
- color:"black"
- width: 300
- height: 130
- anchors.right: parent.right
- anchors.top: parent.top
-
- }
- ShaderEffectSource {
- id: shaderSource
- anchors.fill: parent
- sourceItem: content
- layer.enabled: true
- layer.effect: PageCurl {
- id: pageCurl
- curlExtent: curlValue
+ Rectangle {
+ id: backgroundRect
+ visible: appWindow.pageCurlEffectEnabled
+ color: (TizenConfig.theme === "black") ? "white" : " black"
+ width: 300
+ height: 130
+ anchors.right: parent.right
+ anchors.top: parent.top
}
- }
-
- SequentialAnimation {
- id: curlAnimation
- property int to: 1.0
- SmoothedAnimation {
- velocity: 1.5
- target: appWindow
- property: "curlValue"
- to: curlAnimation.to
+ ShaderEffectSource {
+ id: shaderSource
+ anchors.fill: parent
+ enabled: pageCurlEffectEnabled
+ sourceItem: pageCurlEffectEnabled ? content : null
+ layer.enabled: pageCurlEffectEnabled
+ layer.effect: PageCurl {
+ id: pageCurl
+ curlExtent: curlValue
+ }
}
- ScriptAction {
- script: {
- if (!curlMouseArea.roll) {
- flipTheme()
+ SequentialAnimation {
+ id: curlAnimation
+ property int to: 1.0
+ SmoothedAnimation {
+ velocity: 1.5
+ target: appWindow
+ property: "curlValue"
+ to: curlAnimation.to
+ }
+ ScriptAction {
+ script: {
+ if (!curlMouseArea.roll) {
+ rotatedItem.flipTheme()
+ }
+ shaderSource.live = true
+ curlValue = 0.05
+ backgroundRect.visible = Qt.binding(function(){return appWindow.pageCurlEffectEnabled})
}
- shaderSource.live = true
- curlValue = 0.05
- backgroundRect.color = (TizenConfig.theme === "white") ? "black" : "white"
- backgroundRect.visible = true
}
}
- }
- function flipTheme() {
- if (TizenConfig.theme === "white") {
- TizenConfig.theme = "black"
- } else {
- TizenConfig.theme = "white"
- }
- backgroundRect.visible = false
- }
+ MouseArea {
+ id: curlMouseArea
+ anchors.fill: parent
+ enabled: pageCurlEffectEnabled && !curlAnimation.running
+ property bool dragStarted: false
+ property bool themeChanged: false
+ property int initialY: 0
+ property real oldCurlValue
+ property bool roll: true
+ onPressed: {
+ if (mouse.x > appWindow.width - 100 && mouse.y < 100) {
+ roll = true
+ themeChanged = false
+ oldCurlValue = curlValue
+ shaderSource.live = false
+ initialY = mouse.y
+ dragStarted = true
+ } else {
+ mouse.accepted = false
+ }
- MouseArea {
- id: curlMouseArea
- anchors.fill: parent
- enabled: !curlAnimation.running
- property bool dragStarted: false
- property bool themeChanged: false
- property int initialY: 0
- property real oldCurlValue
- property bool roll: true
- onPressed: {
- if (mouse.x > appWindow.width - 100 && mouse.y < 100) {
- roll = true
- themeChanged = false
- oldCurlValue = curlValue
- shaderSource.live = false
- initialY = mouse.y
- dragStarted = true
- } else {
- mouse.accepted = false
}
-
- }
- onMouseYChanged: {
- mouse.accepted = dragStarted
- if (dragStarted) {
- curlValue = mouse.y / shaderSource.height
- if (Math.abs(curlValue - oldCurlValue) > 0.05) {
- roll = oldCurlValue < curlValue
- oldCurlValue = curlValue
+ onMouseYChanged: {
+ mouse.accepted = dragStarted
+ if (dragStarted) {
+ curlValue = mouse.y / shaderSource.height
+ if (Math.abs(curlValue - oldCurlValue) > 0.05) {
+ roll = oldCurlValue < curlValue
+ oldCurlValue = curlValue
+ }
+ if (!themeChanged && (mouse.y - initialY > 50)) {
+ rotatedItem.flipTheme()
+ themeChanged = true
+ }
}
- if (!themeChanged && (mouse.y - initialY > 50)) {
- flipTheme()
- themeChanged = true
+ }
+ onReleased: {
+ mouse.accepted = dragStarted
+ if (dragStarted) {
+ initialY = 0
+ dragStarted = false
+ if (themeChanged && roll) {
+ curlAnimation.to = 1
+ } else {
+ curlAnimation.to = 0.05
+ }
+ curlAnimation.start()
}
}
}
- onReleased: {
- mouse.accepted = dragStarted
- if (dragStarted) {
- initialY = 0
- dragStarted = false
- if (themeChanged && roll) {
- curlAnimation.to = 1
- } else {
- curlAnimation.to = 0.05
- }
- curlAnimation.start()
+ function flipTheme() {
+ if (TizenConfig.theme === "white") {
+ TizenConfig.theme = "black"
+ } else {
+ TizenConfig.theme = "white"
}
+ backgroundRect.visible = false
}
}
}
[Paths]
-Prefix=/opt/usr/apps/HtoZbhWbHx
+Prefix=/opt/usr/apps/QtControls
Libraries=lib
Binaries=bin
Plugins=data/plugins
<file>content/AndroidDelegate.qml</file>
<file>content/DateTimeEditPage.qml</file>
<file>content/PageCurl.qml</file>
- </qresource>
- <qresource prefix="/qt/etc">
- <file>qt.conf</file>
+ <file>content/ConfigurationPage.qml</file>
+ <file>images/mainmenu.png</file>
</qresource>
</RCC>
--- /dev/null
+<RCC>
+ <qresource prefix="/qt/etc">
+ <file alias="qt.conf">tizen/qt.conf</file>
+ </qresource>
+</RCC>
TEMPLATE=app
-QMAKE_LFLAGS+=-pie -rdynamic
-
-TARGET=QtControls.exe
-
+tizen {
+ QMAKE_LFLAGS+=-pie -rdynamic
+ TARGET=QtControls.exe
+} else {
+ TARGET=QtControls
+}
QT += qml quick
OTHER_FILES += \
content/ContextMenuPage.qml \
content/SplitViewPage.qml \
content/DateTimeEditPage.qml\
- qt.conf \
- content/PageCurl.qml
+ content/PageCurl.qml \
+ content/ConfigurationPage.qml \
+ tizen/qt.conf
SOURCES += \
main.cpp
-RESOURCES += \
- touch.qrc
-
+RESOURCES += touch-default.qrc
+tizen: RESOURCES += touch-tizen.qrc
}
TitleBar { id: prvTitleBar }
- Item { id: prvContent }
+ Item { id: prvContent }
ToolBar { id: prvToolBar; view: root }
Action {id: prvBackAction }
+ focus: true
+
+ Keys.onReleased: {
+ if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape) {
+ backAction.trigger()
+ event.accepted = true
+ } else if (event.key === Qt.Key_Menu || event.key === Qt.Key_F2) {
+ console.log("NOT IMPLEMENTED: ContextMenu should be shown")
+ event.accepted = true
+ }
+ }
}
function findRoot() {
var p = parent;
- while(p.parent != undefined)
+
+ while (p.parent.parent != undefined)
p = p.parent;
return p;
implicitWidth: 720
implicitHeight: header.height + header2.height + 30 + 30
- FontLoader { source: TizenConfig.fonts.defaultSource }
-
Text {
id: header
anchors.top: parent.top
Binding { target: styleData.toolBar; property: "anchors.left"; value: control.left }
Binding { target: styleData.toolBar; property: "anchors.right"; value: control.right }
- focus: true
-
- Keys.onReleased: {
- if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape) {
- backAction.trigger()
- event.accepted = true
- } else if (event.key === Qt.Key_Menu || event.key === Qt.Key_F2) {
- console.log("NOT IMPLEMENTED: ContextMenu should be shown")
- event.accepted = true
- }
- }
+
implicitWidth: 720
implicitHeight: 1280
<file>DefaultSettings.js</file>
<file>themes/Colors.js</file>
<file>Images.js</file>
+ <file alias="private/TizenSansRegular.ttf">TizenSansRegular.ttf</file>
</qresource>
</RCC>
*/
import QtQml 2.0
+import QtQuick 2.0
import QtQuick.Controls.Styles.Tizen 1.0
QtObject {
return TizenConfig.blackColors[key]
}
}
+ property QtObject fontLoader: FontLoader {
+ source: Theme.fonts.defaultSource
+ }
property var panel : Theme.createPanel(theme)
property var progress : Theme.createProgress(theme)
property var slider : Theme.createSlider(theme)
-
TEMPLATE = lib
CONFIG += qt plugin
QT += qml quick
images/720x1280/white/*.png \
images/720x1280/white/*.sci \
images/720x1280/black/*.png \
- images/720x1280/black/*.sci \
- TizenSansRegular.ttf
+ images/720x1280/black/*.sci
CONFIG += force_independent
OTHER_FILES += qmldir \
- private/TizenStyleConfig.qml
+ private/TizenStyleConfig.qml \
+ TizenSansRegular.ttf \
+ $$QML_FILES
load(qml_module)
SOURCES += \
qquicktizenstyleextensionplugin.cpp
INSTALLS += target
-#error($$INSTALLS)
RESOURCES += \
internal_resources.qrc