~qqworini/ubuntu-rssreader-app/reboot-add-cmake

« back to all changes in this revision

Viewing changes to article_items/ArticleTextA.qml

  • Committer: Roman Shchekin
  • Date: 2015-07-04 08:34:43 UTC
  • Revision ID: mrqtros@gmail.com-20150704083443-5o0494vtslrc5d50
Great cleanup!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import QtQuick 2.3
2
 
import Ubuntu.Components 1.1
3
 
import Ubuntu.Components.ListItems 1.0 as ListItem
4
 
import "../dateutils.js" as DateUtils
5
 
import "../databasemodule_v2.js" as DB
6
 
 
7
 
UbuntuShape
8
 
{
9
 
    id: articleTextA
10
 
 
11
 
    property bool invalid: false
12
 
    property var modelItem
13
 
    property var rssModel
14
 
    property int modelIndex
15
 
 
16
 
    // property string secretProp: ""
17
 
 
18
 
    width: units.gu(11)
19
 
    height: units.gu(20) /*content.height + units.gu(4)*/
20
 
    color: invalid ? "black" : modelItem.status == "1" ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.4)
21
 
    radius: "medium"
22
 
 
23
 
    onModelItemChanged: {
24
 
        if (modelItem == null) {
25
 
            invalid = true
26
 
        }
27
 
    }
28
 
 
29
 
    Column {
30
 
        id: content
31
 
 
32
 
        anchors {
33
 
            fill: parent; topMargin: units.gu(2); bottomMargin: units.gu(1.5);
34
 
            leftMargin: units.gu(1); rightMargin: units.gu(1.5)
35
 
        }
36
 
        spacing: units.gu(1)
37
 
 
38
 
        Row {
39
 
            anchors {
40
 
                left: parent.left
41
 
                right: parent.right
42
 
            }
43
 
            height: labelTime.paintedHeight
44
 
            spacing: units.gu(0.5)
45
 
 
46
 
            Image {
47
 
                id: imgFavourite
48
 
                anchors.verticalCenter: labelTime.verticalCenter
49
 
                fillMode: Image.PreserveAspectCrop
50
 
                source: Qt.resolvedUrl("../icons_tmp/favorite-selected.svg")
51
 
                sourceSize.height: invalid ? 0 : (modelItem.favourite == "1" ? units.gu(1.5) : 0)
52
 
                visible: invalid ? false : (modelItem.favourite == "1")
53
 
            }
54
 
 
55
 
            Label {
56
 
                id: labelTime
57
 
                text: { invalid ? "" : DateUtils.formatRelativeTime(i18n, modelItem.pubdate) }
58
 
                fontSize: "x-small"
59
 
                width: parent.width - units.gu(2)
60
 
                wrapMode: Text.WrapAtWordBoundaryOrAnywhere
61
 
                opacity: 0.6
62
 
            }
63
 
        }
64
 
 
65
 
        Label {
66
 
            id: labelTitle
67
 
 
68
 
            text: invalid ? "" : modelItem.title
69
 
            anchors {
70
 
                left: parent.left
71
 
                right: parent.right
72
 
            }
73
 
            height: parent.height - parent.spacing * 2 - labelTime.paintedHeight - labelFeedname.paintedHeight
74
 
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
75
 
            fontSize: "small"
76
 
            textFormat: Text.PlainText
77
 
            font.weight: Font.DemiBold
78
 
            elide: Text.ElideRight
79
 
            opacity: invalid ? 0.4 : modelItem.status == "1" ? 0.4 : 0.8
80
 
        }
81
 
 
82
 
        Label {
83
 
            id: labelFeedname
84
 
 
85
 
            text: invalid? "" : modelItem.feed_name
86
 
            fontSize: "x-small"
87
 
            anchors {
88
 
                left: parent.left
89
 
                right: parent.right
90
 
            }
91
 
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
92
 
            opacity: 0.6
93
 
        }
94
 
    }
95
 
 
96
 
    MouseArea {
97
 
        anchors.fill: parent
98
 
        onClicked: {
99
 
            mainView.showArticle(rssModel, modelIndex)
100
 
        }
101
 
    }
102
 
}
103