summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-03-05 20:12:21 +0000
committersr55 <[email protected]>2013-03-05 20:12:21 +0000
commit4ff95a7b1eac44a1577010e1cf3eaf8fa89c679d (patch)
treef604015295c72573850412eca55b9fd037e59976
parent99fd7e4c1828a837203a9f351ab2df9e30f27216 (diff)
WinGui: Show the two log files as tabs rather than a combobox selection. Makes it more obvious that there are two logs.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5306 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs87
-rw-r--r--win/CS/HandBrakeWPF/Views/LogView.xaml35
2 files changed, 33 insertions, 89 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
index 4c97ab412..5bf95d22f 100644
--- a/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/LogViewModel.cs
@@ -36,10 +36,6 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private readonly IScanServiceWrapper scanService;
- /// <summary>
- /// Backing field for the selected mode
- /// </summary>
- private int selectedMode;
#endregion
/// <summary>
@@ -56,46 +52,32 @@ namespace HandBrakeWPF.ViewModels
this.encodeService = encodeService;
this.scanService = scanService;
this.Title = "Log Viewer";
-
- this.SelectedMode = this.encodeService.IsEncoding ? 0 : 1;
}
/// <summary>
- /// Gets Log.
+ /// Gets or sets the selected tab.
/// </summary>
- public string Log
- {
- get
- {
- return this.SelectedMode == 0 ? this.encodeService.ActivityLog : this.scanService.ActivityLog;
- }
- }
+ public int SelectedTab { get; set; }
/// <summary>
- /// Gets LogModes.
+ /// Gets Log.
/// </summary>
- public IEnumerable<string> LogModes
+ public string ScanLog
{
get
{
- return new List<string> { "Encode Log", "Scan Log" };
+ return this.scanService.ActivityLog;
}
}
/// <summary>
- /// Gets or sets SelectedMode.
+ /// Gets the encodelog.
/// </summary>
- public int SelectedMode
+ public string EncodeLog
{
get
{
- return selectedMode;
- }
- set
- {
- selectedMode = value;
- this.NotifyOfPropertyChange(() => this.SelectedMode);
- this.ChangeLogDisplay();
+ return this.encodeService.ActivityLog;
}
}
@@ -115,7 +97,7 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
public void CopyLog()
{
- Clipboard.SetDataObject(this.Log, true);
+ Clipboard.SetDataObject(this.SelectedTab == 0 ? this.ScanLog : this.EncodeLog, true);
}
/// <summary>
@@ -123,13 +105,14 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
protected override void OnActivate()
{
- this.scanService.ScanStared += ScanServiceScanStared;
this.scanService.ScanCompleted += ScanServiceScanCompleted;
- this.encodeService.EncodeStarted += EncodeServiceEncodeStarted;
this.encodeService.EncodeCompleted += EncodeServiceEncodeCompleted;
this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;
base.OnActivate();
+
+ this.NotifyOfPropertyChange(() => this.ScanLog);
+ this.NotifyOfPropertyChange(() => this.EncodeLog);
}
/// <summary>
@@ -143,7 +126,7 @@ namespace HandBrakeWPF.ViewModels
/// </param>
private void ScanServiceScanStatusChanged(object sender, ScanProgressEventArgs e)
{
- this.NotifyOfPropertyChange(() => this.Log);
+ this.NotifyOfPropertyChange(() => this.ScanLog);
}
/// <summary>
@@ -157,7 +140,7 @@ namespace HandBrakeWPF.ViewModels
/// </param>
private void EncodeServiceEncodeStatusChanged(object sender, EncodeProgressEventArgs e)
{
- this.NotifyOfPropertyChange(() => this.Log);
+ this.NotifyOfPropertyChange(() => this.EncodeLog);
}
/// <summary>
@@ -168,9 +151,7 @@ namespace HandBrakeWPF.ViewModels
/// </param>
protected override void OnDeactivate(bool close)
{
- this.scanService.ScanStared -= ScanServiceScanStared;
this.scanService.ScanCompleted -= ScanServiceScanCompleted;
- this.encodeService.EncodeStarted -= EncodeServiceEncodeStarted;
this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted;
this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;
this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged;
@@ -179,42 +160,6 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
- /// Change the Log Display
- /// </summary>
- private void ChangeLogDisplay()
- {
- this.NotifyOfPropertyChange(() => this.Log);
- }
-
- /// <summary>
- /// Encode Started Event Handler
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void EncodeServiceEncodeStarted(object sender, EventArgs e)
- {
- this.SelectedMode = 0;
- }
-
- /// <summary>
- /// Scan Started Event Handler
- /// </summary>
- /// <param name="sender">
- /// The sender.
- /// </param>
- /// <param name="e">
- /// The e.
- /// </param>
- private void ScanServiceScanStared(object sender, EventArgs e)
- {
- this.SelectedMode = 1;
- }
-
- /// <summary>
/// Scan Completed Event Handler.
/// </summary>
/// <param name="sender">
@@ -225,7 +170,7 @@ namespace HandBrakeWPF.ViewModels
/// </param>
private void ScanServiceScanCompleted(object sender, ScanCompletedEventArgs e)
{
- this.NotifyOfPropertyChange(() => this.Log);
+ this.NotifyOfPropertyChange(() => this.ScanLog);
}
/// <summary>
@@ -239,7 +184,7 @@ namespace HandBrakeWPF.ViewModels
/// </param>
private void EncodeServiceEncodeCompleted(object sender, EncodeCompletedEventArgs e)
{
- this.NotifyOfPropertyChange(() => this.Log);
+ this.NotifyOfPropertyChange(() => this.EncodeLog);
}
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/Views/LogView.xaml b/win/CS/HandBrakeWPF/Views/LogView.xaml
index cb6687251..94e5989ba 100644
--- a/win/CS/HandBrakeWPF/Views/LogView.xaml
+++ b/win/CS/HandBrakeWPF/Views/LogView.xaml
@@ -20,21 +20,7 @@
ToolBarTray.IsLocked="True"
Loaded="ToolBarLoaded"
>
-
-
- <TextBlock Margin="10,0,10,0"
- VerticalAlignment="Center"
- FontWeight="Bold"
- Text="Choose Log:" />
- <ComboBox Width="120
- " Margin="0,0,10,0" Background="LightSteelBlue" Height="22" FontWeight="Black"
- HorizontalAlignment="Right" VerticalAlignment="Center"
- ItemsSource="{Binding LogModes}"
- SelectedIndex="{Binding SelectedMode}"
- />
-
- <Separator />
-
+
<Button cal:Message.Attach="[Event Click] = [Action CopyLog]" Margin="10,0,0,0">
<StackPanel Orientation="Horizontal">
<Image Width="16" Source="Images/copy.png" />
@@ -50,13 +36,26 @@
</ToolBar>
- <TextBox Grid.Row="1"
+ <TabControl Grid.Row="1" SelectedIndex="{Binding SelectedTab}">
+ <TabItem Header="Scan Log">
+ <TextBox Grid.Row="1"
AcceptsReturn="True"
IsReadOnly="True"
ScrollViewer.VerticalScrollBarVisibility="Visible"
- Text="{Binding Log,
- Mode=OneWay}"
+ Text="{Binding ScanLog, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
+ </TabItem>
+
+ <TabItem Header="Encode Log">
+ <TextBox Grid.Row="1"
+ AcceptsReturn="True"
+ IsReadOnly="True"
+ ScrollViewer.VerticalScrollBarVisibility="Visible"
+ Text="{Binding EncodeLog, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
+ TextWrapping="Wrap" />
+ </TabItem>
+
+ </TabControl>
</Grid>
</Grid>