~josephjamesmills/u2t/trunk

« back to all changes in this revision

Viewing changes to shell/3rdparty/confluence/r720/components/ButtonList.qml

  • Committer: josephjamesmills at gmail
  • Date: 2012-12-17 20:10:44 UTC
  • Revision ID: josephjamesmills@gmail.com-20121217201044-n5y9o203r1a5brjv
* /shell/3rdparty: rmemoved qtmediahub stuff and old binary for qmltemplets
* debian/contol: adding deps for testing and also chaning version of libnux
* Removed all Build git and bzr folders 
* shell/launcher/* changed locations and styling of pips and showMenu
* Fixing debian control file
* Fixed some of the shortcuts stuff
* reworte and gave keyboard to metalens and systemsettings dash pages
* addded 3rd party folder to place all thrid party code in to try to keep u2d clean
* Pluged in the Hud for Unity2dconfigurations.formFactor == "TV"
* made a simple mockup of how to change gsettings from the dash
* Added dependencys to (almost all) to debian control
* added a option for fomrFactor == "Tablet"
* Need to add more desktop files to install with package or make into metapackage
modified:
  data/com.canonical.Unity2d.gschema.xml
  debian/changelog
  debian/control
  debian/unity-2d-common.postinst
  debian/unity-2d-common.postrm
  debian/unity-2d-common.triggers
  debian/unity-2d-shell.install.in
  libunity-2d-private/src/unity-2d-private.pc.cmake
  po/unity-2d.pot
  shell/3rdparty/ITV/ITV.qml
  shell/3rdparty/softwarefake/FlicableWebView.qml
  shell/3rdparty/softwarefake/Softwarecenter.qml
  shell/3rdparty/webbrowser/webbrowser.qml
  shell/DashLoader.qml
  shell/HudLoader.qml
  shell/Shell.qml
  shell/app/shelldeclarativeview.cpp
  shell/app/shellmanager.cpp
  shell/common/VideoInfo.qml
  shell/common/utils.js
  shell/dash/Dash.qml
  shell/dash/FilterRatings.qml
  shell/dash/ListViewWithScrollbar.qml
  shell/dash/RendererCoverFlow.qml
  shell/dash/previews/FanArtBackgroundMovie.qml
  shell/dash/previews/FlipableTvBanner.qml
  shell/dash/previews/Previews.qml
  shell/hud/Hud.qml
  shell/hud/ResultItem.qml
  shell/indicators/DashIndicators.qml
  shell/indicators/DashSystemIndicator.qml
  shell/indicators/DashWifiIndicator.qml
  shell/indicators/SystemIndicator.qml
  shell/indicators/Systemdropdown.qml
  shell/indicators/WifiIndicator.qml
  shell/launcher/GridLauncher.qml
  shell/launcher/Launcher.qml
  shell/launcher/LauncherItem.qml
  shell/launcher/LauncherList.qml
  shell/launcher/LauncherLoader.qml
  shell/launcher/ListViewDragAndDrop.qml
  shell/launcher/SimpleLauncher.qml
  shell/launcher/SimpleLauncherItem.qml
  shell/systeminfo/SettingsMangerParser.qml
  shell/systeminfo/Systemsettings.qml
  shell/systeminfo/UserSettings.qml
  spread/Window.qml
  spread/Workspaces.qml

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/** This file is part of Qt Media Hub**
2
 
 
3
 
Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).*
4
 
All rights reserved.
5
 
 
6
 
Contact:  Nokia Corporation qmh-development@qt-project.org
7
 
 
8
 
You may use this file under the terms of the BSD license
9
 
as follows:
10
 
 
11
 
Redistribution and use in source and binary forms, with or
12
 
without modification, are permitted provided that the following
13
 
conditions are met:
14
 
* Redistributions of source code must retain the above copyright
15
 
notice, this list of conditions and the following disclaimer.
16
 
 
17
 
* Redistributions in binary form must reproduce the above copyright
18
 
notice, this list of conditions and the following disclaimer in the
19
 
documentation and/or other materials provided with the distribution.
20
 
 
21
 
* Neither the name of Nokia Corporation and its Subsidiary(-ies)
22
 
nor the names of its contributors may be used to endorse or promote
23
 
products derived from this software without specific prior
24
 
written permission.
25
 
 
26
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
 
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
 
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29
 
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30
 
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
31
 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32
 
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33
 
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34
 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35
 
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37
 
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **/
38
 
 
39
 
