| 1 |
/* |
| 2 |
* Copyright 2012 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation; version 3. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
import QtQuick 2.4 |
| 17 |
import Lomiri.Components 1.2 |
| 18 |
|
| 19 |
Item { |
| 20 |
// styling properties |
| 21 |
anchors.fill: parent |
| 22 |
z: -1 |
| 23 |
id: mainViewStyle |
| 24 |
|
| 25 |
/*! |
| 26 |
The background texture of the main view. The image will be drawn over the background color, |
| 27 |
so if it has (semi-)transparent pixels, in those pixels the background color will be visible. |
| 28 |
*/ |
| 29 |
property url backgroundSource: Qt.resolvedUrl("../artwork/background_paper.png") |
| 30 |
|
| 31 |
Gradient { |
| 32 |
id: backgroundGradient |
| 33 |
GradientStop { position: 0.0; color: styledItem.headerColor } |
| 34 |
GradientStop { position: 0.83; color: styledItem.backgroundColor } |
| 35 |
GradientStop { position: 1.0; color: styledItem.footerColor } |
| 36 |
} |
| 37 |
|
| 38 |
Rectangle { |
| 39 |
id: backgroundColor |
| 40 |
anchors.fill: parent |
| 41 |
color: styledItem.backgroundColor |
| 42 |
gradient: internals.isGradient ? backgroundGradient : null |
| 43 |
visible: internals.isGradient |
| 44 |
} |
| 45 |
|
| 46 |
Binding { |
| 47 |
target: typeof window != 'undefined' ? window : null |
| 48 |
property: "color" |
| 49 |
value: styledItem.backgroundColor |
| 50 |
} |
| 51 |
|
| 52 |
Image { |
| 53 |
id: backgroundTexture |
| 54 |
anchors.fill: parent |
| 55 |
source: mainViewStyle.backgroundSource |
| 56 |
fillMode: Image.Tile |
| 57 |
asynchronous: true |
| 58 |
cache: false |
| 59 |
} |
| 60 |
|
| 61 |
QtObject { |
| 62 |
id: internals |
| 63 |
property bool isGradient: styledItem.backgroundColor != styledItem.headerColor || |
| 64 |
styledItem.backgroundColor != styledItem.footerColor |
| 65 |
} |
| 66 |
} |