/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Themes/Ambiance/1.3/PageHeadStyle.qml is in ubuntu-ui-toolkit-theme 1.3.1918+16.04.20160404-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | /*
* Copyright 2015 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.4
import QtQuick.Window 2.0
import Ubuntu.Components 1.3
import Ubuntu.Components.Popups 1.3
import Ubuntu.Components.Styles 1.3 as Style
Style.PageHeadStyle {
id: headerStyle
objectName: "PageHeadStyle" // used in unit tests
contentHeight: Screen.height > units.gu(50) ? units.gu(6) : units.gu(5)
fontWeight: Font.Light
textSize: Label.Large
textLeftMargin: units.gu(2)
maximumNumberOfActions: 3
PageHeadConfiguration {
id: defaultConfig
}
property PageHeadConfiguration config: styledItem.config ?
styledItem.config :
defaultConfig
/*!
The color of the buttons in the header.
*/
property color buttonColor: headerStyle.config.foregroundColor
/*!
The color of the title text.
*/
property color titleColor: headerStyle.config.foregroundColor
/*!
The background color of the header.
*/
property color backgroundColor: styledItem.backgroundColor
Rectangle {
anchors.fill: parent
color: headerStyle.backgroundColor
}
// FIXME: When the three panel color properties below are removed,
// update unity8/Dash/PageHeader to use the new theming (currently
// in progress) to set these colors.
/*!
\deprecated
The background color of the tabs panel and the actions overflow panel.
*/
property color panelBackgroundColor: styledItem.panelColor
/*!
\deprecated
The background color of the tapped item in the panel.
*/
property color panelHighlightColor: theme.palette.highlighted.background
/*!
\deprecated
The foreground color (icon and text) of actions in the panel.
*/
property color panelForegroundColor: styledItem.enabled
? theme.palette.normal.backgroundText
: theme.palette.disabled.backgroundText
/*!
The text color of unselected sections and the section divider.
*/
property color sectionColor: styledItem.enabled
? theme.palette.normal.backgroundText
: theme.palette.disabled.backgroundText
/*!
The text color of the selected section.
*/
property color selectedSectionColor: styledItem.enabled
? theme.palette.selected.backgroundText
: theme.palette.selectedDisabled.backgroundText
/*!
The background color of the pressed section.
*/
property color sectionHighlightColor: theme.palette.highlighted.background
implicitHeight: headerStyle.contentHeight + divider.height + sectionsItem.height
// Used by unit tests and autopilot tests to wait for animations to finish
readonly property bool animating: headerStyle.state == "OUT"
|| leftAnchor.anchors.leftMargin < 0
// for Unity8
// FIXME: Remove this property when we introduce a header preset that does not
// have a separator.
property alias __separator_visible: divider.visible
Rectangle {
id: divider
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: units.dp(1)
color: styledItem.dividerColor
}
SectionsForPageHead {
id: sectionsItem
objectName: "headerSectionsItem"
anchors {
left: parent.left
leftMargin: units.gu(2)
bottom: divider.top
}
visible: model && model.length > 0
enabled: sections.enabled
height: visible ? implicitHeight : 0
property PageHeadSections sections: headerStyle.config.sections
model: sections ? sections.model : null
onSelectedIndexChanged: {
if (sections) {
sections.selectedIndex = sectionsItem.selectedIndex;
}
}
Binding {
target: sectionsItem
when: sectionsItem.sections
property: "selectedIndex"
value: sectionsItem.sections.selectedIndex
}
}
states: [
State {
name: "IN"
PropertyChanges {
target: allContents
opacity: 1.0
}
},
State {
name: "OUT"
PropertyChanges {
target: allContents
opacity: 0.0
}
}
]
function animateOut() {
state = "OUT";
}
function animateIn() {
state = "IN";
}
signal animateOutFinished()
signal animateInFinished()
transitions: [
Transition {
id: transitionOut
from: "IN"
to: "OUT"
SequentialAnimation {
ParallelAnimation {
UbuntuNumberAnimation {
target: allContents
property: "opacity"
from: 1.0
to: 0.0
}
UbuntuNumberAnimation {
target: leftAnchor
properties: "anchors.leftMargin"
from: 0.0
to: -units.gu(5)
}
UbuntuNumberAnimation {
target: rightAnchor
properties: "anchors.rightMargin"
from: 0
to: -units.gu(5)
}
}
ScriptAction {
script: headerStyle.animateOutFinished()
}
}
},
Transition {
id: transitionIn
from: "OUT"
to: "IN"
SequentialAnimation {
ParallelAnimation {
UbuntuNumberAnimation {
target: allContents
property: "opacity"
from: 0.0
to: 1.0
}
UbuntuNumberAnimation {
target: leftAnchor
properties: "anchors.leftMargin"
from: -units.gu(5)
to: 0
}
UbuntuNumberAnimation {
target: rightAnchor
properties: "anchors.rightMargin"
from: -units.gu(5)
to: 0
}
}
ScriptAction {
script: headerStyle.animateInFinished()
}
}
}
]
Item {
id: allContents
anchors.fill: parent
Item {
id: leftAnchor
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
leftMargin: 0
}
width: 0
}
Item {
id: rightAnchor
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
rightMargin: 0
}
width: 0
}
Item {
id: leftButtonContainer
anchors {
left: leftAnchor.right
top: parent.top
leftMargin: width > 0 ? units.gu(1) : 0
}
width: childrenRect.width
height: headerStyle.contentHeight
PageHeadButton {
id: customBackButton
objectName: "customBackButton"
action: headerStyle.config.backAction
visible: null !== headerStyle.config.backAction &&
headerStyle.config.backAction.visible
color: headerStyle.config.foregroundColor
}
PageHeadButton {
id: backButton
objectName: "backButton"
iconName: "back"
property bool stackBack: styledItem.pageStack !== null &&
styledItem.pageStack !== undefined &&
styledItem.pageStack.depth > 1
// MultiColumnView adds the following properties: multiColumn, page, showBackButton.
property bool treeBack: styledItem.hasOwnProperty("multiColumn") &&
styledItem.showBackButton
visible: !headerStyle.config.backAction && (stackBack || treeBack)
text: "back"
color: headerStyle.config.foregroundColor
onTriggered: {
if (stackBack) {
styledItem.pageStack.pop();
} else {
// treeBack
styledItem.multiColumn.removePages(styledItem.page);
}
}
}
PageHeadButton {
id: tabsButton
objectName: "tabsButton"
iconName: "navigation-menu"
visible: styledItem.tabsModel !== null &&
styledItem.tabsModel !== undefined &&
!backButton.visible &&
!customBackButton.visible
text: visible ? styledItem.tabsModel.count + " tabs" : ""
color: headerStyle.buttonColor
onTriggered: PopupUtils.open(tabsPopoverComponent, tabsButton)
Component {
id: tabsPopoverComponent
OverflowPanel {
id: tabsPopover
objectName: "tabsPopover"
actions: actionsFromTabs(styledItem.tabsModel)
function getActionFromTab(tab) {
return tab.__protected.action;
}
function actionsFromTabs(tabsList) {
var result = [];
var tab;
for (var i=0; i < tabsList.count; i++) {
tab = tabsList.get(i).tab;
result.push(getActionFromTab(tab));
}
return result;
}
backgroundColor: headerStyle.panelBackgroundColor
foregroundColor: headerStyle.panelForegroundColor
highlightColor: headerStyle.panelHighlightColor
}
}
}
}
Item {
id: foreground
anchors {
left: leftButtonContainer.right
top: parent.top
// don't keep a margin if there is already a button with spacing
leftMargin: leftButtonContainer.width > 0 ? 0 : headerStyle.textLeftMargin
}
width: parent.width - anchors.leftMargin
- leftButtonContainer.anchors.leftMargin - leftButtonContainer.width
- actionsContainer.anchors.rightMargin - actionsContainer.width
height: headerStyle.contentHeight
Label {
objectName: "header_title_label"
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
visible: !contentsContainer.visible && headerStyle.config.preset === ""
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
text: headerStyle.config.title
font.weight: headerStyle.fontWeight
textSize: headerStyle.textSize
color: headerStyle.titleColor
elide: Text.ElideRight
}
Item {
// This Item is used to make the custom header item invisible
// when styledItem.contents is unset and its parent is not updated
// when the bindings below is no longer active
id: contentsContainer
anchors.fill: parent
visible: styledItem.contents || headerStyle.config.contents
}
Binding {
target: styledItem.contents
property: "anchors.fill"
value: contentsContainer
when: styledItem.contents
}
Binding {
target: styledItem.contents
property: "parent"
value: contentsContainer
when: styledItem.contents
}
Binding {
target: headerStyle.config.contents
property: "parent"
value: contentsContainer
when: headerStyle.config.contents && !styledItem.contents
}
}
ActionBar {
id: actionsContainer
objectName: "headerActionBar"
anchors {
top: parent.top
right: rightAnchor.left
rightMargin: actionsContainer.width > 0 ? units.gu(1) : 0
}
height: headerStyle.contentHeight
actions: headerStyle.config.actions
numberOfSlots: 3
delegate: AbstractButton {
style: IconButtonStyle { }
objectName: action.objectName + "_button"
height: parent ? parent.height : undefined
action: modelData
StyleHints {
foregroundColor: headerStyle.buttonColor
}
}
}
}
}
|