~zsombi/ubuntu-ui-toolkit/120-custompanel

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml

  • Committer: Zsombor Egri
  • Date: 2014-11-04 09:05:25 UTC
  • mfrom: (1247.1.35 110-captions)
  • Revision ID: zsombor.egri@canonical.com-20141104090525-tbp0xnkqeuq4mehp
prereq sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    id: headerStyle
24
24
    objectName: "PageHeadStyle" // used in unit tests
25
25
    contentHeight: units.gu(7)
 
26
    // FIXME: After After https://code.launchpad.net/~mzanetti/unity8/new-pageheader-api/+merge/239242
 
27
    //  lands, set separatorSource and separatorBottomSource to "" in order to use the new divider.
26
28
    separatorSource: "artwork/PageHeaderBaseDividerLight.sci"
27
29
    separatorBottomSource: "artwork/PageHeaderBaseDividerBottom.png"
28
30
    fontWeight: Font.Light
31
33
    textLeftMargin: units.gu(2)
32
34
    maximumNumberOfActions: 3
33
35
 
34
 
    implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height
 
36
    implicitHeight: headerStyle.contentHeight + divider.height
35
37
 
36
38
    // FIXME: Workaround to get sectionsRepeater.count in autopilot tests,
37
39
    //  see also FIXME in AppHeader where this property is used.
44
46
    // for Unity8
45
47
    // FIXME: Remove this property when we introduce a header preset that does not
46
48
    //  have a separator.
47
 
    property alias __separator_visible: separator.visible
 
49
    property alias __separator_visible: divider.visible
48
50
 
49
 
    BorderImage {
50
 
        id: separator
 
51
    StyledItem {
 
52
        id: divider
51
53
        anchors {
52
54
            bottom: parent.bottom
53
55
            left: parent.left
54
56
            right: parent.right
55
57
        }
56
 
        source: headerStyle.separatorSource
 
58
 
57
59
        height: sectionsRow.visible ? units.gu(3) : units.gu(2)
58
60
 
 
61
        // separatorSource and separatorBottomSource are needed for the deprecated
 
62
        // HeadSeparatorImageStyle.
 
63
        property url separatorSource: headerStyle.separatorSource
 
64
        property url separatorBottomSource: headerStyle.separatorBottomSource
 
65
 
 
66
        // backgroundColor is used in the new HeadDividerStyle
 
67
        property color backgroundColor: styledItem.dividerColor
 
68
 
 
69
        // FIXME: After https://code.launchpad.net/~mzanetti/unity8/new-pageheader-api/+merge/239242
 
70
        //  lands, set the value of useOldDivider to: "" != separatorSource
 
71
        property bool useOldDivider: false
 
72
 
 
73
        style: useOldDivider ? Theme.createStyleComponent("HeadSeparatorImageStyle.qml", divider)
 
74
                             : Theme.createStyleComponent("HeadDividerStyle.qml", divider)
 
75
 
59
76
        property PageHeadSections sections: styledItem.config.sections
60
77
 
61
78
        Row {
63
80
            anchors.centerIn: parent
64
81
            width: childrenRect.width
65
82
            height: parent.height
66
 
            enabled: separator.sections.enabled
67
 
            visible: separator.sections.model !== undefined
 
83
            enabled: divider.sections.enabled
 
84
            visible: divider.sections.model !== undefined
68
85
            opacity: enabled ? 1.0 : 0.5
69
86
 
70
87
            Repeater {
71
88
                id: sectionsRepeater
72
 
                model: separator.sections.model
 
89
                model: divider.sections.model
73
90
                objectName: "page_head_sections_repeater"
74
91
                AbstractButton {
75
92
                    id: sectionButton
78
95
                    enabled: sectionsRow.enabled
79
96
                    width: label.width + units.gu(4)
80
97
                    height: sectionsRow.height + units.gu(2)
81
 
                    property bool selected: index === separator.sections.selectedIndex
82
 
                    onClicked: separator.sections.selectedIndex = index;
 
98
                    property bool selected: index === divider.sections.selectedIndex
 
99
                    onClicked: divider.sections.selectedIndex = index;
83
100
 
84
101
                    Rectangle {
85
102
                        visible: parent.pressed
120
137
            }
121
138
        }
122
139
    }
123
 
    Image {
124
 
        id: separatorBottom
125
 
        anchors {
126
 
            top: separator.bottom
127
 
            left: parent.left
128
 
            right: parent.right
129
 
        }
130
 
        source: headerStyle.separatorBottomSource
131
 
        visible: separator.visible
132
 
    }
133
140
 
134
141
    states: [
135
142
        State {