Merge lp:~fboucault/unity-2d/dash_horizontal_renderer into lp:unity-2d/3.0

Proposed by Florian Boucault
Status: Merged
Approved by: Florian Boucault
Approved revision: no longer in the source branch.
Merged at revision: 613
Proposed branch: lp:~fboucault/unity-2d/dash_horizontal_renderer
Merge into: lp:unity-2d/3.0
Diff against target: 137 lines (+133/-0)
1 file modified
places/UnityHorizontalTileRenderer.qml (+133/-0)
To merge this branch: bzr merge lp:~fboucault/unity-2d/dash_horizontal_renderer
Reviewer Review Type Date Requested Status
Joe Simpson (community) Approve
Review via email: mp+65488@code.launchpad.net

This proposal supersedes a proposal from 2011-06-15.

Commit message

[dash] Added a UnityHorizontalTileRenderer that is required by many community lenses (Gwibber lens, books lens, music lens, etc.)

Description of the change

I fixed a bug which is here:
https://bugs.launchpad.net/unity-2d/+bug/790319

Basically I made the renderer thing.

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

Thanks for the work Joe. I made a few modifications to the renderer you submitted. Can you please test them and see if everything is in order?
Thanks!

584. By Florian Boucault

Merged lp:unity-2d

Revision history for this message
Joe Simpson (headbangerkenny) wrote :

> Thanks for the work Joe. I made a few modifications to the renderer you
> submitted. Can you please test them and see if everything is in order?
> Thanks!

I did the merge command it tells me to do at the top of the page (I'm new to Bazzar and Launchpad!) and if that's the right thing to do, everything is in order!

Joe :)

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

Thanks a lot!

Revision history for this message
Joe Simpson (headbangerkenny) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'places/UnityHorizontalTileRenderer.qml'
2--- places/UnityHorizontalTileRenderer.qml 1970-01-01 00:00:00 +0000
3+++ places/UnityHorizontalTileRenderer.qml 2011-06-22 12:52:01 +0000
4@@ -0,0 +1,133 @@
5+/*
6+ * This file is part of unity-2d
7+ *
8+ * Copyright 2011 Canonical Ltd.
9+ *
10+ * This program is free software; you can redistribute it and/or modify
11+ * it under the terms of the GNU General Public License as published by
12+ * the Free Software Foundation; version 3.
13+ *
14+ * This program is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU General Public License for more details.
18+ *
19+ * You should have received a copy of the GNU General Public License
20+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21+ */
22+
23+import Qt 4.7
24+import Unity2d 1.0 /* required for drag’n’drop handling */
25+
26+RendererGrid {
27+ cellWidth: 280
28+ cellHeight: 75
29+ horizontalSpacing: 10
30+ verticalSpacing: 10
31+
32+ cellRenderer: Component {
33+ Button {
34+ id: button
35+
36+ property string uri
37+ property string iconHint
38+ property string mimetype
39+ property string displayName
40+ property string comment
41+
42+ onClicked: {
43+ dashView.active = false
44+ placeEntryModel.place.activate(decodeURIComponent(uri))
45+ }
46+
47+ DragItemWithUrl {
48+ anchors.fill: parent
49+ url: decodeURIComponent(uri)
50+ defaultAction: {
51+ if (!url.indexOf("application://")) return Qt.CopyAction
52+ else if (!url.indexOf("unity-install://")) return Qt.IgnoreAction
53+ else return Qt.LinkAction
54+ }
55+ supportedActions: defaultAction
56+ delegate: Component {
57+ Image {
58+ source: icon.source
59+ width: icon.width
60+ height: icon.height
61+ fillMode: icon.fillMode
62+ sourceSize.width: width
63+ sourceSize.height: height
64+ asynchronous: true
65+ }
66+ }
67+ onPressed: parent.pressed = true
68+ onReleased: {
69+ parent.pressed = false
70+ parent.clicked()
71+ }
72+ onDrop: parent.pressed = false
73+ }
74+
75+ Image {
76+ id: icon
77+
78+ /* Heuristic: if iconHint does not contain a '/' then it is an icon name */
79+ source: iconHint != "" && iconHint.indexOf("/") == -1 ? "image://icons/" + iconHint : iconHint
80+ width: 48
81+ height: 48
82+ anchors.verticalCenter: parent.verticalCenter
83+ anchors.left: parent.left
84+ anchors.leftMargin: 3
85+ fillMode: Image.PreserveAspectFit
86+ sourceSize.width: width
87+ sourceSize.height: height
88+
89+ asynchronous: true
90+ opacity: status == Image.Ready ? 1 : 0
91+ Behavior on opacity {NumberAnimation {duration: 200; easing.type: Easing.InOutQuad}}
92+ }
93+
94+ Item {
95+ id: labels
96+
97+ anchors.top: parent.top
98+ anchors.topMargin: 3
99+ anchors.bottom: parent.bottom
100+ anchors.bottomMargin: 3
101+ anchors.left: icon.right
102+ anchors.leftMargin: 15
103+ anchors.right: parent.right
104+ anchors.rightMargin: 3
105+
106+ TextCustom {
107+ id: firstLine
108+
109+ text: displayName
110+ color: button.state == "pressed" ? "#5e5e5e" : "#ffffff"
111+ elide: Text.ElideMiddle
112+
113+ anchors.left: parent.left
114+ anchors.right: parent.right
115+ anchors.top: parent.top
116+ height: paintedHeight
117+ }
118+
119+ TextCustom {
120+ id: secondLine
121+
122+ text: comment
123+ color: button.state == "pressed" ? "#888888" : "#cccccc"
124+
125+ anchors.left: parent.left
126+ anchors.right: parent.right
127+ anchors.top: firstLine.bottom
128+ anchors.bottom: parent.bottom
129+
130+ clip: true
131+ wrapMode: Text.Wrap
132+ verticalAlignment: Text.AlignTop
133+ }
134+ }
135+ }
136+ }
137+}

Subscribers

People subscribed via source and target branches