Merge lp:~saviq/unity-2d/shell_revert-resizable-launcher into lp:~unity-2d-team/unity-2d/unity-2d-shell-shaped

Proposed by Michał Sawicz
Status: Merged
Approved by: Ugo Riboni
Approved revision: 916
Merged at revision: 916
Proposed branch: lp:~saviq/unity-2d/shell_revert-resizable-launcher
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell-shaped
Diff against target: 506 lines (+51/-88)
13 files modified
data/com.canonical.Unity2d.gschema.xml (+0/-5)
libunity-2d-private/src/launcherclient.cpp (+2/-0)
libunity-2d-private/src/launcherclient.h (+1/-0)
libunity-2d-private/src/screeninfo.cpp (+2/-11)
libunity-2d-private/src/screeninfo.h (+0/-1)
libunity-2d-private/src/unity2dpanel.cpp (+8/-26)
libunity-2d-private/src/unity2dpanel.h (+1/-4)
panel/app/panelmanager.cpp (+1/-1)
panel/applets/appname/appnameapplet.cpp (+2/-3)
shell/Shell.qml (+1/-1)
shell/launcher/Launcher.qml (+4/-2)
shell/launcher/LauncherItem.qml (+25/-30)
shell/launcher/LauncherList.qml (+4/-4)
To merge this branch: bzr merge lp:~saviq/unity-2d/shell_revert-resizable-launcher
Reviewer Review Type Date Requested Status
Ugo Riboni Pending
Review via email: mp+88744@code.launchpad.net

Commit message

