Merge lp:~fenryxo/nuvola-player/rdio-nav-buttons into lp:nuvola-player/2.5.x

Proposed by Jiří Janoušek
Status: Merged
Merged at revision: 827
Proposed branch: lp:~fenryxo/nuvola-player/rdio-nav-buttons
Merge into: lp:nuvola-player/2.5.x
Diff against target: 146 lines (+77/-6)
3 files modified
data/nuvolaplayer/services/googleplay/integration.js (+1/-1)
data/nuvolaplayer/services/rdio/integration.js (+75/-4)
setup_env.sh (+1/-1)
To merge this branch: bzr merge lp:~fenryxo/nuvola-player/rdio-nav-buttons
Reviewer Review Type Date Requested Status
Michael Mims Pending
Review via email: mp+219324@code.launchpad.net

Description of the change

Michael, could you review following change I've made to your Rdio integration?

Rdio: implemented integrated navigation buttons, see bug LP:1212167.

To post a comment you must log in.
Revision history for this message
Michael Mims (mims-michael) wrote :

Sorry, I haven't had a chance to get to this yet. I reformatted my system recently, so I need to set up a dev environment again. I'll try to look at it this weekend.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/nuvolaplayer/services/googleplay/integration.js'
--- data/nuvolaplayer/services/googleplay/integration.js 2014-05-04 12:17:37 +0000
+++ data/nuvolaplayer/services/googleplay/integration.js 2014-05-13 09:48:56 +0000
@@ -1,6 +1,6 @@
1/*1/*
2 * Copyright 2011-2014 Jiří Janoušek <janousek.jiri@gmail.com>2 * Copyright 2011-2014 Jiří Janoušek <janousek.jiri@gmail.com>
3 * Copyright 2014 Martin Pöhlmann <http://mpdeimos.com>3 * Copyright 2014 Martin Pöhlmann <martin.deimos@gmx.de>
4 *4 *
5 * Redistribution and use in source and binary forms, with or without5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
77
=== modified file 'data/nuvolaplayer/services/rdio/integration.js'
--- data/nuvolaplayer/services/rdio/integration.js 2013-12-22 18:57:54 +0000
+++ data/nuvolaplayer/services/rdio/integration.js 2014-05-13 09:48:56 +0000
@@ -1,6 +1,8 @@
1/*1/*
2 * Copyright 2013 Michael Mims <mims.michael@gmail.com>2 * Copyright 2013 Michael Mims <mims.michael@gmail.com>
3 *3 * Copyright 2014 Martin Pöhlmann <martin.deimos@gmx.de>
4 * Copyright 2014 Jiří Janoušek <janousek.jiri@gmail.com>
5 *
4 * Redistribution and use in source and binary forms, with or without6 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
6 * 8 *
@@ -37,12 +39,13 @@
37 Nuvola.onMessageReceived = Nuvola.bind(this, this.messageHandler);39 Nuvola.onMessageReceived = Nuvola.bind(this, this.messageHandler);
38 40
39 /* For debug output */41 /* For debug output */
40 this.name = "Rdio"; 42 this.name = "Rdio";
41 43
42 /* Let's run */44 /* Let's run */
43 this.state = Nuvola.STATE_NONE;45 this.state = Nuvola.STATE_NONE;
44 this.firstPlayToggled = false;46 this.firstPlayToggled = false;
45 this.update();47 this.update();
48 this.integrateNavigationButtons();
46 };49 };
4750
48 /**51 /**
@@ -85,7 +88,7 @@
85 var can_next;88 var can_next;
8689
87 try{90 try{
88 var playingTrack = R.Services.Player.model.get("playingTrack").attributes; 91 var playingTrack = R.Services.Player.model.get("playingTrack").attributes;
89 album_art = playingTrack.icon;92 album_art = playingTrack.icon;
90 album = playingTrack.album;93 album = playingTrack.album;
91 artist = playingTrack.artist;94 artist = playingTrack.artist;
@@ -144,7 +147,12 @@
144 * Command handler147 * Command handler
145 * @param cmd command to execute148 * @param cmd command to execute
146 */149 */
147 Integration.prototype.messageHandler = function(cmd){150 Integration.prototype.messageHandler = function(cmd, param1, param2){
151 // Return if navigation buttons are enabled and can handle this event.
152 if (this.navigationButtons !== undefined
153 && this.navigationButtons.onMessageReceived(cmd, param1, param2) === true)
154 return;
155
148 try{156 try{
149 switch(cmd){157 switch(cmd){
150 case Nuvola.ACTION_PLAY:158 case Nuvola.ACTION_PLAY:
@@ -173,6 +181,69 @@
173 throw (this.name + ": " + e.message);181 throw (this.name + ": " + e.message);
174 }182 }
175 }183 }
184
185 Integration.prototype.getSearchContainer = function()
186 {
187 return document.querySelector("#header .search_container");
188 }
189
190 Integration.prototype.integrateNavigationButtons = function()
191 {
192 // This feature is disabled on pre 2.4.0
193 if (Nuvola.NavigationButtonIntegration === undefined)
194 return;
195
196 if (!this.getSearchContainer())
197 {
198 console.log("Could not find the search box.");
199 setTimeout(Nuvola.bind(this, this.integrateNavigationButtons), 500);
200 return;
201 }
202
203 var marginTop = "20px";
204 var navigateBack = this.navigateBack = Nuvola.makeElement("button", null, "<");
205 navigateBack.className = "button";
206 navigateBack.style.float = "left";
207 navigateBack.style.marginRight = "0px";
208 navigateBack.style.marginTop = marginTop;
209 navigateBack.style.borderTopRightRadius = "0px";
210 navigateBack.style.borderBottomRightRadius = "0px";
211 navigateBack.style.verticalAlign = "middle";
212
213 var navigateForward = this. navigateForward = Nuvola.makeElement("button", null, ">");
214 navigateForward.className = "button";
215 navigateForward.style.float = "left";
216 navigateForward.style.marginRight = "15px";
217 navigateForward.style.marginTop = marginTop;
218 navigateForward.style.borderLeft = "none";
219 navigateForward.style.borderTopLeftRadius = "0px";
220 navigateForward.style.borderBottomLeftRadius = "0px";
221
222 this.insertNavigationButtons();
223 this.navigationButtons = new Nuvola.NavigationButtonIntegration(navigateBack, navigateForward);
224
225 // The #header element is occasionally removed from the DOM tree,
226 // so we need to re-insert our navigation buttons.
227 $("body").bind("DOMNodeRemoved", Nuvola.bind(this, function(e)
228 {
229 if (e.target.id == "header")
230 setTimeout(Nuvola.bind(this, this.insertNavigationButtons), 100);
231 }));
232 }
233
234 Integration.prototype.insertNavigationButtons = function()
235 {
236 var cursor = this.getSearchContainer();
237 if (!cursor)
238 {
239 setTimeout(Nuvola.bind(this, this.insertNavigationButtons), 500);
240 return;
241 }
242
243 var container = cursor.parentNode;
244 container.insertBefore(this.navigateBack, cursor);
245 container.insertBefore(this.navigateForward, cursor);
246 }
176247
177 /* Store reference */ 248 /* Store reference */
178 Nuvola.integration = new Integration(); // Singleton249 Nuvola.integration = new Integration(); // Singleton
179250
=== modified file 'setup_env.sh'
--- setup_env.sh 2014-01-12 18:17:57 +0000
+++ setup_env.sh 2014-05-13 09:48:56 +0000
@@ -5,7 +5,7 @@
5export LD_LIBRARY_PATH=./build5export LD_LIBRARY_PATH=./build
66
7# rebuild whole project7# rebuild whole project
8alias rebuild='./waf distclean configure --no-unity-quick-list build '8alias rebuild='./waf distclean configure --with-gstreamer=1.0 build '
9# build without tests and run NP9# build without tests and run NP
10alias debug='./waf build --skip-tests && ./nuvolaplayer.wrapper -D '10alias debug='./waf build --skip-tests && ./nuvolaplayer.wrapper -D '
11# launch GUI demos11# launch GUI demos

Subscribers

People subscribed via source and target branches