diff options
author | Scott <[email protected]> | 2015-10-09 22:22:28 +0100 |
---|---|---|
committer | Scott <[email protected]> | 2015-10-24 19:50:57 +0100 |
commit | f08c123b7723df0a84b5b72cbb485c052cb7747a (patch) | |
tree | 3acdac3073e292557c70e1e6c9c161750aa72054 /win/CS/HandBrakeWPF/ViewModels | |
parent | 913ca255c13ba8cdc35e9b2bf1c1c6bdc6c42fba (diff) |
Initial commit to allow the Queue Window to be embedded in the main window. Still some UX/UI stuff to tidy up later.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs | 7 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 159 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs | 214 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs | 45 |
4 files changed, 87 insertions, 338 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs index 3530e84c1..865454a82 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IQueueViewModel.cs @@ -14,5 +14,12 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// </summary>
public interface IQueueViewModel
{
+ /// <summary>
+ /// Activate this window. Either in-line or displayed as a window.
+ /// </summary>
+ /// <param name="isInline">
+ /// The is inline.
+ /// </param>
+ void Activate(bool isInline);
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index a9ec52071..7a1f586a2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -62,144 +62,36 @@ namespace HandBrakeWPF.ViewModels {
#region Private Variables and Services
- /// <summary>
- /// The Encode Service
- /// </summary>
private readonly IQueueProcessor queueProcessor;
-
- /// <summary>
- /// The preset service
- /// </summary>
private readonly IPresetService presetService;
-
- /// <summary>
- /// The Error Service Backing field.
- /// </summary>
private readonly IErrorService errorService;
-
- /// <summary>
- /// Backing field for the update serivce.
- /// </summary>
private readonly IUpdateService updateService;
-
private readonly IWindowManager windowManager;
-
- /// <summary>
- /// Backing field for the user setting service.
- /// </summary>
private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// The Source Scan Service.
- /// </summary>
private readonly IScan scanService;
-
- /// <summary>
- /// The Encode Service
- /// </summary>
private readonly IEncode encodeService;
-
- /// <summary>
- /// Windows 7 API Pack wrapper
- /// </summary>
private readonly Win7 windowsSeven = new Win7();
-
- /// <summary>
- /// HandBrakes Main Window Title
- /// </summary>
private string windowName;
-
- /// <summary>
- /// The Source Label
- /// </summary>
private string sourceLabel;
-
- /// <summary>
- /// The Selected Output Format Backing Field
- /// </summary>
private OutputFormat selectedOutputFormat;
-
- /// <summary>
- /// Is a MKV file backing field
- /// </summary>
private bool isMkv;
-
- /// <summary>
- /// The Toolbar Status Label
- /// </summary>
private string statusLabel;
-
- /// <summary>
- /// Program Status Label
- /// </summary>
private string programStatusLabel;
-
- /// <summary>
- /// Backing field for the scanned source.
- /// </summary>
private Source scannedSource;
-
- /// <summary>
- /// Backing field for the selected title.
- /// </summary>
private Title selectedTitle;
-
- /// <summary>
- /// Backing field for duration
- /// </summary>
private string duration;
-
- /// <summary>
- /// Is Encoding Backing Field
- /// </summary>
private bool isEncoding;
-
- /// <summary>
- /// An Indicated to show the status window
- /// </summary>
private bool showStatusWindow;
-
- /// <summary>
- /// Backing field for the selected preset.
- /// </summary>
private Preset selectedPreset;
-
- /// <summary>
- /// Queue Edit Task
- /// </summary>
private EncodeTask queueEditTask;
-
- /// <summary>
- /// The last percentage complete value.
- /// </summary>
private int lastEncodePercentage;
-
- /// <summary>
- /// The is preset panel showing.
- /// </summary>
private bool isPresetPanelShowing;
-
- /// <summary>
- /// The show source selection.
- /// </summary>
private bool showSourceSelection;
-
- /// <summary>
- /// The drives.
- /// </summary>
private BindingList<SourceMenuItem> drives;
-
- /// <summary>
- /// The can pause.
- /// </summary>
private bool canPause;
-
private bool showAlertWindow;
-
private string alertWindowHeader;
-
private string alertWindowText;
-
private bool hasSource;
#endregion
@@ -257,11 +149,15 @@ namespace HandBrakeWPF.ViewModels /// <param name="staticPreviewViewModel">
/// The static Preview View Model.
/// </param>
+ /// <param name="queueViewModel">
+ /// The queue View Model.
+ /// </param>
public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
IErrorService errorService, IUpdateService updateService,
IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel,
IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,
- IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel)
+ IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel,
+ IQueueViewModel queueViewModel)
{
this.scanService = scanService;
this.encodeService = encodeService;
@@ -269,6 +165,7 @@ namespace HandBrakeWPF.ViewModels this.errorService = errorService;
this.updateService = updateService;
this.windowManager = windowManager;
+ this.QueueViewModel = queueViewModel;
this.userSettingService = userSettingService;
this.queueProcessor = IoC.Get<IQueueProcessor>();
@@ -341,6 +238,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public IFiltersViewModel FiltersViewModel { get; set; }
+ /// <summary>
+ /// Gets or sets the queue view model.
+ /// </summary>
+ public IQueueViewModel QueueViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the static preview view model.
+ /// </summary>
+ public IStaticPreviewViewModel StaticPreviewViewModel { get; set; }
+
#endregion
#region Properties
@@ -1076,11 +983,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets the static preview view model.
- /// </summary>
- public IStaticPreviewViewModel StaticPreviewViewModel { get; set; }
-
- /// <summary>
/// Gets the cancel action.
/// </summary>
public Action CancelAction
@@ -1204,6 +1106,11 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Flag to indicate if the queue is showing on the main view. (I.e inline queue display)
+ /// </summary>
+ public bool IsQueueShowingInLine { get; set; } = false;
+
#endregion
#region Load and Shutdown Handling
@@ -1309,15 +1216,29 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenQueueWindow()
{
- Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(QueueView));
-
- if (window != null)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowQueueInline))
{
- window.Activate();
+ this.IsQueueShowingInLine = !this.IsQueueShowingInLine;
+ this.NotifyOfPropertyChange(() => this.IsQueueShowingInLine);
+ this.QueueViewModel.Activate(true);
}
else
{
- this.windowManager.ShowWindow(IoC.Get<IQueueViewModel>());
+ this.IsQueueShowingInLine = false;
+ this.NotifyOfPropertyChange(() => this.IsQueueShowingInLine);
+
+ this.QueueViewModel.Activate(false);
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.Content.GetType() == typeof(QueueView));
+
+ if (window != null)
+ {
+ window.Activate();
+ }
+ else
+ {
+ // TODO to control the size of this window, we will probably have to create a new window for hosting the queue.
+ this.windowManager.ShowWindow(this.QueueViewModel);
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index ab7fde81a..4d7ea3a80 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -39,245 +39,55 @@ namespace HandBrakeWPF.ViewModels {
#region Constants and Fields
- /// <summary>
- /// Backing field for the user setting service.
- /// </summary>
private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// Backing field for the update service.
- /// </summary>
private readonly IUpdateService updateService;
-
- /// <summary>
- /// The arguments.
- /// </summary>
private string arguments;
-
- /// <summary>
- /// The auto name default path.
- /// </summary>
private string autoNameDefaultPath;
-
- /// <summary>
- /// The automatically name files.
- /// </summary>
private bool automaticallyNameFiles;
-
- /// <summary>
- /// The autoname format.
- /// </summary>
private string autonameFormat;
-
- /// <summary>
- /// The change to title case.
- /// </summary>
private bool changeToTitleCase;
-
- /// <summary>
- /// The check for updates.
- /// </summary>
private bool checkForUpdates;
-
- /// <summary>
- /// The check for updates frequencies.
- /// </summary>
private BindingList<string> checkForUpdatesFrequencies = new BindingList<string>();
-
- /// <summary>
- /// The check for updates frequency.
- /// </summary>
private int checkForUpdatesFrequency;
-
- /// <summary>
- /// The clear old olgs.
- /// </summary>
private bool clearOldOlgs;
-
- /// <summary>
- /// The constant quality granularity.
- /// </summary>
private BindingList<string> constantQualityGranularity = new BindingList<string>();
-
- /// <summary>
- /// The copy log to encode directory.
- /// </summary>
private bool copyLogToEncodeDirectory;
-
- /// <summary>
- /// The copy log to sepcficed location.
- /// </summary>
private bool copyLogToSepcficedLocation;
-
- /// <summary>
- /// The disable libdvd nav.
- /// </summary>
private bool disableLibdvdNav;
-
- /// <summary>
- /// The log directory.
- /// </summary>
private string logDirectory;
-
- /// <summary>
- /// The log verbosity options.
- /// </summary>
private BindingList<int> logVerbosityOptions = new BindingList<int>();
-
- /// <summary>
- /// The min length.
- /// </summary>
private long minLength;
-
- /// <summary>
- /// The minimise to tray.
- /// </summary>
private bool minimiseToTray;
-
- /// <summary>
- /// The mp 4 extension options.
- /// </summary>
private BindingList<string> mp4ExtensionOptions = new BindingList<string>();
-
- /// <summary>
- /// The prevent sleep.
- /// </summary>
private bool preventSleep;
-
- /// <summary>
- /// The preview pictures to scan.
- /// </summary>
private BindingList<int> previewPicturesToScan = new BindingList<int>();
-
- /// <summary>
- /// The priority level options.
- /// </summary>
private BindingList<string> priorityLevelOptions = new BindingList<string>();
-
- /// <summary>
- /// The remove underscores.
- /// </summary>
private bool removeUnderscores;
-
- /// <summary>
- /// The selected granulairty.
- /// </summary>
private string selectedGranulairty;
-
- /// <summary>
- /// The selected mp 4 extension.
- /// </summary>
private int selectedMp4Extension;
-
- /// <summary>
- /// The selected preview count.
- /// </summary>
private int selectedPreviewCount;
-
- /// <summary>
- /// The selected priority.
- /// </summary>
private string selectedPriority;
-
- /// <summary>
- /// The selected verbosity.
- /// </summary>
private int selectedVerbosity;
-
- /// <summary>
- /// The send file after encode.
- /// </summary>
private bool sendFileAfterEncode;
-
- /// <summary>
- /// The send file to.
- /// </summary>
private string sendFileTo;
-
- /// <summary>
- /// The send file to Path.
- /// </summary>
private string sendFileToPath;
-
- /// <summary>
- /// The vlc path.
- /// </summary>
private string vlcPath;
-
- /// <summary>
- /// The when done.
- /// </summary>
private string whenDone;
-
- /// <summary>
- /// The when done options.
- /// </summary>
private BindingList<string> whenDoneOptions = new BindingList<string>();
-
- /// <summary>
- /// Backing field for clear queue on encode completed.
- /// </summary>
private bool clearQueueOnEncodeCompleted;
-
- /// <summary>
- /// The options tab that is selected.
- /// </summary>
private OptionsTab selectedTab;
-
- /// <summary>
- /// Update Message
- /// </summary>
private string updateMessage;
-
- /// <summary>
- /// Update Available
- /// </summary>
private bool updateAvailable;
-
- /// <summary>
- /// Download progress backing field.
- /// </summary>
private int downloadProgressPercentage;
-
- /// <summary>
- /// Backing field for update info.
- /// </summary>
private UpdateCheckInformation updateInfo;
-
- /// <summary>
- /// The show advanced tab backing field.
- /// </summary>
private bool showAdvancedTab;
-
- /// <summary>
- /// The remove punctuation.
- /// </summary>
private bool removePunctuation;
-
- /// <summary>
- /// The reset when done action.
- /// </summary>
private bool resetWhenDoneAction;
-
- /// <summary>
- /// The selected scaling mode.
- /// </summary>
private VideoScaler selectedScalingMode;
-
- /// <summary>
- /// The enable dxva decoding.
- /// </summary>
private bool enableDxvaDecoding;
-
- /// <summary>
- /// The disable quick sync decoding.
- /// </summary>
private bool disableQuickSyncDecoding;
-
- /// <summary>
- /// The is cl scaling.
- /// </summary>
private bool isClScaling;
+ private bool showQueueInline;
#endregion
@@ -509,6 +319,26 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets or sets a value indicating whether show queue inline.
+ /// </summary>
+ public bool ShowQueueInline
+ {
+ get
+ {
+ return this.showQueueInline;
+ }
+ set
+ {
+ if (value == this.showQueueInline)
+ {
+ return;
+ }
+ this.showQueueInline = value;
+ this.NotifyOfPropertyChange(() => this.ShowQueueInline);
+ }
+ }
+
#endregion
#region Output Files
@@ -1310,6 +1140,7 @@ namespace HandBrakeWPF.ViewModels this.SendFileToPath = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileTo) ?? string.Empty;
this.Arguments = this.userSettingService.GetUserSetting<string>(UserSettingConstants.SendFileToArgs) ?? string.Empty;
this.ResetWhenDoneAction = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ResetWhenDoneAction);
+ this.ShowQueueInline = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowQueueInline);
// #############################
// Output Settings
@@ -1436,6 +1267,7 @@ namespace HandBrakeWPF.ViewModels this.userSettingService.SetUserSetting(UserSettingConstants.SendFile, this.SendFileAfterEncode);
this.userSettingService.SetUserSetting(UserSettingConstants.SendFileToArgs, this.Arguments);
this.userSettingService.SetUserSetting(UserSettingConstants.ResetWhenDoneAction, this.ResetWhenDoneAction);
+ this.userSettingService.SetUserSetting(UserSettingConstants.ShowQueueInline, this.ShowQueueInline);
/* Output Files */
this.userSettingService.SetUserSetting(UserSettingConstants.AutoNaming, this.AutomaticallyNameFiles);
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs index 324d9efe2..18bb49284 100644 --- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs @@ -39,39 +39,12 @@ namespace HandBrakeWPF.ViewModels {
#region Constants and Fields
- /// <summary>
- /// The Error Service Backing field
- /// </summary>
private readonly IErrorService errorService;
-
- /// <summary>
- /// The User Setting Service Backing Field.
- /// </summary>
private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// Queue Processor Backing field
- /// </summary>
private readonly IQueueProcessor queueProcessor;
-
- /// <summary>
- /// IsEncoding Backing field
- /// </summary>
private bool isEncoding;
-
- /// <summary>
- /// Job Status Backing field.
- /// </summary>
private string jobStatus;
-
- /// <summary>
- /// Jobs pending backing field
- /// </summary>
private string jobsPending;
-
- /// <summary>
- /// Backing field for the when done action description
- /// </summary>
private string whenDoneAction;
#endregion
@@ -99,6 +72,7 @@ namespace HandBrakeWPF.ViewModels this.JobsPending = Resources.QueueViewModel_NoEncodesPending;
this.JobStatus = Resources.QueueViewModel_NoJobsPending;
this.SelectedItems = new BindingList<QueueTask>();
+ this.DisplayName = "Queue";
}
#endregion
@@ -186,7 +160,12 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// Gets or sets the selected items.
/// </summary>
- public BindingList<QueueTask> SelectedItems { get; set; }
+ public BindingList<QueueTask> SelectedItems { get; set; }
+
+ /// <summary>
+ /// Display the current job status information.
+ /// </summary>
+ public bool DisplayJobStatusInfo { get; set; } = false;
#endregion
@@ -408,6 +387,16 @@ namespace HandBrakeWPF.ViewModels mvm.EditQueueJob(new EncodeTask(task.Task));
}
+ /// <summary>
+ /// Activate this window in the correct mode
+ /// </summary>
+ /// <param name="isInline">Indicdates if this panel is displayed in-line with the main view.</param>
+ public void Activate(bool isInline)
+ {
+ this.DisplayJobStatusInfo = !isInline;
+ this.NotifyOfPropertyChange(() => this.DisplayJobStatusInfo);
+ }
+
#endregion
#region Methods
|