Unity 8
 All Classes Functions Properties
ScopeItem.qml
1 /*
2  * Copyright (C) 2014 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU 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 General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.0
18 import Ubuntu.Components 0.1
19 import Unity 0.2
20 import "../Components"
21 
22 Item {
23  id: root
24 
25  property alias scope: scopeView.scope
26  property alias previewOpen: previewListView.open
27 
28  property ListModel searchHistory
29 
30  signal back
31  signal gotoScope(string scopeId)
32  signal openScope(var scope)
33 
34  Item {
35  id: scopeViewHolder
36 
37  x: previewListView.open ? -width : 0
38  Behavior on x { UbuntuNumberAnimation { } }
39  width: parent.width
40  height: parent.height
41 
42  GenericScopeView {
43  id: scopeView
44  width: parent.width
45  height: parent.height
46  isCurrent: scope != null
47  tabBarHeight: scopeItemPageHeader.implicitHeight
48  pageHeader: scopeItemPageHeader
49  previewListView: previewListView
50 
51  Connections {
52  target: scopeView.isCurrent ? scope : null
53  onGotoScope: root.gotoScope(scopeId);
54  onOpenScope: root.openScope(scope);
55  }
56  }
57 
58  PageHeader {
59  id: scopeItemPageHeader
60  width: parent.width
61  searchEntryEnabled: true
62  searchHistory: root.searchHistory
63  scope: root.scope
64  height: units.gu(8.5)
65  showBackButton: true
66  onBackClicked: root.back();
67 
68  childItem: Label {
69  id: label
70  anchors {
71  left: parent.left
72  right: parent.right
73  verticalCenter: parent.verticalCenter
74  }
75  text: scope ? scope.name : ""
76  color: "#888888"
77  font.family: "Ubuntu"
78  font.weight: Font.Light
79  fontSize: "x-large"
80  elide: Text.ElideRight
81  }
82  }
83  }
84 
85  PreviewListView {
86  id: previewListView
87  visible: x != width
88  pageHeader: scopeItemPageHeader
89  scope: root.scope
90  width: parent.width
91  height: parent.height
92  anchors.left: scopeViewHolder.right
93  }
94 }