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
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
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.

Description of the change

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

To post a comment you must log in.
Revision history for this message
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.

Revision history for this message
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
Revision history for this message
Florian Boucault (fboucault) wrote :

Of course, we won't merge that until unity-2d-shell is merged into lp:unity-2d.

Revision history for this message
Gerry Boland (gerboland) wrote :

Please give credit to Tiago in the commit message, for working on the UI side of this MR.

Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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
Revision history for this message
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
Revision history for this message
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 ShortcutHitSection.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'

Revision history for this message
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.

Revision history for this message
Florian Boucault (fboucault) wrote :

Please resubmit the MR against lp:unity-2d

Revision history for this message
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

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

onSuperKeyHeldChanged 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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libunity-2d-private/Unity2d/plugin.cpp'
--- libunity-2d-private/Unity2d/plugin.cpp 2012-02-08 11:05:30 +0000
+++ libunity-2d-private/Unity2d/plugin.cpp 2012-02-13 12:01:24 +0000
@@ -77,6 +77,9 @@
77#include "unity2dpanel.h"77#include "unity2dpanel.h"
78#include "strutmanager.h"78#include "strutmanager.h"
7979
80// libqtgconf
81#include <gconfitem-qml-wrapper.h>
82
80#include <QtDeclarative/qdeclarative.h>83#include <QtDeclarative/qdeclarative.h>
81#include <QDeclarativeEngine>84#include <QDeclarativeEngine>
82#include <QDeclarativeContext>85#include <QDeclarativeContext>
@@ -176,6 +179,7 @@
176179
177 qmlRegisterType<Unity2dPanel>(uri, 0, 1, "Unity2dPanel");180 qmlRegisterType<Unity2dPanel>(uri, 0, 1, "Unity2dPanel");
178 qmlRegisterType<StrutManager>(uri, 0, 1, "StrutManager");181 qmlRegisterType<StrutManager>(uri, 0, 1, "StrutManager");
182 qmlRegisterType<GConfItemQmlWrapper>(uri, 0, 1, "GConfItem");
179}183}
180184
181void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)185void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
182186
=== modified file 'libunity-2d-private/src/lens.cpp'
--- libunity-2d-private/src/lens.cpp 2011-12-14 22:45:04 +0000
+++ libunity-2d-private/src/lens.cpp 2012-02-13 12:01:24 +0000
@@ -224,9 +224,21 @@
224224
225 m_filters = new Filters(m_unityLens->filters, this);225 m_filters = new Filters(m_unityLens->filters, this);
226226
227 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));227 if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
228 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));228 m_results->setModel(m_unityLens->results()->model());
229 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));229 } else {
230 m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
231 }
232 if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {
233 m_globalResults->setModel(m_unityLens->global_results()->model());
234 } else {
235 m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
236 }
237 if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
238 m_categories->setModel(m_unityLens->categories()->model());
239 } else {
240 m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
241 }
230242
231 /* Property change signals */243 /* Property change signals */
232 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));244 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
233245
=== modified file 'libunity-2d-private/src/lenses.cpp'
--- libunity-2d-private/src/lenses.cpp 2011-09-09 10:15:14 +0000
+++ libunity-2d-private/src/lenses.cpp 2012-02-13 12:01:24 +0000
@@ -27,6 +27,8 @@
2727
28// libunity-core28// libunity-core
29#include <UnityCore/FilesystemLenses.h>29#include <UnityCore/FilesystemLenses.h>
30#include <UnityCore/HomeLens.h>
31#include <unity2dtr.h>
3032
31Lenses::Lenses(QObject *parent) :33Lenses::Lenses(QObject *parent) :
32 QAbstractListModel(parent)34 QAbstractListModel(parent)
@@ -36,17 +38,18 @@
36 roles[Lenses::RoleVisible] = "visible";38 roles[Lenses::RoleVisible] = "visible";
37 setRoleNames(roles);39 setRoleNames(roles);
3840
41 m_homeLens = new unity::dash::HomeLens(u2dTr("Home").toStdString(), u2dTr("Home screen").toStdString(), u2dTr("Search").toStdString());
39 m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses");42 m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses");
40 for (unsigned int i=0; i<m_unityLenses->count(); i++) {43 m_homeLens->AddLenses(*m_unityLenses);
41 unity::dash::Lens::Ptr unityLens = m_unityLenses->GetLensAtIndex(i);44 m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
42 addUnityLens(unityLens, i);45 unity::dash::HomeLens::Ptr homeLensPtr(m_homeLens);
43 }46 addUnityLens(homeLensPtr, 0);
44 m_unityLenses->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
45}47}
4648
47Lenses::~Lenses()49Lenses::~Lenses()
48{50{
49 delete m_unityLenses;51 delete m_unityLenses;
52 delete m_homeLens;
50}53}
5154
52int Lenses::rowCount(const QModelIndex& parent) const55int Lenses::rowCount(const QModelIndex& parent) const
5356
=== modified file 'libunity-2d-private/src/lenses.h'
--- libunity-2d-private/src/lenses.h 2011-08-11 14:38:51 +0000
+++ libunity-2d-private/src/lenses.h 2012-02-13 12:01:24 +0000
@@ -26,6 +26,7 @@
2626
27// libunity-core27// libunity-core
28#include <UnityCore/Lens.h>28#include <UnityCore/Lens.h>
29#include <UnityCore/HomeLens.h>
2930
30namespace unity31namespace unity
31{32{
@@ -64,6 +65,7 @@
6465
65private:66private:
66 unity::dash::Lenses* m_unityLenses;67 unity::dash::Lenses* m_unityLenses;
68 unity::dash::HomeLens* m_homeLens;
67 QList<Lens*> m_lenses;69 QList<Lens*> m_lenses;
6870
69 void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index);71 void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index);
7072
=== modified file 'shell/Shell.qml'
--- shell/Shell.qml 2012-02-10 17:03:01 +0000
+++ shell/Shell.qml 2012-02-13 12:01:24 +0000
@@ -120,6 +120,11 @@
120 }120 }
121 }121 }
122122
123 Loader {
124 id: shortcutHintLoader
125 anchors.centerIn: parent
126 }
127
123 Connections {128 Connections {
124 target: declarativeView129 target: declarativeView
125 onLauncherFocusRequested: {130 onLauncherFocusRequested: {
@@ -164,7 +169,7 @@
164169
165 InputShapeMask {170 InputShapeMask {
166 id: shape1171 id: shape1
167 source: "shell/dash/artwork/desktop_dash_background_no_transparency.png"172 source: "shell/common/artwork/desktop_dash_background_no_transparency.png"
168 color: "red"173 color: "red"
169 position: Qt.point(dashLoader.width - 50, dashLoader.height - 49)174 position: Qt.point(dashLoader.width - 50, dashLoader.height - 49)
170 enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode175 enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
171176
=== modified file 'shell/app/shelldeclarativeview.cpp'
--- shell/app/shelldeclarativeview.cpp 2012-02-09 12:27:35 +0000
+++ shell/app/shelldeclarativeview.cpp 2012-02-13 12:01:24 +0000
@@ -41,6 +41,7 @@
41#include <QtDBus/QDBusInterface>41#include <QtDBus/QDBusInterface>
42#include <QX11Info>42#include <QX11Info>
43#include <QGraphicsObject>43#include <QGraphicsObject>
44#include <QFileInfo>
4445
45// X1146// X11
46#include <X11/Xlib.h>47#include <X11/Xlib.h>
@@ -188,6 +189,12 @@
188 return m_active;189 return m_active;
189}190}
190191
192bool
193ShellDeclarativeView::haveCustomHomeShortcuts() const
194{
195 return QFileInfo(unity2dDirectory() + "/shell/dash/HomeShortcutsCustomized.qml").exists();
196}
197
191void198void
192ShellDeclarativeView::setDashMode(ShellDeclarativeView::DashMode mode)199ShellDeclarativeView::setDashMode(ShellDeclarativeView::DashMode mode)
193{200{
194201
=== modified file 'shell/app/shelldeclarativeview.h'
--- shell/app/shelldeclarativeview.h 2012-02-09 02:22:19 +0000
+++ shell/app/shelldeclarativeview.h 2012-02-13 12:01:24 +0000
@@ -39,6 +39,7 @@
39 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)39 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
40 Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify40 Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify
41 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)41 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
42 Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts)
4243
43 /* These two properties and mouse movement tracking on the widget are added here only because44 /* These two properties and mouse movement tracking on the widget are added here only because
44 we need to detect when the mouse is inside the area occupied by the lancher. This should45 we need to detect when the mouse is inside the area occupied by the lancher. This should
@@ -59,6 +60,7 @@
5960
60 /* getters */61 /* getters */
61 bool dashActive() const;62 bool dashActive() const;
63 bool haveCustomHomeShortcuts() const;
62 DashMode dashMode() const;64 DashMode dashMode() const;
63 const QString& activeLens() const;65 const QString& activeLens() const;
64 bool expanded() const;66 bool expanded() const;
6567
=== added file 'shell/common/Background.qml'
--- shell/common/Background.qml 1970-01-01 00:00:00 +0000
+++ shell/common/Background.qml 2012-02-13 12:01:24 +0000
@@ -0,0 +1,109 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2010-2011 Canonical Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick 1.1
20import Unity2d 1.0
21import Effects 1.0
22
23Item {
24 id: background
25 property bool active: false
26 property bool fullscreen: false
27 property int bottomBorderThickness
28 property int rightBorderThickness
29 /* coordinates of top left corner needed to capture correct segment of background */
30 property int xPosition: 0
31 property int yPosition: 0
32
33 /* Avoid redraw at rendering */
34 effect: CacheEffect {}
35
36 Item {
37 anchors.fill: parent
38 anchors.bottomMargin: bottomBorderThickness
39 anchors.rightMargin: rightBorderThickness
40 clip: true
41
42 Image {
43 id: blurredBackground
44
45 effect: Blur {blurRadius: 12}
46
47 /* 'source' needs to be set when this becomes visible, that is when active
48 becomes true, so that a screenshot of the desktop is taken at that point.
49 See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
50 */
51
52 /* Use an image of the root window which essentially is a
53 capture of the entire screen */
54 source: active ? "image://window/root" : ""
55 cache: false
56
57 fillMode: Image.PreserveAspectCrop
58 x: -xPosition
59 y: -yPosition
60 }
61
62 Image {
63 anchors.fill: parent
64 fillMode: Image.PreserveAspectCrop
65 source: "artwork/background_sheen.png"
66 }
67 }
68
69 BorderImage {
70 id: border
71
72 /* Define properties of border here */
73 property int bottomThickness: 39
74 property int rightThickness: 37
75
76 anchors.fill: parent
77 source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
78 mirror: isRightToLeft()
79 }
80
81 states: [
82 State {
83 name: "normal"
84 when: !fullscreen
85 PropertyChanges {
86 target: background
87 bottomBorderThickness: border.bottomThickness
88 rightBorderThickness: border.rightThickness
89 }
90 PropertyChanges {
91 target: border
92 visible: true
93 }
94 },
95 State {
96 name: "fullscreen"
97 when: fullscreen
98 PropertyChanges {
99 target: background
100 bottomBorderThickness: 0
101 rightBorderThickness: 0
102 }
103 PropertyChanges {
104 target: border
105 visible: false
106 }
107 }
108 ]
109}
0110
=== renamed file 'shell/dash/SearchEntry.qml' => 'shell/common/SearchEntry.qml'
--- shell/dash/SearchEntry.qml 2012-01-10 10:42:46 +0000
+++ shell/common/SearchEntry.qml 2012-02-13 12:01:24 +0000
@@ -18,28 +18,22 @@
1818
19import QtQuick 1.119import QtQuick 1.1
20import Effects 1.020import Effects 1.0
21import "../common/fontUtils.js" as FontUtils21import "fontUtils.js" as FontUtils
22import "../common"
2322
24AbstractButton {23AbstractButton {
25 property string searchQuery24 property string searchQuery
25 property string placeHolderText: ""
26 property bool active: false
27
28 signal activateFirstResult
2629
27 Accessible.name: "Search Entry"30 Accessible.name: "Search Entry"
2831
29 /* Cancels current search when the dash becomes invisible */32 /* Delete search when set in-active */
30 Connections {33 onActiveChanged: if (!active) searchInput.text = ""
31 target: dash
32 onActiveChanged: if (!dash.active) search_input.text = ""
33 }
34
35 Binding {
36 target: dash.currentPage != undefined ? dash.currentPage.model : null
37 property: "searchQuery"
38 value: searchQuery
39 }
4034
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. */
42 Keys.forwardTo: [search_input]36 Keys.forwardTo: [searchInput]
4337
44 opacity: ( state == "selected" || state == "hovered" ) ? 1.0 : 0.738 opacity: ( state == "selected" || state == "hovered" ) ? 1.0 : 0.7
4539
@@ -58,7 +52,7 @@
58 anchors.rightMargin: 1652 anchors.rightMargin: 16
5953
60 Image {54 Image {
61 id: search_icon55 id: searchIcon
6256
63 anchors.left: parent.left57 anchors.left: parent.left
64 anchors.leftMargin: -958 anchors.leftMargin: -9
@@ -68,28 +62,28 @@
6862
69 smooth: true63 smooth: true
7064
71 source: search_input.text ? "artwork/cross.png" : "artwork/search_icon.png"65 source: searchInput.text ? "artwork/cross.png" : "artwork/search_icon.png"
72 fillMode: Image.PreserveAspectFit66 fillMode: Image.PreserveAspectFit
73 }67 }
7468
75 MouseArea {69 MouseArea {
76 id: clear_button70 id: clearButton
7771
78 Accessible.name: "Clear"72 Accessible.name: "Clear"
79 Accessible.role: Accessible.PushButton73 Accessible.role: Accessible.PushButton
8074
81 anchors.fill: search_icon75 anchors.fill: searchIcon
8276
83 onClicked: {77 onClicked: {
84 search_input.forceActiveFocus()78 searchInput.forceActiveFocus()
85 search_input.text = ""79 searchInput.text = ""
86 }80 }
87 }81 }
8882
89 TextInput {83 TextInput {
90 id: search_input84 id: searchInput
9185
92 Accessible.name: search_instructions.text86 Accessible.name: searchInstructions.text
93 Accessible.role: Accessible.EditableText87 Accessible.role: Accessible.EditableText
9488
95 effect: DropShadow {89 effect: DropShadow {
@@ -99,10 +93,10 @@
99 offset.x: 093 offset.x: 0
100 offset.y: 094 offset.y: 0
101 color: "white"95 color: "white"
102 enabled: search_input.text != "" || search_input.inputMethodComposing96 enabled: searchInput.text != "" || searchInput.inputMethodComposing
103 }97 }
10498
105 anchors.left: search_icon.right99 anchors.left: searchIcon.right
106 anchors.leftMargin: -5100 anchors.leftMargin: -5
107 anchors.right: parent.right101 anchors.right: parent.right
108 anchors.verticalCenter: parent.verticalCenter102 anchors.verticalCenter: parent.verticalCenter
@@ -115,17 +109,17 @@
115 cursorDelegate: cursor109 cursorDelegate: cursor
116 selectionColor: "gray"110 selectionColor: "gray"
117111
118 onTextChanged: live_search_timeout.restart()112 onTextChanged: liveSearchTimeout.restart()
119113
120 Timer {114 Timer {
121 id: live_search_timeout115 id: liveSearchTimeout
122 interval: 200116 interval: 200
123 onTriggered: searchQuery = search_input.text117 onTriggered: searchQuery = searchInput.text
124 }118 }
125119
126 Keys.onPressed: {120 Keys.onPressed: {
127 if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) {121 if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) {
128 dash.currentPage.activateFirstResult()122 activateFirstResult()
129 event.accepted = true;123 event.accepted = true;
130 }124 }
131 }125 }
@@ -159,7 +153,7 @@
159 }153 }
160154
161 TextCustom {155 TextCustom {
162 id: search_instructions156 id: searchInstructions
163157
164 anchors.left: parent.left158 anchors.left: parent.left
165 anchors.right: parent.right159 anchors.right: parent.right
@@ -173,12 +167,10 @@
173 fontSize: "x-large"167 fontSize: "x-large"
174 font.italic: true168 font.italic: true
175 text: {169 text: {
176 if(search_input.text || search_input.inputMethodComposing)170 if(searchInput.text || searchInput.inputMethodComposing)
177 return ""171 return ""
178 else if(dash.currentPage != undefined && dash.currentPage.model.searchHint)
179 return dash.currentPage.model.searchHint
180 else172 else
181 return u2d.tr("Search")173 return placeHolderText
182 }174 }
183 }175 }
184 }176 }
185177
=== renamed file 'shell/dash/artwork/background_sheen.png' => 'shell/common/artwork/background_sheen.png'
=== renamed file 'shell/dash/artwork/cross.png' => 'shell/common/artwork/cross.png'
=== renamed file 'shell/dash/artwork/desktop_dash_background.png' => 'shell/common/artwork/desktop_dash_background.png'
=== renamed file 'shell/dash/artwork/desktop_dash_background.sci' => 'shell/common/artwork/desktop_dash_background.sci'
=== renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.png' => 'shell/common/artwork/desktop_dash_background_no_transparency.png'
=== renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.sci' => 'shell/common/artwork/desktop_dash_background_no_transparency.sci'
=== renamed file 'shell/dash/artwork/search_background.png' => 'shell/common/artwork/search_background.png'
=== renamed file 'shell/dash/artwork/search_background.sci' => 'shell/common/artwork/search_background.sci'
=== renamed file 'shell/dash/artwork/search_icon.png' => 'shell/common/artwork/search_icon.png'
=== modified file 'shell/dash/Dash.qml'
--- shell/dash/Dash.qml 2012-02-09 11:22:43 +0000
+++ shell/dash/Dash.qml 2012-02-13 12:01:24 +0000
@@ -106,6 +106,7 @@
106 for (var i=0; i<lenses.rowCount(); i++) {106 for (var i=0; i<lenses.rowCount(); i++) {
107 lenses.get(i).viewType = Lens.Hidden107 lenses.get(i).viewType = Lens.Hidden
108 }108 }
109 declarativeView.activeLens = ""
109 }110 }
110111
111 SpreadMonitor {112 SpreadMonitor {
@@ -133,11 +134,19 @@
133 return134 return
134 }135 }
135136
136 /* To activate lens, we set its viewType to LensView, and then set all
137 other lenses to Hidden */
138 for (var i=0; i<lenses.rowCount(); i++) {137 for (var i=0; i<lenses.rowCount(); i++) {
139 var thislens = lenses.get(i)138 var thislens = lenses.get(i)
140 thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden139 if (lensId == "home.lens") {
140 if (thislens.id == lensId) {
141 thislens.viewType = Lens.LensView
142 continue
143 }
144 /* When Home is shown, need to notify all other lenses. Those in the global view
145 (in home search results page) are set to HomeView, all others to Hidden */
146 thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden
147 } else {
148 thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden
149 }
141 }150 }
142151
143 buildLensPage(lens)152 buildLensPage(lens)
@@ -147,20 +156,19 @@
147156
148 function activateHome() {157 function activateHome() {
149 if (spreadMonitor.shown) return158 if (spreadMonitor.shown) return
150159 if (declarativeView.haveCustomHomeShortcuts) {
151 /* When Home is shown, need to notify all other lenses. Those in the global view160 for (var i=0; i<lenses.rowCount(); i++) {
152 (in home search results page) are set to HomeView, all others to Hidden */161 lenses.get(i).viewType = Lens.Hidden
153 for (var i=0; i<lenses.rowCount(); i++) {162 }
154 var thislens = lenses.get(i)163 pageLoader.setSource("Home.qml")
155 thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden164 /* Take advantage of the fact that the loaded qml is local and setting
165 the source loads it immediately making pageLoader.item valid */
166 activatePage(pageLoader.item)
167 declarativeView.activeLens = ""
168 dash.active = true
169 } else {
170 activateLens("home.lens")
156 }171 }
157
158 pageLoader.setSource("Home.qml")
159 /* Take advantage of the fact that the loaded qml is local and setting
160 the source loads it immediately making pageLoader.item valid */
161 activatePage(pageLoader.item)
162 declarativeView.activeLens = ""
163 dash.active = true
164 }172 }
165173
166 function activateLensWithOptionFilter(lensId, filterId, optionId) {174 function activateLensWithOptionFilter(lensId, filterId, optionId) {
@@ -211,55 +219,15 @@
211 }219 }
212 }220 }
213221
214 Item {222 Background {
215 id: background223 id: background
216224
217 anchors.fill: parent225 anchors.fill: parent
218226
219 /* Avoid redraw at rendering */227 active: dash.active
220 effect: CacheEffect {}228 fullscreen: declarativeView.dashMode != ShellDeclarativeView.DesktopMode
221229 xPosition: launcherLoader.width
222 Item {230 yPosition: declarativeView.globalPosition.y
223 anchors.fill: parent
224 anchors.bottomMargin: content.anchors.bottomMargin
225 anchors.rightMargin: content.anchors.rightMargin
226 clip: true
227
228 Image {
229 id: blurredBackground
230
231 effect: Blur {blurRadius: 12}
232
233 /* 'source' needs to be set when the dash becomes visible, that
234 is when dash.active becomes true, so that a
235 screenshot of the windows behind the dash is taken at that
236 point.
237 See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
238 */
239
240 /* Use an image of the root window which essentially is a
241 capture of the entire screen */
242 source: dash.active ? "image://window/root" : ""
243 cache: false
244
245 fillMode: Image.PreserveAspectCrop
246 x: -launcherLoader.width
247 y: -declarativeView.globalPosition.y
248 }
249
250 Image {
251 anchors.fill: parent
252 fillMode: Image.PreserveAspectCrop
253 source: "artwork/background_sheen.png"
254 }
255 }
256
257 BorderImage {
258 anchors.fill: parent
259 visible: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
260 source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
261 mirror: isRightToLeft()
262 }
263 }231 }
264232
265 Item {233 Item {
@@ -269,8 +237,8 @@
269 /* Margins in DesktopMode set so that the content does not overlap with237 /* Margins in DesktopMode set so that the content does not overlap with
270 the border defined by the background image.238 the border defined by the background image.
271 */239 */
272 anchors.bottomMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 39 : 0240 anchors.bottomMargin: background.bottomBorderThickness
273 anchors.rightMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 37 : 0241 anchors.rightMargin: background.rightBorderThickness
274242
275 /* Unhandled keys will always be forwarded to the search bar. That way243 /* Unhandled keys will always be forwarded to the search bar. That way
276 the user can type and search from anywhere in the interface without244 the user can type and search from anywhere in the interface without
@@ -296,6 +264,17 @@
296 anchors.rightMargin: 15264 anchors.rightMargin: 15
297265
298 height: 42266 height: 42
267
268 active: dash.active
269 placeHolderText: {
270 if(dash.currentPage != undefined && dash.currentPage.model.searchHint)
271 return dash.currentPage.model.searchHint
272 else
273 return u2d.tr("Search")
274 }
275
276 onSearchQueryChanged: if (dash.currentPage != undefined) dash.currentPage.model.searchQuery = searchQuery
277 onActivateFirstResult: if (dash.currentPage != undefined) dash.currentPage.activateFirstResult()
299 }278 }
300279
301 FilterPane {280 FilterPane {
@@ -304,7 +283,7 @@
304 KeyNavigation.left: search_entry283 KeyNavigation.left: search_entry
305284
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 */
307 visible: declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens"286 visible: declarativeView.activeLens != "home.lens" && declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens"
308 lens: visible && currentPage != undefined ? currentPage.model : undefined287 lens: visible && currentPage != undefined ? currentPage.model : undefined
309288
310 anchors.top: search_entry.anchors.top289 anchors.top: search_entry.anchors.top
311290
=== modified file 'shell/dash/Home.qml'
--- shell/dash/Home.qml 2012-01-20 09:35:38 +0000
+++ shell/dash/Home.qml 2012-02-13 12:01:24 +0000
@@ -170,7 +170,7 @@
170 width: sourceSize.width170 width: sourceSize.width
171 height: sourceSize.height171 height: sourceSize.height
172172
173 source: "artwork/cross.png"173 source: "../common/artwork/cross.png"
174 }174 }
175175
176 opacity: (expanded && declarativeView.dashMode == ShellDeclarativeView.DesktopMode) ? 1 : 0176 opacity: (expanded && declarativeView.dashMode == ShellDeclarativeView.DesktopMode) ? 1 : 0
177177
=== modified file 'shell/dash/LensBar.qml'
--- shell/dash/LensBar.qml 2012-01-10 13:07:48 +0000
+++ shell/dash/LensBar.qml 2012-02-13 12:01:24 +0000
@@ -93,22 +93,6 @@
93 return undefined93 return undefined
94 }94 }
9595
96 /* Need to manually include the Home lens */
97 LensButton {
98 id: homeLens
99
100 Accessible.name: u2d.tr("home")
101
102 focus: true
103 icon: "artwork/lens-nav-home.svg"
104 onClicked: dash.activateHome()
105 active: ( declarativeView.activeLens == "" )
106 iconWidth: lensBar.iconWidth
107 iconSpacing: lensBar.iconSpacing
108 width: iconWidth+iconSpacing
109 height: lensContainer.height
110 }
111
112 /* Now fetch all other lenses and display */96 /* Now fetch all other lenses and display */
113 Repeater{97 Repeater{
114 id: repeater98 id: repeater
@@ -118,9 +102,26 @@
118 Accessible.name: u2d.tr(item.name)102 Accessible.name: u2d.tr(item.name)
119103
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 */
121 icon: item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint105 icon: {
122 active: item.viewType == Lens.LensView106 if (item.id == "home.lens") {
123 onClicked: dash.activateLens(item.id)107 return "artwork/lens-nav-home.svg"
108 }
109 item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint
110 }
111 active: {
112 /* we need this in order to activate the arrow when using a custom shortcuts file */
113 if (item.id == "home.lens" && declarativeView.activeLens == "") {
114 return true
115 }
116 return item.viewType == Lens.LensView
117 }
118 onClicked: {
119 if (item.id == "home.lens") {
120 dash.activateHome()
121 } else {
122 dash.activateLens(item.id)
123 }
124 }
124 iconWidth: lensBar.iconWidth125 iconWidth: lensBar.iconWidth
125 iconSpacing: lensBar.iconSpacing126 iconSpacing: lensBar.iconSpacing
126 width: iconWidth+iconSpacing127 width: iconWidth+iconSpacing
127128
=== modified file 'shell/dash/LensView.qml'
--- shell/dash/LensView.qml 2012-01-10 10:42:46 +0000
+++ shell/dash/LensView.qml 2012-02-13 12:01:24 +0000
@@ -81,7 +81,7 @@
81 bodyDelegate: Loader {81 bodyDelegate: Loader {
82 visible: category_model.count > 082 visible: category_model.count > 0
83 width: parent.width83 width: parent.width
84 height: visible ? item.contentHeight : 084 height: item ? visible ? item.contentHeight : 0 : 0
8585
86 property string name: model.column_086 property string name: model.column_0
87 property string iconHint: model.column_187 property string iconHint: model.column_1
@@ -119,18 +119,19 @@
119 Binding { target: item; property: "categoryId"; value: categoryId }119 Binding { target: item; property: "categoryId"; value: categoryId }
120 Binding { target: item; property: "category_model"; value: category_model }120 Binding { target: item; property: "category_model"; value: category_model }
121 Binding { target: item; property: "lens"; value: lensView.model }121 Binding { target: item; property: "lens"; value: lensView.model }
122 Binding { target: item; property: "lensId"; value: lensView.model.id }
122123
123 onLoaded: item.focus = true124 onLoaded: item.focus = true
124 }125 }
125126
126 headerDelegate: CategoryHeader {127 headerDelegate: CategoryHeader {
127 visible: body.item.needHeader && body.visible128 visible: body.item ? body.item.needHeader && body.visible : false
128 height: visible ? 32 : 0129 height: visible ? 32 : 0
129130
130 property bool foldable: body.item.folded != undefined131 property bool foldable: body.item ? body.item.folded != undefined : false
131 availableCount: foldable ? body.category_model.count - body.item.cellsPerRow : 0132 availableCount: body.item ? foldable ? body.category_model.count - body.item.cellsPerRow : 0 : 0
132 folded: foldable ? body.item.folded : false133 folded: body.item ? foldable ? body.item.folded : false : false
133 onClicked: if(foldable) body.item.folded = !body.item.folded134 onClicked: if(foldable && body.item) body.item.folded = !body.item.folded
134 moving: flickerMoving135 moving: flickerMoving
135136
136 icon: body.iconHint137 icon: body.iconHint
137138
=== modified file 'shell/dash/RendererGrid.qml'
--- shell/dash/RendererGrid.qml 2011-11-23 10:27:05 +0000
+++ shell/dash/RendererGrid.qml 2012-02-13 12:01:24 +0000
@@ -77,14 +77,6 @@
7777
78 FocusPath.index: index78 FocusPath.index: index
7979
80 property string uri: column_0
81 property string iconHint: column_1
82 property string categoryId: column_2 // FIXME: rename to categoryIndex
83 property string mimetype: column_3
84 property string displayName: column_4 // FIXME: rename to name
85 property string comment: column_5
86 property string dndUri: column_6
87
88 Loader {80 Loader {
89 id: loader81 id: loader
9082
@@ -96,13 +88,13 @@
9688
97 sourceComponent: cellRenderer89 sourceComponent: cellRenderer
98 onLoaded: {90 onLoaded: {
99 item.uri = uri91 item.uri = column_0
100 item.iconHint = iconHint92 item.iconHint = column_1
101 item.mimetype = mimetype93 item.mimetype = column_3
102 item.displayName = displayName94 item.displayName = column_4
103 item.comment = comment95 item.comment = column_5
104 item.focus = true96 item.focus = true
105 item.dndUri = dndUri97 item.dndUri = column_6
106 }98 }
107 }99 }
108 }100 }
109101
=== modified file 'shell/launcher/LauncherLoader.qml'
--- shell/launcher/LauncherLoader.qml 2012-02-10 11:17:36 +0000
+++ shell/launcher/LauncherLoader.qml 2012-02-13 12:01:24 +0000
@@ -72,8 +72,18 @@
72 Connections {72 Connections {
73 target: declarativeView73 target: declarativeView
74 onSuperKeyHeldChanged: {74 onSuperKeyHeldChanged: {
75 if (superKeyHeld) visibilityController.beginForceVisible()75 if (superKeyHeld) {
76 else visibilityController.endForceVisible()76 visibilityController.beginForceVisible()
77 if (shell.width > 1024 || shell.height > 768) {
78 shortcutHintLoader.source = "../shortcutoverlay/ShortcutHint.qml"
79 }
80 if (declarativeView.dashActive) {
81 declarativeView.dashActive = false
82 }
83 } else {
84 shortcutHintLoader.source = ""
85 visibilityController.endForceVisible()
86 }
77 }87 }
78 }88 }
7989
8090
=== added directory 'shell/shortcutoverlay'
=== added file 'shell/shortcutoverlay/ShortcutHint.qml'
--- shell/shortcutoverlay/ShortcutHint.qml 1970-01-01 00:00:00 +0000
+++ shell/shortcutoverlay/ShortcutHint.qml 2012-02-13 12:01:24 +0000
@@ -0,0 +1,207 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18import QtQuick 1.0
19import "../common/fontUtils.js" as FontUtils
20
21Item {
22 id: main
23 objectName: "shortcutHintOverlay"
24 width: 950
25 height: 660
26
27 BorderImage {
28 id: border
29 smooth: true
30 anchors.fill: parent
31 border { left: 20; top: 20; right: 20; bottom: 20 }
32 source: "artwork/shortcut_hint_borders.png"
33 }
34
35 ListModel {
36 id: leftColumnModel
37 ListElement { sectionId: "launcher"; title: "Launcher"}
38 ListElement { sectionId: "dash"; title: "Dash"}
39 ListElement { sectionId: "topBar"; title: "Top Bar"}
40 }
41
42 ListModel {
43 id: rightColumnModel
44 ListElement { sectionId: "switching"; title: "Switching"}
45 ListElement { sectionId: "workspaces"; title: "Workspaces"}
46 ListElement { sectionId: "windows"; title: "Windows"}
47 }
48
49 ListModel {
50 id: launcherModel
51 ListElement { defaultKey: "Super (Press)"; description: "Open Launcher, displays shortcuts."; gconfKey: "" }
52 ListElement { defaultKey: "Alt + F1"; description: "Open Launcher keyboard navigation mode."; gconfKey: "" }
53 ListElement { defaultKey: "Super + Tab"; description: "Switch applications via Launcher."; gconfKey: "" }
54 ListElement { defaultKey: "Super + 1 to 9"; description: "Same as clicking on a Launcher icon."; gconfKey: "" }
55 ListElement { defaultKey: "Super + Shift + 1 to 9"; description: "Open new window of the app."; gconfKey: "" }
56 ListElement { defaultKey: "Super + T"; description: "Open the Rubbish Bin."; gconfKey: "" }
57 }
58
59 ListModel {
60 id: dashModel
61 ListElement { defaultKey: "Super (Tap)"; description: "Open the Dash home."; gconfKey: "" }
62 ListElement { defaultKey: "Super + A"; description: "Open the Dash App Lens."; gconfKey: "" }
63 ListElement { defaultKey: "Super + F"; description: "Open the Dash Files Lens."; gconfKey: "" }
64 ListElement { defaultKey: "Super + M"; description: "Open the Dash Files Music."; gconfKey: "" }
65 ListElement { defaultKey: "Ctrl + Tab"; description: "Switches between Lenses."; gconfKey: "" }
66 ListElement { defaultKey: "Cursors Keys"; description: "Moves the focus."; gconfKey: "" }
67 ListElement { defaultKey: "Enter / Return"; description: "Open currently focused item."; gconfKey: "" }
68 ListElement { defaultKey: "Alt + F2"; description: "'Run Command' mode."; gconfKey: "" }
69 }
70
71 ListModel {
72 id: topBarModel
73 ListElement { defaultKey: "Alt"; description: "Reveals application menu."; gconfKey: "" }
74 ListElement { defaultKey: "Alt + F10"; description: "Open the indicator menu."; gconfKey: "" }
75 ListElement { defaultKey: "Cursor Left & Right"; description: "Moves focus between indicators."; gconfKey: "" }
76 }
77
78 ListModel {
79 id: switchingModel
80 ListElement { defaultKey: "Alt + Tab"; description: "Switch between applications."; gconfKey: "/apps/metacity/global_keybindings/switch_windows"}
81 ListElement { defaultKey: "Alt + Grave"; description: "Switch windows of current application."; gconfKey: "/apps/metacity/global_keybindings/cycle_group"}
82 ListElement { defaultKey: "Cursor Up"; description: "Close window switch, return to app switch."; gconfKey: "" }
83 ListElement { defaultKey: "Cursor Left & Right"; description: "Moves the focus."; gconfKey: "" }
84 }
85
86 ListModel {
87 id: workspacesModel
88 ListElement { defaultKey: "Super + S"; description: "Spread workspaces."; gconfKey: "" }
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" }
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" }
91 }
92
93 ListModel {
94 id: windowModel
95 ListElement { defaultKey: "Super + W"; description: "Spreads all windows in the current workspace."; gconfKey: "" }
96 ListElement { defaultKey: "Super + D"; description: "Minimizes all windows."; gconfKey: "/apps/metacity/global_keybindings/show_desktop" }
97 ListElement { defaultKey: "Alt + Space"; description: "Opens window accessibility menu."; gconfKey: "/apps/metacity/window_keybindings/activate_window_menu" }
98 ListElement { defaultKey: "Alt + F10"; description: "Maximizes or un-maximizes current window."; gconfKey: "/apps/metacity/window_keybindings/toggle_maximized" }
99 ListElement { defaultKey: "Alt + F9"; description: "Minimizes current window."; gconfKey: "/apps/metacity/window_keybindings/minimize" }
100 ListElement { defaultKey: "Alt + F8"; description: "Resizes current window."; gconfKey: "/apps/metacity/window_keybindings/begin_resize" }
101 ListElement { defaultKey: "Alt + F4"; description: "Closes current window."; gconfKey: "/apps/metacity/window_keybindings/close" }
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" }
103 ListElement { defaultKey: "Alt + Left Mouse Drag"; description: "Move window."; gconfKey: "" }
104 ListElement { defaultKey: "Alt + Middle Mouse Drag"; description: "Resize window."; gconfKey: "" }
105 }
106
107 Rectangle {
108 id: totalArea
109 color: Qt.lighter("#5e275023", -0.8)
110 radius: 8
111 smooth: true
112 anchors.fill: parent
113 anchors.margins: 10
114
115 Item {
116 id: headerArea
117 y: 0
118 height: 75
119 anchors.left: parent.left
120 anchors.right: parent.right
121 smooth: false
122
123 Text {
124 id: title
125 x: 350
126 y: 25
127 color: "#ffffff"
128 text: u2d.tr("Keyboard Shortcuts")
129 anchors.bottom: parent.bottom
130 anchors.bottomMargin: 22
131 anchors.horizontalCenterOffset: 0
132 verticalAlignment: Text.AlignTop
133 anchors.horizontalCenter: parent.horizontalCenter
134 smooth: true
135 font.bold: true
136 horizontalAlignment: Text.AlignHCenter
137 font.pixelSize: FontUtils.fontSizeToPixels("x-large")
138 }
139 }
140
141 Item {
142 id: contentsArea
143 anchors.top: headerArea.bottom
144 anchors.right: parent.right
145 anchors.bottom: parent.bottom
146 anchors.left: parent.left
147 anchors.leftMargin: 20
148 anchors.rightMargin: 20
149
150 Rectangle {
151 id: topDivider
152 width: 200
153 height: 1
154 color: "#ffffff"
155 opacity: 0.2
156 smooth: true
157 anchors.left: parent.left
158 anchors.right: parent.right
159 anchors.top: parent.top
160 }
161
162 Item {
163 id: contentLeft
164 anchors.left: parent.left
165 anchors.right: contentCenter.left
166 anchors.top: topDivider.bottom
167 anchors.bottom: parent.bottom
168
169 Column {
170 id: leftColumn
171 Repeater {
172 model: leftColumnModel
173 ShortcutHintSection {}
174 }
175 }
176 }
177
178 Item {
179 id: contentCenter
180 x: 438
181 width: 40
182 anchors.top: parent.top
183 anchors.bottom: parent.bottom
184 anchors.horizontalCenter: parent.horizontalCenter
185 }
186
187 Item {
188 id: contentRight
189 x: 445
190 y: 0
191 width: 445
192 anchors.left: contentCenter.right
193 anchors.right: parent.right
194 anchors.top: parent.top
195 anchors.bottom: parent.bottom
196
197 Column {
198 id: rightColumn
199 Repeater {
200 model: rightColumnModel
201 ShortcutHintSection {}
202 }
203 }
204 }
205 }
206 }
207}
0208
=== added file 'shell/shortcutoverlay/ShortcutHintSection.qml'
--- shell/shortcutoverlay/ShortcutHintSection.qml 1970-01-01 00:00:00 +0000
+++ shell/shortcutoverlay/ShortcutHintSection.qml 2012-02-13 12:01:24 +0000
@@ -0,0 +1,160 @@
1/*
2 * This file is part of unity-2d
3 *
4 * Copyright 2011 Canonical Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 3.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18import QtQuick 1.0
19import Unity2d 1.0 /* required for GConfItem */
20import "../common/fontUtils.js" as FontUtils
21
22Item {
23 id: shortcutHitSection
24 width: 430
25 height: list.height + sectionTitle.height + sectionTitle.y + bottomSpacing.height + divider.height
26
27 // It is decided by design, that certain keys having multiple values in gconf,
28 // like 'Switch workspaces' should only be displayed when the keys are symmetric.
29 function symmetricKey( gconfKey ) {
30 var gconfKeys = gconfKey.split(";");
31 var previousModifier = ""
32 var count = gconfKeys.length
33 var gconfKey_base = gconfKeys[0]
34 for (var i = 1; i < count; i++) {
35 var gconfItem = Qt.createQmlObject('import QtQuick 1.0; import Unity2d 1.0; GConfItem {}', main);
36 gconfItem.key = gconfKey_base+gconfKeys[i]
37 var gconfValue = gconfItem.value
38 var modifier = gconfValue.substring(0,gconfValue.lastIndexOf(">")+1)
39 var key = gconfValue.substring(gconfValue.lastIndexOf(">")+1)
40 if (previousModifier == "") {
41 previousModifier = gconfValue.substring(0,gconfValue.lastIndexOf(">")+1)
42 continue
43 } else {
44 if (modifier != previousModifier) {
45 return ""
46 }
47 }
48 }
49
50 if (key.toLowerCase().indexOf("kp") == 0){
51 previousModifier = previousModifier + "Num"
52 } else {
53 previousModifier = previousModifier + "Cursors"
54 }
55
56 return previousModifier;
57 }
58
59 Component {
60 id: itemDelegate
61 Item {
62 anchors.right: parent.right
63 anchors.left: parent.left
64
65 function getShortcutKey() {
66 if (gconfKey === "") {
67 return defaultKey;
68 }
69
70 var key = ""
71 // Check is symmetric
72 if (gconfKey.indexOf(";") != -1) {
73 key = symmetricKey(gconfKey);
74 if (key == "") {
75 return ""
76 }
77 } else {
78 var gconfItem = Qt.createQmlObject('import QtQuick 1.0; import Unity2d 1.0; GConfItem {}', main);
79 gconfItem.key = gconfKey
80 key = gconfItem.value
81 }
82
83 key = key.replace("<Control>", "Ctrl + ")
84 key = key.replace("<Shift>", "Shft + ")
85 key = key.replace("<Alt>", "Alt + ")
86 key = key.replace("<Mod4>", "Super + ")
87 key = key.replace("<Super>", "Super + ")
88 key = key.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
89 return key
90 }
91
92 Item {
93 id: key
94 anchors.left: parent.left
95 anchors.leftMargin: 0
96 width: 150
97 Text { id: keyText; text: getShortcutKey(); color: "#ffffff"; font.pixelSize: FontUtils.fontSizeToPixels("small") }
98 }
99
100 Item {
101 id: spacing
102 anchors.left: key.right
103 width: 10
104 }
105
106 Item {
107 id: value
108 width: 265
109 anchors.left: spacing.right
110 Text { text: description; color: "#ffffff"; font.pixelSize: FontUtils.fontSizeToPixels("small") }
111 }
112 }
113 }
114
115 Text {
116 id: sectionTitle
117 y: 27
118 color: "#ffffff"
119 text: title
120 anchors.left: parent.left
121 font.bold: true
122 font.pixelSize: FontUtils.fontSizeToPixels("large")
123 }
124
125 ListView {
126 id: list
127 model: {
128 if (sectionId == "launcher") return launcherModel
129 else if (sectionId == "dash") return dashModel
130 else if (sectionId == "topBar") return topBarModel
131 else if (sectionId == "switching") return switchingModel
132 else if (sectionId == "workspaces") return workspacesModel
133 else if (sectionId == "windows") return windowModel
134 else return ""
135 }
136 spacing: 18
137 anchors.left: parent.left
138 anchors.top: sectionTitle.bottom
139 anchors.topMargin: 14
140 height: (spacing * count) + anchors.topMargin
141 delegate: itemDelegate
142 }
143
144 Item {
145 id: bottomSpacing
146 height: 20
147 }
148
149 Rectangle {
150 id: divider
151 height: 1
152 color: "#ffffff"
153 smooth: true
154 anchors.top: shortcutHitSection.bottom
155 anchors.right: parent.right
156 anchors.left: parent.left
157 opacity: 0.2
158 visible: (index != 2)
159 }
160}
0161
=== added directory 'shell/shortcutoverlay/artwork'
=== added file 'shell/shortcutoverlay/artwork/shortcut_hint_borders.png'
1Binary 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 differ162Binary 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
=== added file 'tests/shell/shortcut-hint-overlay-tests.rb'
--- tests/shell/shortcut-hint-overlay-tests.rb 1970-01-01 00:00:00 +0000
+++ tests/shell/shortcut-hint-overlay-tests.rb 2012-02-13 12:01:24 +0000
@@ -0,0 +1,89 @@
1#!/usr/bin/env ruby1.8
2=begin
3/*
4 * This file is part of unity-2d
5 *
6 * Copyright 2011 Canonical Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 3.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20=end
21
22require '../run-tests.rb' unless $INIT_COMPLETED
23require 'xdo/xwindow'
24require 'xdo/keyboard'
25
26############################# Test Suite #############################
27context "Launcher Shortcut hint overlay Tests" do
28 # Run once at the beginning of this test suite
29 startup do
30 $SUT.execute_shell_command 'killall unity-2d-shell'
31 $SUT.execute_shell_command 'killall unity-2d-shell'
32
33 # Minimize all windows
34 XDo::XWindow.toggle_minimize_all
35 end
36
37 # Run once at the end of this test suite
38 shutdown do
39 end
40
41 # Run before each test case begins
42 setup do
43 # Execute the application
44 @app = $SUT.run( :name => UNITY_2D_SHELL,
45 :arguments => "-testability",
46 :sleeptime => 2 )
47 # Make certain application is ready for testing
48 verify{ @app.Launcher() }
49 end
50
51 # Run after each test case completes
52 teardown do
53 $SUT.execute_shell_command 'pkill -nf unity-2d-shell'
54 end
55
56 #####################################################################################
57 # Test cases
58 # Test case objectives:
59 # * Check shortcut hint overlay display/close
60 # Pre-conditions
61 # * None
62 # Test steps
63 # * Hold super key
64 # * Check the shortcut hint overlay is displayed
65 # * Release super key
66 # * Check that shortcut hint overlay is closed
67 # Post-conditions
68 # * None
69 # References
70 # * lp:#855532
71 test "Check shortcut hint overlay display/close" do
72 # Check the hint window is not displayed initially
73 verify_not(TIMEOUT, 'Shortcut hint overlay should be closed, but visible') {
74 @app.ShellDeclarativeView().ShortcutHint();
75 }
76
77 XDo::Keyboard.key_down('SUPER')
78 # Check the hint window is displayed when 'super' is pressed
79 verify(TIMEOUT, 'Shortcut hint overlay should be displayed, but it is not') {
80 @app.ShellDeclarativeView().ShortcutHint();
81 }
82
83 XDo::Keyboard.key_up('SUPER')
84 # Check the hint window is closed when 'super' is released
85 verify_not(TIMEOUT, 'Shortcut hint overlay should be closed, but visible') {
86 @app.ShellDeclarativeView().ShortcutHint();
87 }
88 end
89end

Subscribers

People subscribed via source and target branches

to all changes: