Skip to content

Commit

Permalink
Linux: Updated implementation after changes on other platforms.
Browse files Browse the repository at this point in the history
Related to issue #382.
  • Loading branch information
ycastonguay committed Apr 12, 2013
1 parent 5965d2e commit 5692f3c
Show file tree
Hide file tree
Showing 6 changed files with 1,159 additions and 1,151 deletions.
2 changes: 1 addition & 1 deletion MPfm/MPfm.GTK/Classes/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void Main (string[] args)
Bootstrapper.GetContainer().Register<IMainView, MainWindow>().AsMultiInstance();
Bootstrapper.GetContainer().Register<IUpdateLibraryView, UpdateLibraryWindow>().AsMultiInstance();
Bootstrapper.GetContainer().Register<IPreferencesView, PreferencesWindow>().AsMultiInstance();
Bootstrapper.GetContainer().Register<IEffectsView, EffectsWindow>().AsMultiInstance();
//Bootstrapper.GetContainer().Register<IEffectsView, EffectsWindow>().AsMultiInstance();
Bootstrapper.GetContainer().Register<IPlaylistView, PlaylistWindow>().AsMultiInstance();

// Create and start navigation manager
Expand Down
244 changes: 122 additions & 122 deletions MPfm/MPfm.GTK/Windows/EffectsWindow.cs
Original file line number Diff line number Diff line change
@@ -1,126 +1,126 @@
// Copyright © 2011-2013 Yanick Castonguay
//// Copyright © 2011-2013 Yanick Castonguay
////
//// This file is part of MPfm.
////
//// MPfm is free software: you can redistribute it and/or modify
//// it under the terms of the GNU General Public License as published by
//// the Free Software Foundation, either version 3 of the License, or
//// (at your option) any later version.
////
//// MPfm is distributed in the hope that it will be useful,
//// but WITHOUT ANY WARRANTY; without even the implied warranty of
//// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//// GNU General Public License for more details.
////
//// You should have received a copy of the GNU General Public License
//// along with MPfm. If not, see <http://www.gnu.org/licenses/>.
//
// This file is part of MPfm.
//using System;
//using System.Collections.Generic;
//using Pango;
//using MPfm.MVP;
//using MPfm.MVP.Views;
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//namespace MPfm.GTK.Windows
//{
// /// <summary>
// /// Effects window.
// /// </summary>
// public partial class EffectsWindow : BaseWindow, IEffectsView
// {
// /// <summary>
// /// Reference to the main window.
// /// </summary>
// private MainWindow main = null;
//
// /// <summary>
// /// Initializes a new instance of the <see cref="MPfm.GTK.EffectsWindow"/> class.
// /// </summary>
// /// <param name='main'>Reference to the main window.</param>
// public EffectsWindow(MainWindow main, Action<IBaseView> onViewReady) :
// base(Gtk.WindowType.Toplevel, onViewReady)
// {
// this.Build();
//
// // Set reference to main window
// this.main = main;
//
// // Set font properties
// SetFontProperties();
// }
//
// private void SetFontProperties()
// {
// // Get default font name
// string defaultFontName = this.label1.Style.FontDescription.Family;
// string label1FontName = defaultFontName + " 8";
// this.label1.ModifyFont(FontDescription.FromString(label1FontName));
// this.label2.ModifyFont(FontDescription.FromString(label1FontName));
// this.label3.ModifyFont(FontDescription.FromString(label1FontName));
// this.label4.ModifyFont(FontDescription.FromString(label1FontName));
// this.label5.ModifyFont(FontDescription.FromString(label1FontName));
// this.label6.ModifyFont(FontDescription.FromString(label1FontName));
// this.label7.ModifyFont(FontDescription.FromString(label1FontName));
// this.label8.ModifyFont(FontDescription.FromString(label1FontName));
// this.label9.ModifyFont(FontDescription.FromString(label1FontName));
// this.label10.ModifyFont(FontDescription.FromString(label1FontName));
// this.label11.ModifyFont(FontDescription.FromString(label1FontName));
// this.label12.ModifyFont(FontDescription.FromString(label1FontName));
// this.label13.ModifyFont(FontDescription.FromString(label1FontName));
// this.label14.ModifyFont(FontDescription.FromString(label1FontName));
// this.label15.ModifyFont(FontDescription.FromString(label1FontName));
// this.label16.ModifyFont(FontDescription.FromString(label1FontName));
// this.label17.ModifyFont(FontDescription.FromString(label1FontName));
// this.label18.ModifyFont(FontDescription.FromString(label1FontName));
// this.label1Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label2Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label3Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label4Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label5Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label6Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label7Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label8Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label9Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label10Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label11Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label12Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label13Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label14Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label15Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label16Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label17Value.ModifyFont(FontDescription.FromString(label1FontName));
// this.label18Value.ModifyFont(FontDescription.FromString(label1FontName));
// }
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// /// <summary>
// /// Raises the delete event (when the form is closing).
// /// Prevents the form from closing by hiding it instead.
// /// </summary>
// /// <param name='o'>Object</param>
// /// <param name='args'>Event arguments</param>
// protected void OnDeleteEvent(object o, Gtk.DeleteEventArgs args)
// {
// // Prevent window from closing
// args.RetVal = true;
//
// // Hide window instead
// this.HideAll();
// }
//
// #region IEffectsView implementation
//
// public void UpdateFader(int index, float value)
// {
//
// }
//
// public void UpdatePresetList(IEnumerable<string> presets)
// {
//
// }
//
// #endregion
//
// }
//}
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using Pango;
using MPfm.MVP;
using MPfm.MVP.Views;

