// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// The Video View Model
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Caliburn.Micro;
using HandBrake.ApplicationServices.Functions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.Interop.Model.Encoding;
using HandBrakeWPF.ViewModels.Interfaces;
///
/// The Video View Model
///
[Export(typeof(IVideoViewModel))]
public class VideoViewModel : ViewModelBase, IVideoViewModel
{
#region Constants and Fields
///
/// The average bitrate.
///
private int averageBitrate;
///
/// The is constant framerate.
///
private bool isConstantFramerate;
///
/// The is constant quantity.
///
private bool isConstantQuantity;
///
/// The is peak framerate.
///
private bool isPeakFramerate;
///
/// The is turbo first pass.
///
private bool isTurboFirstPass;
///
/// The is two pass.
///
private bool isTwoPass;
///
/// The is variable framerate.
///
private bool isVariableFramerate;
///
/// The quality max.
///
private int qualityMax;
///
/// The quality min.
///
private int qualityMin;
///
/// The rf.
///
private int rf;
///
/// The selected framerate.
///
private double? selectedFramerate;
///
/// The selected video encoder.
///
private VideoEncoder selectedVideoEncoder;
///
/// The show peak framerate.
///
private bool showPeakFramerate;
#endregion
#region Constructors and Destructors
///
/// Initializes a new instance of the class.
///
///
/// The window manager.
///
///
/// The user Setting Service.
///
public VideoViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
{
this.QualityMin = 0;
this.QualityMax = 51;
this.IsConstantQuantity = true;
}
#endregion
#region Public Properties
///
/// Gets or sets AverageBitrate.
///
public string AverageBitrate
{
get
{
return this.averageBitrate.ToString();
}
set
{
if (value != null)
{
this.averageBitrate = int.Parse(value);
}
this.NotifyOfPropertyChange(() => this.AverageBitrate);
}
}
///
/// Gets Framerates.
///
public IEnumerable Framerates
{
get
{
return new List { "Same as source", "5", "10", "12", "15", "23.976", "24", "25", "29.97`" };
}
}
///
/// Gets or sets a value indicating whether IsConstantFramerate.
///
public bool IsConstantFramerate
{
get
{
return this.isConstantFramerate;
}
set
{
this.isConstantFramerate = value;
if (value)
{
this.IsVariableFramerate = false;
this.IsPeakFramerate = false;
}
this.NotifyOfPropertyChange(() => this.IsConstantFramerate);
}
}
///
/// Gets or sets a value indicating whether IsConstantQuantity.
///
public bool IsConstantQuantity
{
get
{
return this.isConstantQuantity;
}
set
{
this.isConstantQuantity = value;
this.NotifyOfPropertyChange(() => this.IsConstantQuantity);
}
}
///
/// Gets or sets a value indicating whether IsPeakFramerate.
///
public bool IsPeakFramerate
{
get
{
return this.isPeakFramerate;
}
set
{
this.isPeakFramerate = value;
if (value)
{
this.IsVariableFramerate = false;
this.IsConstantFramerate = false;
}
this.NotifyOfPropertyChange(() => this.IsPeakFramerate);
}
}
///
/// Gets or sets a value indicating whether IsTurboFirstPass.
///
public bool IsTurboFirstPass
{
get
{
return this.isTurboFirstPass;
}
set
{
this.isTurboFirstPass = value;
this.NotifyOfPropertyChange(() => this.IsTurboFirstPass);
}
}
///
/// Gets or sets a value indicating whether IsTwoPass.
///
public bool IsTwoPass
{
get
{
return this.isTwoPass;
}
set
{
this.isTwoPass = value;
this.NotifyOfPropertyChange(() => this.IsTwoPass);
}
}
///
/// Gets or sets a value indicating whether IsVariableFramerate.
///
public bool IsVariableFramerate
{
get
{
return this.isVariableFramerate;
}
set
{
this.isVariableFramerate = value;
if (value)
{
this.IsPeakFramerate = false;
this.IsConstantFramerate = false;
}
this.NotifyOfPropertyChange(() => this.IsVariableFramerate);
}
}
///
/// Gets or sets QualityMax.
///
public int QualityMax
{
get
{
return this.qualityMax;
}
set
{
this.qualityMax = value;
this.NotifyOfPropertyChange(() => this.QualityMax);
}
}
///
/// Gets or sets QualityMin.
///
public int QualityMin
{
get
{
return this.qualityMin;
}
set
{
this.qualityMin = value;
this.NotifyOfPropertyChange(() => this.QualityMin);
}
}
///
/// Gets or sets RF.
///
public int RF
{
get
{
return this.rf;
}
set
{
this.rf = value;
this.NotifyOfPropertyChange(() => this.RF);
}
}
///
/// Gets or sets SelectedFramerate.
///
public string SelectedFramerate
{
get
{
if (this.selectedFramerate == null)
{
return "Same as source";
}
return this.selectedFramerate.ToString();
}
set
{
if (value == "Same as source")
{
this.selectedFramerate = null;
this.ShowPeakFramerate = false;
}
else
{
this.ShowPeakFramerate = true;
this.selectedFramerate = double.Parse(value);
}
this.NotifyOfPropertyChange(() => this.SelectedFramerate);
}
}
///
/// Gets or sets SelectedVideoEncoder.
///
public string SelectedVideoEncoder
{
get
{
return EnumHelper.GetDisplay(this.selectedVideoEncoder);
}
set
{
this.selectedVideoEncoder = EnumHelper.GetValue(value);
this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
}
}
///
/// Gets or sets a value indicating whether ShowPeakFramerate.
///
public bool ShowPeakFramerate
{
get
{
return this.showPeakFramerate;
}
set
{
this.showPeakFramerate = value;
this.NotifyOfPropertyChange(() => this.ShowPeakFramerate);
}
}
///
/// Gets VideoEncoders.
///
public IEnumerable VideoEncoders
{
get
{
return EnumHelper.GetEnumDisplayValues(typeof(VideoEncoder));
}
}
#endregion
#region Public Methods
///
/// Set the currently selected preset.
///
///
/// The preset.
///
public void SetPreset(Preset preset)
{
}
#endregion
}
}