~osomon/webbrowser-app/maxCacheSizeHint

« back to all changes in this revision

Viewing changes to src/app/webbrowser/TabChrome.qml

  • Committer: Olivier Tilloy
  • Date: 2015-04-08 15:29:44 UTC
  • mfrom: (930.1.25 webbrowser-app)
  • Revision ID: olivier.tilloy@canonical.com-20150408152944-zg7hpedldixspgf7
Merge the latest changes from trunk and resolve a conflict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2014-2015 Canonical Ltd.
 
3
 *
 
4
 * This file is part of webbrowser-app.
 
5
 *
 
6
 * webbrowser-app is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * webbrowser-app is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
import QtQuick 2.0
 
20
import Ubuntu.Components 1.1
 
21
 
 
22
Item {
 
23
    property alias title: label.text
 
24
 
 
25
    signal selected()
 
26
    signal closed()
 
27
 
 
28
    implicitHeight: units.gu(4)
 
29
 
 
30
    Row {
 
31
        anchors.fill: parent
 
32
 
 
33
        AbstractButton {
 
34
            id: closeButton
 
35
            objectName: "closeButton"
 
36
 
 
37
            anchors {
 
38
                top: parent.top
 
39
                bottom: parent.bottom
 
40
            }
 
41
            width: units.gu(5)
 
42
 
 
43
            Rectangle {
 
44
                anchors.fill: parent
 
45
                color: closeButton.pressed ? Qt.rgba(1.0, 1.0, 1.0, 0.9) : "white"
 
46
            }
 
47
 
 
48
            Icon {
 
49
                height: units.gu(2)
 
50
                width: height
 
51
                anchors.centerIn: parent
 
52
                name: "close"
 
53
            }
 
54
 
 
55
            onTriggered: closed()
 
56
 
 
57
            Rectangle {
 
58
                anchors {
 
59
                    top: parent.top
 
60
                    bottom: parent.bottom
 
61
                    right: parent.right
 
62
                }
 
63
                width: units.dp(1)
 
64
 
 
65
                color: "#d9d9d9"
 
66
            }
 
67
        }
 
68
 
 
69
        Item {
 
70
            width: parent.width - closeButton.width
 
71
            anchors {
 
72
                top: parent.top
 
73
                bottom: parent.bottom
 
74
            }
 
75
 
 
76
            Image {
 
77
                id: tabBackgroundLeft
 
78
                anchors {
 
79
                    top: parent.top
 
80
                    bottom: parent.bottom
 
81
                    left: parent.left
 
82
                    right: tabBackgroundCenter.left
 
83
                }
 
84
                source: "assets/tab-header-left.png"
 
85
                fillMode: Image.TileHorizontally
 
86
            }
 
87
 
 
88
            Image {
 
89
                id: tabBackgroundCenter
 
90
                anchors {
 
91
                    top: parent.top
 
92
                    bottom: parent.bottom
 
93
                    horizontalCenter: parent.horizontalCenter
 
94
                }
 
95
                source: "assets/tab-header-center.png"
 
96
            }
 
97
 
 
98
            Image {
 
99
                id: tabBackgroundRight
 
100
                anchors {
 
101
                    top: parent.top
 
102
                    bottom: parent.bottom
 
103
                    left: tabBackgroundCenter.right
 
104
                    right: parent.right
 
105
                }
 
106
                source: "assets/tab-header-right.png"
 
107
                fillMode: Image.TileHorizontally
 
108
            }
 
109
 
 
110
            Label {
 
111
                id: label
 
112
                anchors {
 
113
                    fill: tabBackgroundLeft
 
114
                    leftMargin: units.gu(1)
 
115
                }
 
116
                verticalAlignment: Text.AlignVCenter
 
117
                elide: Text.ElideRight
 
118
            }
 
119
 
 
120
            MouseArea {
 
121
                anchors {
 
122
                    top: parent.top
 
123
                    bottom: parent.bottom
 
124
                    left: parent.left
 
125
                }
 
126
                // The activable part of the tab occupies its leftmost half
 
127
                width: parent.width / 2
 
128
 
 
129
                onClicked: selected()
 
130
            }
 
131
        }
 
132
    }
 
133
 
 
134
    Rectangle {
 
135
        anchors {
 
136
            left: parent.left
 
137
            right: parent.right
 
138
            bottom: parent.bottom
 
139
        }
 
140
        height: units.dp(1)
 
141
 
 
142
        color: "#d9d9d9"
 
143
    }
 
144
}