mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-15 20:52:40 +00:00
@@ -145,6 +145,19 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</Button.Style>
|
</Button.Style>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button x:Name="buttonLoop" DockPanel.Dock="Left">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding ShouldLoop, ElementName=viewerPanel}"
|
||||||
|
Value="True">
|
||||||
|
<Setter Property="Content" Value="" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
<Button x:Name="buttonMute" DockPanel.Dock="Right">
|
<Button x:Name="buttonMute" DockPanel.Dock="Right">
|
||||||
<Button.Style>
|
<Button.Style>
|
||||||
<Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
|
<Style TargetType="Button" BasedOn="{StaticResource ControlButtonStyle}">
|
||||||
|
@@ -48,6 +48,7 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
private bool _hasVideo;
|
private bool _hasVideo;
|
||||||
private bool _isPlaying;
|
private bool _isPlaying;
|
||||||
private bool _wasPlaying;
|
private bool _wasPlaying;
|
||||||
|
private bool _shouldLoop;
|
||||||
|
|
||||||
public ViewerPanel(ContextObject context)
|
public ViewerPanel(ContextObject context)
|
||||||
{
|
{
|
||||||
@@ -70,6 +71,7 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
mediaElement.MediaFailed += MediaFailed;
|
mediaElement.MediaFailed += MediaFailed;
|
||||||
|
|
||||||
buttonPlayPause.Click += TogglePlayPause;
|
buttonPlayPause.Click += TogglePlayPause;
|
||||||
|
buttonLoop.Click += ToggleShouldLoop;
|
||||||
buttonTime.Click += (sender, e) => buttonTime.Tag = (string) buttonTime.Tag == "Time" ? "Length" : "Time";
|
buttonTime.Click += (sender, e) => buttonTime.Tag = (string) buttonTime.Tag == "Time" ? "Length" : "Time";
|
||||||
buttonMute.Click += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
|
buttonMute.Click += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
|
||||||
volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
||||||
@@ -109,6 +111,23 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShouldLoop
|
||||||
|
{
|
||||||
|
get => _shouldLoop;
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
if (value == _shouldLoop) return;
|
||||||
|
_shouldLoop = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
if (!IsPlaying)
|
||||||
|
{
|
||||||
|
IsPlaying = true;
|
||||||
|
|
||||||
|
mediaElement.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public BitmapSource CoverArt
|
public BitmapSource CoverArt
|
||||||
{
|
{
|
||||||
get => _coverArt;
|
get => _coverArt;
|
||||||
@@ -169,10 +188,19 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
if (mediaElement == null)
|
if (mediaElement == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IsPlaying = false;
|
|
||||||
|
|
||||||
mediaElement.MediaPosition = 0;
|
mediaElement.MediaPosition = 0;
|
||||||
mediaElement.Pause();
|
if (ShouldLoop)
|
||||||
|
{
|
||||||
|
IsPlaying = true;
|
||||||
|
|
||||||
|
mediaElement.Play();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsPlaying = false;
|
||||||
|
|
||||||
|
mediaElement.Pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowViedoControlContainer(object sender, MouseEventArgs e)
|
private void ShowViedoControlContainer(object sender, MouseEventArgs e)
|
||||||
@@ -266,6 +294,11 @@ namespace QuickLook.Plugin.VideoViewer
|
|||||||
mediaElement.Play();
|
mediaElement.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleShouldLoop(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ShouldLoop = !ShouldLoop;
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadAndPlay(string path, MediaInfo.MediaInfo info)
|
public void LoadAndPlay(string path, MediaInfo.MediaInfo info)
|
||||||
{
|
{
|
||||||
UpdateMeta(path, info);
|
UpdateMeta(path, info);
|
||||||
|
Reference in New Issue
Block a user