123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- /****************************************************************************
- **
- ** Copyright (C) 2012 Róbert Márki
- **
- ** This file is part of Web Feeds.
- **
- ** Web Feeds is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** Web Feeds 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 General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with Web Feeds. If not, see <http://www.gnu.org/licenses/>.
- ****************************************************************************/
- import QtQuick 1.1
- import com.nokia.meego 1.0
- import com.nokia.extras 1.1
- import "UIConstants.js" as UIConstants
- Item {
- id: root
- signal clicked;
- property bool filterEnabled: false
- property string titleText: qsTr("Title")
- property string subTitleText: qsTr("Subtitle")
- property alias titleFont: headerTitle.font.family
- property alias subTitleFont: subTitle.font.family
- property bool multiline: false
- property color titleColor: "black"
- property color subTitleColor: "dimgray"
- property color backgrounColor: "transparent"
- property alias leftHelperItem: leftHelperItemLoader.sourceComponent
- property alias rightHelperItem: rightHelperItemLoader.sourceComponent
- property int leftHelperSpacing: UIConstants.DEFAULT_MARGIN
- property int rightHelperSpacing: UIConstants.DEFAULT_MARGIN
- height: root.multiline ? Math.max((UIConstants.HEADER_DEFAULT_TOP_SPACING_PORTRAIT + headerTitle.paintedHeight +
- (subTitle.visible ? (subTitle.paintedHeight + UIConstants.DEFAULT_MARGIN) : 0) +
- UIConstants.HEADER_DEFAULT_BOTTOM_SPACING_PORTRAIT), UIConstants.HEADER_DEFAULT_HEIGHT_PORTRAIT)
- : UIConstants.HEADER_DEFAULT_HEIGHT_PORTRAIT;
- Rectangle {
- id: background
- anchors.fill: parent
- color: (root.filterEnabled && mouseArea.pressed) ? "gray" : root.backgrounColor
- }
- Loader {
- id: leftHelperItemLoader
- visible: (leftHelperItemLoader.status == Loader.Ready)
- anchors.left: parent.left
- anchors.leftMargin: leftHelperItemLoader.sourceComponent ? UIConstants.DEFAULT_MARGIN : 0
- anchors.verticalCenter: parent.verticalCenter
- width: leftHelperItemLoader.sourceComponent ? leftHelperItemLoader.item.width : 0
- height: leftHelperItemLoader.sourceComponent ? leftHelperItemLoader.item.height : 0
- }
- Column {
- id: column
- anchors.left: leftHelperItemLoader.right
- anchors.leftMargin: leftHelperItemLoader.visible ? root.leftHelperSpacing : UIConstants.DEFAULT_MARGIN
- anchors.right: rightHelperItemLoader.left
- anchors.rightMargin: rightHelperItemLoader.visible ? root.rightHelperSpacing : UIConstants.DEFAULT_MARGIN
- anchors.verticalCenter: parent.verticalCenter
- spacing: UIConstants.DEFAULT_MARGIN
- Label {
- id: headerTitle
- text: root.titleText
- color: root.titleColor
- font.pixelSize: UIConstants.FONT_XLARGE
- font.weight: Font.Normal
- width: parent.width
- elide: root.multiline ? Text.ElideNone : Text.ElideRight
- wrapMode: root.multiline ? Text.Wrap : Text.NoWrap
- }
- Label {
- id: subTitle
- font.weight: Font.Normal
- font.pixelSize: UIConstants.FONT_LSMALL
- color: root.subTitleColor
- visible: subTitle.text.length && root.multiline
- text: root.subTitleText
- width: parent.width
- elide: Text.ElideNone
- wrapMode: Text.Wrap
- maximumLineCount: 2
- }
- }
- Loader {
- id: rightHelperItemLoader
- visible: (rightHelperItemLoader.status == Loader.Ready)
- anchors.right: filterIndicator.left
- anchors.rightMargin: rightHelperItemLoader.sourceComponent ? UIConstants.DEFAULT_MARGIN : 0
- anchors.verticalCenter: parent.verticalCenter
- width: rightHelperItemLoader.sourceComponent ? rightHelperItemLoader.item.width : 0
- height: rightHelperItemLoader.sourceComponent ? rightHelperItemLoader.item.height : 0
- }
- FilterIndicator {
- id: filterIndicator
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.right
- anchors.rightMargin: root.filterEnabled ? UIConstants.DEFAULT_MARGIN : 0
- width: root.filterEnabled ? 32 : 0
- visible: root.filterEnabled
- }
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- onClicked: {
- if(root.filterEnabled)
- root.clicked();
- }
- }
- }
|