summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Lorentz <bertrand.lorentz@gmail.com>2011-09-10 14:41:06 +0200
committerBertrand Lorentz <bertrand.lorentz@gmail.com>2011-09-10 14:41:06 +0200
commit6035b7e3586754bad53852acb4bd1e6050b8fe1e (patch)
tree2d362cbe3d075141bcd0594628307334db6eadac
parentb6419fbb09fd163c4ffbf198b8652cca0545bdf3 (diff)
Karaoke: Improve code formatting, no real code change
-rw-r--r--src/Karaoke/Banshee.Karaoke/Gui/KaraokePane.cs35
-rw-r--r--src/Karaoke/Banshee.Karaoke/Gui/KaraokeView.cs7
-rw-r--r--src/Karaoke/Banshee.Karaoke/KaraokeService.cs36
3 files changed, 43 insertions, 35 deletions
diff --git a/src/Karaoke/Banshee.Karaoke/Gui/KaraokePane.cs b/src/Karaoke/Banshee.Karaoke/Gui/KaraokePane.cs
index 2b0b711..501ce15 100644
--- a/src/Karaoke/Banshee.Karaoke/Gui/KaraokePane.cs
+++ b/src/Karaoke/Banshee.Karaoke/Gui/KaraokePane.cs
@@ -45,7 +45,7 @@ namespace Banshee.Karaoke.Gui
private KaraokeView view;
private ContextPage context_page;
private TrackInfo track;
- private Timer t;
+ private Timer timer;
private Label disconnected;
public KaraokePane (ContextPage context_page)
@@ -67,13 +67,13 @@ namespace Banshee.Karaoke.Gui
} else {
view.LoadLyrics (track);
view.LoadStatusChanged += OnViewLoadStatusChanged;
- t.Change (0, 2000);
+ timer.Change (0, 2000);
this.CurrentPage = this.PageNum (view);
}
context_page.SetState (Banshee.ContextPane.ContextState.Loaded);
} else {
context_page.SetState (Banshee.ContextPane.ContextState.NotLoaded);
- t.Change (System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
+ timer.Change (System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
}
}
}
@@ -88,7 +88,9 @@ namespace Banshee.Karaoke.Gui
private void TimerTimedOut (object o)
{
- if (this.CurrentPage == this.PageNum (disconnected)) return;
+ if (this.CurrentPage == this.PageNum (disconnected)) {
+ return;
+ }
ServiceStack.Application.Invoke (delegate {
if (track != null && ServiceManager.PlayerEngine.IsPlaying (track) && view.LoadStatus != Banshee.WebBrowser.OssiferLoadStatus.Failed) {
SetSongTime ();
@@ -98,38 +100,46 @@ namespace Banshee.Karaoke.Gui
private void PauseScrolling ()
{
- if (this.CurrentPage == this.PageNum (disconnected)) return;
+ if (this.CurrentPage == this.PageNum (disconnected)) {
+ return;
+ }
view.ExecuteScript (String.Format ("window.postMessage('pause','http://youtubelyric.com');", ServiceManager.PlayerEngine.Position / 1000));
}
private void ResumeScrolling ()
{
- if (this.CurrentPage == this.PageNum (disconnected)) return;
+ if (this.CurrentPage == this.PageNum (disconnected)) {
+ return;
+ }
view.ExecuteScript (String.Format ("window.postMessage('play','http://youtubelyric.com');", ServiceManager.PlayerEngine.Position / 1000));
}
private void SetSongTime ()
{
- if (this.CurrentPage == this.PageNum (disconnected)) return;
+ if (this.CurrentPage == this.PageNum (disconnected)) {
+ return;
+ }
view.ExecuteScript (String.Format ("window.postMessage({0},'http://youtubelyric.com');", ServiceManager.PlayerEngine.Position / 1000));
}
private void SetStyle ()
{
- if (this.CurrentPage == this.PageNum (disconnected)) return;
+ if (this.CurrentPage == this.PageNum (disconnected)) {
+ return;
+ }
view.ExecuteScript ("if (document.getElementById ('lyricbox')) { document.getElementById ('lyricbox').style.fontSize='2.5em'; }");
}
- public void InitComponents ()
+ private void InitComponents ()
{
this.view = new KaraokeView ();
view.Zoom = 1.2f;
- t = new Timer (TimerTimedOut, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
+ timer = new Timer (TimerTimedOut, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
ServiceManager.PlayerEngine.ConnectEvent (OnTrackChange, PlayerEvent.StateChange);
ServiceManager.PlayerEngine.ConnectEvent (OnSeek, PlayerEvent.Seek);
- this.disconnected = new Label (AddinManager.CurrentLocalizer.GetString ("You are disconnected" +
- " from the internet, so karaoke lyrics are not available."));
+ this.disconnected = new Label (AddinManager.CurrentLocalizer.GetString (
+ "You are disconnected from the internet, so karaoke lyrics are not available."));
this.Add (disconnected);
this.Add (view);
@@ -154,6 +164,5 @@ namespace Banshee.Karaoke.Gui
{
SetSongTime ();
}
-
}
}
diff --git a/src/Karaoke/Banshee.Karaoke/Gui/KaraokeView.cs b/src/Karaoke/Banshee.Karaoke/Gui/KaraokeView.cs
index 16f0425..22f8e2f 100644
--- a/src/Karaoke/Banshee.Karaoke/Gui/KaraokeView.cs
+++ b/src/Karaoke/Banshee.Karaoke/Gui/KaraokeView.cs
@@ -47,7 +47,9 @@ namespace Banshee.Karaoke.Gui
protected override OssiferNavigationResponse OnNavigationPolicyDecisionRequested (string uri)
{
- if (uri.StartsWith ("http://youtubelyric.com/lyric")) return OssiferNavigationResponse.Accept;
+ if (uri.StartsWith ("http://youtubelyric.com/lyric")) {
+ return OssiferNavigationResponse.Accept;
+ }
return OssiferNavigationResponse.Ignore;
}
@@ -65,7 +67,8 @@ namespace Banshee.Karaoke.Gui
public void LoadLyrics (TrackInfo track)
{
- LoadUri (String.Format ("http://youtubelyric.com/lyric/showlyric.php?artist={0}&song={1}",track.DisplayArtistName, track.DisplayTrackTitle));
+ LoadUri (String.Format ("http://youtubelyric.com/lyric/showlyric.php?artist={0}&song={1}",
+ track.DisplayArtistName, track.DisplayTrackTitle));
}
}
}
diff --git a/src/Karaoke/Banshee.Karaoke/KaraokeService.cs b/src/Karaoke/Banshee.Karaoke/KaraokeService.cs
index 1b39495..2bd74b0 100644
--- a/src/Karaoke/Banshee.Karaoke/KaraokeService.cs
+++ b/src/Karaoke/Banshee.Karaoke/KaraokeService.cs
@@ -37,10 +37,8 @@ using Banshee.Configuration;
namespace Banshee.Karaoke
{
-
public class KaraokeService : IExtensionService, IDelayedInitializeService, IDisposable
{
-
Bin audiobin;
Bin playbin;
Bin audiotee;
@@ -70,7 +68,6 @@ namespace Banshee.Karaoke
effect_level = effect_level / 100;
filter_band = (float)FilterBandEntry.Get ();
filter_width = (float)FilterWidthEntry.Get ();
-
}
#region IExtensionService implementation
@@ -109,7 +106,6 @@ namespace Banshee.Karaoke
action_service.UIManager.InsertActionGroup (actions, 0);
ui_menu_id = action_service.UIManager.AddUiFromResource ("KaraokeMenu.xml");
ui_button_id = action_service.UIManager.AddUiFromResource ("KaraokeButton.xml");
-
}
/// <summary>
@@ -133,7 +129,6 @@ namespace Banshee.Karaoke
audiokaraoke.SetFloatProperty ("level", effect_level);
audiokaraoke.SetFloatProperty ("mono-level", effect_level);
}
-
}
/// <summary>
@@ -153,8 +148,9 @@ namespace Banshee.Karaoke
void OnLyricsEnabledChanged ()
{
EventHandler handler = LyricsEnabledChanged;
- if (handler != null)
+ if (handler != null) {
handler (this, new EventArgs ());
+ }
}
void IDelayedInitializeService.DelayedInitialize ()
@@ -165,13 +161,13 @@ namespace Banshee.Karaoke
audiobin = new Bin (ServiceManager.PlayerEngine.ActiveEngine.GetBaseElements ()[1]);
audiotee = new Bin (ServiceManager.PlayerEngine.ActiveEngine.GetBaseElements ()[2]);
- if (playbin.IsNull ())
+ if (playbin.IsNull ()) {
Hyena.Log.Debug ("[Karaoke] Playbin is not yet initialized, cannot start Karaoke Mode");
+ }
audiokaraoke = audiobin.GetByName ("karaoke");
- if (audiokaraoke.IsNull ())
- {
+ if (audiokaraoke.IsNull ()) {
audiokaraoke = ElementFactory.Make ("audiokaraoke","karaoke");
//add audiokaraoke to audiobin
@@ -193,29 +189,27 @@ namespace Banshee.Karaoke
audiokaraoke.SetFloatProperty ("level", effect_level);
audiokaraoke.SetFloatProperty ("mono-level", effect_level);
}
-
- //Hyena.Log.DebugFormat ("Karaoke service has been initialized! {0}", audiobin.ToString ());
}
#endregion
#region IDisposable implementation
void IDisposable.Dispose ()
{
- if (has_karaoke && !playbin.IsNull () && !audiokaraoke.IsNull ())
- {
+ if (has_karaoke && !playbin.IsNull () && !audiokaraoke.IsNull ()) {
audiokaraoke.SetFloatProperty ("level", 0);
audiokaraoke.SetFloatProperty ("mono-level", 0);
}
- if (ui_menu_id > 0)
+ if (ui_menu_id > 0) {
action_service.UIManager.RemoveUi (ui_menu_id);
-
- if (ui_button_id > 0)
+ }
+ if (ui_button_id > 0) {
action_service.UIManager.RemoveUi (ui_button_id);
-
- if (actions != null)
+ }
+ if (actions != null) {
action_service.UIManager.RemoveActionGroup (actions);
- actions = null;
+ actions = null;
+ }
}
#endregion
@@ -241,7 +235,9 @@ namespace Banshee.Karaoke
public void ApplyKaraokeEffectLevel (float new_level)
{
- if (!karaoke_enabled) return;
+ if (!karaoke_enabled) {
+ return;
+ }
audiokaraoke.SetFloatProperty ("level", new_level);
audiokaraoke.SetFloatProperty ("mono-level", new_level);
}