summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-04-01 17:09:11 +0000
committersr55 <[email protected]>2012-04-01 17:09:11 +0000
commit649939589305d92e9d6edf3c28955dfa37774722 (patch)
treea34796100b099cd6e7ff70667bd470bfd9439675
parentb07bb66a24127135b5b921db6486f1cad45f42cc (diff)
WinGui: (WPF) Cleanup and fixes to the main window and preferences screen.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4579 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs104
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs24
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml22
-rw-r--r--win/CS/HandBrakeWPF/Views/MainView.xaml.cs1
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml7
5 files changed, 134 insertions, 24 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index 268002957..68f20cf85 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -11,11 +11,15 @@ namespace HandBrakeWPF.ViewModels
{
using System;
using System.Collections.Generic;
+ using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Diagnostics;
+ using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows;
+ using System.Windows.Controls;
+ using System.Windows.Media.Imaging;
using Caliburn.Micro;
@@ -23,7 +27,6 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
- using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -34,6 +37,8 @@ namespace HandBrakeWPF.ViewModels
using HandBrakeWPF.Services.Interfaces;
+ using Image = System.Windows.Controls.Image;
+
/// <summary>
/// HandBrakes Main Window
/// </summary>
@@ -255,6 +260,52 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Gets SourceToolbarMenu.
+ /// </summary>
+ public IEnumerable<MenuItem> SourceToolbarMenu
+ {
+ get
+ {
+ BindingList<MenuItem> menuItems = new BindingList<MenuItem>();
+
+ // Folder Menu Item
+ MenuItem folderMenuItem = new MenuItem
+ {
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrakeWPF;component/Views/Images/folder.png")), Width = 16, Height = 16 },
+ Header = new TextBlock { Text = "Open Folder", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }
+ };
+ folderMenuItem.Click += this.folderMenuItem_Click;
+ menuItems.Add(folderMenuItem);
+
+ // File Menu Item
+ MenuItem fileMenuItem = new MenuItem
+ {
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrakeWPF;component/Views/Images/Movies.png")), Width = 16, Height = 16 },
+ Header = new TextBlock { Text = "Open File", Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center }
+ };
+ fileMenuItem.Click += this.fileMenuItem_Click;
+ menuItems.Add(fileMenuItem);
+
+
+ // Drives
+ foreach (DriveInformation item in GeneralUtilities.GetDrives())
+ {
+ MenuItem driveMenuItem = new MenuItem
+ {
+ Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/HandBrakeWPF;component/Views/Images/disc_small.png")), Width = 16, Height = 16 },
+ Header = new TextBlock { Text = string.Format("{0} ({1})", item.RootDirectory, item.VolumeLabel), Margin = new Thickness(8, 0, 0, 0), VerticalAlignment = VerticalAlignment.Center },
+ Tag = item
+ };
+ driveMenuItem.Click += this.driveMenuItem_Click;
+ menuItems.Add(driveMenuItem);
+ }
+
+
+ return menuItems;
+ }
+ }
+
+ /// <summary>
/// Gets or sets Presets.
/// </summary>
public IEnumerable<Preset> Presets { get; set; }
@@ -861,6 +912,11 @@ namespace HandBrakeWPF.ViewModels
MessageBoxImage.Information);
}
+ public void SourceContextMenuOpening(MenuItem item)
+ {
+ Console.WriteLine(item);
+ }
+
#endregion
#region Main Window Public Methods
@@ -1298,6 +1354,52 @@ namespace HandBrakeWPF.ViewModels
// TODO Handle Updating the UI
}
+
+ /// <summary>
+ /// Drive Scan
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The RoutedEventArgs.
+ /// </param>
+ private void driveMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ MenuItem item = e.OriginalSource as MenuItem;
+ if (item != null)
+ {
+ this.StartScan(((DriveInformation)item.Tag).RootDirectory, 0);
+ }
+ }
+
+ /// <summary>
+ /// File Scan
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The RoutedEventArgs.
+ /// </param>
+ private void fileMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ this.FileScan();
+ }
+
+ /// <summary>
+ /// Folder Scan
+ /// </summary>
+ /// <param name="sender">
+ /// The sender.
+ /// </param>
+ /// <param name="e">
+ /// The RoutedEventArgs.
+ /// </param>
+ private void folderMenuItem_Click(object sender, RoutedEventArgs e)
+ {
+ this.FolderScan();
+ }
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 673579915..71d2476f1 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -299,6 +299,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private bool showAdvancedPassthruOpts;
+ /// <summary>
+ /// Backing field for clear queue on encode completed.
+ /// </summary>
+ private bool clearQueueOnEncodeCompleted;
+
#endregion
#region Constructors and Destructors
@@ -1215,6 +1220,23 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange("ShowCliWindow");
}
}
+
+ /// <summary>
+ /// Gets or sets a value indicating whether ClearQueueOnEncodeCompleted.
+ /// </summary>
+ public bool ClearQueueOnEncodeCompleted
+ {
+ get
+ {
+ return this.clearQueueOnEncodeCompleted;
+ }
+ set
+ {
+ this.clearQueueOnEncodeCompleted = value;
+ this.NotifyOfPropertyChange(() => this.ClearQueueOnEncodeCompleted);
+ }
+ }
+
#endregion
#endregion
@@ -1393,6 +1415,7 @@ namespace HandBrakeWPF.ViewModels
this.minimiseToTray = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.MainWindowMinimize);
this.disablePresetUpdateCheckNotification = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.PresetNotification);
this.showCliWindow = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ShowCLI);
+ this.clearQueueOnEncodeCompleted = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.ClearCompletedFromQueue);
// Set the preview count
this.PreviewPicturesToScan.Add(10);
@@ -1632,6 +1655,7 @@ namespace HandBrakeWPF.ViewModels
userSettingService.SetUserSetting(UserSettingConstants.TrayIconAlerts, this.DisplayStatusMessagesTrayIcon);
userSettingService.SetUserSetting(UserSettingConstants.PresetNotification, this.DisablePresetUpdateCheckNotification);
userSettingService.SetUserSetting(ASUserSettingConstants.ShowCLI, this.ShowCliWindow);
+ userSettingService.SetUserSetting(ASUserSettingConstants.ClearCompletedFromQueue, this.ClearQueueOnEncodeCompleted);
userSettingService.SetUserSetting(ASUserSettingConstants.PreviewScanCount, this.SelectedPreviewCount);
userSettingService.SetUserSetting(ASUserSettingConstants.X264Step, double.Parse(this.SelectedGranulairty));
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml
index 4f243237f..79cc340eb 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml
@@ -113,32 +113,14 @@
<!-- ToolBar -->
<ToolBar Name="mainToolBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SnapsToDevicePixels="False">
-
<Menu Background="Transparent" >
- <MenuItem>
+ <MenuItem ItemsSource="{Binding SourceToolbarMenu}">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<Image Source="Images/Movies.png" Height="32" Width="32" />
<Label Content="Source" Margin="8,0,0,0" VerticalAlignment="Center" />
</StackPanel>
</MenuItem.Header>
-
- <MenuItem Micro:Message.Attach="[Event Click] = [Action FolderScan]">
- <MenuItem.Header>
- <StackPanel Orientation="Horizontal">
- <Image Source="Images/folder.png" Height="20" Width="20" />
- <Label Content="Open Folder" Margin="8,0,0,0" VerticalAlignment="Center" />
- </StackPanel>
- </MenuItem.Header>
- </MenuItem>
- <MenuItem Micro:Message.Attach="[Event Click] = [Action FileScan]">
- <MenuItem.Header>
- <StackPanel Orientation="Horizontal">
- <Image Source="Images/Movies.png" Height="20" Width="20" />
- <Label Content="Open File" Margin="8,0,0,0" VerticalAlignment="Center" />
- </StackPanel>
- </MenuItem.Header>
- </MenuItem>
</MenuItem>
</Menu>
@@ -239,7 +221,7 @@
<!-- Output Options -->
<StackPanel Margin="10,5,10,5" MaxWidth="725" Width="725" HorizontalAlignment="Left">
- <Label Content="Output Settings (Preset: None)" FontWeight="Bold" />
+ <Label Content="Output Settings" FontWeight="Bold" />
<StackPanel Orientation="Horizontal">
<Label Content="Container" Margin="8,0,0,0" />
<ComboBox Name="Container" Margin="8,0,0,0" MinWidth="100" ItemsSource="{Binding OutputFormats}" SelectedItem="{Binding SelectedOutputFormat}" />
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
index 165e74923..057a35a5e 100644
--- a/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/MainView.xaml.cs
@@ -9,6 +9,7 @@
namespace HandBrakeWPF.Views
{
+ using System;
using System.Windows;
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index 6852e5704..c3f60077b 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -50,7 +50,7 @@
<CheckBox Content="Check for Updates" IsChecked="{Binding CheckForUpdates}" />
<ComboBox Name="checkForUpdateFrequency" ItemsSource="{Binding CheckForUpdatesFrequencies}" SelectedIndex="{Binding CheckForUpdatesFrequency}" Margin="25,0,0,5" HorizontalAlignment="Left" Width="120"></ComboBox>
- <CheckBox Content="Enable Tooltips" IsChecked="{Binding EnableGuiTooltips}" />
+ <CheckBox Content="Enable Tooltips" Visibility="Collapsed" IsChecked="{Binding EnableGuiTooltips}" />
</StackPanel>
</Grid>
@@ -320,10 +320,11 @@
<TextBlock Text="GUI:" Grid.Column="0" FontWeight="Bold"/>
<StackPanel Orientation="Vertical" Grid.Column="1">
- <CheckBox Content="Minimize to system tray (Requires Restart)" IsChecked="{Binding MinimiseToTray}" />
- <CheckBox Content="Display status messages from tray icon (balloon popups)" IsChecked="{Binding DisplayStatusMessagesTrayIcon}" />
+ <CheckBox Content="Minimize to system tray (Requires Restart)" Visibility="Collapsed" IsChecked="{Binding MinimiseToTray}" />
+ <CheckBox Content="Display status messages from tray icon (balloon popups)" Visibility="Collapsed" IsChecked="{Binding DisplayStatusMessagesTrayIcon}" />
<CheckBox Content="Disable built-in preset update notification" IsChecked="{Binding DisablePresetUpdateCheckNotification}" />
<CheckBox Content="Show CLI window (Allows you to cleanly exit encode with ctrl-c)" IsChecked="{Binding ShowCliWindow}" />
+ <CheckBox Content="Always clear completed queue items after an encode completes" IsChecked="{Binding ClearQueueOnEncodeCompleted}" />
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Text="Number of picture previews to scan:" VerticalAlignment="Center" Width="250" />
<ComboBox Name="numberOfPreviews" ItemsSource="{Binding PreviewPicturesToScan}" SelectedItem="{Binding SelectedPreviewCount}" Width="120" />