Skip to content

Commit

Permalink
iOS: Renamed EffectsViewController to EqualizerPresetsViewController.
Browse files Browse the repository at this point in the history
iOS: Added EqualizerPresetDetailsViewController.
MVP: Renamed EffectsPresenter/View to EqualizerPresetsPresenter/View.
MVP: Added EqualizerPresetDetailsPresenter/View.

Related to issue #397, issue #405 and issue #417.
  • Loading branch information
ycastonguay committed Apr 11, 2013
1 parent f1416a2 commit adf5a61
Show file tree
Hide file tree
Showing 25 changed files with 558 additions and 124 deletions.
3 changes: 2 additions & 1 deletion MPfm/MPfm.MVP/Bootstrap/Bootstrapper.cs
Expand Up @@ -60,7 +60,8 @@ static Bootstrapper()
container.Register<IMobileOptionsMenuPresenter, MobileOptionsMenuPresenter>().AsSingleton();
container.Register<ILibraryBrowserPresenter, LibraryBrowserPresenter>().AsSingleton();
container.Register<IUpdateLibraryPresenter, UpdateLibraryPresenter>().AsSingleton();
container.Register<IEffectsPresenter, EffectsPresenter>().AsMultiInstance();
container.Register<IEqualizerPresetsPresenter, EqualizerPresetsPresenter>().AsMultiInstance();
container.Register<IEqualizerPresetDetailsPresenter, EqualizerPresetDetailsPresenter>().AsMultiInstance();
container.Register<IAudioPreferencesPresenter, AudioPreferencesPresenter>().AsSingleton();
container.Register<IGeneralPreferencesPresenter, GeneralPreferencesPresenter>().AsSingleton();
container.Register<ILibraryPreferencesPresenter, LibraryPreferencesPresenter>().AsSingleton();
Expand Down
9 changes: 6 additions & 3 deletions MPfm/MPfm.MVP/MPfm.MVP.iOS.csproj
Expand Up @@ -240,9 +240,6 @@
<Compile Include="Config\MPfmWindowsConfig.cs" />
<Compile Include="Services\PlayerService.cs" />
<Compile Include="Services\Interfaces\IPlayerService.cs" />
<Compile Include="Presenters\Interfaces\IEffectsPresenter.cs" />
<Compile Include="Views\IEffectsView.cs" />
<Compile Include="Presenters\EffectsPresenter.cs" />
<Compile Include="Views\IPreferencesView.cs" />
<Compile Include="Presenters\Interfaces\IGeneralPreferencesPresenter.cs" />
<Compile Include="Presenters\GeneralPreferencesPresenter.cs" />
Expand Down Expand Up @@ -296,5 +293,11 @@
<Compile Include="Presenters\Interfaces\IPlayerStatusPresenter.cs" />
<Compile Include="Presenters\PlayerStatusPresenter.cs" />
<Compile Include="Messages\MobileNavigationManagerCommandMessage.cs" />
<Compile Include="Views\IEqualizerPresetsView.cs" />
<Compile Include="Presenters\Interfaces\IEqualizerPresetsPresenter.cs" />
<Compile Include="Views\IEqualizerPresetDetailsView.cs" />
<Compile Include="Presenters\Interfaces\IEqualizerPresetDetailsPresenter.cs" />
<Compile Include="Presenters\EqualizerPresetsPresenter.cs" />
<Compile Include="Presenters\EqualizerPresetDetailsPresenter.cs" />
</ItemGroup>
</Project>
Expand Up @@ -39,6 +39,6 @@ public MobileNavigationManagerCommandMessage(object sender, MobileNavigationMana
public enum MobileNavigationManagerCommandMessageType
{
ShowPlayerView = 0,
ShowEffectsView = 1
ShowEqualizerPresetsView = 1
}
}
28 changes: 15 additions & 13 deletions MPfm/MPfm.MVP/Navigation/MobileNavigationManager.cs
Expand Up @@ -40,8 +40,10 @@ public abstract class MobileNavigationManager
private IMobileOptionsMenuPresenter _optionsMenuPresenter;
private IUpdateLibraryView _updateLibraryView;
private IUpdateLibraryPresenter _updateLibraryPresenter;
private IEffectsView _effectsView;
private IEffectsPresenter _effectsPresenter;
private IEqualizerPresetsView _equalizerPresetsView;
private IEqualizerPresetsPresenter _equalizerPresetsPresenter;
private IEqualizerPresetDetailsView _equalizerPresetDetailsView;
private IEqualizerPresetDetailsPresenter _equalizerPresetDetailsPresenter;
private IPlayerView _playerView;
private IPlayerPresenter _playerPresenter;

