2 * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
18import Ubuntu.Components 0.1
19import Unity.Indicators 0.1 as Indicators
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
29 property QtObject indicatorsModel: null
30 property bool __contentActive: false
31 readonly property int currentMenuIndex : filteredIndicators.mapToSource(tabs.selectedTabIndex)
32 backgroundColor: "#221e1c" // FIXME not in palette yet
33 property int contentReleaseInterval: 20000
34 property bool activeHeader: false
35 property alias visibleIndicators: visibleIndicatorsModel.visible
36 property bool animateNextMenuChange: false
41 function setCurrentMenuIndex(index) {
42 var filteredIndex = filteredIndicators.mapFromSource(index)
44 if (tabs.selectedTabIndex !== filteredIndex) {
45 if (tabs.selectedTabIndex == -1 || !animateNextMenuChange) {
46 tabs.tabBar.animate = false;
48 tabs.selectedTabIndex = filteredIndex;
49 tabs.tabBar.animate = true;
50 animateNextMenuChange = true;
54 function activateContent() {
55 contentReleaseTimer.stop();
56 __contentActive = true;
59 function releaseContent() {
60 if (__contentActive) {
61 contentReleaseTimer.restart();
65 onActiveHeaderChanged: {
66 tabs.tabBar.selectionMode = activeHeader;
67 tabs.tabBar.alwaysSelectionMode = activeHeader;
70 SortFilterProxyModel {
71 id: filteredIndicators
72 model: visibleIndicatorsModel
73 dynamicSortFilter: true
75 filterRole: Indicators.IndicatorsModelRole.IsVisible
76 filterRegExp: RegExp("^true$")
79 Indicators.VisibleIndicatorsModel {
80 id: visibleIndicatorsModel
81 model: indicatorsModel
92 model: filteredIndicators
93 objectName: "tabsRepeater"
95 // FIXME: This is needed because tabs dont handle repeaters well.
96 // Due to the child ordering happening after child insertion.
99 parent.childrenChanged();
104 objectName: model.identifier
114 readonly property bool indexActive: index >= 0 && index < menuActivator.count && menuActivator.content[index].active
115 readonly property bool contentActive: content.__contentActive && indexActive
117 onContentActiveChanged: {
118 if (contentActive && item) {
120 } else if (!contentActive && item) {
126 // Reset the indicator states
127 if (!visible && item && item["reset"]) {
133 for(var pName in indicatorProperties) {
134 if (item.hasOwnProperty(pName)) {
135 item[pName] = indicatorProperties[pName]
138 if (contentActive && tabs.visible) {
146 value: loader.item && loader.item.hasOwnProperty("title") && loader.item.title !== "" ? loader.item.title : model.identifier
155 id: contentReleaseTimer
157 interval: contentReleaseInterval
159 content.__contentActive = false;
160 menuActivator.clear();
164 Indicators.MenuContentActivator {
166 running: content.__contentActive
167 baseIndex: content.currentMenuIndex
168 count: indicatorsModel.count
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list