Merge lp:~nick-dedekind/unity/preview.lp1043997-music-tracks into lp:unity

Proposed by Nick Dedekind
Status: Merged
Approved by: Michal Hruby
Approved revision: no longer in the source branch.
Merged at revision: 2677
Proposed branch: lp:~nick-dedekind/unity/preview.lp1043997-music-tracks
Merge into: lp:unity
Diff against target: 159 lines (+37/-18)
3 files modified
dash/previews/Track.cpp (+27/-13)
dash/previews/Track.h (+1/-0)
manual-tests/Preview.txt (+9/-5)
To merge this branch: bzr merge lp:~nick-dedekind/unity/preview.lp1043997-music-tracks
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+122292@code.launchpad.net

Commit message

Extended track play/pause mouse discovery for entire track row.
Re-worded manual test for play/pause music track.

Description of the change

Extended track play/pause mouse discovery for entire track row.
Re-worded manual test for play/pause music track.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Looks good code wise. Though the only problem I see is when you re-open the dash the music stops playing. I would think it would continue to play independent of the dash opening/closing. Though im not sure how easy of a fix that will be...if it is large enough we should merge this part, then open a new bug to work that part. Let me know what you think!

Revision history for this message
Michal Hruby (mhr3) wrote :

> Looks good code wise. Though the only problem I see is when you re-open the
> dash the music stops playing. I would think it would continue to play
> independent of the dash opening/closing. Though im not sure how easy of a fix
> that will be...if it is large enough we should merge this part, then open a
> new bug to work that part. Let me know what you think!