Expand Down Expand Up @@ -120,10 +122,10 @@ protected void ShowPlayerView(MobileNavigationTabType tabType)
PushTabView(tabType, _playerView);
}

protected void ShowEffectsView()
protected void ShowEqualizerPresetsView()
{
var view = CreateEffectsView();
PushDialogView("Effects", view);
var view = CreateEqualizerPresetsView();
PushDialogView("EqualizerPresets", view);
}

public virtual void BindOptionsMenuView(IMobileOptionsMenuView view)
Expand Down Expand Up @@ -438,23 +440,23 @@ public virtual IPitchShiftingView CreatePitchShiftingView()
return _pitchShiftingView;
}

public virtual IEffectsView CreateEffectsView()
public virtual IEqualizerPresetsView CreateEqualizerPresetsView()
{
// The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
Action<IBaseView> onViewReady = (view) =>
{
_effectsPresenter = Bootstrapper.GetContainer().Resolve<IEffectsPresenter>();
_effectsPresenter.BindView((IEffectsView)view);
_equalizerPresetsPresenter = Bootstrapper.GetContainer().Resolve<IEqualizerPresetsPresenter>();
_equalizerPresetsPresenter.BindView((IEqualizerPresetsView)view);
};

// Create view and manage view destruction
_effectsView = Bootstrapper.GetContainer().Resolve<IEffectsView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_effectsView.OnViewDestroy = (view) =>
_equalizerPresetsView = Bootstrapper.GetContainer().Resolve<IEqualizerPresetsView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
_equalizerPresetsView.OnViewDestroy = (view) =>
{
_effectsView = null;
_effectsPresenter = null;
_equalizerPresetsView = null;
_equalizerPresetsPresenter = null;
};
return _effectsView;
return _equalizerPresetsView;
}
}

Expand Down
Expand Up @@ -21,31 +21,16 @@