import QtQuick 1.1
40
 
 
41
 
Flow {
42
 
    id: root
43
 
 
44
 
    property int upperThreshold: children.length - 1
45
 
 
46
 
    property bool wrapping: false
47
 
    property int focusedIndex: 0
48
 
 
49
 
    signal activity
50
 
    signal lowerBoundExceeded
51
 
    signal upperBoundExceeded
52
 
 
53
 
    Keys.onPressed: {
54
 
        root.activity()
55
 
 
56
 
        if (event.key == Qt.Key_Left) {
57
 
            adjustIndex(-1)
58
 
            event.accepted = true;
59
 
        } else if (event.key == Qt.Key_Right) {
60
 
            adjustIndex(+1)
61
 
            event.accepted = true;
62
 
        }
63
 
    }
64
 
 
65
 
    function adjustIndex(delta)
66
 
    {
67
 
        var exceededLower = false
68
 
        var exceededUpper = false
69
 
 
70
 
        focusedIndex += delta
71
 
        
72
 
        //FIXME: surely I can queue these?!
73
 
        if(focusedIndex < 0) {
74
 
            focusedIndex = wrapping ? upperThreshold : 0
75
 
            exceededLower = true
76
 
        }
77
 
        if(focusedIndex > upperThreshold) {
78
 
            focusedIndex = wrapping ? 0 : upperThreshold
79
 
            exceededUpper = true
80
 
        }
81
 
 
82
 
        //Propagate beyond spacers && deactivated items
83
 
        (!children[focusedIndex].enabled || children[focusedIndex].children.length == 0)
84
 
                && !exceededUpper
85
 
                && !exceededLower
86
 
            ? adjustIndex(delta)
87
 
            : children[focusedIndex].forceActiveFocus() 
88
 
 
89
 
        if(exceededLower)
90
 
            lowerBoundExceeded()
91
 
        if(exceededUpper)
92
 
            upperBoundExceeded()
93
 
    }
94
 
 
95
 
    function focusItem() {
96
 
        var index = -1
97
 
        for(var i = 0; i < children.length; i++)
98
 
            if (children[i].activeFocus)
99
 
               index = i
100
 
        return index == -1 ? null : children[index]
101
 
    }
102
 
 
103
 
    function setFocusItem(item) {
104
 
        var index = -1
105
 
 
106
 
        for(var i = 0; i < children.length; i++)
107
 
            if (item == children[i]) 
108
 
                index = i
109
 
 
110
 
        if (index != -1) {
111
 
            children[index].forceActiveFocus()
112
 
            activity()
113
 
        }
114
 
    }
115
 
 
116
 
    function resetFocus() {
117
 
        focusedIndex = 0
118
 
        adjustIndex(0)
119
 
    }
120
 
 
121
 
    function giveFocus() {
122
 
        children[focusedIndex].focus = true
123
 
    }
124
 
 
125
 
    function focusLowerItem() {
126
 
        focusedIndex = 0
127
 
        adjustIndex(0)
128
 
    }
129
 
 
130
 
    function focusUpperItem() {
131
 
        focusedIndex = upperThreshold
132
 
        adjustIndex(0)
133
 
    }
134
 
 
135
 
    move: Transition {
136
 
        NumberAnimation {
137
 
            properties: "x,y"
138
 
            easing.type: confluence.standardEasingCurve
139
 
        }
140
 
    }
141
 
 
142
 
    add: Transition {
143
 
        NumberAnimation {
144
 
            properties: "x,y"
145
 
            easing.type: confluence.standardEasingCurve
146
 
        }
147
 
    }
148
 
}
149