namespace MPfm.GTK.Windows
{
/// <summary>
/// Effects window.
/// </summary>
public partial class EffectsWindow : BaseWindow, IEffectsView
{
/// <summary>
/// Reference to the main window.
/// </summary>
private MainWindow main = null;

/// <summary>
/// Initializes a new instance of the <see cref="MPfm.GTK.EffectsWindow"/> class.
/// </summary>
/// <param name='main'>Reference to the main window.</param>
public EffectsWindow(MainWindow main, Action<IBaseView> onViewReady) :
base(Gtk.WindowType.Toplevel, onViewReady)
{
this.Build();

// Set reference to main window
this.main = main;

// Set font properties
SetFontProperties();
}

private void SetFontProperties()
{
// Get default font name
string defaultFontName = this.label1.Style.FontDescription.Family;
string label1FontName = defaultFontName + " 8";
this.label1.ModifyFont(FontDescription.FromString(label1FontName));
this.label2.ModifyFont(FontDescription.FromString(label1FontName));
this.label3.ModifyFont(FontDescription.FromString(label1FontName));
this.label4.ModifyFont(FontDescription.FromString(label1FontName));
this.label5.ModifyFont(FontDescription.FromString(label1FontName));
this.label6.ModifyFont(FontDescription.FromString(label1FontName));
this.label7.ModifyFont(FontDescription.FromString(label1FontName));
this.label8.ModifyFont(FontDescription.FromString(label1FontName));
this.label9.ModifyFont(FontDescription.FromString(label1FontName));
this.label10.ModifyFont(FontDescription.FromString(label1FontName));
this.label11.ModifyFont(FontDescription.FromString(label1FontName));
this.label12.ModifyFont(FontDescription.FromString(label1FontName));
this.label13.ModifyFont(FontDescription.FromString(label1FontName));
this.label14.ModifyFont(FontDescription.FromString(label1FontName));
this.label15.ModifyFont(FontDescription.FromString(label1FontName));
this.label16.ModifyFont(FontDescription.FromString(label1FontName));
this.label17.ModifyFont(FontDescription.FromString(label1FontName));
this.label18.ModifyFont(FontDescription.FromString(label1FontName));
this.label1Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label2Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label3Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label4Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label5Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label6Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label7Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label8Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label9Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label10Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label11Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label12Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label13Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label14Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label15Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label16Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label17Value.ModifyFont(FontDescription.FromString(label1FontName));
this.label18Value.ModifyFont(FontDescription.FromString(label1FontName));
}

/// <summary>
/// Raises the delete event (when the form is closing).
/// Prevents the form from closing by hiding it instead.
/// </summary>
/// <param name='o'>Object</param>
/// <param name='args'>Event arguments</param>
protected void OnDeleteEvent(object o, Gtk.DeleteEventArgs args)
{
// Prevent window from closing
args.RetVal = true;

// Hide window instead
this.HideAll();
}

#region IEffectsView implementation

public void UpdateFader(int index, float value)
{

}

public void UpdatePresetList(IEnumerable<string> presets)
{

}

#endregion

}
}

