Merge lp:~unity-2d-team/unity-2d/shortcut-hint-overlay into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Lohith D Shivamurthy on 2012-02-01
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
To merge this branch: bzr merge lp:~unity-2d-team/unity-2d/shortcut-hint-overlay
Reviewer Review Type Date Requested Status
Florian Boucault Needs Fixing on 2012-02-10
Gerry Boland Needs Fixing on 2012-02-03
Michał Sawicz Needs Fixing on 2012-02-02
Albert Astals Cid 2012-02-01 Needs Fixing on 2012-02-01
Review via email: mp+91116@code.launchpad.net

This proposal has been superseded by a proposal from 2012-02-13.

Description of the Change

[launcher] Shortcut list should be shown while super key is held.

To post a comment you must log in.
Lohith D Shivamurthy (dyams) wrote :

Further details:
The List of keys to be displayed and the layout of the overlay can be found in the bug description https://bugs.launchpad.net/unity-2d/+bug/855532
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.

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.

review: Needs Fixing
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?

review: Needs Information
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.

review: Needs Fixing
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.left: launcherLoader" ?
- in symmetricKey() and getShortcutKey(), GConfItem declared in Unity2D, no need to import QtQuick
- in your javascript, your notation is mixing camelCase and underscore_separator. Use camelCase please. Some spacing between arguments in the function calls would help readability too.
- 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://imgur.com/a/okLFf can you also check with design to see what to do?
- overlay needs to be positioned a little higher, see comparison image: https://imgur.com/xqAVf
- 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/input_shaping.rb in the diff, please remove.
- 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.

review: Needs Fixing
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 on 2012-02-08

[launcher] Use font utils

956. By Lohith D Shivamurthy on 2012-02-08

[launcher] Remove unnecessary margins

957. By Lohith D Shivamurthy on 2012-02-08

[launcher] Use camelCases and remove underscore_separator

958. By Lohith D Shivamurthy on 2012-02-08

[launcher] Fix spellings to US-English

959. By Lohith D Shivamurthy on 2012-02-08

[launcher] move import 'Unity2d 1.0' to ShortcutHitSection.qml

960. By Lohith D Shivamurthy on 2012-02-08

[launcher] Remove unnecessary margins

961. By Lohith D Shivamurthy on 2012-02-08

[launcher] Fix a confusing comment

962. By Lohith D Shivamurthy on 2012-02-08