According to design the preview needs to stop right away after closing dash, but that's tracked as #1045298. Approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/previews/Track.cpp'
2--- dash/previews/Track.cpp 2012-08-28 08:30:00 +0000
3+++ dash/previews/Track.cpp 2012-08-31 14:44:00 +0000
4@@ -194,19 +194,16 @@
5 nux::BaseTexture* tex_play = style.GetPlayIcon();
6 IconTexture* status_play = new IconTexture(tex_play, style.GetStatusIconSize(), style.GetStatusIconSize());
7 status_play->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
8- status_play->SetInputEventSensitivity(false);
9
10 nux::BaseTexture* tex_pause = style.GetPauseIcon();
11 IconTexture* status_pause = new IconTexture(tex_pause, style.GetStatusIconSize(), style.GetStatusIconSize());
12 status_pause->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
13- status_pause->SetInputEventSensitivity(false);
14
15 track_number_ = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);
16 track_number_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_CENTRE);
17 track_number_->SetTextVerticalAlignment(nux::StaticCairoText::NUX_ALIGN_CENTRE);
18 track_number_->SetLines(-1);
19 track_number_->SetFont(style.track_font());
20- track_number_->SetInputEventSensitivity(false);
21
22 title_ = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);
23 title_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);
24@@ -229,26 +226,18 @@
25 status_play_layout_->GetLayout()->AddSpace(0, 1);
26 status_play_layout_->GetLayout()->AddView(status_play, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
27 status_play_layout_->GetLayout()->AddSpace(0, 1);
28- status_play_layout_->mouse_click.connect([&](int, int, unsigned long, unsigned long) { play.emit(uri_); });
29- status_play_layout_->mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
30- status_play_layout_->mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
31
32 status_pause_layout_ = new TmpView();
33 status_pause_layout_->SetLayout(new nux::HLayout());
34 status_pause_layout_->GetLayout()->AddSpace(0, 1);
35 status_pause_layout_->GetLayout()->AddView(status_pause, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
36 status_pause_layout_->GetLayout()->AddSpace(0, 1);
37- status_pause_layout_->mouse_click.connect([&](int, int, unsigned long, unsigned long) { pause.emit(uri_); });
38- status_pause_layout_->mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
39- status_pause_layout_->mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
40
41 track_number_layout_ = new TmpView();
42 track_number_layout_->SetLayout(new nux::HLayout());
43 track_number_layout_->GetLayout()->AddSpace(0, 1);
44 track_number_layout_->GetLayout()->AddView(track_number_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
45 track_number_layout_->GetLayout()->AddSpace(0, 1);
46- track_number_layout_->mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
47- track_number_layout_->mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
48
49 track_status_layout_ = new nux::LayeredLayout();
50 track_status_layout_->AddLayer(status_play_layout_, true);
51@@ -265,11 +254,27 @@
52 duration_layout_->AddSpace(0, 1);
53 duration_layout_->AddView(duration_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
54
55- layout->SetSpaceBetweenChildren(6);
56 layout->AddLayout(track_status_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
57 layout->AddLayout(title_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
58 layout->AddLayout(duration_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
59 SetLayout(layout);
60+
61+ mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
62+ mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
63+ mouse_click.connect([&](int, int, unsigned long, unsigned long)
64+ {
65+ switch (play_state_)
66+ {
67+ case dash::PLAYING:
68+ pause.emit(uri_);
69+ break;
70+ case dash::PAUSED:
71+ case dash::STOPPED:
72+ default:
73+ play.emit(uri_);
74+ break;
75+ }
76+ });
77 }
78
79 void Track::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
80@@ -342,9 +347,18 @@
81 gfx_engine.PopClippingRectangle();
82 }
83
84+nux::Area* Track::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
85+{
86+ bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);
87+ if (mouse_inside == false)
88+ return NULL;
89+
90+ return this;
91+}
92+
93 bool Track::HasStatusFocus() const
94 {
95- return play_state_ == dash::PLAYING || play_state_ == dash::PAUSED;
96+ return mouse_over_ || play_state_ == dash::PLAYING || play_state_ == dash::PAUSED;
97 }
98
99 void Track::OnTrackControlMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags)
100
101=== modified file 'dash/previews/Track.h'
102--- dash/previews/Track.h 2012-08-22 10:03:52 +0000
103+++ dash/previews/Track.h 2012-08-31 14:44:00 +0000
104@@ -61,6 +61,7 @@
105 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
106 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
107 virtual void PreLayoutManagement();
108+ virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
109
110 // From debug::Introspectable
111 std::string GetName() const;
112
113=== modified file 'manual-tests/Preview.txt'
114--- manual-tests/Preview.txt 2012-08-24 22:23:11 +0000
115+++ manual-tests/Preview.txt 2012-08-31 14:44:00 +0000
116@@ -73,7 +73,7 @@
117 The Track information will contain a title and duration.
118
119
120-Preview Music Play
121+Preview Music Track Play
122 note: Should be automated.
123 ------------
124 This tests the dash music preview track play
125@@ -84,14 +84,16 @@
126 #. Open a preview for a result which contains tracks.
127
128 Actions:
129-#. Play first track.
130+#. Hover over track number for the track you wish to play.
131+#. Click play icon.
132
133 Expected Result:
134+ When hovering on track number, it will change to a play icon.
135 Music Player daemon will start playing track and update status of the track
136 in the preview to playing as well as update it's progress.
137
138
139-Preview Music Pause
140+Preview Music Track Pause
141 note: Should be automated.
142 ------------
143 This tests the dash preview preview navigate right animation
144@@ -100,12 +102,14 @@
145 #. Open music lens (Super+M)
146 #. Enter arbitrary search string and ensure a result is available.
147 #. Open a preview for a result which contains tracks.
148-#. Play first track.
149+#. Play first track. (by hovering+click on track number.)
150
151 Actions:
152-#. Pause playing track.
153+#. Hover over pause icon for the track which is playing.
154+#. Click pause icon.
155
156 Expected Result:
157+ When hovering on play icon, it will change to a pause icon.
158 Music Player daemon will pause the playing track and update it's status
159 to paused. Progress will stop incresing.
160