summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-07-08 15:57:58 +0000
committersr55 <[email protected]>2012-07-08 15:57:58 +0000
commitaea2c5f0a32428671182a5e9d680ab4c016fce2c (patch)
tree39ae475bc274cb2ecf5099c6ddb98bc44e7d0e66 /win/CS/HandBrakeWPF/ViewModels
parentda44aa82136fb9423f041b200b3e40632b8287e7 (diff)
WinGui: Initial work to restore queue editing functionality. (Note, it's not complete yet)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4821 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs13
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs13
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs14
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs23
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs60
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs18
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs27
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs12
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs21
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs4
12 files changed, 214 insertions, 7 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
index 39861bce7..2a0425114 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs
@@ -954,6 +954,19 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.SetEncoder(task.VideoEncoder);
+ this.AdvancedOptionsString = task.AdvancedEncoderOptions;
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
index 06bd20326..03e779665 100644
--- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs
@@ -185,6 +185,19 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => Task.AudioTracks);
+ this.NotifyOfPropertyChange(() => this.Task);
+ }
+
+ /// <summary>
/// Set the Source Title
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
index cbd6e8441..586167840 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
@@ -227,6 +227,20 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+
+ this.NotifyOfPropertyChange(() => this.Task.IncludeChapterMarkers);
+ this.NotifyOfPropertyChange(() => this.Task.ChapterNames);
+ }
+
+ /// <summary>
/// Set the Source Chapters List
/// </summary>
/// <param name="sourceChapters">
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index 92d069698..e6a93a41b 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -373,6 +373,29 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.CurrentTask = task;
+
+ this.NotifyOfPropertyChange(() => this.SelectedDenoise);
+ this.NotifyOfPropertyChange(() => this.SelectedDecomb);
+ this.NotifyOfPropertyChange(() => this.SelectedDeInterlace);
+ this.NotifyOfPropertyChange(() => this.SelectedDetelecine);
+ this.NotifyOfPropertyChange(() => this.Grayscale);
+ this.NotifyOfPropertyChange(() => this.DeblockValue);
+
+ this.NotifyOfPropertyChange(() => this.CustomDecomb);
+ this.NotifyOfPropertyChange(() => this.CustomDeinterlace);
+ this.NotifyOfPropertyChange(() => this.CustomDetelecine);
+ this.NotifyOfPropertyChange(() => this.CustomDenoise);
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
index 8f1f6e5a6..079ce3ad5 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IMainViewModel.cs
@@ -60,5 +60,13 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// Start an Encode
/// </summary>
void StartEncode();
+
+ /// <summary>
+ /// Edit a Queue Task
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void EditQueueJob(EncodeTask task);
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs
index b583fba86..42ca560f4 100644
--- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs
@@ -41,5 +41,13 @@ namespace HandBrakeWPF.ViewModels.Interfaces
/// The task.
/// </param>
void SetPreset(Preset preset, EncodeTask task);
+
+ /// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ void UpdateTask(EncodeTask task);
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index d63915624..36a1a0e11 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -147,6 +147,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private Preset selectedPreset;
+ /// <summary>
+ /// Queue Edit Task
+ /// </summary>
+ private EncodeTask queueEditTask;
+
#endregion
/// <summary>
@@ -1115,6 +1120,19 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Edit a Queue Task
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void EditQueueJob(EncodeTask task)
+ {
+ // Rescan the source to make sure it's still valid
+ this.queueEditTask = task;
+ this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction);
+ }
+
+ /// <summary>
/// Pause an Encode
/// </summary>
public void PauseEncode()
@@ -1369,6 +1387,44 @@ namespace HandBrakeWPF.ViewModels
#region Private Methods
/// <summary>
+ /// Update all the UI Components to allow the user to edit their previous settings.
+ /// </summary>
+ /// <param name="successful">
+ /// The successful.
+ /// </param>
+ private void QueueEditAction(bool successful)
+ {
+ Execute.OnUIThread(() =>
+ {
+ // Copy all the Scan data into the UI
+ this.scanService.SouceData.CopyTo(this.ScannedSource);
+ this.NotifyOfPropertyChange(() => this.ScannedSource);
+ this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);
+
+ // Select the Users Title
+ this.CurrentTask = new EncodeTask(queueEditTask);
+ this.NotifyOfPropertyChange(() => this.CurrentTask);
+ this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.TitleNumber == this.CurrentTask.Title);
+
+ // Update the Main UI control Area (TODO)
+ this.CurrentTask = new EncodeTask(queueEditTask);
+ this.NotifyOfPropertyChange(() => this.CurrentTask);
+
+ // Update the Tab Controls (TODO)
+ this.PictureSettingsViewModel.UpdateTask(this.CurrentTask);
+ this.VideoViewModel.UpdateTask(this.CurrentTask);
+ this.FiltersViewModel.UpdateTask(this.CurrentTask);
+ this.AudioViewModel.UpdateTask(this.CurrentTask);
+ this.SubtitleViewModel.UpdateTask(this.CurrentTask);
+ this.ChaptersViewModel.UpdateTask(this.CurrentTask);
+ this.AdvancedViewModel.UpdateTask(this.CurrentTask);
+
+ // Cleanup
+ this.ShowStatusWindow = false;
+ });
+ }
+
+ /// <summary>
/// Start a Scan
/// </summary>
/// <param name="filename">
@@ -1381,7 +1437,7 @@ namespace HandBrakeWPF.ViewModels
{
// TODO
// 1. Disable GUI.
- this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount));
+ this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);
}
/// <summary>
@@ -1548,8 +1604,6 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange("ScannedSource.Titles");
this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle)
?? this.ScannedSource.Titles.FirstOrDefault();
- this.JobContextService.CurrentSource = this.ScannedSource;
- this.JobContextService.CurrentTask = this.CurrentTask;
this.SetupTabs();
this.ShowStatusWindow = false;
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
index b052a4ba7..e911905d2 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs
@@ -640,6 +640,24 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.Width);
+ this.NotifyOfPropertyChange(() => this.Height);
+ this.NotifyOfPropertyChange(() => this.SelectedAnamorphicMode);
+ this.NotifyOfPropertyChange(() => this.SelectedModulus);
+ this.NotifyOfPropertyChange(() => this.DisplayWidth);
+ this.NotifyOfPropertyChange(() => this.ParHeight);
+ this.NotifyOfPropertyChange(() => this.ParWidth);
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
index abcf289e5..badb64e17 100644
--- a/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/QueueViewModel.cs
@@ -331,6 +331,33 @@ namespace HandBrakeWPF.ViewModels
this.queueProcessor.QueueManager.RestoreQueue(dialog.FileName);
}
+ /// <summary>
+ /// Edit this Job
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void EditJob(QueueTask task)
+ {
+ MessageBoxResult result = this.errorService.ShowMessageBox(
+ "Are you sure you wish to edit this job?\nWARNING!!! This feature is not finished YET! Only part of the job will be copied back!!!",
+ "Modify Job?",
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question);
+
+ if (result != MessageBoxResult.Yes)
+ {
+ return;
+ }
+
+ // Remove the job if it is not already encoding. Let the user decide if they want to cancel or not.
+ this.RemoveJob(task);
+
+ // Pass a copy of the job back to the Main Screen
+ IMainViewModel mvm = IoC.Get<IMainViewModel>();
+ mvm.EditQueueJob(new EncodeTask(task.Task));
+ }
+
#endregion
#region Methods
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
index aaf6fa43e..5950bc448 100644
--- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs
@@ -253,6 +253,18 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.Task.SubtitleTracks);
+ }
+
+ /// <summary>
/// Setup this window for a new source
/// </summary>
/// <param name="title">
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
index a520bf202..c5460b0ae 100644
--- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
@@ -487,7 +487,28 @@ namespace HandBrakeWPF.ViewModels
// this.X264Profile = preset.Task.x264Profile;
// this.X264Tune = preset.Task.X264Tune;
//}
+ }
+ /// <summary>
+ /// Update all the UI controls based on the encode task passed in.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ public void UpdateTask(EncodeTask task)
+ {
+ this.Task = task;
+ this.NotifyOfPropertyChange(() => this.IsConstantFramerate);
+ this.NotifyOfPropertyChange(() => this.IsConstantQuantity);
+ this.NotifyOfPropertyChange(() => this.IsPeakFramerate);
+ this.NotifyOfPropertyChange(() => this.IsVariableFramerate);
+ this.NotifyOfPropertyChange(() => this.SelectedVideoEncoder);
+ this.NotifyOfPropertyChange(() => this.SelectedFramerate);
+ this.NotifyOfPropertyChange(() => this.RF);
+ this.NotifyOfPropertyChange(() => this.DisplayRF);
+ this.NotifyOfPropertyChange(() => this.Task.VideoBitrate);
+ this.NotifyOfPropertyChange(() => this.Task.TwoPass);
+ this.NotifyOfPropertyChange(() => this.Task.TurboFirstPass);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
index dd992ef68..ac9098bac 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs
@@ -75,10 +75,6 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public IUserSettingService UserSettingService { get; set; }
- /// <summary>
- /// Gets or sets JobContextService.
- /// </summary>
- public IJobContextService JobContextService { get; set; }
#endregion
#region Public Methods