10 changes: 8 additions & 2 deletions MPfm/MPfm.GTK/Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using MPfm.MVP.Models;
using MPfm.Library.UpdateLibrary;
using MPfm.GTK.Helpers;
using MPfm.MVP.Messages;

namespace MPfm.GTK.Windows
{
Expand Down Expand Up @@ -62,6 +63,7 @@ public partial class MainWindow: BaseWindow, IMainView
public System.Action<float> OnPlayerSetTimeShifting { get; set; }
public System.Action<float> OnPlayerSetVolume { get; set; }
public System.Action<float> OnPlayerSetPosition { get; set; }
public Func<float, PlayerPositionEntity> OnPlayerRequestPosition { get; set; }

public System.Action<AudioFileFormat> OnAudioFileFormatFilterChanged { get; set; }
public System.Action<LibraryBrowserEntity> OnTreeNodeSelected { get; set; }
Expand Down Expand Up @@ -101,7 +103,7 @@ public MainWindow(Action<IBaseView> onViewReady): base (Gtk.WindowType.Toplevel,

// Refresh other stuff
RefreshRepeatButton();
RefreshSongInformation(null);
RefreshSongInformation(null, 0, 0, 0);

// Fill sound format combo box
storeAudioFileFormat = new ListStore(typeof(string));
Expand Down Expand Up @@ -769,6 +771,10 @@ private static Gdk.Pixbuf ImageToPixbuf(System.Drawing.Image image)

#region IPlayerView implementation

public void RefreshPlayerStatus(PlayerStatusType status)
{
}

public void RefreshPlayerPosition(PlayerPositionEntity entity)
{
Gtk.Application.Invoke(delegate{
Expand All @@ -782,7 +788,7 @@ public void RefreshPlayerPosition(PlayerPositionEntity entity)
});
}

public void RefreshSongInformation(AudioFile audioFile)
public void RefreshSongInformation(AudioFile audioFile, long lengthBytes, int playlistIndex, int playlistCount)
{
Gtk.Application.Invoke(delegate{
if(audioFile != null)
Expand Down
6 changes: 4 additions & 2 deletions MPfm/MPfm.GTK/Windows/UpdateLibraryWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ namespace MPfm.GTK.Windows
/// </summary>
public partial class UpdateLibraryWindow : BaseWindow, IUpdateLibraryView
{
public Action<UpdateLibraryMode, List<string>, string> OnStartUpdateLibrary { get; set; }
public System.Action<UpdateLibraryMode, List<string>, string> OnStartUpdateLibrary { get; set; }
public System.Action OnCancelUpdateLibrary { get; set; }

// Private variables
private IUpdateLibraryPresenter presenter = null;
Expand All @@ -53,9 +54,10 @@ public UpdateLibraryWindow (UpdateLibraryMode mode, List<string> filePaths, stri
SetFontProperties();

// Create presenter
var audioFileCacheService = Bootstrapper.GetContainer().Resolve<AudioFileCacheService>();
var libraryService = Bootstrapper.GetContainer().Resolve<LibraryService>();
var updateLibraryService = Bootstrapper.GetContainer().Resolve<UpdateLibraryService>();
presenter = new UpdateLibraryPresenter(libraryService, updateLibraryService);
presenter = new UpdateLibraryPresenter(audioFileCacheService, libraryService, updateLibraryService);
presenter.BindView(this);

presenter.UpdateLibrary(mode, filePaths, folderPath);
Expand Down
Loading

0 comments on commit 5692f3c

Please sign in to comment.