[shell] revert resizable launcher
The resizable launcher code needs to be revisited at a later time.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.Unity2d.gschema.xml'
2--- data/com.canonical.Unity2d.gschema.xml 2011-12-14 13:36:26 +0000
3+++ data/com.canonical.Unity2d.gschema.xml 2012-01-16 18:02:25 +0000
4@@ -24,11 +24,6 @@
5 2: intellihide; same as auto hide but the launcher will disappear if a window is placed on top of it
6 </description>
7 </key>
8- <key name="thickness" type="i">
9- <default>66</default>
10- <summary>Thickness of the launcher</summary>
11- <description>Size of the small side (typically the horizontal side) of the launcher</description>
12- </key>
13 </schema>
14 <schema path="/com/canonical/unity-2d/panel/" id="com.canonical.Unity2d.Panel" gettext-domain="unity-2d">
15 <key type="as" name="applets">
16
17=== modified file 'libunity-2d-private/src/launcherclient.cpp'
18--- libunity-2d-private/src/launcherclient.cpp 2012-01-10 10:42:46 +0000
19+++ libunity-2d-private/src/launcherclient.cpp 2012-01-16 18:02:25 +0000
20@@ -21,4 +21,6 @@
21 // Self
22 #include "launcherclient.h"
23
24+const int LauncherClient::MaximumWidth = 65;
25+
26 #include "launcherclient.moc"
27
28=== modified file 'libunity-2d-private/src/launcherclient.h'
29--- libunity-2d-private/src/launcherclient.h 2011-12-14 13:45:43 +0000
30+++ libunity-2d-private/src/launcherclient.h 2012-01-16 18:02:25 +0000
31@@ -32,6 +32,7 @@
32 class LauncherClient
33 {
34 public:
35+ static const int MaximumWidth;
36 };
37
38 #endif /* LAUNCHERCLIENT_H */
39
40=== modified file 'libunity-2d-private/src/screeninfo.cpp'
41--- libunity-2d-private/src/screeninfo.cpp 2012-01-09 18:08:01 +0000
42+++ libunity-2d-private/src/screeninfo.cpp 2012-01-16 18:02:25 +0000
43@@ -14,7 +14,6 @@
44 #include <QX11Info>
45 #include <QApplication>
46 #include <QDesktopWidget>
47-#include <QVariant>
48
49 ScreenInfo::ScreenInfo(QObject *parent) :
50 QObject(parent),
51@@ -30,8 +29,6 @@
52 SLOT(updateGeometry(int)));
53 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
54 SLOT(updateAvailableGeometry(int)));
55- connect(&launcher2dConfiguration(), SIGNAL(thicknessChanged(int)),
56- SLOT(onLauncherThicknessChanged()));
57 }
58
59
60@@ -79,11 +76,10 @@
61 QRect screenRect = QApplication::desktop()->screenGeometry(screen);
62 QRect availableRect = QApplication::desktop()->availableGeometry(screen);
63
64- int launcherThickness = launcher2dConfiguration().property("thickness").toInt();
65 QRect availableGeometry(
66- launcherThickness,
67+ LauncherClient::MaximumWidth,
68 availableRect.top(),
69- screenRect.width() - launcherThickness,
70+ screenRect.width() - LauncherClient::MaximumWidth,
71 availableRect.height()
72 );
73 if (QApplication::isRightToLeft()) {
74@@ -112,11 +108,6 @@
75 }
76 }
77
78-void ScreenInfo::onLauncherThicknessChanged()
79-{
80- Q_EMIT panelsFreeGeometryChanged(panelsFreeGeometry());
81-}
82-
83 bool ScreenInfo::isCompositingManagerRunning() const
84 {
85 return QX11Info::isCompositingManagerRunning();
86
87=== modified file 'libunity-2d-private/src/screeninfo.h'
88--- libunity-2d-private/src/screeninfo.h 2012-01-09 18:08:01 +0000
89+++ libunity-2d-private/src/screeninfo.h 2012-01-16 18:02:25 +0000
90@@ -54,7 +54,6 @@
91 private Q_SLOTS:
92 void updateGeometry(int screen);
93 void updateAvailableGeometry(int screen);
94- void onLauncherThicknessChanged();
95
96 private:
97 WorkspacesInfo m_workspacesInfo;
98
99=== modified file 'libunity-2d-private/src/unity2dpanel.cpp'
100--- libunity-2d-private/src/unity2dpanel.cpp 2011-12-14 13:34:52 +0000
101+++ libunity-2d-private/src/unity2dpanel.cpp 2012-01-16 18:02:25 +0000
102@@ -49,7 +49,6 @@
103 bool m_useStrut;
104 int m_delta;
105 bool m_manualSliding;
106- int m_thickness;
107
108 void setStrut(ulong* struts)
109 {
110@@ -105,15 +104,15 @@
111 switch (m_edge) {
112 case Unity2dPanel::LeftEdge:
113 if (QApplication::isLeftToRight()) {
114- rect = QRect(screen.left(), available.top(), m_thickness, available.height());
115+ rect = QRect(screen.left(), available.top(), q->width(), available.height());
116 rect.moveLeft(m_delta);
117 } else {
118- rect = QRect(screen.right() - m_thickness, available.top(), m_thickness, available.height());
119+ rect = QRect(screen.right() - q->width(), available.top(), q->width(), available.height());
120 rect.moveRight(screen.right() - m_delta);
121 }
122 break;
123 case Unity2dPanel::TopEdge:
124- rect = QRect(screen.left(), screen.top(), screen.width(), m_thickness);
125+ rect = QRect(screen.left(), screen.top(), screen.width(), q->height());
126 rect.moveTop(m_delta);
127 break;
128 }
129@@ -158,7 +157,6 @@
130 d->m_layout = new QHBoxLayout(this);
131 d->m_layout->setMargin(0);
132 d->m_layout->setSpacing(0);
133- d->m_thickness = 0;
134
135 d->m_slideInAnimation = new QPropertyAnimation(this);
136 d->m_slideInAnimation->setTargetObject(this);
137@@ -170,7 +168,7 @@
138 d->m_slideOutAnimation->setTargetObject(this);
139 d->m_slideOutAnimation->setPropertyName("delta");
140 d->m_slideOutAnimation->setDuration(SLIDE_DURATION);
141- d->m_slideOutAnimation->setEndValue(-thickness());
142+ d->m_slideOutAnimation->setEndValue(-panelSize());
143
144 setAttribute(Qt::WA_X11NetWmWindowTypeDock);
145 setAttribute(Qt::WA_Hover);
146@@ -219,13 +217,13 @@
147 {
148 QWidget::showEvent(event);
149 d->updateEdge();
150- d->m_slideOutAnimation->setEndValue(-thickness());
151+ d->m_slideOutAnimation->setEndValue(-panelSize());
152 }
153
154 void Unity2dPanel::resizeEvent(QResizeEvent* event)
155 {
156 QWidget::resizeEvent(event);
157- d->m_slideOutAnimation->setEndValue(-thickness());
158+ d->m_slideOutAnimation->setEndValue(-panelSize());
159 }
160
161 void Unity2dPanel::slotWorkAreaResized(int screen)
162@@ -279,34 +277,18 @@
163 void Unity2dPanel::setDelta(int delta)
164 {
165 /* Clamp delta to be between 0 and minus its size */
166- int minDelta = -thickness();
167+ int minDelta = -panelSize();
168 int maxDelta = 0;
169
170 d->m_delta = qMax(qMin(delta, maxDelta), minDelta);
171 d->updateGeometry();
172 }
173
174-int Unity2dPanel::thickness() const
175+int Unity2dPanel::panelSize() const
176 {
177 return (d->m_edge == Unity2dPanel::TopEdge) ? height() : width();
178 }
179
180-void Unity2dPanel::setThickness(int thickness)
181-{
182- if (thickness == d->m_thickness) {
183- return;
184- }
185-
186- d->m_thickness = thickness;
187-
188- /* Update variables that depend on thickness' value */
189- setDelta(d->m_delta);
190- d->m_slideOutAnimation->setEndValue(-thickness);
191- d->updateGeometry();
192-
193- Q_EMIT thicknessChanged(thickness);
194-}
195-
196 void Unity2dPanel::slideIn()
197 {
198 d->m_slideOutAnimation->stop();
199
200=== modified file 'libunity-2d-private/src/unity2dpanel.h'
201--- libunity-2d-private/src/unity2dpanel.h 2011-12-14 13:34:52 +0000
202+++ libunity-2d-private/src/unity2dpanel.h 2012-01-16 18:02:25 +0000
203@@ -45,7 +45,6 @@
204 */
205 Q_PROPERTY(int manualSliding READ manualSliding WRITE setManualSliding NOTIFY manualSlidingChanged)
206 Q_PROPERTY(bool useStrut READ useStrut WRITE setUseStrut NOTIFY useStrutChanged)
207- Q_PROPERTY(int thickness READ thickness WRITE setThickness NOTIFY thicknessChanged)
208
209 public:
210 enum Edge {
211@@ -77,8 +76,7 @@
212 int delta() const;
213 void setDelta(int);
214
215- int thickness() const;
216- void setThickness(int);
217+ int panelSize() const;
218
219 bool manualSliding() const;
220 void setManualSliding(bool);
221@@ -92,7 +90,6 @@
222 Q_SIGNALS:
223 void manualSlidingChanged(bool);
224 void useStrutChanged(bool);
225- void thicknessChanged(int);
226
227 protected:
228 virtual void showEvent(QShowEvent*);
229
230=== modified file 'panel/app/panelmanager.cpp'
231--- panel/app/panelmanager.cpp 2011-12-14 13:34:52 +0000
232+++ panel/app/panelmanager.cpp 2012-01-16 18:02:25 +0000
233@@ -141,7 +141,7 @@
234 Unity2dPanel* panel = new Unity2dPanel;
235 panel->setAccessibleName("Top Panel");
236 panel->setEdge(Unity2dPanel::TopEdge);
237- panel->setThickness(24);
238+ panel->setFixedHeight(24);
239
240 QPoint p;
241 if (QApplication::isRightToLeft()) {
242
243=== modified file 'panel/applets/appname/appnameapplet.cpp'
244--- panel/applets/appname/appnameapplet.cpp 2011-12-14 13:36:26 +0000
245+++ panel/applets/appname/appnameapplet.cpp 2012-01-16 18:02:25 +0000
246@@ -55,7 +55,6 @@
247 #include <QPoint>
248
249 static const int APPNAME_LABEL_LEFT_MARGIN = 6;
250-static const int APPNAME_WINDOW_BUTTONS_WIDTH = 66;
251
252 class WindowButton : public QAbstractButton
253 {
254@@ -183,7 +182,7 @@
255 layout->addWidget(m_closeButton);
256 layout->addWidget(m_minimizeButton);
257 layout->addWidget(m_maximizeButton);
258- m_windowButtonWidget->setFixedWidth(APPNAME_WINDOW_BUTTONS_WIDTH);
259+ m_windowButtonWidget->setFixedWidth(LauncherClient::MaximumWidth);
260 QObject::connect(m_closeButton, SIGNAL(clicked()), m_windowHelper, SLOT(close()));
261 QObject::connect(m_minimizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(minimize()));
262 QObject::connect(m_maximizeButton, SIGNAL(clicked()), m_windowHelper, SLOT(toggleMaximize()));
263@@ -301,7 +300,7 @@
264
265 // Define label width
266 if (!isMaximized && showMenu) {
267- d->m_label->setMaximumWidth(APPNAME_WINDOW_BUTTONS_WIDTH);
268+ d->m_label->setMaximumWidth(LauncherClient::MaximumWidth);
269 } else {
270 d->m_label->setMaximumWidth(QWIDGETSIZE_MAX);
271 }
272
273=== modified file 'shell/Shell.qml'
274--- shell/Shell.qml 2012-01-13 11:58:28 +0000
275+++ shell/Shell.qml 2012-01-16 18:02:25 +0000
276@@ -31,7 +31,7 @@
277 id: launcherLoader
278 anchors.top: parent.top
279 anchors.bottom: parent.bottom
280- width: launcher2dConfiguration.thickness
281+ width: 65
282 x: visibilityController.shown ? 0 : -width
283
284 KeyNavigation.right: dashLoader
285
286=== modified file 'shell/launcher/Launcher.qml'
287--- shell/launcher/Launcher.qml 2012-01-10 16:41:53 +0000
288+++ shell/launcher/Launcher.qml 2012-01-16 18:02:25 +0000
289@@ -117,9 +117,10 @@
290 }
291
292 anchors.top: parent.top
293- anchors.bottom: shelf.top
294+ anchors.bottomMargin: 0
295 /* the distance from the top of the launcher and the dash tile is 6 instead of 7 */
296 anchors.topMargin: -1
297+ height: parent.height - shelf.height + ((selectionOutlineSize - tileSize)) - 4
298 width: parent.width
299
300 /* Ensure all delegates are cached in order to improve smoothness of
301@@ -163,7 +164,8 @@
302 objectName: "shelf"
303
304 anchors.bottom: parent.bottom
305- anchors.bottomMargin: main.anchors.topMargin
306+ anchors.bottomMargin: main.anchors.bottomMargin
307+ anchors.topMargin: main.anchors.topMargin
308 height: selectionOutlineSize * count
309 width: parent.width
310 interactive: false
311
312=== modified file 'shell/launcher/LauncherItem.qml'
313--- shell/launcher/LauncherItem.qml 2012-01-10 17:14:44 +0000
314+++ shell/launcher/LauncherItem.qml 2012-01-16 18:02:25 +0000
315@@ -52,8 +52,11 @@
316
317 anchors.horizontalCenter: parent.horizontalCenter
318
319+ height: selectionOutlineSize
320+
321 property bool isBfb: false
322 property int tileSize
323+ property int selectionOutlineSize
324 property alias name: looseItem.objectName
325 property string desktopFile: ""
326 property alias icon: icon.source
327@@ -132,13 +135,8 @@
328 the active one */
329 Image {
330 objectName: "active"
331-
332- anchors.top: parent.top
333- anchors.bottom: parent.bottom
334 anchors.right: parent.right
335-
336- width: parent.width * 0.15
337- fillMode: Image.PreserveAspectFit
338+ y: item.height - item.selectionOutlineSize / 2 - height / 2
339 mirror: isRightToLeft()
340
341 source: "image://blended/%1color=%2alpha=%3"
342@@ -164,9 +162,7 @@
343 printed for the following two anchor assignements. This fixes the
344 problem, but I'm not sure if it should happen in the first place. */
345 anchors.left: (parent) ? parent.left : undefined
346- width: parent.width * 0.15
347- height: width * sourceSize.height / sourceSize.width
348- y: (item.height - height) / 2 + getPipOffset(index) * 0.015 * item.height
349+ y: item.height - item.selectionOutlineSize / 2 - height / 2 + getPipOffset(index)
350 mirror: isRightToLeft()
351
352 source: "image://blended/%1color=%2alpha=%3"
353@@ -216,6 +212,8 @@
354 running: launching
355 }
356
357+ sourceSize.width: item.tileSize
358+ sourceSize.height: item.tileSize
359 source: {
360 if (isBfb) {
361 if (declarativeView.focus && item.activeFocus) {
362@@ -240,6 +238,8 @@
363 anchors.fill: parent
364 smooth: true
365
366+ sourceSize.width: item.tileSize
367+ sourceSize.height: item.tileSize
368 source: "artwork/round_outline_54x54.png"
369
370 opacity: 0
371@@ -258,13 +258,11 @@
372 Image {
373 id: icon
374 objectName: "icon"
375-
376- anchors.fill: parent
377- anchors.margins: parent.width * 0.056
378+ anchors.centerIn: parent
379 smooth: true
380
381- sourceSize.width: Math.max(width, 16)
382- sourceSize.height: Math.max(height, 16)
383+ sourceSize.width: 48
384+ sourceSize.height: 48
385
386 /* Whenever one of the parameters used in calculating the background color of
387 the icon changes, recalculate its value */
388@@ -288,14 +286,14 @@
389 smooth: true
390
391 source: isBfb ? "artwork/squircle_shine_54.png" : "artwork/round_shine_54x54.png"
392+ sourceSize.width: item.tileSize
393+ sourceSize.height: item.tileSize
394 }
395
396 Image {
397 id: selectionOutline
398 objectName: "selectionOutline"
399 anchors.centerIn: parent
400- width: item.width
401- height: item.height
402 smooth: true
403 source: isBfb ? "artwork/squircle_glow_54.png" : "artwork/round_selected_66x66.png"
404 visible: declarativeView.focus && item.activeFocus
405@@ -303,22 +301,22 @@
406
407 Rectangle {
408 id: counter
409- height: width / 2 - border.width
410- width: parent.width * 0.59
411+ height: 16 - border.width
412+ width: 32
413 // Using anchors the item will be 1 pixel off with respect to Unity
414 y: 1
415 x: 1
416 radius: height / 2 - 1
417 smooth: true
418- border.width: width / 16
419+ border.width: 2
420 border.color: "white"
421 color: "#595959"
422 visible: launcherItem.counterVisible
423
424 Text {
425 anchors.centerIn: parent
426- font.pixelSize: parent.height * 0.79
427- width: parent.width * 0.84
428+ font.pixelSize: parent.height - 3
429+ width: parent.width - 5
430 smooth: true
431 elide: Text.ElideRight
432 horizontalAlignment: Text.AlignHCenter
433@@ -331,8 +329,7 @@
434 id: progressBar
435 objectName: "progressBar"
436 source: "artwork/progress_bar_trough.png"
437- anchors.top: parent.top
438- anchors.bottom: parent.bottom
439+ anchors.verticalCenter: parent.verticalCenter
440 anchors.left: parent.left
441 width: tile.width
442 smooth: true
443@@ -341,10 +338,9 @@
444 Image {
445 id: progressFill
446 source: "artwork/progress_bar_fill.png"
447- x: parent.width * 0.11
448- y: (parent.height - height) / 2
449- width: parent.width * 0.78 * launcherItem.progress
450- height: parent.height * 0.074
451+ anchors.verticalCenter: parent.verticalCenter
452+ x: 6
453+ width: sourceSize.width * launcherItem.progress
454 smooth: true
455
456 Behavior on width {
457@@ -377,8 +373,8 @@
458 anchors.centerIn: parent
459 color: "#B3000000" // 0.7 opacity on black
460 radius: 2
461- width: parent.width * 0.41
462- height: parent.height * 0.41
463+ width: 22
464+ height: 22
465 smooth: true
466
467 Text {
468@@ -386,7 +382,6 @@
469 anchors.centerIn: parent
470 color: "white"
471 smooth: true
472- font.pixelSize: parent.height * 0.7
473 }
474 }
475
476
477=== modified file 'shell/launcher/LauncherList.qml'
478--- shell/launcher/LauncherList.qml 2012-01-10 17:14:44 +0000
479+++ shell/launcher/LauncherList.qml 2012-01-16 18:02:25 +0000
480@@ -25,13 +25,13 @@
481
482 /* The spacing is explicitly set in order to compensate
483 the space added by selectionOutline and round_corner_54x54.png. */
484- spacing: -width * 0.12 // FIXME: live update broken by this code
485+ spacing: -8
486
487- property int tileSize: width * 0.82
488+ property int tileSize: 54
489
490 /* selectionOutline tile size, so AutoScrollingList view can calculate
491 the right height. */
492- property int selectionOutlineSize: width // this is the size of an item; items are square
493+ property int selectionOutlineSize: 65
494
495 /* Keep a reference to the currently visible contextual menu */
496 property variant visibleMenu
497@@ -96,8 +96,8 @@
498 name: item.name
499
500 width: list.width
501- height: width
502 tileSize: list.tileSize
503+ selectionOutlineSize: list.selectionOutlineSize
504
505 desktopFile: item.desktop_file ? item.desktop_file : ""
506 icon: item.icon != "" ? "image://icons/" + item.icon : "image://icons/unknown"

Subscribers

People subscribed via source and target branches

to all changes: