OSDN Git Service

Version 0.4.95(0.5RC)
[fontmanager/fontmanager.git] / qml / fontmanager / EditorListDelegate.qml
1 import QtQuick 1.1
2 import com.nokia.meego 1.0
3 import com.nokia.extras 1.0
4 import 'UIConstants.js' as UI
5
6 Item {
7     id: listItem
8
9     signal clicked
10     property bool pressed: false
11
12     property bool isHeader: model.header
13
14     property int titleSize: (model.header ? UI.FONT_XLARGE : UI.FONT_DEFAULT)
15     property int titleWeight: Font.Bold
16     property color titleColor: theme.inverted ? (model.header ? UI.COLOR_FOREGROUND : UI.COLOR_INVERTED_FOREGROUND) : (UI.COLOR_FOREGROUND)
17
18     property int subtitleSize: UI.FONT_XSMALL
19     property int subtitleWeight: Font.Light
20     property color subtitleColor: theme.inverted ? UI.COLOR_SECONDARY_FOREGROUND : UI.COLOR_INVERTED_SECONDARY_FOREGROUND
21
22     height: UI.LIST_ITEM_HEIGHT_SMALL
23     width: parent.width
24
25     Rectangle {
26         anchors.fill: parent
27         anchors.leftMargin: -UI.MARGIN_XLARGE
28         anchors.rightMargin: -UI.MARGIN_XLARGE
29         color: UI.COLOR_SELECT
30         visible: listItem.isHeader
31     }
32
33     Row {
34         anchors.fill: parent
35         spacing: UI.DEFAULT_MARGIN
36
37         Item { width: UI.DEFAULT_MARGIN; height: 1; visible: !model.header }
38
39         Item {
40             //                        anchors.top: parent.top
41             height: UI.LIST_ITEM_HEIGHT_SMALL
42
43             Column {
44                 anchors.verticalCenter: parent.verticalCenter
45
46                 Text {
47                     id: mainText
48                     text: model.title
49                     font.weight: listItem.titleWeight
50                     font.pixelSize: listItem.titleSize
51                     color: listItem.titleColor
52                 }
53
54                 Text {
55                     id: subText
56                     text: model.subtitle
57                     font.weight: listItem.subtitleWeight
58                     font.pixelSize: listItem.subtitleSize
59                     color: listItem.subtitleColor
60
61                     visible: text != ""
62                 }
63             }
64         }
65     }
66
67     ListButton {
68         id: appendButton
69         anchors.right: parent.right
70         anchors.verticalCenter: parent.verticalCenter
71         anchors.rightMargin: UI.DEFAULT_MARGIN
72         iconSource: "image://theme/icon-m-toolbar-add"
73         onClicked: {
74             openSelectInstallFamilyDialog(model.priority)
75         }
76         visible: listItem.isHeader
77     }
78
79     Loader {
80         id: selectInstallFamilyDialogLoader
81         anchors.fill: parent
82     }
83
84     MouseArea {
85         id: selectItem
86         anchors.fill: parent
87         enabled: !listItem.isHeader
88         visible: !listItem.isHeader
89         onClicked: {
90             if (preferFamilyListView.currentIndex === index)
91                 preferFamilyListView.currentIndex = -1
92             else
93                 preferFamilyListView.currentIndex = index
94         }
95     }
96 }