summaryrefslogtreecommitdiff
path: root/AudioManagerPoC/presentation_layer/Tab.qml
blob: 8116029a944bb9b0be5fcbccc79f1db28fac50b7 (plain)
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
/**
 * SPDX license identifier: MPL-2.0
 *
 * Copyright (C) 2011-2014, Wind River Systems
 * Copyright (C) 2014, GENIVI Alliance
 *
 * This file is part of GENIVI AudioManager PoC.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License (MPL), v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * For further information see http://www.genivi.org/.
 *
 * List of changes:
 *
 * 21.09.2014, Adrian Scarlat, First version of the code;
 *                             Added Copyright and License information;
 */

import QtQuick 2.2

Rectangle {

  id: tab

  property bool isSelected: false;
  property string iconURL: ""
  property string basecolor: "#FFFFFF"
  property variant idContainer

  Image {
    id: name
    source: iconURL;
    smooth: true;
    anchors.horizontalCenter: parent.horizontalCenter;
    anchors.verticalCenter: parent.verticalCenter;
  }

  Rectangle {
    smooth: true;
    z:1000
    x: -12
    y: -12
    radius: 14
    width:  24;
    height: fullScreen.width * 0.08 + 10;
    color: "#000000"
  }


  Rectangle {
    id: unselected;
    x: 0
    y: +1
    width:  fullScreen.width * 0.08;
    height: fullScreen.width * 0.08;

    gradient: Gradient {
      GradientStop {
        position: 0.00;
        color: "#00000000";
      }
      GradientStop {
        position: 0.9;
        color: "#55000000";
      }
      GradientStop {
        position: 1;
        color: "#AA000000";
      }
    }
    color: "#000000"
  }

  color: tab.basecolor



  gradient: Gradient {
    GradientStop {
      id: selected;
      position: 0.00;
      color: tab.basecolor;//"#77FFFFFF";
    }
    GradientStop {
      position: 0.2;
      color: tab.basecolor;
    }
  }

 // color: "#FFCC33"
  width:  fullScreen.width * 0.08-1;
  height: fullScreen.width * 0.08;

  transform: Rotation {
    origin.x: fullScreen.width * 0.09 / 2;
    origin.y: fullScreen.width * 0.09 / 2;
    angle: -90
  }

  SequentialAnimation {
      id:animationSelect;
      PropertyAnimation {
          id: animation1;
          target: selected;
          property: "color";
          to: "#77000000";
          duration: 200
      }
  }

  SequentialAnimation {
      id:animationUnselect;
      PropertyAnimation {
          id: animation2;
          target: selected;
          property: "color";
          to: tab.basecolor;
          duration: 200
      }
  }
  onIsSelectedChanged:  {
    console.log("TAB",  isSelected);
    if (isSelected) {
      console.log("TAB selected");
      animationSelect.start();
      unselected.visible = false;
    } else {
      console.log("TAB un-selected");
      unselected.visible = true;
      animationUnselect.start();
    }
  }
}