diff options
author | sr55 <[email protected]> | 2013-01-13 17:51:42 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-01-13 17:51:42 +0000 |
commit | f3fcc49085f080ad5f075da4a87bbaff47f92572 (patch) | |
tree | 2b483848c6111e73958d4f69af03e790a8abadc3 /win/CS/HandBrakeWPF/ViewModels | |
parent | b62992bfb1623ae6c0930c41e00c2b150ea780d9 (diff) |
WinGui: Options screen refactoring.
Help -> Check for updates now takes the user to the options screen update tab.
Help -> About now takes the user to the options screen about tab. Saves popping up annoying window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5169 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels')
5 files changed, 56 insertions, 48 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index eeb3def77..516fc7642 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -23,6 +23,8 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Utilities;
using HandBrake.Interop.Model.Encoding;
+ using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Model;
using HandBrakeWPF.ViewModels.Interfaces;
/// <summary>
@@ -167,6 +169,15 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Open the options screen to the Audio and Subtitles tab.
+ /// </summary>
+ public void SetDefaultBehaviour()
+ {
+ OpenOptionsScreenCommand command = new OpenOptionsScreenCommand();
+ command.Execute(OptionsTab.AudioAndSubtitles);
+ }
+
#endregion
#region Implemented Interfaces
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs index 7805aea63..c2d48f8e5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IOptionsViewModel.cs @@ -9,10 +9,19 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
+ using HandBrakeWPF.Model;
+
/// <summary>
/// The Options Screen View Model Interface
/// </summary>
public interface IOptionsViewModel
{
+ /// <summary>
+ /// The goto tab.
+ /// </summary>
+ /// <param name="tab">
+ /// The tab.
+ /// </param>
+ void GotoTab(OptionsTab tab);
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 7a9461b25..335509150 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -896,16 +896,8 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenAboutApplication()
{
- Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(AboutView));
-
- if (window != null)
- {
- window.Activate();
- }
- else
- {
- this.WindowManager.ShowWindow(IoC.Get<IAboutViewModel>());
- }
+ OpenOptionsScreenCommand command = new OpenOptionsScreenCommand();
+ command.Execute(OptionsTab.About);
}
/// <summary>
@@ -983,8 +975,8 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void CheckForUpdates()
{
- this.ProgramStatusLabel = "Checking for Updates ...";
- this.updateService.CheckForUpdates(this.HandleManualUpdateCheckResults);
+ OpenOptionsScreenCommand command = new OpenOptionsScreenCommand();
+ command.Execute(OptionsTab.Updates);
}
/// <summary>
@@ -1614,27 +1606,6 @@ namespace HandBrakeWPF.ViewModels this.ProgramStatusLabel = "A New Update is Available. Goto Tools Menu > Options to Install";
}
}
-
- /// <summary>
- /// Handle Update Check Results
- /// </summary>
- /// <param name="information">
- /// The information.
- /// </param>
- private void HandleManualUpdateCheckResults(UpdateCheckInformation information)
- {
- if (information.NewVersionAvailable)
- {
- MessageBox.Show("A New Version is available. Goto Tools Menu > Options to Install or visit http://handbrake.fr for details.", "Update Available", MessageBoxButton.OK, MessageBoxImage.Information);
- }
- else
- {
- MessageBox.Show("There is no new updates at this time.", "No Update Available", MessageBoxButton.OK, MessageBoxImage.Information);
- }
-
- this.ProgramStatusLabel = "Ready";
- }
-
#endregion
#region Event Handlers
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs index 6dc2a44dc..36fa35985 100644 --- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs @@ -309,7 +309,7 @@ namespace HandBrakeWPF.ViewModels /// <summary>
/// The options tab that is selected.
/// </summary>
- private string selectedTab;
+ private OptionsTab selectedTab;
/// <summary>
/// Update Message
@@ -380,7 +380,7 @@ namespace HandBrakeWPF.ViewModels this.updateService = updateService;
this.OnLoad();
- this.SelectedTab = "General";
+ this.SelectedTab = OptionsTab.General;
this.UpdateMessage = "Click 'Check for Updates' to check for new versions";
}
@@ -389,20 +389,9 @@ namespace HandBrakeWPF.ViewModels #region Window Properties
/// <summary>
- /// Gets OptionTabs.
- /// </summary>
- public IEnumerable<string> OptionTabs
- {
- get
- {
- return new List<string> { "General", "Output Files", "Audio and Subtitles", "Advanced", "Updates" };
- }
- }
-
- /// <summary>
/// Gets or sets SelectedTab.
/// </summary>
- public string SelectedTab
+ public OptionsTab SelectedTab
{
get
{
@@ -415,6 +404,12 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.SelectedTab);
}
}
+
+ /// <summary>
+ /// Gets or sets the about view model.
+ /// </summary>
+ public IAboutViewModel AboutViewModel { get; set; }
+
#endregion
#region Properties
@@ -1344,7 +1339,7 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Enable Debugging features in the UI.
+ /// Gets or sets a value indicating whether debug features are enabled.
/// </summary>
public bool EnableDebugFeatures
{
@@ -1962,5 +1957,16 @@ namespace HandBrakeWPF.ViewModels Process.Start(Path.Combine(Path.GetTempPath(), "handbrake-setup.exe"));
Application.Current.Shutdown();
}
+
+ /// <summary>
+ /// The goto tab.
+ /// </summary>
+ /// <param name="tab">
+ /// The tab.
+ /// </param>
+ public void GotoTab(OptionsTab tab)
+ {
+ this.SelectedTab = tab;
+ }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index b52dd961a..3fcca18aa 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -22,6 +22,8 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
+ using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Model;
using HandBrakeWPF.ViewModels.Interfaces;
using Ookii.Dialogs.Wpf;
@@ -279,6 +281,15 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Open the options screen to the Audio and Subtitles tab.
+ /// </summary>
+ public void SetDefaultBehaviour()
+ {
+ OpenOptionsScreenCommand command = new OpenOptionsScreenCommand();
+ command.Execute(OptionsTab.AudioAndSubtitles);
+ }
+
#endregion
#region Implemented Interfaces
|