[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.left: launcherLoader" ?
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.qml:22:1: Item is not a type'
> - in your javascript, your notation is mixing camelCase and
> underscore_separator. Use camelCase please. Some spacing between arguments in
> 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://imgur.com/a/okLFf
> 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://imgur.com/xqAVf
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/input_shaping.rb in the diff, please remove.
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.

review: Needs Fixing
963. By Lohith D Shivamurthy on 2012-02-13

merge lp:unity-2d

964. By Lohith D Shivamurthy on 2012-02-13

Move shortcut overlay files into separate folder

965. By Lohith D Shivamurthy on 2012-02-13

Directly import gconf 0.1

966. By Lohith D Shivamurthy on 2012-02-13

keep object id same as objectname

967. By Lohith D Shivamurthy on 2012-02-13

Add a FIXME for i18n of display strings

968. By Lohith D Shivamurthy on 2012-02-13

Remove background color

969. By Lohith D Shivamurthy on 2012-02-13

Use TextCustom instead of Text element

970. By Lohith D Shivamurthy on 2012-02-13

Fix missing parent object

971. By Lohith D Shivamurthy on 2012-02-13

Apply blur background

972. By Lohith D Shivamurthy on 2012-02-13

Activate/Deactivate overlay in shell.qml

973. By Lohith D Shivamurthy on 2012-02-13

Deactivate the overlay on tapping launcher tile shortcuts

974. By Lohith D Shivamurthy on 2012-02-14

Add a dummy function and call u2d.tr on all display strings

975. By Lohith D Shivamurthy on 2012-02-14

Improve background

976. By Lohith D Shivamurthy on 2012-02-14

Use workaround mentioned in the bugreport

977. By Lohith D Shivamurthy on 2012-02-15

Use regExp to replace case-insensitively

978. By Lohith D Shivamurthy on 2012-02-15

Replace Shft with Shift

979. By Lohith D Shivamurthy on 2012-02-15

Add missing file ModelElement.qml

980. By Lohith D Shivamurthy on 2012-02-15

merge

981. By Lohith D Shivamurthy on 2012-02-16

Remove extra field from ModelElement.qml

982. By Lohith D Shivamurthy on 2012-02-16

deactivate overlay when view looses focus

983. By Lohith D Shivamurthy on 2012-02-16

Apply black background with 70% opacity

984. By Tiago Salem Herrmann on 2012-03-19

merge trunk

985. By Tiago Salem Herrmann on 2012-03-19

onSuperKeyHeldChanged was moved to shellManager

986. By Tiago Salem Herrmann on 2012-03-20

remove debug

987. By Tiago Salem Herrmann on 2012-03-20

Force string object for the key. In some cases key is a object so replace() and substring fail

988. By Tiago Salem Herrmann on 2012-03-20

fix white spaces

989. By Tiago Salem Herrmann on 2012-03-20

ignore <Primary> string

990. By Tiago Salem Herrmann on 2012-03-21

merge trunk

991. By Tiago Salem Herrmann on 2012-03-21

add MultiMonitor support
Use the same trick as Dash to update the blurred background

992. By Gerry Boland on 2012-03-26

Replace 'KP_' with 'Num' in gconf string. Needed for Numpad keys

993. By Gerry Boland on 2012-03-26

QtQuick1.0 not needed to read gconf values

994. By Gerry Boland on 2012-03-26

Add basic RTL support

995. By Gerry Boland on 2012-03-29

[debian] Install shortcut overlay QML files

Unmerged revisions

995. By Gerry Boland on 2012-03-29

[debian] Install shortcut overlay QML files

994. By Gerry Boland on 2012-03-26

Add basic RTL support

993. By Gerry Boland on 2012-03-26

QtQuick1.0 not needed to read gconf values

992. By Gerry Boland on 2012-03-26

Replace 'KP_' with 'Num' in gconf string. Needed for Numpad keys

991. By Tiago Salem Herrmann on 2012-03-21

add MultiMonitor support
Use the same trick as Dash to update the blurred background

990. By Tiago Salem Herrmann on 2012-03-21

merge trunk

989. By Tiago Salem Herrmann on 2012-03-20

ignore <Primary> string

988. By Tiago Salem Herrmann on 2012-03-20

fix white spaces

987. By Tiago Salem Herrmann on 2012-03-20

Force string object for the key. In some cases key is a object so replace() and substring fail

986. By Tiago Salem Herrmann on 2012-03-20

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 #include "unity2dpanel.h"
6 #include "strutmanager.h"
7
8+// libqtgconf
9+#include <gconfitem-qml-wrapper.h>
10+
11 #include <QtDeclarative/qdeclarative.h>
12 #include <QDeclarativeEngine>
13 #include <QDeclarativeContext>
14@@ -176,6 +179,7 @@
15
16 qmlRegisterType<Unity2dPanel>(uri, 0, 1, "Unity2dPanel");
17 qmlRegisterType<StrutManager>(uri, 0, 1, "StrutManager");
18+ qmlRegisterType<GConfItemQmlWrapper>(uri, 0, 1, "GConfItem");
19 }
20
21 void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
22
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
28 m_filters = new Filters(m_unityLens->filters, this);
29
30- m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
31- m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
32- m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
33+ if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
34+ m_results->setModel(m_unityLens->results()->model());
35+ } else {
36+ m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
37+ }
38+ if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {
39+ m_globalResults->setModel(m_unityLens->global_results()->model());
40+ } else {
41+ m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
42+ }
43+ if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
44+ m_categories->setModel(m_unityLens->categories()->model());
45+ } else {
46+ m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
47+ }
48
49 /* Property change signals */
50 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
51
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
57 // libunity-core
58 #include <UnityCore/FilesystemLenses.h>
59+#include <UnityCore/HomeLens.h>
60+#include <unity2dtr.h>
61
62 Lenses::Lenses(QObject *parent) :
63 QAbstractListModel(parent)
64@@ -36,17 +38,18 @@
65 roles[Lenses::RoleVisible] = "visible";
66 setRoleNames(roles);
67
68+ m_homeLens = new unity::dash::HomeLens(u2dTr("Home").toStdString(), u2dTr("Home screen").toStdString(), u2dTr("Search").toStdString());
69 m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses");
70- for (unsigned int i=0; i<m_unityLenses->count(); i++) {
71- unity::dash::Lens::Ptr unityLens = m_unityLenses->GetLensAtIndex(i);
72- addUnityLens(unityLens, i);
73- }
74- m_unityLenses->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
75+ m_homeLens->AddLenses(*m_unityLenses);
76+ m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
77+ unity::dash::HomeLens::Ptr homeLensPtr(m_homeLens);
78+ addUnityLens(homeLensPtr, 0);
79 }
80
81 Lenses::~Lenses()
82 {
83 delete m_unityLenses;
84+ delete m_homeLens;
85 }
86
87 int Lenses::rowCount(const QModelIndex& parent) const
88
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
94 // libunity-core
95 #include <UnityCore/Lens.h>
96+#include <UnityCore/HomeLens.h>
97
98 namespace unity
99 {
100@@ -64,6 +65,7 @@
101
102 private:
103 unity::dash::Lenses* m_unityLenses;
104+ unity::dash::HomeLens* m_homeLens;
105 QList<Lens*> m_lenses;
106
107 void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index);
108
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 }
114 }
115
116+ Loader {
117+ id: shortcutHintLoader
118+ anchors.centerIn: parent
119+ }
120+
121 Connections {
122 target: declarativeView
123 onLauncherFocusRequested: {
124@@ -164,7 +169,7 @@
125
126 InputShapeMask {
127 id: shape1
128- source: "shell/dash/artwork/desktop_dash_background_no_transparency.png"
129+ source: "shell/common/artwork/desktop_dash_background_no_transparency.png"
130 color: "red"
131 position: Qt.point(dashLoader.width - 50, dashLoader.height - 49)
132 enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
133
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 #include <QtDBus/QDBusInterface>
139 #include <QX11Info>
140 #include <QGraphicsObject>
141+#include <QFileInfo>
142
143 // X11
144 #include <X11/Xlib.h>
145@@ -188,6 +189,12 @@
146 return m_active;
147 }
148
149+bool
150+ShellDeclarativeView::haveCustomHomeShortcuts() const
151+{
152+ return QFileInfo(unity2dDirectory() + "/shell/dash/HomeShortcutsCustomized.qml").exists();
153+}
154+
155 void
156 ShellDeclarativeView::setDashMode(ShellDeclarativeView::DashMode mode)
157 {
158
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 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
164 Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify
165 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
166+ Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts)
167
168 /* These two properties and mouse movement tracking on the widget are added here only because
169 we need to detect when the mouse is inside the area occupied by the lancher. This should
170@@ -59,6 +60,7 @@
171
172 /* getters */
173 bool dashActive() const;
174+ bool haveCustomHomeShortcuts() const;
175 DashMode dashMode() const;
176 const QString& activeLens() const;
177 bool expanded() const;
178
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+/*
184+ * This file is part of unity-2d
185+ *
186+ * Copyright 2010-2011 Canonical Ltd.
187+ *
188+ * This program is free software; you can redistribute it and/or modify
189+ * it under the terms of the GNU General Public License as published by
190+ * the Free Software Foundation; version 3.
191+ *
192+ * This program is distributed in the hope that it will be useful,
193+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
194+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
195+ * GNU General Public License for more details.
196+ *
197+ * You should have received a copy of the GNU General Public License
198+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
199+ */
200+
201+import QtQuick 1.1
202+import Unity2d 1.0
203+import Effects 1.0
204+
205+Item {
206+ id: background
207+ property bool active: false
208+ property bool fullscreen: false
209+ property int bottomBorderThickness
210+ property int rightBorderThickness
211+ /* coordinates of top left corner needed to capture correct segment of background */
212+ property int xPosition: 0
213+ property int yPosition: 0
214+
215+ /* Avoid redraw at rendering */
216+ effect: CacheEffect {}
217+
218+ Item {
219+ anchors.fill: parent
220+ anchors.bottomMargin: bottomBorderThickness
221+ anchors.rightMargin: rightBorderThickness
222+ clip: true
223+
224+ Image {
225+ id: blurredBackground
226+
227+ effect: Blur {blurRadius: 12}
228+
229+ /* 'source' needs to be set when this becomes visible, that is when active
230+ becomes true, so that a screenshot of the desktop is taken at that point.
231+ See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
232+ */
233+
234+ /* Use an image of the root window which essentially is a
235+ capture of the entire screen */
236+ source: active ? "image://window/root" : ""
237+ cache: false
238+
239+ fillMode: Image.PreserveAspectCrop
240+ x: -xPosition
241+ y: -yPosition
242+ }
243+
244+ Image {
245+ anchors.fill: parent
246+ fillMode: Image.PreserveAspectCrop
247+ source: "artwork/background_sheen.png"
248+ }
249+ }
250+
251+ BorderImage {
252+ id: border
253+
254+ /* Define properties of border here */
255+ property int bottomThickness: 39
256+ property int rightThickness: 37
257+
258+ anchors.fill: parent
259+ source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
260+ mirror: isRightToLeft()
261+ }
262+
263+ states: [
264+ State {
265+ name: "normal"
266+ when: !fullscreen
267+ PropertyChanges {
268+ target: background
269+ bottomBorderThickness: border.bottomThickness
270+ rightBorderThickness: border.rightThickness
271+ }
272+ PropertyChanges {
273+ target: border
274+ visible: true
275+ }
276+ },
277+ State {
278+ name: "fullscreen"
279+ when: fullscreen
280+ PropertyChanges {
281+ target: background
282+ bottomBorderThickness: 0
283+ rightBorderThickness: 0
284+ }
285+ PropertyChanges {
286+ target: border
287+ visible: false
288+ }
289+ }
290+ ]
291+}
292
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
298 import QtQuick 1.1
299 import Effects 1.0
300-import "../common/fontUtils.js" as FontUtils
301-import "../common"
302+import "fontUtils.js" as FontUtils
303
304 AbstractButton {
305 property string searchQuery
306+ property string placeHolderText: ""
307+ property bool active: false
308+
309+ signal activateFirstResult
310
311 Accessible.name: "Search Entry"
312
313- /* Cancels current search when the dash becomes invisible */
314- Connections {
315- target: dash
316- onActiveChanged: if (!dash.active) search_input.text = ""
317- }
318-
319- Binding {
320- target: dash.currentPage != undefined ? dash.currentPage.model : null
321- property: "searchQuery"
322- value: searchQuery
323- }
324+ /* Delete search when set in-active */
325+ onActiveChanged: if (!active) searchInput.text = ""
326
327 /* Keys forwarded to the search entry are forwarded to the text input. */
328- Keys.forwardTo: [search_input]
329+ Keys.forwardTo: [searchInput]
330
331 opacity: ( state == "selected" || state == "hovered" ) ? 1.0 : 0.7
332
333@@ -58,7 +52,7 @@
334 anchors.rightMargin: 16
335
336 Image {
337- id: search_icon
338+ id: searchIcon
339
340 anchors.left: parent.left
341 anchors.leftMargin: -9
342@@ -68,28 +62,28 @@
343
344 smooth: true
345
346- source: search_input.text ? "artwork/cross.png" : "artwork/search_icon.png"
347+ source: searchInput.text ? "artwork/cross.png" : "artwork/search_icon.png"
348 fillMode: Image.PreserveAspectFit
349 }
350
351 MouseArea {
352- id: clear_button
353+ id: clearButton
354
355 Accessible.name: "Clear"
356 Accessible.role: Accessible.PushButton
357
358- anchors.fill: search_icon
359+ anchors.fill: searchIcon
360
361 onClicked: {
362- search_input.forceActiveFocus()
363- search_input.text = ""
364+ searchInput.forceActiveFocus()
365+ searchInput.text = ""
366 }
367 }
368
369 TextInput {
370- id: search_input
371+ id: searchInput
372
373- Accessible.name: search_instructions.text
374+ Accessible.name: searchInstructions.text
375 Accessible.role: Accessible.EditableText
376
377 effect: DropShadow {
378@@ -99,10 +93,10 @@
379 offset.x: 0
380 offset.y: 0
381 color: "white"
382- enabled: search_input.text != "" || search_input.inputMethodComposing
383+ enabled: searchInput.text != "" || searchInput.inputMethodComposing
384 }
385
386- anchors.left: search_icon.right
387+ anchors.left: searchIcon.right
388 anchors.leftMargin: -5
389 anchors.right: parent.right
390 anchors.verticalCenter: parent.verticalCenter
391@@ -115,17 +109,17 @@
392 cursorDelegate: cursor
393 selectionColor: "gray"
394
395- onTextChanged: live_search_timeout.restart()
396+ onTextChanged: liveSearchTimeout.restart()
397
398 Timer {
399- id: live_search_timeout
400+ id: liveSearchTimeout
401 interval: 200
402- onTriggered: searchQuery = search_input.text
403+ onTriggered: searchQuery = searchInput.text
404 }
405
406 Keys.onPressed: {
407 if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) {
408- dash.currentPage.activateFirstResult()
409+ activateFirstResult()
410 event.accepted = true;
411 }
412 }
413@@ -159,7 +153,7 @@
414 }
415
416 TextCustom {
417- id: search_instructions
418+ id: searchInstructions
419
420 anchors.left: parent.left
421 anchors.right: parent.right
422@@ -173,12 +167,10 @@
423 fontSize: "x-large"
424 font.italic: true
425 text: {
426- if(search_input.text || search_input.inputMethodComposing)
427+ if(searchInput.text || searchInput.inputMethodComposing)
428 return ""
429- else if(dash.currentPage != undefined && dash.currentPage.model.searchHint)
430- return dash.currentPage.model.searchHint
431 else
432- return u2d.tr("Search")
433+ return placeHolderText
434 }
435 }
436 }
437
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 for (var i=0; i<lenses.rowCount(); i++) {
452 lenses.get(i).viewType = Lens.Hidden
453 }
454+ declarativeView.activeLens = ""
455 }
456
457 SpreadMonitor {
458@@ -133,11 +134,19 @@
459 return
460 }
461
462- /* To activate lens, we set its viewType to LensView, and then set all
463- other lenses to Hidden */
464 for (var i=0; i<lenses.rowCount(); i++) {
465 var thislens = lenses.get(i)
466- thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden
467+ if (lensId == "home.lens") {
468+ if (thislens.id == lensId) {
469+ thislens.viewType = Lens.LensView
470+ continue
471+ }
472+ /* When Home is shown, need to notify all other lenses. Those in the global view
473+ (in home search results page) are set to HomeView, all others to Hidden */
474+ thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden
475+ } else {
476+ thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden
477+ }
478 }
479
480 buildLensPage(lens)
481@@ -147,20 +156,19 @@
482
483 function activateHome() {
484 if (spreadMonitor.shown) return
485-
486- /* When Home is shown, need to notify all other lenses. Those in the global view
487- (in home search results page) are set to HomeView, all others to Hidden */
488- for (var i=0; i<lenses.rowCount(); i++) {
489- var thislens = lenses.get(i)
490- thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden
491+ if (declarativeView.haveCustomHomeShortcuts) {
492+ for (var i=0; i<lenses.rowCount(); i++) {
493+ lenses.get(i).viewType = Lens.Hidden
494+ }
495+ pageLoader.setSource("Home.qml")
496+ /* Take advantage of the fact that the loaded qml is local and setting
497+ the source loads it immediately making pageLoader.item valid */
498+ activatePage(pageLoader.item)
499+ declarativeView.activeLens = ""
500+ dash.active = true
501+ } else {
502+ activateLens("home.lens")
503 }
504-
505- pageLoader.setSource("Home.qml")
506- /* Take advantage of the fact that the loaded qml is local and setting
507- the source loads it immediately making pageLoader.item valid */
508- activatePage(pageLoader.item)
509- declarativeView.activeLens = ""
510- dash.active = true
511 }
512
513 function activateLensWithOptionFilter(lensId, filterId, optionId) {
514@@ -211,55 +219,15 @@
515 }
516 }
517
518- Item {
519+ Background {
520 id: background
521
522 anchors.fill: parent
523
524- /* Avoid redraw at rendering */
525- effect: CacheEffect {}
526-
527- Item {
528- anchors.fill: parent
529- anchors.bottomMargin: content.anchors.bottomMargin
530- anchors.rightMargin: content.anchors.rightMargin
531- clip: true
532-
533- Image {
534- id: blurredBackground
535-
536- effect: Blur {blurRadius: 12}
537-
538- /* 'source' needs to be set when the dash becomes visible, that
539- is when dash.active becomes true, so that a
540- screenshot of the windows behind the dash is taken at that
541- point.
542- See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
543- */
544-
545- /* Use an image of the root window which essentially is a
546- capture of the entire screen */
547- source: dash.active ? "image://window/root" : ""
548- cache: false
549-
550- fillMode: Image.PreserveAspectCrop
551- x: -launcherLoader.width
552- y: -declarativeView.globalPosition.y
553- }
554-
555- Image {
556- anchors.fill: parent
557- fillMode: Image.PreserveAspectCrop
558- source: "artwork/background_sheen.png"
559- }
560- }
561-
562- BorderImage {
563- anchors.fill: parent
564- visible: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
565- source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
566- mirror: isRightToLeft()
567- }
568+ active: dash.active
569+ fullscreen: declarativeView.dashMode != ShellDeclarativeView.DesktopMode
570+ xPosition: launcherLoader.width
571+ yPosition: declarativeView.globalPosition.y
572 }
573
574 Item {
575@@ -269,8 +237,8 @@
576 /* Margins in DesktopMode set so that the content does not overlap with
577 the border defined by the background image.
578 */
579- anchors.bottomMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 39 : 0
580- anchors.rightMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 37 : 0
581+ anchors.bottomMargin: background.bottomBorderThickness
582+ anchors.rightMargin: background.rightBorderThickness
583
584 /* Unhandled keys will always be forwarded to the search bar. That way
585 the user can type and search from anywhere in the interface without
586@@ -296,6 +264,17 @@
587 anchors.rightMargin: 15
588
589 height: 42
590+
591+ active: dash.active
592+ placeHolderText: {
593+ if(dash.currentPage != undefined && dash.currentPage.model.searchHint)
594+ return dash.currentPage.model.searchHint
595+ else
596+ return u2d.tr("Search")
597+ }
598+
599+ onSearchQueryChanged: if (dash.currentPage != undefined) dash.currentPage.model.searchQuery = searchQuery
600+ onActivateFirstResult: if (dash.currentPage != undefined) dash.currentPage.activateFirstResult()
601 }
602
603 FilterPane {
604@@ -304,7 +283,7 @@
605 KeyNavigation.left: search_entry
606
607 /* FilterPane is only to be displayed for lenses, not in the home page or Alt+F2 Run page */
608- visible: declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens"
609+ visible: declarativeView.activeLens != "home.lens" && declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens"
610 lens: visible && currentPage != undefined ? currentPage.model : undefined
611
612 anchors.top: search_entry.anchors.top
613
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 width: sourceSize.width
619 height: sourceSize.height
620
621- source: "artwork/cross.png"
622+ source: "../common/artwork/cross.png"
623 }
624
625 opacity: (expanded && declarativeView.dashMode == ShellDeclarativeView.DesktopMode) ? 1 : 0
626
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 return undefined
632 }
633
634- /* Need to manually include the Home lens */
635- LensButton {
636- id: homeLens
637-
638- Accessible.name: u2d.tr("home")
639-
640- focus: true
641- icon: "artwork/lens-nav-home.svg"
642- onClicked: dash.activateHome()
643- active: ( declarativeView.activeLens == "" )
644- iconWidth: lensBar.iconWidth
645- iconSpacing: lensBar.iconSpacing
646- width: iconWidth+iconSpacing
647- height: lensContainer.height
648- }
649-
650 /* Now fetch all other lenses and display */
651 Repeater{
652 id: repeater
653@@ -118,9 +102,26 @@
654 Accessible.name: u2d.tr(item.name)
655
656 /* Heuristic: if iconHint does not contain a '/' then it is an icon name */
657- icon: item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint
658- active: item.viewType == Lens.LensView
659- onClicked: dash.activateLens(item.id)
660+ icon: {
661+ if (item.id == "home.lens") {
662+ return "artwork/lens-nav-home.svg"
663+ }
664+ item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint
665+ }
666+ active: {
667+ /* we need this in order to activate the arrow when using a custom shortcuts file */
668+ if (item.id == "home.lens" && declarativeView.activeLens == "") {
669+ return true
670+ }
671+ return item.viewType == Lens.LensView
672+ }
673+ onClicked: {
674+ if (item.id == "home.lens") {
675+ dash.activateHome()
676+ } else {
677+ dash.activateLens(item.id)
678+ }
679+ }
680 iconWidth: lensBar.iconWidth
681 iconSpacing: lensBar.iconSpacing
682 width: iconWidth+iconSpacing
683
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 bodyDelegate: Loader {
689 visible: category_model.count > 0
690 width: parent.width
691- height: visible ? item.contentHeight : 0
692+ height: item ? visible ? item.contentHeight : 0 : 0
693
694 property string name: model.column_0
695 property string iconHint: model.column_1
696@@ -119,18 +119,19 @@
697 Binding { target: item; property: "categoryId"; value: categoryId }
698 Binding { target: item; property: "category_model"; value: category_model }
699 Binding { target: item; property: "lens"; value: lensView.model }
700+ Binding { target: item; property: "lensId"; value: lensView.model.id }
701
702 onLoaded: item.focus = true
703 }
704
705 headerDelegate: CategoryHeader {
706- visible: body.item.needHeader && body.visible
707+ visible: body.item ? body.item.needHeader && body.visible : false
708 height: visible ? 32 : 0
709
710- property bool foldable: body.item.folded != undefined
711- availableCount: foldable ? body.category_model.count - body.item.cellsPerRow : 0
712- folded: foldable ? body.item.folded : false
713- onClicked: if(foldable) body.item.folded = !body.item.folded
714+ property bool foldable: body.item ? body.item.folded != undefined : false
715+ availableCount: body.item ? foldable ? body.category_model.count - body.item.cellsPerRow : 0 : 0
716+ folded: body.item ? foldable ? body.item.folded : false : false
717+ onClicked: if(foldable && body.item) body.item.folded = !body.item.folded
718 moving: flickerMoving
719
720 icon: body.iconHint
721
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
727 FocusPath.index: index
728
729- property string uri: column_0
730- property string iconHint: column_1
731- property string categoryId: column_2 // FIXME: rename to categoryIndex
732- property string mimetype: column_3
733- property string displayName: column_4 // FIXME: rename to name
734- property string comment: column_5
735- property string dndUri: column_6
736-
737 Loader {
738 id: loader
739
740@@ -96,13 +88,13 @@
741
742 sourceComponent: cellRenderer
743 onLoaded: {
744- item.uri = uri
745- item.iconHint = iconHint
746- item.mimetype = mimetype
747- item.displayName = displayName
748- item.comment = comment
749+ item.uri = column_0
750+ item.iconHint = column_1
751+ item.mimetype = column_3
752+ item.displayName = column_4
753+ item.comment = column_5
754 item.focus = true
755- item.dndUri = dndUri
756+ item.dndUri = column_6
757 }
758 }
759 }
760
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 Connections {
766 target: declarativeView
767 onSuperKeyHeldChanged: {
768- if (superKeyHeld) visibilityController.beginForceVisible()
769- else visibilityController.endForceVisible()
770+ if (superKeyHeld) {
771+ visibilityController.beginForceVisible()
772+ if (shell.width > 1024 || shell.height > 768) {
773+ shortcutHintLoader.source = "../shortcutoverlay/ShortcutHint.qml"
774+ }
775+ if (declarativeView.dashActive) {
776+ declarativeView.dashActive = false
777+ }
778+ } else {
779+ shortcutHintLoader.source = ""
780+ visibilityController.endForceVisible()
781+ }
782 }
783 }
784
785
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+/*
792+ * This file is part of unity-2d
793+ *
794+ * Copyright 2011 Canonical Ltd.
795+ *
796+ * This program is free software; you can redistribute it and/or modify
797+ * it under the terms of the GNU General Public License as published by
798+ * the Free Software Foundation; version 3.
799+ *
800+ * This program is distributed in the hope that it will be useful,
801+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
802+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
803+ * GNU General Public License for more details.
804+ *
805+ * You should have received a copy of the GNU General Public License
806+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
807+ */
808+import QtQuick 1.0
809+import "../common/fontUtils.js" as FontUtils
810+
811+Item {
812+ id: main
813+ objectName: "shortcutHintOverlay"
814+ width: 950
815+ height: 660
816+
817+ BorderImage {
818+ id: border
819+ smooth: true
820+ anchors.fill: parent
821+ border { left: 20; top: 20; right: 20; bottom: 20 }
822+ source: "artwork/shortcut_hint_borders.png"
823+ }
824+
825+ ListModel {
826+ id: leftColumnModel
827+ ListElement { sectionId: "launcher"; title: "Launcher"}
828+ ListElement { sectionId: "dash"; title: "Dash"}
829+ ListElement { sectionId: "topBar"; title: "Top Bar"}
830+ }
831+
832+ ListModel {
833+ id: rightColumnModel
834+ ListElement { sectionId: "switching"; title: "Switching"}
835+ ListElement { sectionId: "workspaces"; title: "Workspaces"}
836+ ListElement { sectionId: "windows"; title: "Windows"}
837+ }
838+
839+ ListModel {
840+ id: launcherModel
841+ ListElement { defaultKey: "Super (Press)"; description: "Open Launcher, displays shortcuts."; gconfKey: "" }
842+ ListElement { defaultKey: "Alt + F1"; description: "Open Launcher keyboard navigation mode."; gconfKey: "" }
843+ ListElement { defaultKey: "Super + Tab"; description: "Switch applications via Launcher."; gconfKey: "" }
844+ ListElement { defaultKey: "Super + 1 to 9"; description: "Same as clicking on a Launcher icon."; gconfKey: "" }
845+ ListElement { defaultKey: "Super + Shift + 1 to 9"; description: "Open new window of the app."; gconfKey: "" }
846+ ListElement { defaultKey: "Super + T"; description: "Open the Rubbish Bin."; gconfKey: "" }
847+ }
848+
849+ ListModel {
850+ id: dashModel
851+ ListElement { defaultKey: "Super (Tap)"; description: "Open the Dash home."; gconfKey: "" }
852+ ListElement { defaultKey: "Super + A"; description: "Open the Dash App Lens."; gconfKey: "" }
853+ ListElement { defaultKey: "Super + F"; description: "Open the Dash Files Lens."; gconfKey: "" }
854+ ListElement { defaultKey: "Super + M"; description: "Open the Dash Files Music."; gconfKey: "" }
855+ ListElement { defaultKey: "Ctrl + Tab"; description: "Switches between Lenses."; gconfKey: "" }
856+ ListElement { defaultKey: "Cursors Keys"; description: "Moves the focus."; gconfKey: "" }
857+ ListElement { defaultKey: "Enter / Return"; description: "Open currently focused item."; gconfKey: "" }
858+ ListElement { defaultKey: "Alt + F2"; description: "'Run Command' mode."; gconfKey: "" }
859+ }
860+
861+ ListModel {
862+ id: topBarModel
863+ ListElement { defaultKey: "Alt"; description: "Reveals application menu."; gconfKey: "" }
864+ ListElement { defaultKey: "Alt + F10"; description: "Open the indicator menu."; gconfKey: "" }
865+ ListElement { defaultKey: "Cursor Left & Right"; description: "Moves focus between indicators."; gconfKey: "" }
866+ }
867+
868+ ListModel {
869+ id: switchingModel
870+ ListElement { defaultKey: "Alt + Tab"; description: "Switch between applications."; gconfKey: "/apps/metacity/global_keybindings/switch_windows"}
871+ ListElement { defaultKey: "Alt + Grave"; description: "Switch windows of current application."; gconfKey: "/apps/metacity/global_keybindings/cycle_group"}
872+ ListElement { defaultKey: "Cursor Up"; description: "Close window switch, return to app switch."; gconfKey: "" }
873+ ListElement { defaultKey: "Cursor Left & Right"; description: "Moves the focus."; gconfKey: "" }
874+ }
875+
876+ ListModel {
877+ id: workspacesModel
878+ ListElement { defaultKey: "Super + S"; description: "Spread workspaces."; gconfKey: "" }
879+ 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+ 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+ }
882+
883+ ListModel {
884+ id: windowModel
885+ ListElement { defaultKey: "Super + W"; description: "Spreads all windows in the current workspace."; gconfKey: "" }
886+ ListElement { defaultKey: "Super + D"; description: "Minimizes all windows."; gconfKey: "/apps/metacity/global_keybindings/show_desktop" }
887+ ListElement { defaultKey: "Alt + Space"; description: "Opens window accessibility menu."; gconfKey: "/apps/metacity/window_keybindings/activate_window_menu" }
888+ ListElement { defaultKey: "Alt + F10"; description: "Maximizes or un-maximizes current window."; gconfKey: "/apps/metacity/window_keybindings/toggle_maximized" }
889+ ListElement { defaultKey: "Alt + F9"; description: "Minimizes current window."; gconfKey: "/apps/metacity/window_keybindings/minimize" }
890+ ListElement { defaultKey: "Alt + F8"; description: "Resizes current window."; gconfKey: "/apps/metacity/window_keybindings/begin_resize" }
891+ ListElement { defaultKey: "Alt + F4"; description: "Closes current window."; gconfKey: "/apps/metacity/window_keybindings/close" }
892+ 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+ ListElement { defaultKey: "Alt + Left Mouse Drag"; description: "Move window."; gconfKey: "" }
894+ ListElement { defaultKey: "Alt + Middle Mouse Drag"; description: "Resize window."; gconfKey: "" }
895+ }
896+
897+ Rectangle {
898+ id: totalArea
899+ color: Qt.lighter("#5e275023", -0.8)
900+ radius: 8
901+ smooth: true
902+ anchors.fill: parent
903+ anchors.margins: 10
904+
905+ Item {
906+ id: headerArea
907+ y: 0
908+ height: 75
909+ anchors.left: parent.left
910+ anchors.right: parent.right
911+ smooth: false
912+
913+ Text {
914+ id: title
915+ x: 350
916+ y: 25
917+ color: "#ffffff"
918+ text: u2d.tr("Keyboard Shortcuts")
919+ anchors.bottom: parent.bottom
920+ anchors.bottomMargin: 22
921+ anchors.horizontalCenterOffset: 0
922+ verticalAlignment: Text.AlignTop
923+ anchors.horizontalCenter: parent.horizontalCenter
924+ smooth: true
925+ font.bold: true
926+ horizontalAlignment: Text.AlignHCenter
927+ font.pixelSize: FontUtils.fontSizeToPixels("x-large")
928+ }
929+ }
930+
931+ Item {
932+ id: contentsArea
933+ anchors.top: headerArea.bottom
934+ anchors.right: parent.right
935+ anchors.bottom: parent.bottom
936+ anchors.left: parent.left
937+ anchors.leftMargin: 20
938+ anchors.rightMargin: 20
939+
940+ Rectangle {
941+ id: topDivider
942+ width: 200
943+ height: 1
944+ color: "#ffffff"
945+ opacity: 0.2
946+ smooth: true
947+ anchors.left: parent.left
948+ anchors.right: parent.right
949+ anchors.top: parent.top
950+ }
951+
952+ Item {
953+ id: contentLeft
954+ anchors.left: parent.left
955+ anchors.right: contentCenter.left
956+ anchors.top: topDivider.bottom
957+ anchors.bottom: parent.bottom
958+
959+ Column {
960+ id: leftColumn
961+ Repeater {
962+ model: leftColumnModel
963+ ShortcutHintSection {}
964+ }
965+ }
966+ }
967+
968+ Item {
969+ id: contentCenter
970+ x: 438
971+ width: 40
972+ anchors.top: parent.top
973+ anchors.bottom: parent.bottom
974+ anchors.horizontalCenter: parent.horizontalCenter
975+ }
976+
977+ Item {
978+ id: contentRight
979+ x: 445
980+ y: 0
981+ width: 445
982+ anchors.left: contentCenter.right
983+ anchors.right: parent.right
984+ anchors.top: parent.top
985+ anchors.bottom: parent.bottom
986+
987+ Column {
988+ id: rightColumn
989+ Repeater {
990+ model: rightColumnModel
991+ ShortcutHintSection {}
992+ }
993+ }
994+ }
995+ }
996+ }
997+}
998
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+/*
1004+ * This file is part of unity-2d
1005+ *
1006+ * Copyright 2011 Canonical Ltd.
1007+ *
1008+ * This program is free software; you can redistribute it and/or modify
1009+ * it under the terms of the GNU General Public License as published by
1010+ * the Free Software Foundation; version 3.
1011+ *
1012+ * This program is distributed in the hope that it will be useful,
1013+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1014+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1015+ * GNU General Public License for more details.
1016+ *
1017+ * You should have received a copy of the GNU General Public License
1018+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1019+ */
1020+import QtQuick 1.0
1021+import Unity2d 1.0 /* required for GConfItem */
1022+import "../common/fontUtils.js" as FontUtils
1023+
1024+Item {
1025+ id: shortcutHitSection
1026+ width: 430
1027+ height: list.height + sectionTitle.height + sectionTitle.y + bottomSpacing.height + divider.height
1028+
1029+ // It is decided by design, that certain keys having multiple values in gconf,
1030+ // like 'Switch workspaces' should only be displayed when the keys are symmetric.
1031+ function symmetricKey( gconfKey ) {
1032+ var gconfKeys = gconfKey.split(";");
1033+ var previousModifier = ""
1034+ var count = gconfKeys.length
1035+ var gconfKey_base = gconfKeys[0]
1036+ for (var i = 1; i < count; i++) {
1037+ var gconfItem = Qt.createQmlObject('import QtQuick 1.0; import Unity2d 1.0; GConfItem {}', main);
1038+ gconfItem.key = gconfKey_base+gconfKeys[i]
1039+ var gconfValue = gconfItem.value
1040+ var modifier = gconfValue.substring(0,gconfValue.lastIndexOf(">")+1)
1041+ var key = gconfValue.substring(gconfValue.lastIndexOf(">")+1)
1042+ if (previousModifier == "") {
1043+ previousModifier = gconfValue.substring(0,gconfValue.lastIndexOf(">")+1)
1044+ continue
1045+ } else {
1046+ if (modifier != previousModifier) {
1047+ return ""
1048+ }
1049+ }
1050+ }
1051+
1052+ if (key.toLowerCase().indexOf("kp") == 0){
1053+ previousModifier = previousModifier + "Num"
1054+ } else {
1055+ previousModifier = previousModifier + "Cursors"
1056+ }
1057+
1058+ return previousModifier;
1059+ }
1060+
1061+ Component {
1062+ id: itemDelegate
1063+ Item {
1064+ anchors.right: parent.right
1065+ anchors.left: parent.left
1066+
1067+ function getShortcutKey() {
1068+ if (gconfKey === "") {
1069+ return defaultKey;
1070+ }
1071+
1072+ var key = ""
1073+ // Check is symmetric
1074+ if (gconfKey.indexOf(";") != -1) {
1075+ key = symmetricKey(gconfKey);
1076+ if (key == "") {
1077+ return ""
1078+ }
1079+ } else {
1080+ var gconfItem = Qt.createQmlObject('import QtQuick 1.0; import Unity2d 1.0; GConfItem {}', main);
1081+ gconfItem.key = gconfKey
1082+ key = gconfItem.value
1083+ }
1084+
1085+ key = key.replace("<Control>", "Ctrl + ")
1086+ key = key.replace("<Shift>", "Shft + ")
1087+ key = key.replace("<Alt>", "Alt + ")
1088+ key = key.replace("<Mod4>", "Super + ")
1089+ key = key.replace("<Super>", "Super + ")
1090+ key = key.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
1091+ return key
1092+ }
1093+
1094+ Item {
1095+ id: key
1096+ anchors.left: parent.left
1097+ anchors.leftMargin: 0
1098+ width: 150
1099+ Text { id: keyText; text: getShortcutKey(); color: "#ffffff"; font.pixelSize: FontUtils.fontSizeToPixels("small") }
1100+ }
1101+
1102+ Item {
1103+ id: spacing
1104+ anchors.left: key.right
1105+ width: 10
1106+ }
1107+
1108+ Item {
1109+ id: value
1110+ width: 265
1111+ anchors.left: spacing.right
1112+ Text { text: description; color: "#ffffff"; font.pixelSize: FontUtils.fontSizeToPixels("small") }
1113+ }
1114+ }
1115+ }
1116+
1117+ Text {
1118+ id: sectionTitle
1119+ y: 27
1120+ color: "#ffffff"
1121+ text: title
1122+ anchors.left: parent.left
1123+ font.bold: true
1124+ font.pixelSize: FontUtils.fontSizeToPixels("large")
1125+ }
1126+
1127+ ListView {
1128+ id: list
1129+ model: {
1130+ if (sectionId == "launcher") return launcherModel
1131+ else if (sectionId == "dash") return dashModel
1132+ else if (sectionId == "topBar") return topBarModel
1133+ else if (sectionId == "switching") return switchingModel
1134+ else if (sectionId == "workspaces") return workspacesModel
1135+ else if (sectionId == "windows") return windowModel
1136+ else return ""
1137+ }
1138+ spacing: 18
1139+ anchors.left: parent.left
1140+ anchors.top: sectionTitle.bottom
1141+ anchors.topMargin: 14
1142+ height: (spacing * count) + anchors.topMargin
1143+ delegate: itemDelegate
1144+ }
1145+
1146+ Item {
1147+ id: bottomSpacing
1148+ height: 20
1149+ }
1150+
1151+ Rectangle {
1152+ id: divider
1153+ height: 1
1154+ color: "#ffffff"
1155+ smooth: true
1156+ anchors.top: shortcutHitSection.bottom
1157+ anchors.right: parent.right
1158+ anchors.left: parent.left
1159+ opacity: 0.2
1160+ visible: (index != 2)
1161+ }
1162+}
1163
1164=== added directory 'shell/shortcutoverlay/artwork'
1165=== added file 'shell/shortcutoverlay/artwork/shortcut_hint_borders.png'
1166Binary 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+#!/usr/bin/env ruby1.8
1172+=begin
1173+/*
1174+ * This file is part of unity-2d
1175+ *
1176+ * Copyright 2011 Canonical Ltd.
1177+ *
1178+ * This program is free software; you can redistribute it and/or modify
1179+ * it under the terms of the GNU General Public License as published by
1180+ * the Free Software Foundation; version 3.
1181+ *
1182+ * This program is distributed in the hope that it will be useful,
1183+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1184+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1185+ * GNU General Public License for more details.
1186+ *
1187+ * You should have received a copy of the GNU General Public License
1188+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1189+ */
1190+=end
1191+
1192+require '../run-tests.rb' unless $INIT_COMPLETED
1193+require 'xdo/xwindow'
1194+require 'xdo/keyboard'
1195+
1196+############################# Test Suite #############################
1197+context "Launcher Shortcut hint overlay Tests" do
1198+ # Run once at the beginning of this test suite
1199+ startup do
1200+ $SUT.execute_shell_command 'killall unity-2d-shell'
1201+ $SUT.execute_shell_command 'killall unity-2d-shell'
1202+
1203+ # Minimize all windows
1204+ XDo::XWindow.toggle_minimize_all
1205+ end
1206+
1207+ # Run once at the end of this test suite
1208+ shutdown do
1209+ end
1210+
1211+ # Run before each test case begins
1212+ setup do
1213+ # Execute the application
1214+ @app = $SUT.run( :name => UNITY_2D_SHELL,
1215+ :arguments => "-testability",
1216+ :sleeptime => 2 )
1217+ # Make certain application is ready for testing
1218+ verify{ @app.Launcher() }
1219+ end
1220+
1221+ # Run after each test case completes
1222+ teardown do
1223+ $SUT.execute_shell_command 'pkill -nf unity-2d-shell'
1224+ end
1225+
1226+ #####################################################################################
1227+ # Test cases
1228+ # Test case objectives:
1229+ # * Check shortcut hint overlay display/close
1230+ # Pre-conditions
1231+ # * None
1232+ # Test steps
1233+ # * Hold super key
1234+ # * Check the shortcut hint overlay is displayed
1235+ # * Release super key
1236+ # * Check that shortcut hint overlay is closed
1237+ # Post-conditions
1238+ # * None
1239+ # References
1240+ # * lp:#855532
1241+ test "Check shortcut hint overlay display/close" do
1242+ # Check the hint window is not displayed initially
1243+ verify_not(TIMEOUT, 'Shortcut hint overlay should be closed, but visible') {
1244+ @app.ShellDeclarativeView().ShortcutHint();
1245+ }
1246+
1247+ XDo::Keyboard.key_down('SUPER')
1248+ # Check the hint window is displayed when 'super' is pressed
1249+ verify(TIMEOUT, 'Shortcut hint overlay should be displayed, but it is not') {
1250+ @app.ShellDeclarativeView().ShortcutHint();
1251+ }
1252+
1253+ XDo::Keyboard.key_up('SUPER')
1254+ # Check the hint window is closed when 'super' is released
1255+ verify_not(TIMEOUT, 'Shortcut hint overlay should be closed, but visible') {
1256+ @app.ShellDeclarativeView().ShortcutHint();
1257+ }
1258+ end
1259+end

Subscribers

People subscribed via source and target branches

to all changes: