Debian Codegraph @

src/imports/Components/Themes/Ambiance/1.2/DialerStyle.qml

raw
1 /*
2 * Copyright 2013 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
17 import QtQuick 2.4
18 import Lomiri.Components 1.2
19 import QtGraphicalEffects 1.0
20
21 // FIXME: Replace this once LomiriShape support for gradients and shading has landed
22 Rectangle {
23 anchors.fill: parent
24 radius: width / 2
25 antialiasing: true
26
27 property real offset : units.gu(0.2)
28
29 gradient: Gradient {
30 GradientStop { position: 0.0; color: "#512F48" }
31 GradientStop { position: 0.25; color: "#583048" }
32 GradientStop { position: 0.5; color: "#653449" }
33 GradientStop { position: 0.75; color: "#6D384A" }
34 GradientStop { position: 1.0; color: "#753B4A" }
35 }
36 // draws the outter shadow/highlight
37 Rectangle {
38 id: sourceOutter
39 anchors { fill: parent; margins: -offset }
40 radius: (width / 2)
41 antialiasing: true
42 gradient: Gradient {
43 GradientStop { position: 0.0; color: "black" }
44 GradientStop { position: 0.5; color: "transparent" }
45 GradientStop { position: 1.0; color: "white" }
46 }
47 }
48
49 // mask for outer 3D effect
50 Rectangle {
51 id: maskOutter
52 anchors.fill: sourceOutter
53 color: "transparent"
54 radius: (width / 2)
55 antialiasing: true
56 border { width: offset; color: "black" }
57 }
58
59 // outter effect
60 OpacityMask {
61 anchors.fill: sourceOutter
62 opacity: 0.65
63 source: ShaderEffectSource {
64 sourceItem: sourceOutter
65 hideSource: true
66 }
67 maskSource: ShaderEffectSource {
68 sourceItem: maskOutter
69 hideSource: true
70 }
71 }
72
73 // center item
74 // FIXME: Replace this once LomiriShape support for gradients and shading has landed
75 Rectangle {
76 parent: styledItem.centerItem.parent
77 anchors.fill: parent
78 radius: width / 2;
79 antialiasing: true;
80
81 gradient: Gradient {
82 GradientStop { position: 0.0; color: "#7A4C68" }
83 GradientStop { position: 0.25; color: "#804563" }
84 GradientStop { position: 0.5; color: "#864660" }
85 GradientStop { position: 0.75; color: "#86465E" }
86 GradientStop { position: 1.0; color: "#964E66" }
87 }
88
89 // draws the inner highlight / shadow
90 Rectangle {
91 id: sourceInner;
92 anchors { fill: parent; margins: -offset }
93 radius: (width / 2)
94 antialiasing: true
95 gradient: Gradient {
96 GradientStop { position: 0.0; color: "white" }
97 GradientStop { position: 0.5; color: "transparent" }
98 GradientStop { position: 1.0; color: "black" }
99 }
100 }
101
102 // mask for inner 3D effect
103 Rectangle {
104 id: maskInner
105 color: "transparent"
106 anchors.fill: sourceInner
107 radius: (width / 2)
108 antialiasing: true
109 border { width: offset; color: "black" }
110 }
111
112 // inner effect
113 OpacityMask {
114 opacity: 0.65
115 anchors.fill: sourceInner
116 source: ShaderEffectSource {
117 sourceItem: sourceInner
118 hideSource: true
119 }
120 maskSource: ShaderEffectSource {
121 sourceItem: maskInner
122 hideSource: true
123 }
124 }
125 }
126 }