// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import com.nokia.symbian 1.1
import "UIConstants.js" as UI
import "constants.js" as ExtrasConstants
import "category.js" as Category
Page {
id: descriptionPage
property XmlListModel dModel
property int dIndex: 0
onDIndexChanged: {
dView.positionViewAtIndex(dIndex, ListView.Center)
}
ListView {
id: dView
anchors.fill: parent
model: dModel
orientation: ListView.Horizontal
flickDeceleration: 500
snapMode: ListView.SnapOneItem
highlightRangeMode: ListView.StrictlyEnforceRange
preferredHighlightBegin: 0
preferredHighlightEnd: 0
cacheBuffer: width
currentIndex: -1
delegate: mushroomDelegate
}
Component {
id: mushroomDelegate
Item {
width: dView.width
height: dView.height
Flickable {
id: flickable
contentHeight: column.height + titleRect.height + 2*UI.DEFAULT_MARGIN
anchors.fill: parent
Rectangle {
id: titleRect
color: "#313131"
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: Math.max(descriptionPage.height / 2 + 52, 480 - 91)
Column {
id: textColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 10
Text {
id: mName
text: name
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
font.pixelSize: UI.FONT_LARGE
color: !true ? UI.COLOR_FOREGROUND : UI.COLOR_INVERTED_FOREGROUND
}
Text {
id: latname
text: lat_name
visible: text ? true : false
wrapMode: Text.Wrap
horizontalAlignment: Text.AlignHCenter
width: parent.width
font.pixelSize: UI.FONT_LARGE
color: !true ? UI.COLOR_FOREGROUND : UI.COLOR_INVERTED_FOREGROUND
}
}
Item {
id: picItem
anchors.top: textColumn.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
height: parent.height - textColumn.height
width: parent.width
Image {
id: mPic
anchors.fill: parent
anchors.margins: UI.DEFAULT_MARGIN
source: "file:///" + applicationPath + "/" + pic
fillMode: Image.PreserveAspectFit
clip: true
}
}
HorizontalDivider {
anchors.bottom: parent.bottom
}
}
Column {
id: column
anchors.left: parent.left
anchors.right: parent.right
anchors.top: titleRect.bottom
anchors.margins: UI.DEFAULT_MARGIN
spacing: 6
Text {
text: type
font.pixelSize: UI.FONT_DEFAULT
font.italic: true
visible: (type === "") ? false : true
smooth: true
color: UI.COLOR_INVERTED_FOREGROUND
}
Text {
text: "Категория: " + "" + Category.getCategoryName(m_category) + ""
font.pixelSize: UI.FONT_DEFAULT
smooth: true
color: UI.COLOR_INVERTED_FOREGROUND
}
Text {
text: text_begin
font.pixelSize: UI.FONT_LSMALL
visible: (text_begin === "") ? false : true
smooth: true
font.weight: Font.Light
width: parent.width
wrapMode: Text.Wrap
color: ExtrasConstants.LIST_SUBTITLE_COLOR_INVERTED
}
MushroomInfoItem {
title: "Растет"
content: grow
visible: (grow === "") ? false : true
}
MushroomInfoItem {
title: "Шляпка"
content: cap
visible: (cap === "") ? false : true
}
MushroomInfoItem {
title: "Ножка"
content: leg
visible: (leg === "") ? false : true
}
MushroomInfoItem {
title: "Мякоть"
content: meat
visible: (meat === "") ? false : true
}
MushroomInfoItem {
title: "Пластинки"
content: plates
visible: (plates === "") ? false : true
}
Text {
text: text_end
font.pixelSize: UI.FONT_LSMALL
visible: (text_end === "") ? false : true
smooth: true
font.weight: Font.Light
width: parent.width
wrapMode: Text.Wrap
color: ExtrasConstants.LIST_SUBTITLE_COLOR_INVERTED
}
}
}
}
}
SequentialAnimation {
id: activatingAnimation
running: false
NumberAnimation { target:descriptionPage; property:"opacity"; from: 0; to: 1; duration:500 }
}
SequentialAnimation {
id: deactivatingAnimation
running: false
NumberAnimation { target:descriptionPage; property:"opacity"; from: 1; to: 0; duration:500 }
}
onStatusChanged: {
if (status == PageStatus.Activating) {
activatingAnimation.start()
}
if (status == PageStatus.Active) {
activatingAnimation.complete()
}
if (status == PageStatus.Deactivating) {
deactivatingAnimation.start()
}
if (status == PageStatus.Inactive) {
deactivatingAnimation.complete()
}
}
}