namespace MPfm.MVP.Presenters
{
/// <summary>
/// Effects presenter.
/// </summary>
public class EffectsPresenter : BasePresenter<IEffectsView>, IEffectsPresenter
public class EqualizerPresetDetailsPresenter : BasePresenter<IEqualizerPresetDetailsView>, IEqualizerPresetDetailsPresenter
{
// Private variables
//IEffectsView view = null;
readonly IPlayerService playerService;

#region Constructor and Dispose

/// <summary>
/// Initializes a new instance of the <see cref="EffectsPresenter"/> class.
/// </summary>
/// <param name='playerService'>
/// Player service.
/// </param>
public EffectsPresenter(IPlayerService playerService)
public EqualizerPresetDetailsPresenter(IPlayerService playerService)
{
// Set properties
this.playerService = playerService;
}

#endregion

public void SetEQParam(int index, float value)
{
// Set EQ and update UI
Expand Down
70 changes: 70 additions & 0 deletions MPfm/MPfm.MVP/Presenters/EqualizerPresetsPresenter.cs
@@ -0,0 +1,70 @@
// 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/>.

using MPfm.MVP.Presenters.Interfaces;
using MPfm.MVP.Services.Interfaces;
using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters
{
public class EqualizerPresetsPresenter : BasePresenter<IEqualizerPresetsView>, IEqualizerPresetsPresenter
{
readonly IPlayerService playerService;

public EqualizerPresetsPresenter(IPlayerService playerService)
{
// Set properties
this.playerService = playerService;
}

public void SetEQParam(int index, float value)
{
// Set EQ and update UI
playerService.UpdateEQBand(index, value, true);
View.UpdateFader(index, value);
}

public void BypassEQ()
{
playerService.BypassEQ();
}

public void AutoLevel()
{
}

public void Reset()
{
playerService.ResetEQ();
for (int a = 0; a < 18; a++)
View.UpdateFader(a, 0);
}

public void LoadPreset(string presetName)
{
}

public void SavePreset(string presetName)
{
}

public void DeletePreset(string presetName)
{
}
}
}

Expand Up @@ -19,10 +19,7 @@

namespace MPfm.MVP.Presenters.Interfaces
{
/// <summary>
/// Effects presenter interface.
/// </summary>
public interface IEffectsPresenter : IBasePresenter<IEffectsView>
public interface IEqualizerPresetDetailsPresenter : IBasePresenter<IEqualizerPresetDetailsView>
{
void SetEQParam(int index, float value);
void BypassEQ();
Expand Down
34 changes: 34 additions & 0 deletions MPfm/MPfm.MVP/Presenters/Interfaces/IEqualizerPresetsPresenter.cs
@@ -0,0 +1,34 @@
// 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/>.

using MPfm.MVP.Views;

namespace MPfm.MVP.Presenters.Interfaces
{
public interface IEqualizerPresetsPresenter : IBasePresenter<IEqualizerPresetsView>
{
void SetEQParam(int index, float value);
void BypassEQ();
void AutoLevel();
void Reset();

void LoadPreset(string presetName);
void SavePreset(string presetName);
void DeletePreset(string presetName);
}
}

8 changes: 4 additions & 4 deletions MPfm/MPfm.MVP/Presenters/MobileOptionsMenuPresenter.cs
Expand Up @@ -53,7 +53,7 @@ private void Initialize()
{
_items = new List<KeyValuePair<MobileOptionsMenuType, string>>();
_items.Add(new KeyValuePair<MobileOptionsMenuType, string>(MobileOptionsMenuType.UpdateLibrary, "Update Library"));
_items.Add(new KeyValuePair<MobileOptionsMenuType, string>(MobileOptionsMenuType.Effects, "Effects"));
_items.Add(new KeyValuePair<MobileOptionsMenuType, string>(MobileOptionsMenuType.EqualizerPresets, "Equalizer Presets"));
_items.Add(new KeyValuePair<MobileOptionsMenuType, string>(MobileOptionsMenuType.Preferences, "Preferences"));
_items.Add(new KeyValuePair<MobileOptionsMenuType, string>(MobileOptionsMenuType.About, "About MPfm"));
View.RefreshMenu(_items);
Expand All @@ -73,10 +73,10 @@ private void OnItemClick(MobileOptionsMenuType menuType)
_navigationManager.PushDialogView("Update Library", view);
break;
}
case MobileOptionsMenuType.Effects:
case MobileOptionsMenuType.EqualizerPresets:
{
var view = _navigationManager.CreateEffectsView();
_navigationManager.PushDialogView("Effects", view);
var view = _navigationManager.CreateEqualizerPresetsView();
_navigationManager.PushDialogView("Equalizer Presets", view);
break;
}
case MobileOptionsMenuType.Preferences:
Expand Down
Expand Up @@ -19,13 +19,9 @@

namespace MPfm.MVP.Views
{
/// <summary>
/// Effects view interface.
/// </summary>
public interface IEffectsView : IBaseView
public interface IEqualizerPresetDetailsView : IBaseView
{
void UpdateFader(int index, float value);
void UpdatePresetList(IEnumerable<string> presets);
}
}

27 changes: 27 additions & 0 deletions MPfm/MPfm.MVP/Views/IEqualizerPresetsView.cs
@@ -0,0 +1,27 @@
// 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/>.

using System.Collections.Generic;

namespace MPfm.MVP.Views
{
public interface IEqualizerPresetsView : IBaseView
{
void UpdateFader(int index, float value);
void UpdatePresetList(IEnumerable<string> presets);
}
}
2 changes: 1 addition & 1 deletion MPfm/MPfm.MVP/Views/IMobileOptionsMenuView.cs
Expand Up @@ -34,7 +34,7 @@ public enum MobileOptionsMenuType
{
About = 0,
Preferences = 1,
Effects = 2,
EqualizerPresets = 2,
UpdateLibrary = 3
}
}

0 comments on commit adf5a61

Please sign in to comment.