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
=== modified file 'dash/previews/Track.cpp'
--- dash/previews/Track.cpp 2012-08-28 08:30:00 +0000
+++ dash/previews/Track.cpp 2012-08-31 14:44:00 +0000
@@ -194,19 +194,16 @@
194 nux::BaseTexture* tex_play = style.GetPlayIcon();194 nux::BaseTexture* tex_play = style.GetPlayIcon();
195 IconTexture* status_play = new IconTexture(tex_play, style.GetStatusIconSize(), style.GetStatusIconSize());195 IconTexture* status_play = new IconTexture(tex_play, style.GetStatusIconSize(), style.GetStatusIconSize());
196 status_play->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);196 status_play->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
197 status_play->SetInputEventSensitivity(false);
198197
199 nux::BaseTexture* tex_pause = style.GetPauseIcon();198 nux::BaseTexture* tex_pause = style.GetPauseIcon();
200 IconTexture* status_pause = new IconTexture(tex_pause, style.GetStatusIconSize(), style.GetStatusIconSize());199 IconTexture* status_pause = new IconTexture(tex_pause, style.GetStatusIconSize(), style.GetStatusIconSize());
201 status_pause->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);200 status_pause->SetDrawMode(IconTexture::DrawMode::STRETCH_WITH_ASPECT);
202 status_pause->SetInputEventSensitivity(false);
203201
204 track_number_ = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);202 track_number_ = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);
205 track_number_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_CENTRE);203 track_number_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_CENTRE);
206 track_number_->SetTextVerticalAlignment(nux::StaticCairoText::NUX_ALIGN_CENTRE);204 track_number_->SetTextVerticalAlignment(nux::StaticCairoText::NUX_ALIGN_CENTRE);
207 track_number_->SetLines(-1);205 track_number_->SetLines(-1);
208 track_number_->SetFont(style.track_font());206 track_number_->SetFont(style.track_font());
209 track_number_->SetInputEventSensitivity(false);
210207
211 title_ = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);208 title_ = new nux::StaticCairoText("", NUX_TRACKER_LOCATION);
212 title_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);209 title_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);
@@ -229,26 +226,18 @@
229 status_play_layout_->GetLayout()->AddSpace(0, 1);226 status_play_layout_->GetLayout()->AddSpace(0, 1);
230 status_play_layout_->GetLayout()->AddView(status_play, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);227 status_play_layout_->GetLayout()->AddView(status_play, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
231 status_play_layout_->GetLayout()->AddSpace(0, 1);228 status_play_layout_->GetLayout()->AddSpace(0, 1);
232 status_play_layout_->mouse_click.connect([&](int, int, unsigned long, unsigned long) { play.emit(uri_); });
233 status_play_layout_->mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
234 status_play_layout_->mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
235229
236 status_pause_layout_ = new TmpView();230 status_pause_layout_ = new TmpView();
237 status_pause_layout_->SetLayout(new nux::HLayout());231 status_pause_layout_->SetLayout(new nux::HLayout());
238 status_pause_layout_->GetLayout()->AddSpace(0, 1);232 status_pause_layout_->GetLayout()->AddSpace(0, 1);
239 status_pause_layout_->GetLayout()->AddView(status_pause, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);233 status_pause_layout_->GetLayout()->AddView(status_pause, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
240 status_pause_layout_->GetLayout()->AddSpace(0, 1);234 status_pause_layout_->GetLayout()->AddSpace(0, 1);
241 status_pause_layout_->mouse_click.connect([&](int, int, unsigned long, unsigned long) { pause.emit(uri_); });
242 status_pause_layout_->mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
243 status_pause_layout_->mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
244235
245 track_number_layout_ = new TmpView();236 track_number_layout_ = new TmpView();
246 track_number_layout_->SetLayout(new nux::HLayout());237 track_number_layout_->SetLayout(new nux::HLayout());
247 track_number_layout_->GetLayout()->AddSpace(0, 1);238 track_number_layout_->GetLayout()->AddSpace(0, 1);
248 track_number_layout_->GetLayout()->AddView(track_number_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);239 track_number_layout_->GetLayout()->AddView(track_number_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
249 track_number_layout_->GetLayout()->AddSpace(0, 1);240 track_number_layout_->GetLayout()->AddSpace(0, 1);
250 track_number_layout_->mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
251 track_number_layout_->mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
252241
253 track_status_layout_ = new nux::LayeredLayout();242 track_status_layout_ = new nux::LayeredLayout();
254 track_status_layout_->AddLayer(status_play_layout_, true);243 track_status_layout_->AddLayer(status_play_layout_, true);
@@ -265,11 +254,27 @@
265 duration_layout_->AddSpace(0, 1);254 duration_layout_->AddSpace(0, 1);
266 duration_layout_->AddView(duration_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);255 duration_layout_->AddView(duration_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
267256
268 layout->SetSpaceBetweenChildren(6);
269 layout->AddLayout(track_status_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);257 layout->AddLayout(track_status_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
270 layout->AddLayout(title_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);258 layout->AddLayout(title_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
271 layout->AddLayout(duration_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);259 layout->AddLayout(duration_layout_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
272 SetLayout(layout);260 SetLayout(layout);
261
262 mouse_enter.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseEnter));
263 mouse_leave.connect(sigc::mem_fun(this, &Track::OnTrackControlMouseLeave));
264 mouse_click.connect([&](int, int, unsigned long, unsigned long)
265 {
266 switch (play_state_)
267 {
268 case dash::PLAYING:
269 pause.emit(uri_);
270 break;
271 case dash::PAUSED:
272 case dash::STOPPED:
273 default:
274 play.emit(uri_);
275 break;
276 }
277 });
273}278}
274279
275void Track::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)280void Track::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
@@ -342,9 +347,18 @@
342 gfx_engine.PopClippingRectangle();347 gfx_engine.PopClippingRectangle();
343}348}
344349
350nux::Area* Track::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
351{
352 bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);
353 if (mouse_inside == false)
354 return NULL;
355
356 return this;
357}
358
345bool Track::HasStatusFocus() const359bool Track::HasStatusFocus() const
346{360{
347 return play_state_ == dash::PLAYING || play_state_ == dash::PAUSED;361 return mouse_over_ || play_state_ == dash::PLAYING || play_state_ == dash::PAUSED;
348}362}
349363
350void Track::OnTrackControlMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags)364void Track::OnTrackControlMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags)
351365
=== modified file 'dash/previews/Track.h'
--- dash/previews/Track.h 2012-08-22 10:03:52 +0000
+++ dash/previews/Track.h 2012-08-31 14:44:00 +0000
@@ -61,6 +61,7 @@
61 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);61 virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw);
62 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);62 virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw);
63 virtual void PreLayoutManagement();63 virtual void PreLayoutManagement();
64 virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
64 65
65 // From debug::Introspectable66 // From debug::Introspectable
66 std::string GetName() const;67 std::string GetName() const;
6768
=== modified file 'manual-tests/Preview.txt'
--- manual-tests/Preview.txt 2012-08-24 22:23:11 +0000
+++ manual-tests/Preview.txt 2012-08-31 14:44:00 +0000
@@ -73,7 +73,7 @@
73 The Track information will contain a title and duration.73 The Track information will contain a title and duration.
7474
7575
76Preview Music Play76Preview Music Track Play
77note: Should be automated.77note: Should be automated.
78------------78------------
79This tests the dash music preview track play79This tests the dash music preview track play
@@ -84,14 +84,16 @@
84#. Open a preview for a result which contains tracks.84#. Open a preview for a result which contains tracks.
8585
86Actions:86Actions:
87#. Play first track.87#. Hover over track number for the track you wish to play.
88#. Click play icon.
8889
89Expected Result:90Expected Result:
91 When hovering on track number, it will change to a play icon.
90 Music Player daemon will start playing track and update status of the track92 Music Player daemon will start playing track and update status of the track
91 in the preview to playing as well as update it's progress.93 in the preview to playing as well as update it's progress.
9294
9395
94Preview Music Pause96Preview Music Track Pause
95note: Should be automated.97note: Should be automated.
96------------98------------
97This tests the dash preview preview navigate right animation99This tests the dash preview preview navigate right animation
@@ -100,12 +102,14 @@
100#. Open music lens (Super+M)102#. Open music lens (Super+M)
101#. Enter arbitrary search string and ensure a result is available.103#. Enter arbitrary search string and ensure a result is available.
102#. Open a preview for a result which contains tracks.104#. Open a preview for a result which contains tracks.
103#. Play first track.105#. Play first track. (by hovering+click on track number.)
104106
105Actions:107Actions:
106#. Pause playing track.108#. Hover over pause icon for the track which is playing.
109#. Click pause icon.
107110
108Expected Result:111Expected Result:
112 When hovering on play icon, it will change to a pause icon.
109 Music Player daemon will pause the playing track and update it's status113 Music Player daemon will pause the playing track and update it's status
110 to paused. Progress will stop incresing.114 to paused. Progress will stop incresing.
111115