Merge lp:~unity-2d-team/unity-2d/shortcut-hint-overlay into lp:~unity-2d-team/unity-2d/unity-2d-shell
- shortcut-hint-overlay
- Merge into unity-2d-shell
Status: | Superseded |
---|---|
Proposed branch: | lp:~unity-2d-team/unity-2d/shortcut-hint-overlay |
Merge into: | lp:~unity-2d-team/unity-2d/unity-2d-shell |
Diff against target: |
1259 lines (+723/-148) 18 files modified
libunity-2d-private/Unity2d/plugin.cpp (+4/-0) libunity-2d-private/src/lens.cpp (+15/-3) libunity-2d-private/src/lenses.cpp (+8/-5) libunity-2d-private/src/lenses.h (+2/-0) shell/Shell.qml (+6/-1) shell/app/shelldeclarativeview.cpp (+7/-0) shell/app/shelldeclarativeview.h (+2/-0) shell/common/Background.qml (+109/-0) shell/common/SearchEntry.qml (+25/-33) shell/dash/Dash.qml (+43/-64) shell/dash/Home.qml (+1/-1) shell/dash/LensBar.qml (+20/-19) shell/dash/LensView.qml (+7/-6) shell/dash/RendererGrid.qml (+6/-14) shell/launcher/LauncherLoader.qml (+12/-2) shell/shortcutoverlay/ShortcutHint.qml (+207/-0) shell/shortcutoverlay/ShortcutHintSection.qml (+160/-0) tests/shell/shortcut-hint-overlay-tests.rb (+89/-0) |
To merge this branch: | bzr merge lp:~unity-2d-team/unity-2d/shortcut-hint-overlay |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Florian Boucault (community) | Needs Fixing | ||
Gerry Boland (community) | Needs Fixing | ||
Michał Sawicz | Needs Fixing | ||
Albert Astals Cid (community) | Needs Fixing | ||
Review via email: mp+91116@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-02-13.
Commit message
Description of the change
[launcher] Shortcut list should be shown while super key is held.
Lohith D Shivamurthy (dyams) wrote : | # |
Albert Astals Cid (aacid) wrote : | # |
u2d.tr(description) won't work since the text of the description won't be extracted by the update-unity-2d-pot script, the same for the title. And since the won't be in the .po file they won't be translatable. You'll have to move the u2d.tr to were you have the actual "text" so the text is extracted.
Florian Boucault (fboucault) wrote : | # |
Of course, we won't merge that until unity-2d-shell is merged into lp:unity-2d.
Gerry Boland (gerboland) wrote : | # |
Please give credit to Tiago in the commit message, for working on the UI side of this MR.
Michał Sawicz (saviq) wrote : | # |
Hey, this looks like it could go into lp:unity-2d with minor modifications, and will reduce the diff when we actually go to merging shell into trunk, could you please have a MR against lp:unity-2d for this?
Michał Sawicz (saviq) wrote : | # |
> Hey, this looks like it could go into lp:unity-2d with minor modifications,
> and will reduce the diff when we actually go to merging shell into trunk,
> could you please have a MR against lp:unity-2d for this?
Actually that might not be worth it, since you don't have any fullscreen part of the UI with unity-2d, you'd have to hack up the dash to go fullscreen when the hint is supposed to show.
In that case I propose that we wait with merging this for the shell to be merged into trunk and then MR that change against trunk.
Michał Sawicz (saviq) wrote : | # |
The overlay needs to have a blurred background, it's unreadable when you have a terminal window behind it.
Also, I wonder if the overlay should be input-shaped? Right now you can interact with windows behind the overlay, which makes sense, for it being just an overlay, but not sure that's the designed behavior.
Gerry Boland (gerboland) wrote : | # |
Looks nice! Aside from above comments:
- along with blurred background, the sheen is also needed. See Background.qml
- background has unusual colour tint set. We don't have tinting just now, so should be removed.
- shell/Shell.qml - why remove "KeyNavigation.
- in symmetricKey() and getShortcutKey(), GConfItem declared in Unity2D, no need to import QtQuick
- in your javascript, your notation is mixing camelCase and underscore_
- symmetricKey deserves a comment to explain why it is there.
- can you check with design about using empty strings if no key is set? I think it looks confusing.
- I have a truncation for a long key combination: https:/
- overlay needs to be positioned a little higher, see comparison image: https:/
- there are typos, and some EnglishUK spellings instead of US (see first screenshot again). Yes they're in the mockup, but check with design
- in "Switching" - the left/right cursor keys do not move focus in Metacity. Is this something that needs to be enabled, or should this listing be removed?
- Alt+Middle Mouse drag also doesn't work for me.
- Please use fontUtils.js to specify font sizes
- you have unrelated changes from tests/run-tests.rb & tests/shell/
- recently we decided having authors names in text files was going to be a pain, so we removed them. Will you do the same?
- have you given any thought to accessibility? How will this work with Orca? Since focus is not stolen, what will Orca do? Will it be possible to have Orca read out these shortcuts in some way? Just something to think about.
- import Unity2d 1.0 /* required by GConfItem */ <- GConfItem requires Unity2D, not other way around
- qml (I know, Tiago's) could be cleaned up a little, with both x,y coordinates & anchors being used, lots of unnecessary margin:0 scattered about for example.
Lohith D Shivamurthy (dyams) wrote : | # |
> The overlay needs to have a blurred background, it's unreadable when you have
> a terminal window behind it.
>
I checked with design and have done what they said.
> Also, I wonder if the overlay should be input-shaped? Right now you can
> interact with windows behind the overlay, which makes sense, for it being just
> an overlay, but not sure that's the designed behavior.
Yes you can interact with windows behind it.
- 955. By Lohith D Shivamurthy
-
[launcher] Use font utils
- 956. By Lohith D Shivamurthy
-
[launcher] Remove unnecessary margins
- 957. By Lohith D Shivamurthy
-
[launcher] Use camelCases and remove underscore_
separator - 958. By Lohith D Shivamurthy
-
[launcher] Fix spellings to US-English
- 959. By Lohith D Shivamurthy
-
[launcher] move import 'Unity2d 1.0' to ShortcutHitSect
ion.qml - 960. By Lohith D Shivamurthy
-
[launcher] Remove unnecessary margins
- 961. By Lohith D Shivamurthy
-
[launcher] Fix a confusing comment
- 962. By Lohith D Shivamurthy
-
[launcher] Fix gconf key for 'move window'
Lohith D Shivamurthy (dyams) wrote : | # |
> Looks nice! Aside from above comments:
> - along with blurred background, the sheen is also needed. See Background.qml
> - background has unusual colour tint set. We don't have tinting just now, so
> should be removed.
I checked with design, this is the conversation:
dyams rosie: should we need to have a background for overlay hint?
dyams rosie: if the overlay is displayed on a white background for ex: gedit window, the shortcuts are hardly visible
rosie dyams: there is a 35% #5e2750 layer and a -80% (-150% - 150%) brightness layer
> - shell/Shell.qml - why remove "KeyNavigation.
The only difference i see in Shell.qml is
30 + Loader {
31 + id: shortcutHintLoader
32 + anchors.centerIn: parent
33 + }
34 +
> - in symmetricKey() and getShortcutKey(), GConfItem declared in Unity2D, no
> need to import QtQuick
Are you sure? FYI, i get this '[WARNING] ShortcutHint.
> - in your javascript, your notation is mixing camelCase and
> underscore_
> the function calls would help readability too.
> - symmetricKey deserves a comment to explain why it is there.
Done.
> - can you check with design about using empty strings if no key is set? I
> think it looks confusing.
true, but its design decision.
> - I have a truncation for a long key combination: https:/
> can you also check with design to see what to do?
Design changed a bit, I have updated the same.
> - overlay needs to be positioned a little higher, see comparison image:
> https:/
It is positioned to the center. I doubt we need to adjust it again.
> - there are typos, and some EnglishUK spellings instead of US (see first
> screenshot again). Yes they're in the mockup, but check with design
Done
> - in "Switching" - the left/right cursor keys do not move focus in Metacity.
> Is this something that needs to be enabled, or should this listing be removed?
No, It works
> - Alt+Middle Mouse drag also doesn't work for me.
No, It works
> - Please use fontUtils.js to specify font sizes
Done.
> - you have unrelated changes from tests/run-tests.rb &
> tests/shell/
Is it? but they are not listed under the 'differences' here.
> - recently we decided having authors names in text files was going to be a
> pain, so we removed them. Will you do the same?
Done.
> - have you given any thought to accessibility? How will this work with Orca?
> Since focus is not stolen, what will Orca do? Will it be possible to have Orca
> read out these shortcuts in some way? Just something to think about.
No.
> - import Unity2d 1.0 /* required by GConfItem */ <- GConfItem requires
> Unity2D, not other way around
Yes I know.
> - qml (I know, Tiago's) could be cleaned up a little, with both x,y
> coordinates & anchors being used, lots of unnecessary margin:0 scattered about
> for example.
Done.
Florian Boucault (fboucault) wrote : | # |
Please resubmit the MR against lp:unity-2d
Florian Boucault (fboucault) wrote : | # |
Maybe I am out of line here but I don't see how the overlay belongs to the launcher.
- 963. By Lohith D Shivamurthy
-
merge lp:unity-2d
- 964. By Lohith D Shivamurthy
-
Move shortcut overlay files into separate folder
- 965. By Lohith D Shivamurthy
-
Directly import gconf 0.1
- 966. By Lohith D Shivamurthy
-
keep object id same as objectname
- 967. By Lohith D Shivamurthy
-
Add a FIXME for i18n of display strings
- 968. By Lohith D Shivamurthy
-
Remove background color
- 969. By Lohith D Shivamurthy
-
Use TextCustom instead of Text element
- 970. By Lohith D Shivamurthy
-
Fix missing parent object
- 971. By Lohith D Shivamurthy
-
Apply blur background
- 972. By Lohith D Shivamurthy
-
Activate/Deactivate overlay in shell.qml
- 973. By Lohith D Shivamurthy
-
Deactivate the overlay on tapping launcher tile shortcuts
- 974. By Lohith D Shivamurthy
-
Add a dummy function and call u2d.tr on all display strings
- 975. By Lohith D Shivamurthy
-
Improve background
- 976. By Lohith D Shivamurthy
-
Use workaround mentioned in the bugreport
- 977. By Lohith D Shivamurthy
-
Use regExp to replace case-insensitively
- 978. By Lohith D Shivamurthy
-
Replace Shft with Shift
- 979. By Lohith D Shivamurthy
-
Add missing file ModelElement.qml
- 980. By Lohith D Shivamurthy
-
merge
- 981. By Lohith D Shivamurthy
-
Remove extra field from ModelElement.qml
- 982. By Lohith D Shivamurthy
-
deactivate overlay when view looses focus
- 983. By Lohith D Shivamurthy
-
Apply black background with 70% opacity
- 984. By Tiago Salem Herrmann
-
merge trunk
- 985. By Tiago Salem Herrmann
-
onSuperKeyHeldC
hanged was moved to shellManager - 986. By Tiago Salem Herrmann
-
remove debug
- 987. By Tiago Salem Herrmann
-
Force string object for the key. In some cases key is a object so replace() and substring fail
- 988. By Tiago Salem Herrmann
-
fix white spaces
- 989. By Tiago Salem Herrmann
-
ignore <Primary> string
- 990. By Tiago Salem Herrmann
-
merge trunk
- 991. By Tiago Salem Herrmann
-
add MultiMonitor support
Use the same trick as Dash to update the blurred background - 992. By Gerry Boland
-
Replace 'KP_' with 'Num' in gconf string. Needed for Numpad keys
- 993. By Gerry Boland
-
QtQuick1.0 not needed to read gconf values
- 994. By Gerry Boland
-
Add basic RTL support
- 995. By Gerry Boland
-
[debian] Install shortcut overlay QML files
Unmerged revisions
- 995. By Gerry Boland
-
[debian] Install shortcut overlay QML files
- 994. By Gerry Boland
-
Add basic RTL support
- 993. By Gerry Boland
-
QtQuick1.0 not needed to read gconf values
- 992. By Gerry Boland
-
Replace 'KP_' with 'Num' in gconf string. Needed for Numpad keys
- 991. By Tiago Salem Herrmann
-
add MultiMonitor support
Use the same trick as Dash to update the blurred background - 990. By Tiago Salem Herrmann
-
merge trunk
- 989. By Tiago Salem Herrmann
-
ignore <Primary> string
- 988. By Tiago Salem Herrmann
-
fix white spaces
- 987. By Tiago Salem Herrmann
-
Force string object for the key. In some cases key is a object so replace() and substring fail
- 986. By Tiago Salem Herrmann
-
remove debug
Preview Diff
1 | === modified file 'libunity-2d-private/Unity2d/plugin.cpp' | |||
2 | --- libunity-2d-private/Unity2d/plugin.cpp 2012-02-08 11:05:30 +0000 | |||
3 | +++ libunity-2d-private/Unity2d/plugin.cpp 2012-02-13 12:01:24 +0000 | |||
4 | @@ -77,6 +77,9 @@ | |||
5 | 77 | #include "unity2dpanel.h" | 77 | #include "unity2dpanel.h" |
6 | 78 | #include "strutmanager.h" | 78 | #include "strutmanager.h" |
7 | 79 | 79 | ||
8 | 80 | // libqtgconf | ||
9 | 81 | #include <gconfitem-qml-wrapper.h> | ||
10 | 82 | |||
11 | 80 | #include <QtDeclarative/qdeclarative.h> | 83 | #include <QtDeclarative/qdeclarative.h> |
12 | 81 | #include <QDeclarativeEngine> | 84 | #include <QDeclarativeEngine> |
13 | 82 | #include <QDeclarativeContext> | 85 | #include <QDeclarativeContext> |
14 | @@ -176,6 +179,7 @@ | |||
15 | 176 | 179 | ||
16 | 177 | qmlRegisterType<Unity2dPanel>(uri, 0, 1, "Unity2dPanel"); | 180 | qmlRegisterType<Unity2dPanel>(uri, 0, 1, "Unity2dPanel"); |
17 | 178 | qmlRegisterType<StrutManager>(uri, 0, 1, "StrutManager"); | 181 | qmlRegisterType<StrutManager>(uri, 0, 1, "StrutManager"); |
18 | 182 | qmlRegisterType<GConfItemQmlWrapper>(uri, 0, 1, "GConfItem"); | ||
19 | 179 | } | 183 | } |
20 | 180 | 184 | ||
21 | 181 | void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) | 185 | void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) |
22 | 182 | 186 | ||
23 | === modified file 'libunity-2d-private/src/lens.cpp' | |||
24 | --- libunity-2d-private/src/lens.cpp 2011-12-14 22:45:04 +0000 | |||
25 | +++ libunity-2d-private/src/lens.cpp 2012-02-13 12:01:24 +0000 | |||
26 | @@ -224,9 +224,21 @@ | |||
27 | 224 | 224 | ||
28 | 225 | m_filters = new Filters(m_unityLens->filters, this); | 225 | m_filters = new Filters(m_unityLens->filters, this); |
29 | 226 | 226 | ||
33 | 227 | m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name)); | 227 | if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) { |
34 | 228 | m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name)); | 228 | m_results->setModel(m_unityLens->results()->model()); |
35 | 229 | m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name)); | 229 | } else { |
36 | 230 | m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name)); | ||
37 | 231 | } | ||
38 | 232 | if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) { | ||
39 | 233 | m_globalResults->setModel(m_unityLens->global_results()->model()); | ||
40 | 234 | } else { | ||
41 | 235 | m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name)); | ||
42 | 236 | } | ||
43 | 237 | if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) { | ||
44 | 238 | m_categories->setModel(m_unityLens->categories()->model()); | ||
45 | 239 | } else { | ||
46 | 240 | m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name)); | ||
47 | 241 | } | ||
48 | 230 | 242 | ||
49 | 231 | /* Property change signals */ | 243 | /* Property change signals */ |
50 | 232 | m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged)); | 244 | m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged)); |
51 | 233 | 245 | ||
52 | === modified file 'libunity-2d-private/src/lenses.cpp' | |||
53 | --- libunity-2d-private/src/lenses.cpp 2011-09-09 10:15:14 +0000 | |||
54 | +++ libunity-2d-private/src/lenses.cpp 2012-02-13 12:01:24 +0000 | |||
55 | @@ -27,6 +27,8 @@ | |||
56 | 27 | 27 | ||
57 | 28 | // libunity-core | 28 | // libunity-core |
58 | 29 | #include <UnityCore/FilesystemLenses.h> | 29 | #include <UnityCore/FilesystemLenses.h> |
59 | 30 | #include <UnityCore/HomeLens.h> | ||
60 | 31 | #include <unity2dtr.h> | ||
61 | 30 | 32 | ||
62 | 31 | Lenses::Lenses(QObject *parent) : | 33 | Lenses::Lenses(QObject *parent) : |
63 | 32 | QAbstractListModel(parent) | 34 | QAbstractListModel(parent) |
64 | @@ -36,17 +38,18 @@ | |||
65 | 36 | roles[Lenses::RoleVisible] = "visible"; | 38 | roles[Lenses::RoleVisible] = "visible"; |
66 | 37 | setRoleNames(roles); | 39 | setRoleNames(roles); |
67 | 38 | 40 | ||
68 | 41 | m_homeLens = new unity::dash::HomeLens(u2dTr("Home").toStdString(), u2dTr("Home screen").toStdString(), u2dTr("Search").toStdString()); | ||
69 | 39 | m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses"); | 42 | m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses"); |
75 | 40 | for (unsigned int i=0; i<m_unityLenses->count(); i++) { | 43 | m_homeLens->AddLenses(*m_unityLenses); |
76 | 41 | unity::dash::Lens::Ptr unityLens = m_unityLenses->GetLensAtIndex(i); | 44 | m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded)); |
77 | 42 | addUnityLens(unityLens, i); | 45 | unity::dash::HomeLens::Ptr homeLensPtr(m_homeLens); |
78 | 43 | } | 46 | addUnityLens(homeLensPtr, 0); |
74 | 44 | m_unityLenses->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded)); | ||
79 | 45 | } | 47 | } |
80 | 46 | 48 | ||
81 | 47 | Lenses::~Lenses() | 49 | Lenses::~Lenses() |
82 | 48 | { | 50 | { |
83 | 49 | delete m_unityLenses; | 51 | delete m_unityLenses; |
84 | 52 | delete m_homeLens; | ||
85 | 50 | } | 53 | } |
86 | 51 | 54 | ||
87 | 52 | int Lenses::rowCount(const QModelIndex& parent) const | 55 | int Lenses::rowCount(const QModelIndex& parent) const |
88 | 53 | 56 | ||
89 | === modified file 'libunity-2d-private/src/lenses.h' | |||
90 | --- libunity-2d-private/src/lenses.h 2011-08-11 14:38:51 +0000 | |||
91 | +++ libunity-2d-private/src/lenses.h 2012-02-13 12:01:24 +0000 | |||
92 | @@ -26,6 +26,7 @@ | |||
93 | 26 | 26 | ||
94 | 27 | // libunity-core | 27 | // libunity-core |
95 | 28 | #include <UnityCore/Lens.h> | 28 | #include <UnityCore/Lens.h> |
96 | 29 | #include <UnityCore/HomeLens.h> | ||
97 | 29 | 30 | ||
98 | 30 | namespace unity | 31 | namespace unity |
99 | 31 | { | 32 | { |
100 | @@ -64,6 +65,7 @@ | |||
101 | 64 | 65 | ||
102 | 65 | private: | 66 | private: |
103 | 66 | unity::dash::Lenses* m_unityLenses; | 67 | unity::dash::Lenses* m_unityLenses; |
104 | 68 | unity::dash::HomeLens* m_homeLens; | ||
105 | 67 | QList<Lens*> m_lenses; | 69 | QList<Lens*> m_lenses; |
106 | 68 | 70 | ||
107 | 69 | void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index); | 71 | void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index); |
108 | 70 | 72 | ||
109 | === modified file 'shell/Shell.qml' | |||
110 | --- shell/Shell.qml 2012-02-10 17:03:01 +0000 | |||
111 | +++ shell/Shell.qml 2012-02-13 12:01:24 +0000 | |||
112 | @@ -120,6 +120,11 @@ | |||
113 | 120 | } | 120 | } |
114 | 121 | } | 121 | } |
115 | 122 | 122 | ||
116 | 123 | Loader { | ||
117 | 124 | id: shortcutHintLoader | ||
118 | 125 | anchors.centerIn: parent | ||
119 | 126 | } | ||
120 | 127 | |||
121 | 123 | Connections { | 128 | Connections { |
122 | 124 | target: declarativeView | 129 | target: declarativeView |
123 | 125 | onLauncherFocusRequested: { | 130 | onLauncherFocusRequested: { |
124 | @@ -164,7 +169,7 @@ | |||
125 | 164 | 169 | ||
126 | 165 | InputShapeMask { | 170 | InputShapeMask { |
127 | 166 | id: shape1 | 171 | id: shape1 |
129 | 167 | source: "shell/dash/artwork/desktop_dash_background_no_transparency.png" | 172 | source: "shell/common/artwork/desktop_dash_background_no_transparency.png" |
130 | 168 | color: "red" | 173 | color: "red" |
131 | 169 | position: Qt.point(dashLoader.width - 50, dashLoader.height - 49) | 174 | position: Qt.point(dashLoader.width - 50, dashLoader.height - 49) |
132 | 170 | enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode | 175 | enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode |
133 | 171 | 176 | ||
134 | === modified file 'shell/app/shelldeclarativeview.cpp' | |||
135 | --- shell/app/shelldeclarativeview.cpp 2012-02-09 12:27:35 +0000 | |||
136 | +++ shell/app/shelldeclarativeview.cpp 2012-02-13 12:01:24 +0000 | |||
137 | @@ -41,6 +41,7 @@ | |||
138 | 41 | #include <QtDBus/QDBusInterface> | 41 | #include <QtDBus/QDBusInterface> |
139 | 42 | #include <QX11Info> | 42 | #include <QX11Info> |
140 | 43 | #include <QGraphicsObject> | 43 | #include <QGraphicsObject> |
141 | 44 | #include <QFileInfo> | ||
142 | 44 | 45 | ||
143 | 45 | // X11 | 46 | // X11 |
144 | 46 | #include <X11/Xlib.h> | 47 | #include <X11/Xlib.h> |
145 | @@ -188,6 +189,12 @@ | |||
146 | 188 | return m_active; | 189 | return m_active; |
147 | 189 | } | 190 | } |
148 | 190 | 191 | ||
149 | 192 | bool | ||
150 | 193 | ShellDeclarativeView::haveCustomHomeShortcuts() const | ||
151 | 194 | { | ||
152 | 195 | return QFileInfo(unity2dDirectory() + "/shell/dash/HomeShortcutsCustomized.qml").exists(); | ||
153 | 196 | } | ||
154 | 197 | |||
155 | 191 | void | 198 | void |
156 | 192 | ShellDeclarativeView::setDashMode(ShellDeclarativeView::DashMode mode) | 199 | ShellDeclarativeView::setDashMode(ShellDeclarativeView::DashMode mode) |
157 | 193 | { | 200 | { |
158 | 194 | 201 | ||
159 | === modified file 'shell/app/shelldeclarativeview.h' | |||
160 | --- shell/app/shelldeclarativeview.h 2012-02-09 02:22:19 +0000 | |||
161 | +++ shell/app/shelldeclarativeview.h 2012-02-13 12:01:24 +0000 | |||
162 | @@ -39,6 +39,7 @@ | |||
163 | 39 | Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged) | 39 | Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged) |
164 | 40 | Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify | 40 | Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify |
165 | 41 | Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged) | 41 | Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged) |
166 | 42 | Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts) | ||
167 | 42 | 43 | ||
168 | 43 | /* These two properties and mouse movement tracking on the widget are added here only because | 44 | /* These two properties and mouse movement tracking on the widget are added here only because |
169 | 44 | we need to detect when the mouse is inside the area occupied by the lancher. This should | 45 | we need to detect when the mouse is inside the area occupied by the lancher. This should |
170 | @@ -59,6 +60,7 @@ | |||
171 | 59 | 60 | ||
172 | 60 | /* getters */ | 61 | /* getters */ |
173 | 61 | bool dashActive() const; | 62 | bool dashActive() const; |
174 | 63 | bool haveCustomHomeShortcuts() const; | ||
175 | 62 | DashMode dashMode() const; | 64 | DashMode dashMode() const; |
176 | 63 | const QString& activeLens() const; | 65 | const QString& activeLens() const; |
177 | 64 | bool expanded() const; | 66 | bool expanded() const; |
178 | 65 | 67 | ||
179 | === added file 'shell/common/Background.qml' | |||
180 | --- shell/common/Background.qml 1970-01-01 00:00:00 +0000 | |||
181 | +++ shell/common/Background.qml 2012-02-13 12:01:24 +0000 | |||
182 | @@ -0,0 +1,109 @@ | |||
183 | 1 | /* | ||
184 | 2 | * This file is part of unity-2d | ||
185 | 3 | * | ||
186 | 4 | * Copyright 2010-2011 Canonical Ltd. | ||
187 | 5 | * | ||
188 | 6 | * This program is free software; you can redistribute it and/or modify | ||
189 | 7 | * it under the terms of the GNU General Public License as published by | ||
190 | 8 | * the Free Software Foundation; version 3. | ||
191 | 9 | * | ||
192 | 10 | * This program is distributed in the hope that it will be useful, | ||
193 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
194 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
195 | 13 | * GNU General Public License for more details. | ||
196 | 14 | * | ||
197 | 15 | * You should have received a copy of the GNU General Public License | ||
198 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
199 | 17 | */ | ||
200 | 18 | |||
201 | 19 | import QtQuick 1.1 | ||
202 | 20 | import Unity2d 1.0 | ||
203 | 21 | import Effects 1.0 | ||
204 | 22 | |||
205 | 23 | Item { | ||
206 | 24 | id: background | ||
207 | 25 | property bool active: false | ||
208 | 26 | property bool fullscreen: false | ||
209 | 27 | property int bottomBorderThickness | ||
210 | 28 | property int rightBorderThickness | ||
211 | 29 | /* coordinates of top left corner needed to capture correct segment of background */ | ||
212 | 30 | property int xPosition: 0 | ||
213 | 31 | property int yPosition: 0 | ||
214 | 32 | |||
215 | 33 | /* Avoid redraw at rendering */ | ||
216 | 34 | effect: CacheEffect {} | ||
217 | 35 | |||
218 | 36 | Item { | ||
219 | 37 | anchors.fill: parent | ||
220 | 38 | anchors.bottomMargin: bottomBorderThickness | ||
221 | 39 | anchors.rightMargin: rightBorderThickness | ||
222 | 40 | clip: true | ||
223 | 41 | |||
224 | 42 | Image { | ||
225 | 43 | id: blurredBackground | ||
226 | 44 | |||
227 | 45 | effect: Blur {blurRadius: 12} | ||
228 | 46 | |||
229 | 47 | /* 'source' needs to be set when this becomes visible, that is when active | ||
230 | 48 | becomes true, so that a screenshot of the desktop is taken at that point. | ||
231 | 49 | See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop | ||
232 | 50 | */ | ||
233 | 51 | |||
234 | 52 | /* Use an image of the root window which essentially is a | ||
235 | 53 | capture of the entire screen */ | ||
236 | 54 | source: active ? "image://window/root" : "" | ||
237 | 55 | cache: false | ||
238 | 56 | |||
239 | 57 | fillMode: Image.PreserveAspectCrop | ||
240 | 58 | x: -xPosition | ||
241 | 59 | y: -yPosition | ||
242 | 60 | } | ||
243 | 61 | |||
244 | 62 | Image { | ||
245 | 63 | anchors.fill: parent | ||
246 | 64 | fillMode: Image.PreserveAspectCrop | ||
247 | 65 | source: "artwork/background_sheen.png" | ||
248 | 66 | } | ||
249 | 67 | } | ||
250 | 68 | |||
251 | 69 | BorderImage { | ||
252 | 70 | id: border | ||
253 | 71 | |||
254 | 72 | /* Define properties of border here */ | ||
255 | 73 | property int bottomThickness: 39 | ||
256 | 74 | property int rightThickness: 37 | ||
257 | 75 | |||
258 | 76 | anchors.fill: parent | ||
259 | 77 | source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci" | ||
260 | 78 | mirror: isRightToLeft() | ||
261 | 79 | } | ||
262 | 80 | |||
263 | 81 | states: [ | ||
264 | 82 | State { | ||
265 | 83 | name: "normal" | ||
266 | 84 | when: !fullscreen | ||
267 | 85 | PropertyChanges { | ||
268 | 86 | target: background | ||
269 | 87 | bottomBorderThickness: border.bottomThickness | ||
270 | 88 | rightBorderThickness: border.rightThickness | ||
271 | 89 | } | ||
272 | 90 | PropertyChanges { | ||
273 | 91 | target: border | ||
274 | 92 | visible: true | ||
275 | 93 | } | ||
276 | 94 | }, | ||
277 | 95 | State { | ||
278 | 96 | name: "fullscreen" | ||
279 | 97 | when: fullscreen | ||
280 | 98 | PropertyChanges { | ||
281 | 99 | target: background | ||
282 | 100 | bottomBorderThickness: 0 | ||
283 | 101 | rightBorderThickness: 0 | ||
284 | 102 | } | ||
285 | 103 | PropertyChanges { | ||
286 | 104 | target: border | ||
287 | 105 | visible: false | ||
288 | 106 | } | ||
289 | 107 | } | ||
290 | 108 | ] | ||
291 | 109 | } | ||
292 | 0 | 110 | ||
293 | === renamed file 'shell/dash/SearchEntry.qml' => 'shell/common/SearchEntry.qml' | |||
294 | --- shell/dash/SearchEntry.qml 2012-01-10 10:42:46 +0000 | |||
295 | +++ shell/common/SearchEntry.qml 2012-02-13 12:01:24 +0000 | |||
296 | @@ -18,28 +18,22 @@ | |||
297 | 18 | 18 | ||
298 | 19 | import QtQuick 1.1 | 19 | import QtQuick 1.1 |
299 | 20 | import Effects 1.0 | 20 | import Effects 1.0 |
302 | 21 | import "../common/fontUtils.js" as FontUtils | 21 | import "fontUtils.js" as FontUtils |
301 | 22 | import "../common" | ||
303 | 23 | 22 | ||
304 | 24 | AbstractButton { | 23 | AbstractButton { |
305 | 25 | property string searchQuery | 24 | property string searchQuery |
306 | 25 | property string placeHolderText: "" | ||
307 | 26 | property bool active: false | ||
308 | 27 | |||
309 | 28 | signal activateFirstResult | ||
310 | 26 | 29 | ||
311 | 27 | Accessible.name: "Search Entry" | 30 | Accessible.name: "Search Entry" |
312 | 28 | 31 | ||
324 | 29 | /* Cancels current search when the dash becomes invisible */ | 32 | /* Delete search when set in-active */ |
325 | 30 | Connections { | 33 | onActiveChanged: if (!active) searchInput.text = "" |
315 | 31 | target: dash | ||
316 | 32 | onActiveChanged: if (!dash.active) search_input.text = "" | ||
317 | 33 | } | ||
318 | 34 | |||
319 | 35 | Binding { | ||
320 | 36 | target: dash.currentPage != undefined ? dash.currentPage.model : null | ||
321 | 37 | property: "searchQuery" | ||
322 | 38 | value: searchQuery | ||
323 | 39 | } | ||
326 | 40 | 34 | ||
327 | 41 | /* Keys forwarded to the search entry are forwarded to the text input. */ | 35 | /* Keys forwarded to the search entry are forwarded to the text input. */ |
329 | 42 | Keys.forwardTo: [search_input] | 36 | Keys.forwardTo: [searchInput] |
330 | 43 | 37 | ||
331 | 44 | opacity: ( state == "selected" || state == "hovered" ) ? 1.0 : 0.7 | 38 | opacity: ( state == "selected" || state == "hovered" ) ? 1.0 : 0.7 |
332 | 45 | 39 | ||
333 | @@ -58,7 +52,7 @@ | |||
334 | 58 | anchors.rightMargin: 16 | 52 | anchors.rightMargin: 16 |
335 | 59 | 53 | ||
336 | 60 | Image { | 54 | Image { |
338 | 61 | id: search_icon | 55 | id: searchIcon |
339 | 62 | 56 | ||
340 | 63 | anchors.left: parent.left | 57 | anchors.left: parent.left |
341 | 64 | anchors.leftMargin: -9 | 58 | anchors.leftMargin: -9 |
342 | @@ -68,28 +62,28 @@ | |||
343 | 68 | 62 | ||
344 | 69 | smooth: true | 63 | smooth: true |
345 | 70 | 64 | ||
347 | 71 | source: search_input.text ? "artwork/cross.png" : "artwork/search_icon.png" | 65 | source: searchInput.text ? "artwork/cross.png" : "artwork/search_icon.png" |
348 | 72 | fillMode: Image.PreserveAspectFit | 66 | fillMode: Image.PreserveAspectFit |
349 | 73 | } | 67 | } |
350 | 74 | 68 | ||
351 | 75 | MouseArea { | 69 | MouseArea { |
353 | 76 | id: clear_button | 70 | id: clearButton |
354 | 77 | 71 | ||
355 | 78 | Accessible.name: "Clear" | 72 | Accessible.name: "Clear" |
356 | 79 | Accessible.role: Accessible.PushButton | 73 | Accessible.role: Accessible.PushButton |
357 | 80 | 74 | ||
359 | 81 | anchors.fill: search_icon | 75 | anchors.fill: searchIcon |
360 | 82 | 76 | ||
361 | 83 | onClicked: { | 77 | onClicked: { |
364 | 84 | search_input.forceActiveFocus() | 78 | searchInput.forceActiveFocus() |
365 | 85 | search_input.text = "" | 79 | searchInput.text = "" |
366 | 86 | } | 80 | } |
367 | 87 | } | 81 | } |
368 | 88 | 82 | ||
369 | 89 | TextInput { | 83 | TextInput { |
371 | 90 | id: search_input | 84 | id: searchInput |
372 | 91 | 85 | ||
374 | 92 | Accessible.name: search_instructions.text | 86 | Accessible.name: searchInstructions.text |
375 | 93 | Accessible.role: Accessible.EditableText | 87 | Accessible.role: Accessible.EditableText |
376 | 94 | 88 | ||
377 | 95 | effect: DropShadow { | 89 | effect: DropShadow { |
378 | @@ -99,10 +93,10 @@ | |||
379 | 99 | offset.x: 0 | 93 | offset.x: 0 |
380 | 100 | offset.y: 0 | 94 | offset.y: 0 |
381 | 101 | color: "white" | 95 | color: "white" |
383 | 102 | enabled: search_input.text != "" || search_input.inputMethodComposing | 96 | enabled: searchInput.text != "" || searchInput.inputMethodComposing |
384 | 103 | } | 97 | } |
385 | 104 | 98 | ||
387 | 105 | anchors.left: search_icon.right | 99 | anchors.left: searchIcon.right |
388 | 106 | anchors.leftMargin: -5 | 100 | anchors.leftMargin: -5 |
389 | 107 | anchors.right: parent.right | 101 | anchors.right: parent.right |
390 | 108 | anchors.verticalCenter: parent.verticalCenter | 102 | anchors.verticalCenter: parent.verticalCenter |
391 | @@ -115,17 +109,17 @@ | |||
392 | 115 | cursorDelegate: cursor | 109 | cursorDelegate: cursor |
393 | 116 | selectionColor: "gray" | 110 | selectionColor: "gray" |
394 | 117 | 111 | ||
396 | 118 | onTextChanged: live_search_timeout.restart() | 112 | onTextChanged: liveSearchTimeout.restart() |
397 | 119 | 113 | ||
398 | 120 | Timer { | 114 | Timer { |
400 | 121 | id: live_search_timeout | 115 | id: liveSearchTimeout |
401 | 122 | interval: 200 | 116 | interval: 200 |
403 | 123 | onTriggered: searchQuery = search_input.text | 117 | onTriggered: searchQuery = searchInput.text |
404 | 124 | } | 118 | } |
405 | 125 | 119 | ||
406 | 126 | Keys.onPressed: { | 120 | Keys.onPressed: { |
407 | 127 | if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) { | 121 | if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) { |
409 | 128 | dash.currentPage.activateFirstResult() | 122 | activateFirstResult() |
410 | 129 | event.accepted = true; | 123 | event.accepted = true; |
411 | 130 | } | 124 | } |
412 | 131 | } | 125 | } |
413 | @@ -159,7 +153,7 @@ | |||
414 | 159 | } | 153 | } |
415 | 160 | 154 | ||
416 | 161 | TextCustom { | 155 | TextCustom { |
418 | 162 | id: search_instructions | 156 | id: searchInstructions |
419 | 163 | 157 | ||
420 | 164 | anchors.left: parent.left | 158 | anchors.left: parent.left |
421 | 165 | anchors.right: parent.right | 159 | anchors.right: parent.right |
422 | @@ -173,12 +167,10 @@ | |||
423 | 173 | fontSize: "x-large" | 167 | fontSize: "x-large" |
424 | 174 | font.italic: true | 168 | font.italic: true |
425 | 175 | text: { | 169 | text: { |
427 | 176 | if(search_input.text || search_input.inputMethodComposing) | 170 | if(searchInput.text || searchInput.inputMethodComposing) |
428 | 177 | return "" | 171 | return "" |
429 | 178 | else if(dash.currentPage != undefined && dash.currentPage.model.searchHint) | ||
430 | 179 | return dash.currentPage.model.searchHint | ||
431 | 180 | else | 172 | else |
433 | 181 | return u2d.tr("Search") | 173 | return placeHolderText |
434 | 182 | } | 174 | } |
435 | 183 | } | 175 | } |
436 | 184 | } | 176 | } |
437 | 185 | 177 | ||
438 | === renamed file 'shell/dash/artwork/background_sheen.png' => 'shell/common/artwork/background_sheen.png' | |||
439 | === renamed file 'shell/dash/artwork/cross.png' => 'shell/common/artwork/cross.png' | |||
440 | === renamed file 'shell/dash/artwork/desktop_dash_background.png' => 'shell/common/artwork/desktop_dash_background.png' | |||
441 | === renamed file 'shell/dash/artwork/desktop_dash_background.sci' => 'shell/common/artwork/desktop_dash_background.sci' | |||
442 | === renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.png' => 'shell/common/artwork/desktop_dash_background_no_transparency.png' | |||
443 | === renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.sci' => 'shell/common/artwork/desktop_dash_background_no_transparency.sci' | |||
444 | === renamed file 'shell/dash/artwork/search_background.png' => 'shell/common/artwork/search_background.png' | |||
445 | === renamed file 'shell/dash/artwork/search_background.sci' => 'shell/common/artwork/search_background.sci' | |||
446 | === renamed file 'shell/dash/artwork/search_icon.png' => 'shell/common/artwork/search_icon.png' | |||
447 | === modified file 'shell/dash/Dash.qml' | |||
448 | --- shell/dash/Dash.qml 2012-02-09 11:22:43 +0000 | |||
449 | +++ shell/dash/Dash.qml 2012-02-13 12:01:24 +0000 | |||
450 | @@ -106,6 +106,7 @@ | |||
451 | 106 | for (var i=0; i<lenses.rowCount(); i++) { | 106 | for (var i=0; i<lenses.rowCount(); i++) { |
452 | 107 | lenses.get(i).viewType = Lens.Hidden | 107 | lenses.get(i).viewType = Lens.Hidden |
453 | 108 | } | 108 | } |
454 | 109 | declarativeView.activeLens = "" | ||
455 | 109 | } | 110 | } |
456 | 110 | 111 | ||
457 | 111 | SpreadMonitor { | 112 | SpreadMonitor { |
458 | @@ -133,11 +134,19 @@ | |||
459 | 133 | return | 134 | return |
460 | 134 | } | 135 | } |
461 | 135 | 136 | ||
462 | 136 | /* To activate lens, we set its viewType to LensView, and then set all | ||
463 | 137 | other lenses to Hidden */ | ||
464 | 138 | for (var i=0; i<lenses.rowCount(); i++) { | 137 | for (var i=0; i<lenses.rowCount(); i++) { |
465 | 139 | var thislens = lenses.get(i) | 138 | var thislens = lenses.get(i) |
467 | 140 | thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden | 139 | if (lensId == "home.lens") { |
468 | 140 | if (thislens.id == lensId) { | ||
469 | 141 | thislens.viewType = Lens.LensView | ||
470 | 142 | continue | ||
471 | 143 | } | ||
472 | 144 | /* When Home is shown, need to notify all other lenses. Those in the global view | ||
473 | 145 | (in home search results page) are set to HomeView, all others to Hidden */ | ||
474 | 146 | thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden | ||
475 | 147 | } else { | ||
476 | 148 | thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden | ||
477 | 149 | } | ||
478 | 141 | } | 150 | } |
479 | 142 | 151 | ||
480 | 143 | buildLensPage(lens) | 152 | buildLensPage(lens) |
481 | @@ -147,20 +156,19 @@ | |||
482 | 147 | 156 | ||
483 | 148 | function activateHome() { | 157 | function activateHome() { |
484 | 149 | if (spreadMonitor.shown) return | 158 | if (spreadMonitor.shown) return |
491 | 150 | 159 | if (declarativeView.haveCustomHomeShortcuts) { | |
492 | 151 | /* When Home is shown, need to notify all other lenses. Those in the global view | 160 | for (var i=0; i<lenses.rowCount(); i++) { |
493 | 152 | (in home search results page) are set to HomeView, all others to Hidden */ | 161 | lenses.get(i).viewType = Lens.Hidden |
494 | 153 | for (var i=0; i<lenses.rowCount(); i++) { | 162 | } |
495 | 154 | var thislens = lenses.get(i) | 163 | pageLoader.setSource("Home.qml") |
496 | 155 | thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden | 164 | /* Take advantage of the fact that the loaded qml is local and setting |
497 | 165 | the source loads it immediately making pageLoader.item valid */ | ||
498 | 166 | activatePage(pageLoader.item) | ||
499 | 167 | declarativeView.activeLens = "" | ||
500 | 168 | dash.active = true | ||
501 | 169 | } else { | ||
502 | 170 | activateLens("home.lens") | ||
503 | 156 | } | 171 | } |
504 | 157 | |||
505 | 158 | pageLoader.setSource("Home.qml") | ||
506 | 159 | /* Take advantage of the fact that the loaded qml is local and setting | ||
507 | 160 | the source loads it immediately making pageLoader.item valid */ | ||
508 | 161 | activatePage(pageLoader.item) | ||
509 | 162 | declarativeView.activeLens = "" | ||
510 | 163 | dash.active = true | ||
511 | 164 | } | 172 | } |
512 | 165 | 173 | ||
513 | 166 | function activateLensWithOptionFilter(lensId, filterId, optionId) { | 174 | function activateLensWithOptionFilter(lensId, filterId, optionId) { |
514 | @@ -211,55 +219,15 @@ | |||
515 | 211 | } | 219 | } |
516 | 212 | } | 220 | } |
517 | 213 | 221 | ||
519 | 214 | Item { | 222 | Background { |
520 | 215 | id: background | 223 | id: background |
521 | 216 | 224 | ||
522 | 217 | anchors.fill: parent | 225 | anchors.fill: parent |
523 | 218 | 226 | ||
568 | 219 | /* Avoid redraw at rendering */ | 227 | active: dash.active |
569 | 220 | effect: CacheEffect {} | 228 | fullscreen: declarativeView.dashMode != ShellDeclarativeView.DesktopMode |
570 | 221 | 229 | xPosition: launcherLoader.width | |
571 | 222 | Item { | 230 | yPosition: declarativeView.globalPosition.y |
528 | 223 | anchors.fill: parent | ||
529 | 224 | anchors.bottomMargin: content.anchors.bottomMargin | ||
530 | 225 | anchors.rightMargin: content.anchors.rightMargin | ||
531 | 226 | clip: true | ||
532 | 227 | |||
533 | 228 | Image { | ||
534 | 229 | id: blurredBackground | ||
535 | 230 | |||
536 | 231 | effect: Blur {blurRadius: 12} | ||
537 | 232 | |||
538 | 233 | /* 'source' needs to be set when the dash becomes visible, that | ||
539 | 234 | is when dash.active becomes true, so that a | ||
540 | 235 | screenshot of the windows behind the dash is taken at that | ||
541 | 236 | point. | ||
542 | 237 | See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop | ||
543 | 238 | */ | ||
544 | 239 | |||
545 | 240 | /* Use an image of the root window which essentially is a | ||
546 | 241 | capture of the entire screen */ | ||
547 | 242 | source: dash.active ? "image://window/root" : "" | ||
548 | 243 | cache: false | ||
549 | 244 | |||
550 | 245 | fillMode: Image.PreserveAspectCrop | ||
551 | 246 | x: -launcherLoader.width | ||
552 | 247 | y: -declarativeView.globalPosition.y | ||
553 | 248 | } | ||
554 | 249 | |||
555 | 250 | Image { | ||
556 | 251 | anchors.fill: parent | ||
557 | 252 | fillMode: Image.PreserveAspectCrop | ||
558 | 253 | source: "artwork/background_sheen.png" | ||
559 | 254 | } | ||
560 | 255 | } | ||
561 | 256 | |||
562 | 257 | BorderImage { | ||
563 | 258 | anchors.fill: parent | ||
564 | 259 | visible: declarativeView.dashMode == ShellDeclarativeView.DesktopMode | ||
565 | 260 | source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci" | ||
566 | 261 | mirror: isRightToLeft() | ||
567 | 262 | } | ||
572 | 263 | } | 231 | } |
573 | 264 | 232 | ||
574 | 265 | Item { | 233 | Item { |
575 | @@ -269,8 +237,8 @@ | |||
576 | 269 | /* Margins in DesktopMode set so that the content does not overlap with | 237 | /* Margins in DesktopMode set so that the content does not overlap with |
577 | 270 | the border defined by the background image. | 238 | the border defined by the background image. |
578 | 271 | */ | 239 | */ |
581 | 272 | anchors.bottomMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 39 : 0 | 240 | anchors.bottomMargin: background.bottomBorderThickness |
582 | 273 | anchors.rightMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 37 : 0 | 241 | anchors.rightMargin: background.rightBorderThickness |
583 | 274 | 242 | ||
584 | 275 | /* Unhandled keys will always be forwarded to the search bar. That way | 243 | /* Unhandled keys will always be forwarded to the search bar. That way |
585 | 276 | the user can type and search from anywhere in the interface without | 244 | the user can type and search from anywhere in the interface without |
586 | @@ -296,6 +264,17 @@ | |||
587 | 296 | anchors.rightMargin: 15 | 264 | anchors.rightMargin: 15 |
588 | 297 | 265 | ||
589 | 298 | height: 42 | 266 | height: 42 |
590 | 267 | |||
591 | 268 | active: dash.active | ||
592 | 269 | placeHolderText: { | ||
593 | 270 | if(dash.currentPage != undefined && dash.currentPage.model.searchHint) | ||
594 | 271 | return dash.currentPage.model.searchHint | ||
595 | 272 | else | ||
596 | 273 | return u2d.tr("Search") | ||
597 | 274 | } | ||
598 | 275 | |||
599 | 276 | onSearchQueryChanged: if (dash.currentPage != undefined) dash.currentPage.model.searchQuery = searchQuery | ||
600 | 277 | onActivateFirstResult: if (dash.currentPage != undefined) dash.currentPage.activateFirstResult() | ||
601 | 299 | } | 278 | } |
602 | 300 | 279 | ||
603 | 301 | FilterPane { | 280 | FilterPane { |
604 | @@ -304,7 +283,7 @@ | |||
605 | 304 | KeyNavigation.left: search_entry | 283 | KeyNavigation.left: search_entry |
606 | 305 | 284 | ||
607 | 306 | /* FilterPane is only to be displayed for lenses, not in the home page or Alt+F2 Run page */ | 285 | /* FilterPane is only to be displayed for lenses, not in the home page or Alt+F2 Run page */ |
609 | 307 | visible: declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens" | 286 | visible: declarativeView.activeLens != "home.lens" && declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens" |
610 | 308 | lens: visible && currentPage != undefined ? currentPage.model : undefined | 287 | lens: visible && currentPage != undefined ? currentPage.model : undefined |
611 | 309 | 288 | ||
612 | 310 | anchors.top: search_entry.anchors.top | 289 | anchors.top: search_entry.anchors.top |
613 | 311 | 290 | ||
614 | === modified file 'shell/dash/Home.qml' | |||
615 | --- shell/dash/Home.qml 2012-01-20 09:35:38 +0000 | |||
616 | +++ shell/dash/Home.qml 2012-02-13 12:01:24 +0000 | |||
617 | @@ -170,7 +170,7 @@ | |||
618 | 170 | width: sourceSize.width | 170 | width: sourceSize.width |
619 | 171 | height: sourceSize.height | 171 | height: sourceSize.height |
620 | 172 | 172 | ||
622 | 173 | source: "artwork/cross.png" | 173 | source: "../common/artwork/cross.png" |
623 | 174 | } | 174 | } |
624 | 175 | 175 | ||
625 | 176 | opacity: (expanded && declarativeView.dashMode == ShellDeclarativeView.DesktopMode) ? 1 : 0 | 176 | opacity: (expanded && declarativeView.dashMode == ShellDeclarativeView.DesktopMode) ? 1 : 0 |
626 | 177 | 177 | ||
627 | === modified file 'shell/dash/LensBar.qml' | |||
628 | --- shell/dash/LensBar.qml 2012-01-10 13:07:48 +0000 | |||
629 | +++ shell/dash/LensBar.qml 2012-02-13 12:01:24 +0000 | |||
630 | @@ -93,22 +93,6 @@ | |||
631 | 93 | return undefined | 93 | return undefined |
632 | 94 | } | 94 | } |
633 | 95 | 95 | ||
634 | 96 | /* Need to manually include the Home lens */ | ||
635 | 97 | LensButton { | ||
636 | 98 | id: homeLens | ||
637 | 99 | |||
638 | 100 | Accessible.name: u2d.tr("home") | ||
639 | 101 | |||
640 | 102 | focus: true | ||
641 | 103 | icon: "artwork/lens-nav-home.svg" | ||
642 | 104 | onClicked: dash.activateHome() | ||
643 | 105 | active: ( declarativeView.activeLens == "" ) | ||
644 | 106 | iconWidth: lensBar.iconWidth | ||
645 | 107 | iconSpacing: lensBar.iconSpacing | ||
646 | 108 | width: iconWidth+iconSpacing | ||
647 | 109 | height: lensContainer.height | ||
648 | 110 | } | ||
649 | 111 | |||
650 | 112 | /* Now fetch all other lenses and display */ | 96 | /* Now fetch all other lenses and display */ |
651 | 113 | Repeater{ | 97 | Repeater{ |
652 | 114 | id: repeater | 98 | id: repeater |
653 | @@ -118,9 +102,26 @@ | |||
654 | 118 | Accessible.name: u2d.tr(item.name) | 102 | Accessible.name: u2d.tr(item.name) |
655 | 119 | 103 | ||
656 | 120 | /* Heuristic: if iconHint does not contain a '/' then it is an icon name */ | 104 | /* Heuristic: if iconHint does not contain a '/' then it is an icon name */ |
660 | 121 | icon: item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint | 105 | icon: { |
661 | 122 | active: item.viewType == Lens.LensView | 106 | if (item.id == "home.lens") { |
662 | 123 | onClicked: dash.activateLens(item.id) | 107 | return "artwork/lens-nav-home.svg" |
663 | 108 | } | ||
664 | 109 | item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint | ||
665 | 110 | } | ||
666 | 111 | active: { | ||
667 | 112 | /* we need this in order to activate the arrow when using a custom shortcuts file */ | ||
668 | 113 | if (item.id == "home.lens" && declarativeView.activeLens == "") { | ||
669 | 114 | return true | ||
670 | 115 | } | ||
671 | 116 | return item.viewType == Lens.LensView | ||
672 | 117 | } | ||
673 | 118 | onClicked: { | ||
674 | 119 | if (item.id == "home.lens") { | ||
675 | 120 | dash.activateHome() | ||
676 | 121 | } else { | ||
677 | 122 | dash.activateLens(item.id) | ||
678 | 123 | } | ||
679 | 124 | } | ||
680 | 124 | iconWidth: lensBar.iconWidth | 125 | iconWidth: lensBar.iconWidth |
681 | 125 | iconSpacing: lensBar.iconSpacing | 126 | iconSpacing: lensBar.iconSpacing |
682 | 126 | width: iconWidth+iconSpacing | 127 | width: iconWidth+iconSpacing |
683 | 127 | 128 | ||
684 | === modified file 'shell/dash/LensView.qml' | |||
685 | --- shell/dash/LensView.qml 2012-01-10 10:42:46 +0000 | |||
686 | +++ shell/dash/LensView.qml 2012-02-13 12:01:24 +0000 | |||
687 | @@ -81,7 +81,7 @@ | |||
688 | 81 | bodyDelegate: Loader { | 81 | bodyDelegate: Loader { |
689 | 82 | visible: category_model.count > 0 | 82 | visible: category_model.count > 0 |
690 | 83 | width: parent.width | 83 | width: parent.width |
692 | 84 | height: visible ? item.contentHeight : 0 | 84 | height: item ? visible ? item.contentHeight : 0 : 0 |
693 | 85 | 85 | ||
694 | 86 | property string name: model.column_0 | 86 | property string name: model.column_0 |
695 | 87 | property string iconHint: model.column_1 | 87 | property string iconHint: model.column_1 |
696 | @@ -119,18 +119,19 @@ | |||
697 | 119 | Binding { target: item; property: "categoryId"; value: categoryId } | 119 | Binding { target: item; property: "categoryId"; value: categoryId } |
698 | 120 | Binding { target: item; property: "category_model"; value: category_model } | 120 | Binding { target: item; property: "category_model"; value: category_model } |
699 | 121 | Binding { target: item; property: "lens"; value: lensView.model } | 121 | Binding { target: item; property: "lens"; value: lensView.model } |
700 | 122 | Binding { target: item; property: "lensId"; value: lensView.model.id } | ||
701 | 122 | 123 | ||
702 | 123 | onLoaded: item.focus = true | 124 | onLoaded: item.focus = true |
703 | 124 | } | 125 | } |
704 | 125 | 126 | ||
705 | 126 | headerDelegate: CategoryHeader { | 127 | headerDelegate: CategoryHeader { |
707 | 127 | visible: body.item.needHeader && body.visible | 128 | visible: body.item ? body.item.needHeader && body.visible : false |
708 | 128 | height: visible ? 32 : 0 | 129 | height: visible ? 32 : 0 |
709 | 129 | 130 | ||
714 | 130 | property bool foldable: body.item.folded != undefined | 131 | property bool foldable: body.item ? body.item.folded != undefined : false |
715 | 131 | availableCount: foldable ? body.category_model.count - body.item.cellsPerRow : 0 | 132 | availableCount: body.item ? foldable ? body.category_model.count - body.item.cellsPerRow : 0 : 0 |
716 | 132 | folded: foldable ? body.item.folded : false | 133 | folded: body.item ? foldable ? body.item.folded : false : false |
717 | 133 | onClicked: if(foldable) body.item.folded = !body.item.folded | 134 | onClicked: if(foldable && body.item) body.item.folded = !body.item.folded |
718 | 134 | moving: flickerMoving | 135 | moving: flickerMoving |
719 | 135 | 136 | ||
720 | 136 | icon: body.iconHint | 137 | icon: body.iconHint |
721 | 137 | 138 | ||
722 | === modified file 'shell/dash/RendererGrid.qml' | |||
723 | --- shell/dash/RendererGrid.qml 2011-11-23 10:27:05 +0000 | |||
724 | +++ shell/dash/RendererGrid.qml 2012-02-13 12:01:24 +0000 | |||
725 | @@ -77,14 +77,6 @@ | |||
726 | 77 | 77 | ||
727 | 78 | FocusPath.index: index | 78 | FocusPath.index: index |
728 | 79 | 79 | ||
729 | 80 | property string uri: column_0 | ||
730 | 81 | property string iconHint: column_1 | ||
731 | 82 | property string categoryId: column_2 // FIXME: rename to categoryIndex | ||
732 | 83 | property string mimetype: column_3 | ||
733 | 84 | property string displayName: column_4 // FIXME: rename to name | ||
734 | 85 | property string comment: column_5 | ||
735 | 86 | property string dndUri: column_6 | ||
736 | 87 | |||
737 | 88 | Loader { | 80 | Loader { |
738 | 89 | id: loader | 81 | id: loader |
739 | 90 | 82 | ||
740 | @@ -96,13 +88,13 @@ | |||
741 | 96 | 88 | ||
742 | 97 | sourceComponent: cellRenderer | 89 | sourceComponent: cellRenderer |
743 | 98 | onLoaded: { | 90 | onLoaded: { |
749 | 99 | item.uri = uri | 91 | item.uri = column_0 |
750 | 100 | item.iconHint = iconHint | 92 | item.iconHint = column_1 |
751 | 101 | item.mimetype = mimetype | 93 | item.mimetype = column_3 |
752 | 102 | item.displayName = displayName | 94 | item.displayName = column_4 |
753 | 103 | item.comment = comment | 95 | item.comment = column_5 |
754 | 104 | item.focus = true | 96 | item.focus = true |
756 | 105 | item.dndUri = dndUri | 97 | item.dndUri = column_6 |
757 | 106 | } | 98 | } |
758 | 107 | } | 99 | } |
759 | 108 | } | 100 | } |
760 | 109 | 101 | ||
761 | === modified file 'shell/launcher/LauncherLoader.qml' | |||
762 | --- shell/launcher/LauncherLoader.qml 2012-02-10 11:17:36 +0000 | |||
763 | +++ shell/launcher/LauncherLoader.qml 2012-02-13 12:01:24 +0000 | |||
764 | @@ -72,8 +72,18 @@ | |||
765 | 72 | Connections { | 72 | Connections { |
766 | 73 | target: declarativeView | 73 | target: declarativeView |
767 | 74 | onSuperKeyHeldChanged: { | 74 | onSuperKeyHeldChanged: { |
770 | 75 | if (superKeyHeld) visibilityController.beginForceVisible() | 75 | if (superKeyHeld) { |
771 | 76 | else visibilityController.endForceVisible() | 76 | visibilityController.beginForceVisible() |
772 | 77 | if (shell.width > 1024 || shell.height > 768) { | ||
773 | 78 | shortcutHintLoader.source = "../shortcutoverlay/ShortcutHint.qml" | ||
774 | 79 | } | ||
775 | 80 | if (declarativeView.dashActive) { | ||
776 | 81 | declarativeView.dashActive = false | ||
777 | 82 | } | ||
778 | 83 | } else { | ||
779 | 84 | shortcutHintLoader.source = "" | ||
780 | 85 | visibilityController.endForceVisible() | ||
781 | 86 | } | ||
782 | 77 | } | 87 | } |
783 | 78 | } | 88 | } |
784 | 79 | 89 | ||
785 | 80 | 90 | ||
786 | === added directory 'shell/shortcutoverlay' | |||
787 | === added file 'shell/shortcutoverlay/ShortcutHint.qml' | |||
788 | --- shell/shortcutoverlay/ShortcutHint.qml 1970-01-01 00:00:00 +0000 | |||
789 | +++ shell/shortcutoverlay/ShortcutHint.qml 2012-02-13 12:01:24 +0000 | |||
790 | @@ -0,0 +1,207 @@ | |||
791 | 1 | /* | ||
792 | 2 | * This file is part of unity-2d | ||
793 | 3 | * | ||
794 | 4 | * Copyright 2011 Canonical Ltd. | ||
795 | 5 | * | ||
796 | 6 | * This program is free software; you can redistribute it and/or modify | ||
797 | 7 | * it under the terms of the GNU General Public License as published by | ||
798 | 8 | * the Free Software Foundation; version 3. | ||
799 | 9 | * | ||
800 | 10 | * This program is distributed in the hope that it will be useful, | ||
801 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
802 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
803 | 13 | * GNU General Public License for more details. | ||
804 | 14 | * | ||
805 | 15 | * You should have received a copy of the GNU General Public License | ||
806 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
807 | 17 | */ | ||
808 | 18 | import QtQuick 1.0 | ||
809 | 19 | import "../common/fontUtils.js" as FontUtils | ||
810 | 20 | |||
811 | 21 | Item { | ||
812 | 22 | id: main | ||
813 | 23 | objectName: "shortcutHintOverlay" | ||
814 | 24 | width: 950 | ||
815 | 25 | height: 660 | ||
816 | 26 | |||
817 | 27 | BorderImage { | ||
818 | 28 | id: border | ||
819 | 29 | smooth: true | ||
820 | 30 | anchors.fill: parent | ||
821 | 31 | border { left: 20; top: 20; right: 20; bottom: 20 } | ||
822 | 32 | source: "artwork/shortcut_hint_borders.png" | ||
823 | 33 | } | ||
824 | 34 | |||
825 | 35 | ListModel { | ||
826 | 36 | id: leftColumnModel | ||
827 | 37 | ListElement { sectionId: "launcher"; title: "Launcher"} | ||
828 | 38 | ListElement { sectionId: "dash"; title: "Dash"} | ||
829 | 39 | ListElement { sectionId: "topBar"; title: "Top Bar"} | ||
830 | 40 | } | ||
831 | 41 | |||
832 | 42 | ListModel { | ||
833 | 43 | id: rightColumnModel | ||
834 | 44 | ListElement { sectionId: "switching"; title: "Switching"} | ||
835 | 45 | ListElement { sectionId: "workspaces"; title: "Workspaces"} | ||
836 | 46 | ListElement { sectionId: "windows"; title: "Windows"} | ||
837 | 47 | } | ||
838 | 48 | |||
839 | 49 | ListModel { | ||
840 | 50 | id: launcherModel | ||
841 | 51 | ListElement { defaultKey: "Super (Press)"; description: "Open Launcher, displays shortcuts."; gconfKey: "" } | ||
842 | 52 | ListElement { defaultKey: "Alt + F1"; description: "Open Launcher keyboard navigation mode."; gconfKey: "" } | ||
843 | 53 | ListElement { defaultKey: "Super + Tab"; description: "Switch applications via Launcher."; gconfKey: "" } | ||
844 | 54 | ListElement { defaultKey: "Super + 1 to 9"; description: "Same as clicking on a Launcher icon."; gconfKey: "" } | ||
845 | 55 | ListElement { defaultKey: "Super + Shift + 1 to 9"; description: "Open new window of the app."; gconfKey: "" } | ||
846 | 56 | ListElement { defaultKey: "Super + T"; description: "Open the Rubbish Bin."; gconfKey: "" } | ||
847 | 57 | } | ||
848 | 58 | |||
849 | 59 | ListModel { | ||
850 | 60 | id: dashModel | ||
851 | 61 | ListElement { defaultKey: "Super (Tap)"; description: "Open the Dash home."; gconfKey: "" } | ||
852 | 62 | ListElement { defaultKey: "Super + A"; description: "Open the Dash App Lens."; gconfKey: "" } | ||
853 | 63 | ListElement { defaultKey: "Super + F"; description: "Open the Dash Files Lens."; gconfKey: "" } | ||
854 | 64 | ListElement { defaultKey: "Super + M"; description: "Open the Dash Files Music."; gconfKey: "" } | ||
855 | 65 | ListElement { defaultKey: "Ctrl + Tab"; description: "Switches between Lenses."; gconfKey: "" } | ||
856 | 66 | ListElement { defaultKey: "Cursors Keys"; description: "Moves the focus."; gconfKey: "" } | ||
857 | 67 | ListElement { defaultKey: "Enter / Return"; description: "Open currently focused item."; gconfKey: "" } | ||
858 | 68 | ListElement { defaultKey: "Alt + F2"; description: "'Run Command' mode."; gconfKey: "" } | ||
859 | 69 | } | ||
860 | 70 | |||
861 | 71 | ListModel { | ||
862 | 72 | id: topBarModel | ||
863 | 73 | ListElement { defaultKey: "Alt"; description: "Reveals application menu."; gconfKey: "" } | ||
864 | 74 | ListElement { defaultKey: "Alt + F10"; description: "Open the indicator menu."; gconfKey: "" } | ||
865 | 75 | ListElement { defaultKey: "Cursor Left & Right"; description: "Moves focus between indicators."; gconfKey: "" } | ||
866 | 76 | } | ||
867 | 77 | |||
868 | 78 | ListModel { | ||
869 | 79 | id: switchingModel | ||
870 | 80 | ListElement { defaultKey: "Alt + Tab"; description: "Switch between applications."; gconfKey: "/apps/metacity/global_keybindings/switch_windows"} | ||
871 | 81 | ListElement { defaultKey: "Alt + Grave"; description: "Switch windows of current application."; gconfKey: "/apps/metacity/global_keybindings/cycle_group"} | ||
872 | 82 | ListElement { defaultKey: "Cursor Up"; description: "Close window switch, return to app switch."; gconfKey: "" } | ||
873 | 83 | ListElement { defaultKey: "Cursor Left & Right"; description: "Moves the focus."; gconfKey: "" } | ||
874 | 84 | } | ||
875 | 85 | |||
876 | 86 | ListModel { | ||
877 | 87 | id: workspacesModel | ||
878 | 88 | ListElement { defaultKey: "Super + S"; description: "Spread workspaces."; gconfKey: "" } | ||
879 | 89 | ListElement { defaultKey: "Super + Cursors"; description: "Switch workspaces."; gconfKey: "/apps/metacity/global_keybindings/;switch_to_workspace_down;switch_to_workspace_up;switch_to_workspace_left;switch_to_workspace_right" } | ||
880 | 90 | ListElement { defaultKey: "Super + Alt + Cursors"; description: "Move focused window to other workspace."; gconfKey: "/apps/metacity/window_keybindings/;move_to_workspace_down;move_to_workspace_left;move_to_workspace_right;move_to_workspace_up" } | ||
881 | 91 | } | ||
882 | 92 | |||
883 | 93 | ListModel { | ||
884 | 94 | id: windowModel | ||
885 | 95 | ListElement { defaultKey: "Super + W"; description: "Spreads all windows in the current workspace."; gconfKey: "" } | ||
886 | 96 | ListElement { defaultKey: "Super + D"; description: "Minimizes all windows."; gconfKey: "/apps/metacity/global_keybindings/show_desktop" } | ||
887 | 97 | ListElement { defaultKey: "Alt + Space"; description: "Opens window accessibility menu."; gconfKey: "/apps/metacity/window_keybindings/activate_window_menu" } | ||
888 | 98 | ListElement { defaultKey: "Alt + F10"; description: "Maximizes or un-maximizes current window."; gconfKey: "/apps/metacity/window_keybindings/toggle_maximized" } | ||
889 | 99 | ListElement { defaultKey: "Alt + F9"; description: "Minimizes current window."; gconfKey: "/apps/metacity/window_keybindings/minimize" } | ||
890 | 100 | ListElement { defaultKey: "Alt + F8"; description: "Resizes current window."; gconfKey: "/apps/metacity/window_keybindings/begin_resize" } | ||
891 | 101 | ListElement { defaultKey: "Alt + F4"; description: "Closes current window."; gconfKey: "/apps/metacity/window_keybindings/close" } | ||
892 | 102 | ListElement { defaultKey: "Ctrl + Alt + Num"; description: "Places window in corresponding positions."; gconfKey: "/apps/metacity/window_keybindings/;move_to_corner_ne;move_to_corner_nw;move_to_corner_se;move_to_corner_sw;move_to_side_e;move_to_side_n;move_to_side_s;move_to_side_w" } | ||
893 | 103 | ListElement { defaultKey: "Alt + Left Mouse Drag"; description: "Move window."; gconfKey: "" } | ||
894 | 104 | ListElement { defaultKey: "Alt + Middle Mouse Drag"; description: "Resize window."; gconfKey: "" } | ||
895 | 105 | } | ||
896 | 106 | |||
897 | 107 | Rectangle { | ||
898 | 108 | id: totalArea | ||
899 | 109 | color: Qt.lighter("#5e275023", -0.8) | ||
900 | 110 | radius: 8 | ||
901 | 111 | smooth: true | ||
902 | 112 | anchors.fill: parent | ||
903 | 113 | anchors.margins: 10 | ||
904 | 114 | |||
905 | 115 | Item { | ||
906 | 116 | id: headerArea | ||
907 | 117 | y: 0 | ||
908 | 118 | height: 75 | ||
909 | 119 | anchors.left: parent.left | ||
910 | 120 | anchors.right: parent.right | ||
911 | 121 | smooth: false | ||
912 | 122 | |||
913 | 123 | Text { | ||
914 | 124 | id: title | ||
915 | 125 | x: 350 | ||
916 | 126 | y: 25 | ||
917 | 127 | color: "#ffffff" | ||
918 | 128 | text: u2d.tr("Keyboard Shortcuts") | ||
919 | 129 | anchors.bottom: parent.bottom | ||
920 | 130 | anchors.bottomMargin: 22 | ||
921 | 131 | anchors.horizontalCenterOffset: 0 | ||
922 | 132 | verticalAlignment: Text.AlignTop | ||
923 | 133 | anchors.horizontalCenter: parent.horizontalCenter | ||
924 | 134 | smooth: true | ||
925 | 135 | font.bold: true | ||
926 | 136 | horizontalAlignment: Text.AlignHCenter | ||
927 | 137 | font.pixelSize: FontUtils.fontSizeToPixels("x-large") | ||
928 | 138 | } | ||
929 | 139 | } | ||
930 | 140 | |||
931 | 141 | Item { | ||
932 | 142 | id: contentsArea | ||
933 | 143 | anchors.top: headerArea.bottom | ||
934 | 144 | anchors.right: parent.right | ||
935 | 145 | anchors.bottom: parent.bottom | ||
936 | 146 | anchors.left: parent.left | ||
937 | 147 | anchors.leftMargin: 20 | ||
938 | 148 | anchors.rightMargin: 20 | ||
939 | 149 | |||
940 | 150 | Rectangle { | ||
941 | 151 | id: topDivider | ||
942 | 152 | width: 200 | ||
943 | 153 | height: 1 | ||
944 | 154 | color: "#ffffff" | ||
945 | 155 | opacity: 0.2 | ||
946 | 156 | smooth: true | ||
947 | 157 | anchors.left: parent.left | ||
948 | 158 | anchors.right: parent.right | ||
949 | 159 | anchors.top: parent.top | ||
950 | 160 | } | ||
951 | 161 | |||
952 | 162 | Item { | ||
953 | 163 | id: contentLeft | ||
954 | 164 | anchors.left: parent.left | ||
955 | 165 | anchors.right: contentCenter.left | ||
956 | 166 | anchors.top: topDivider.bottom | ||
957 | 167 | anchors.bottom: parent.bottom | ||
958 | 168 | |||
959 | 169 | Column { | ||
960 | 170 | id: leftColumn | ||
961 | 171 | Repeater { | ||
962 | 172 | model: leftColumnModel | ||
963 | 173 | ShortcutHintSection {} | ||
964 | 174 | } | ||
965 | 175 | } | ||
966 | 176 | } | ||
967 | 177 | |||
968 | 178 | Item { | ||
969 | 179 | id: contentCenter | ||
970 | 180 | x: 438 | ||
971 | 181 | width: 40 | ||
972 | 182 | anchors.top: parent.top | ||
973 | 183 | anchors.bottom: parent.bottom | ||
974 | 184 | anchors.horizontalCenter: parent.horizontalCenter | ||
975 | 185 | } | ||
976 | 186 | |||
977 | 187 | Item { | ||
978 | 188 | id: contentRight | ||
979 | 189 | x: 445 | ||
980 | 190 | y: 0 | ||
981 | 191 | width: 445 | ||
982 | 192 | anchors.left: contentCenter.right | ||
983 | 193 | anchors.right: parent.right | ||
984 | 194 | anchors.top: parent.top | ||
985 | 195 | anchors.bottom: parent.bottom | ||
986 | 196 | |||
987 | 197 | Column { | ||
988 | 198 | id: rightColumn | ||
989 | 199 | Repeater { | ||
990 | 200 | model: rightColumnModel | ||
991 | 201 | ShortcutHintSection {} | ||
992 | 202 | } | ||
993 | 203 | } | ||
994 | 204 | } | ||
995 | 205 | } | ||
996 | 206 | } | ||
997 | 207 | } | ||
998 | 0 | 208 | ||
999 | === added file 'shell/shortcutoverlay/ShortcutHintSection.qml' | |||
1000 | --- shell/shortcutoverlay/ShortcutHintSection.qml 1970-01-01 00:00:00 +0000 | |||
1001 | +++ shell/shortcutoverlay/ShortcutHintSection.qml 2012-02-13 12:01:24 +0000 | |||
1002 | @@ -0,0 +1,160 @@ | |||
1003 | 1 | /* | ||
1004 | 2 | * This file is part of unity-2d | ||
1005 | 3 | * | ||
1006 | 4 | * Copyright 2011 Canonical Ltd. | ||
1007 | 5 | * | ||
1008 | 6 | * This program is free software; you can redistribute it and/or modify | ||
1009 | 7 | * it under the terms of the GNU General Public License as published by | ||
1010 | 8 | * the Free Software Foundation; version 3. | ||
1011 | 9 | * | ||
1012 | 10 | * This program is distributed in the hope that it will be useful, | ||
1013 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1014 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1015 | 13 | * GNU General Public License for more details. | ||
1016 | 14 | * | ||
1017 | 15 | * You should have received a copy of the GNU General Public License | ||
1018 | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1019 | 17 | */ | ||
1020 | 18 | import QtQuick 1.0 | ||
1021 | 19 | import Unity2d 1.0 /* required for GConfItem */ | ||
1022 | 20 | import "../common/fontUtils.js" as FontUtils | ||
1023 | 21 | |||
1024 | 22 | Item { | ||
1025 | 23 | id: shortcutHitSection | ||
1026 | 24 | width: 430 | ||
1027 | 25 | height: list.height + sectionTitle.height + sectionTitle.y + bottomSpacing.height + divider.height | ||
1028 | 26 | |||
1029 | 27 | // It is decided by design, that certain keys having multiple values in gconf, | ||
1030 | 28 | // like 'Switch workspaces' should only be displayed when the keys are symmetric. | ||
1031 | 29 | function symmetricKey( gconfKey ) { | ||
1032 | 30 | var gconfKeys = gconfKey.split(";"); | ||
1033 | 31 | var previousModifier = "" | ||
1034 | 32 | var count = gconfKeys.length | ||
1035 | 33 | var gconfKey_base = gconfKeys[0] | ||
1036 | 34 | for (var i = 1; i < count; i++) { | ||
1037 | 35 | var gconfItem = Qt.createQmlObject('import QtQuick 1.0; import Unity2d 1.0; GConfItem {}', main); | ||
1038 | 36 | gconfItem.key = gconfKey_base+gconfKeys[i] | ||
1039 | 37 | var gconfValue = gconfItem.value | ||
1040 | 38 | var modifier = gconfValue.substring(0,gconfValue.lastIndexOf(">")+1) | ||
1041 | 39 | var key = gconfValue.substring(gconfValue.lastIndexOf(">")+1) | ||
1042 | 40 | if (previousModifier == "") { | ||
1043 | 41 | previousModifier = gconfValue.substring(0,gconfValue.lastIndexOf(">")+1) | ||
1044 | 42 | continue | ||
1045 | 43 | } else { | ||
1046 | 44 | if (modifier != previousModifier) { | ||
1047 | 45 | return "" | ||
1048 | 46 | } | ||
1049 | 47 | } | ||
1050 | 48 | } | ||
1051 | 49 | |||
1052 | 50 | if (key.toLowerCase().indexOf("kp") == 0){ | ||
1053 | 51 | previousModifier = previousModifier + "Num" | ||
1054 | 52 | } else { | ||
1055 | 53 | previousModifier = previousModifier + "Cursors" | ||
1056 | 54 | } | ||
1057 | 55 | |||
1058 | 56 | return previousModifier; | ||
1059 | 57 | } | ||
1060 | 58 | |||
1061 | 59 | Component { | ||
1062 | 60 | id: itemDelegate | ||
1063 | 61 | Item { | ||
1064 | 62 | anchors.right: parent.right | ||
1065 | 63 | anchors.left: parent.left | ||
1066 | 64 | |||
1067 | 65 | function getShortcutKey() { | ||
1068 | 66 | if (gconfKey === "") { | ||
1069 | 67 | return defaultKey; | ||
1070 | 68 | } | ||
1071 | 69 | |||
1072 | 70 | var key = "" | ||
1073 | 71 | // Check is symmetric | ||
1074 | 72 | if (gconfKey.indexOf(";") != -1) { | ||
1075 | 73 | key = symmetricKey(gconfKey); | ||
1076 | 74 | if (key == "") { | ||
1077 | 75 | return "" | ||
1078 | 76 | } | ||
1079 | 77 | } else { | ||
1080 | 78 | var gconfItem = Qt.createQmlObject('import QtQuick 1.0; import Unity2d 1.0; GConfItem {}', main); | ||
1081 | 79 | gconfItem.key = gconfKey | ||
1082 | 80 | key = gconfItem.value | ||
1083 | 81 | } | ||
1084 | 82 | |||
1085 | 83 | key = key.replace("<Control>", "Ctrl + ") | ||
1086 | 84 | key = key.replace("<Shift>", "Shft + ") | ||
1087 | 85 | key = key.replace("<Alt>", "Alt + ") | ||
1088 | 86 | key = key.replace("<Mod4>", "Super + ") | ||
1089 | 87 | key = key.replace("<Super>", "Super + ") | ||
1090 | 88 | key = key.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } ); | ||
1091 | 89 | return key | ||
1092 | 90 | } | ||
1093 | 91 | |||
1094 | 92 | Item { | ||
1095 | 93 | id: key | ||
1096 | 94 | anchors.left: parent.left | ||
1097 | 95 | anchors.leftMargin: 0 | ||
1098 | 96 | width: 150 | ||
1099 | 97 | Text { id: keyText; text: getShortcutKey(); color: "#ffffff"; font.pixelSize: FontUtils.fontSizeToPixels("small") } | ||
1100 | 98 | } | ||
1101 | 99 | |||
1102 | 100 | Item { | ||
1103 | 101 | id: spacing | ||
1104 | 102 | anchors.left: key.right | ||
1105 | 103 | width: 10 | ||
1106 | 104 | } | ||
1107 | 105 | |||
1108 | 106 | Item { | ||
1109 | 107 | id: value | ||
1110 | 108 | width: 265 | ||
1111 | 109 | anchors.left: spacing.right | ||
1112 | 110 | Text { text: description; color: "#ffffff"; font.pixelSize: FontUtils.fontSizeToPixels("small") } | ||
1113 | 111 | } | ||
1114 | 112 | } | ||
1115 | 113 | } | ||
1116 | 114 | |||
1117 | 115 | Text { | ||
1118 | 116 | id: sectionTitle | ||
1119 | 117 | y: 27 | ||
1120 | 118 | color: "#ffffff" | ||
1121 | 119 | text: title | ||
1122 | 120 | anchors.left: parent.left | ||
1123 | 121 | font.bold: true | ||
1124 | 122 | font.pixelSize: FontUtils.fontSizeToPixels("large") | ||
1125 | 123 | } | ||
1126 | 124 | |||
1127 | 125 | ListView { | ||
1128 | 126 | id: list | ||
1129 | 127 | model: { | ||
1130 | 128 | if (sectionId == "launcher") return launcherModel | ||
1131 | 129 | else if (sectionId == "dash") return dashModel | ||
1132 | 130 | else if (sectionId == "topBar") return topBarModel | ||
1133 | 131 | else if (sectionId == "switching") return switchingModel | ||
1134 | 132 | else if (sectionId == "workspaces") return workspacesModel | ||
1135 | 133 | else if (sectionId == "windows") return windowModel | ||
1136 | 134 | else return "" | ||
1137 | 135 | } | ||
1138 | 136 | spacing: 18 | ||
1139 | 137 | anchors.left: parent.left | ||
1140 | 138 | anchors.top: sectionTitle.bottom | ||
1141 | 139 | anchors.topMargin: 14 | ||
1142 | 140 | height: (spacing * count) + anchors.topMargin | ||
1143 | 141 | delegate: itemDelegate | ||
1144 | 142 | } | ||
1145 | 143 | |||
1146 | 144 | Item { | ||
1147 | 145 | id: bottomSpacing | ||
1148 | 146 | height: 20 | ||
1149 | 147 | } | ||
1150 | 148 | |||
1151 | 149 | Rectangle { | ||
1152 | 150 | id: divider | ||
1153 | 151 | height: 1 | ||
1154 | 152 | color: "#ffffff" | ||
1155 | 153 | smooth: true | ||
1156 | 154 | anchors.top: shortcutHitSection.bottom | ||
1157 | 155 | anchors.right: parent.right | ||
1158 | 156 | anchors.left: parent.left | ||
1159 | 157 | opacity: 0.2 | ||
1160 | 158 | visible: (index != 2) | ||
1161 | 159 | } | ||
1162 | 160 | } | ||
1163 | 0 | 161 | ||
1164 | === added directory 'shell/shortcutoverlay/artwork' | |||
1165 | === added file 'shell/shortcutoverlay/artwork/shortcut_hint_borders.png' | |||
1166 | 1 | Binary files shell/shortcutoverlay/artwork/shortcut_hint_borders.png 1970-01-01 00:00:00 +0000 and shell/shortcutoverlay/artwork/shortcut_hint_borders.png 2012-02-13 12:01:24 +0000 differ | 162 | Binary files shell/shortcutoverlay/artwork/shortcut_hint_borders.png 1970-01-01 00:00:00 +0000 and shell/shortcutoverlay/artwork/shortcut_hint_borders.png 2012-02-13 12:01:24 +0000 differ |
1167 | === added file 'tests/shell/shortcut-hint-overlay-tests.rb' | |||
1168 | --- tests/shell/shortcut-hint-overlay-tests.rb 1970-01-01 00:00:00 +0000 | |||
1169 | +++ tests/shell/shortcut-hint-overlay-tests.rb 2012-02-13 12:01:24 +0000 | |||
1170 | @@ -0,0 +1,89 @@ | |||
1171 | 1 | #!/usr/bin/env ruby1.8 | ||
1172 | 2 | =begin | ||
1173 | 3 | /* | ||
1174 | 4 | * This file is part of unity-2d | ||
1175 | 5 | * | ||
1176 | 6 | * Copyright 2011 Canonical Ltd. | ||
1177 | 7 | * | ||
1178 | 8 | * This program is free software; you can redistribute it and/or modify | ||
1179 | 9 | * it under the terms of the GNU General Public License as published by | ||
1180 | 10 | * the Free Software Foundation; version 3. | ||
1181 | 11 | * | ||
1182 | 12 | * This program is distributed in the hope that it will be useful, | ||
1183 | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1184 | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1185 | 15 | * GNU General Public License for more details. | ||
1186 | 16 | * | ||
1187 | 17 | * You should have received a copy of the GNU General Public License | ||
1188 | 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1189 | 19 | */ | ||
1190 | 20 | =end | ||
1191 | 21 | |||
1192 | 22 | require '../run-tests.rb' unless $INIT_COMPLETED | ||
1193 | 23 | require 'xdo/xwindow' | ||
1194 | 24 | require 'xdo/keyboard' | ||
1195 | 25 | |||
1196 | 26 | ############################# Test Suite ############################# | ||
1197 | 27 | context "Launcher Shortcut hint overlay Tests" do | ||
1198 | 28 | # Run once at the beginning of this test suite | ||
1199 | 29 | startup do | ||
1200 | 30 | $SUT.execute_shell_command 'killall unity-2d-shell' | ||
1201 | 31 | $SUT.execute_shell_command 'killall unity-2d-shell' | ||
1202 | 32 | |||
1203 | 33 | # Minimize all windows | ||
1204 | 34 | XDo::XWindow.toggle_minimize_all | ||
1205 | 35 | end | ||
1206 | 36 | |||
1207 | 37 | # Run once at the end of this test suite | ||
1208 | 38 | shutdown do | ||
1209 | 39 | end | ||
1210 | 40 | |||
1211 | 41 | # Run before each test case begins | ||
1212 | 42 | setup do | ||
1213 | 43 | # Execute the application | ||
1214 | 44 | @app = $SUT.run( :name => UNITY_2D_SHELL, | ||
1215 | 45 | :arguments => "-testability", | ||
1216 | 46 | :sleeptime => 2 ) | ||
1217 | 47 | # Make certain application is ready for testing | ||
1218 | 48 | verify{ @app.Launcher() } | ||
1219 | 49 | end | ||
1220 | 50 | |||
1221 | 51 | # Run after each test case completes | ||
1222 | 52 | teardown do | ||
1223 | 53 | $SUT.execute_shell_command 'pkill -nf unity-2d-shell' | ||
1224 | 54 | end | ||
1225 | 55 | |||
1226 | 56 | ##################################################################################### | ||
1227 | 57 | # Test cases | ||
1228 | 58 | # Test case objectives: | ||
1229 | 59 | # * Check shortcut hint overlay display/close | ||
1230 | 60 | # Pre-conditions | ||
1231 | 61 | # * None | ||
1232 | 62 | # Test steps | ||
1233 | 63 | # * Hold super key | ||
1234 | 64 | # * Check the shortcut hint overlay is displayed | ||
1235 | 65 | # * Release super key | ||
1236 | 66 | # * Check that shortcut hint overlay is closed | ||
1237 | 67 | # Post-conditions | ||
1238 | 68 | # * None | ||
1239 | 69 | # References | ||
1240 | 70 | # * lp:#855532 | ||
1241 | 71 | test "Check shortcut hint overlay display/close" do | ||
1242 | 72 | # Check the hint window is not displayed initially | ||
1243 | 73 | verify_not(TIMEOUT, 'Shortcut hint overlay should be closed, but visible') { | ||
1244 | 74 | @app.ShellDeclarativeView().ShortcutHint(); | ||
1245 | 75 | } | ||
1246 | 76 | |||
1247 | 77 | XDo::Keyboard.key_down('SUPER') | ||
1248 | 78 | # Check the hint window is displayed when 'super' is pressed | ||
1249 | 79 | verify(TIMEOUT, 'Shortcut hint overlay should be displayed, but it is not') { | ||
1250 | 80 | @app.ShellDeclarativeView().ShortcutHint(); | ||
1251 | 81 | } | ||
1252 | 82 | |||
1253 | 83 | XDo::Keyboard.key_up('SUPER') | ||
1254 | 84 | # Check the hint window is closed when 'super' is released | ||
1255 | 85 | verify_not(TIMEOUT, 'Shortcut hint overlay should be closed, but visible') { | ||
1256 | 86 | @app.ShellDeclarativeView().ShortcutHint(); | ||
1257 | 87 | } | ||
1258 | 88 | end | ||
1259 | 89 | end |
Further details: /bugs.launchpad .net/unity- 2d/+bug/ 855532
The List of keys to be displayed and the layout of the overlay can be found in the bug description https:/
It is discussed with the design team, that certain keys having multiple values in gconf, like 'Switch workspaces' should only be displayed when the keys are symmetric.