on xenial help sign in
removed indicator tabs
commit07ec39e1a8e493e5d13864334913ffd229be37ed authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 25 Jul 2014, 18:52 (12 years ago) parent6af3cbe
2 files changed+94−83
qml/Panel/Indicators.qml−1 qml/Panel/MenuContent.qml+94−82
qml/Panel/Indicators.qml−1
@@ -188,7 +188,6 @@ Showable {
188188 }
189189 indicatorsModel: visibleIndicators.model
190190 clip: !indicators.fullyOpened
191− activeHeader: indicators.state == "hint" || indicators.state == "reveal"
192191 enabled: contentEnabled
193192
194193 //small shadow gradient at bottom of menu
qml/Panel/MenuContent.qml+94−82
@@ -15,36 +15,28 @@
1515 */
1616
1717import QtQuick 2.0
18+import QtQuick.Layouts 1.1
1819import Ubuntu.Components 0.1
1920import Unity.Indicators 0.1 as Indicators
2021import Utils 0.1
2122import "../Components"
23+import "Indicators"
2224
23−// FIXME : We dont want to use MainView.
24−// Need a regular Item which can have tabs with local header.
25−// https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211704
26−MainView {
25+Rectangle {
2726 id: content
2827
2928 property QtObject indicatorsModel: null
3029 property bool __contentActive: false
31− readonly property int currentMenuIndex: tabs.selectedTabIndex
32− backgroundColor: "#221e1c" // FIXME not in palette yet
30+ readonly property alias currentMenuIndex: listViewHeader.currentIndex
31+ color: "#221e1c" // FIXME not in palette yet
3332 property int contentReleaseInterval: 20000
34− property bool activeHeader: false
35− property real headerHeight: tabs.tabBar.height
33+ property real headerHeight: listViewHeader
3634
3735 width: units.gu(40)
3836 height: units.gu(42)
3937
4038 function setCurrentMenuIndex(index, animate) {
41− if (tabs.selectedTabIndex !== index) {
42− if (tabs.selectedTabIndex === -1 || !animate) {
43− tabs.tabBar.animate = false;
44− }
45− tabs.selectedTabIndex = index;
46− tabs.tabBar.animate = true;
47− }
39+ listViewHeader.currentIndex = index;
4840 }
4941
5042 function activateContent() {
@@ -58,79 +50,38 @@ MainView {
5850 }
5951 }
6052
61− onActiveHeaderChanged: {
62− tabs.tabBar.selectionMode = activeHeader;
63− tabs.tabBar.alwaysSelectionMode = activeHeader;
64− }
53+ ListView {
54+ id: listViewHeader
55+ objectName: "indicatorsListViewHeader"
56+ model: content.indicatorsModel
6557
66− Tabs {
67− id: tabs
68− objectName: "tabs"
69− anchors.fill: parent
70−
71− Repeater {
72− id: repeater
73− model: content.indicatorsModel ? content.indicatorsModel : null
74− objectName: "tabsRepeater"
75−
76− // FIXME: This is needed because tabs dont handle repeaters well.
77− // Due to the child ordering happening after child insertion.
78− // QTBUG-32438
79− onItemAdded: {
80− parent.childrenChanged();
81− }
58+ anchors {
59+ left: parent.left
60+ right: parent.right
61+ }
62+ height: units.gu(8.5)
8263
83− Tab {
84− id: tab
85− objectName: model.identifier
86−
87− page: Page {
88− Loader {
89− id: loader
90− clip: true
91− anchors.fill: parent
92− source: pageSource
93− asynchronous: true
94−
95− readonly property bool indexActive: index >= 0 && index < menuActivator.count && menuActivator.content[index].active
96− readonly property bool contentActive: content.__contentActive && indexActive
97−
98− onContentActiveChanged: {
99− if (contentActive && item) {
100− item.start()
101− } else if (!contentActive && item) {
102− item.stop()
103− }
104− }
64+ highlightFollowsCurrentItem: true
65+ highlightMoveDuration: 0
10566
106− onVisibleChanged: {
107− // Reset the indicator states
108− if (!visible && item && item["reset"]) {
109− item.reset()
110− }
111− }
67+ orientation: ListView.Horizontal
68+ snapMode: ListView.SnapOneItem
69+ highlightRangeMode: ListView.StrictlyEnforceRange
70+ boundsBehavior: Flickable.StopAtBounds
11271
113− onLoaded: {
114− for(var pName in indicatorProperties) {
115− if (item.hasOwnProperty(pName)) {
116− item[pName] = indicatorProperties[pName]
117− }
118− }
119− if (contentActive && tabs.visible) {
120− item.start()
121− }
122− }
72+ delegate: PageHeader {
73+ width: ListView.view.width
74+ height: implicitHeight
12375
124− Binding {
125− target: tab
126− property: "title"
127− value: loader.item && loader.item.hasOwnProperty("title") && loader.item.title !== "" ? loader.item.title : model.identifier
128− }
76+ title: indicatorDelegate.title !== "" ? indicatorDelegate.title : identifier
77+
78+ IndicatorDelegate {
79+ id: indicatorDelegate
12980
130− Binding {
131− target: loader.item
132− property: "objectName"
133− value: identifier + "-page"
81+ Component.onCompleted: {
82+ for(var pName in indicatorProperties) {
83+ if (indicatorDelegate.hasOwnProperty(pName)) {
84+ indicatorDelegate[pName] = indicatorProperties[pName];
13485 }
13586 }
13687 }
@@ -138,6 +89,67 @@ MainView {
13889 }
13990 }
14091
92+ ListView {
93+ id: listViewContent
94+ objectName: "indicatorsListViewContent"
95+ anchors {
96+ left: parent.left
97+ right: parent.right
98+ top: listViewHeader.bottom
99+ bottom: parent.bottom
100+ }
101+ model: content.indicatorsModel
102+
103+ currentIndex: listViewHeader.currentIndex
104+ interactive: false
105+ highlightMoveDuration: 0
106+ orientation: ListView.Horizontal
107+
108+ delegate: Loader {
109+ id: loader
110+ width: ListView.view.width
111+ height: ListView.view.height
112+
113+ source: pageSource
114+ asynchronous: true
115+
116+ readonly property bool indexActive: index >= 0 && index < menuActivator.count && menuActivator.content[index].active
117+ readonly property bool contentActive: content.__contentActive && indexActive
118+
119+ onContentActiveChanged: {
120+ if (contentActive && item) {
121+ item.start()
122+ } else if (!contentActive && item) {
123+ item.stop()
124+ }
125+ }
126+
127+ onVisibleChanged: {
128+ // Reset the indicator states
129+ if (!visible && item && item["reset"]) {
130+ item.reset()
131+ }
132+ }
133+
134+ onLoaded: {
135+ for(var pName in indicatorProperties) {
136+ if (item.hasOwnProperty(pName)) {
137+ item[pName] = indicatorProperties[pName]
138+ }
139+ }
140+ if (contentActive && listViewContent.visible) {
141+ item.start()
142+ }
143+ }
144+
145+ Binding {
146+ target: loader.item
147+ property: "objectName"
148+ value: identifier + "-page"
149+ }
150+ }
151+ }
152+
141153 Timer {
142154 id: contentReleaseTimer
143155