[gnome-subtitles] Fix #130 Video area not cleared after closing it
- From: Pedro Castro <pcastro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Fix #130 Video area not cleared after closing it
- Date: Sun, 19 May 2019 19:35:21 +0000 (UTC)
commit 42b0858da20be6a6d5e79e18afced2404c22a917
Author: Pedro Castro <pedro gnomesubtitles org>
Date: Sun May 19 20:34:59 2019 +0100
Fix #130 Video area not cleared after closing it
src/GnomeSubtitles/Ui/VideoPreview/Player.cs | 3 ++-
.../Ui/VideoPreview/PlayerPositionWatcher.cs | 5 ++--
src/GnomeSubtitles/Ui/VideoPreview/Video.cs | 27 +++++++++++-----------
3 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/Player.cs b/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
index 73a6874..0377c56 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/Player.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2007-2018 Pedro Castro
+ * Copyright (C) 2007-2019 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ using Gtk;
using SubLib.Core.Domain;
using System;
using SubLib.Util;
+using Gdk;
namespace GnomeSubtitles.Ui.VideoPreview {
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs
b/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs
index 6403b61..2b3aefe 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/PlayerPositionWatcher.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2017 Pedro Castro
+ * Copyright (C) 2006-2019 Pedro Castro
*
* Gnome Subtitles is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -82,8 +82,9 @@ public class PlayerPositionWatcher {
}
private void EmitPositionPulse (TimeSpan position) {
- if (PositionPulse != null)
+ if (PositionPulse != null) {
PositionPulse(position);
+ }
}
}
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
index 8224826..9caf60b 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
@@ -107,6 +107,8 @@ public class Video {
/// <exception cref="PlayerCouldNotOpenVideoException">Thrown if the player could not open the
video.</exception>
public void Open (Uri videoUri) {
Close();
+
+ frame.Show();
player.Open(videoUri);
}
@@ -122,20 +124,17 @@ public class Video {
tracker.Close();
overlay.Close();
-
/* Update the frame */
-// frame.Child.Hide();
-// frame.Child.Show();
- frame.QueueDraw(); //To make sure the frame stops showing the last image from the closed video
frame.Ratio = Player.DefaultAspectRatio;
-
+ frame.Hide(); //To keep the frame from showing the last video image that was being played
+
SilentDisablePlayPauseButton();
UpdateSpeedControls(1);
SetControlsSensitivity(false);
}
public void Quit () {
- player.Close();
+ player.Dispose();
}
public void SetLoopSelectionPlayback (bool enabled){
@@ -283,8 +282,8 @@ public class Video {
}
}
- private void handlePlayerLoading () {
- if (isLoaded || (!isPlayerLoadComplete()))
+ private void HandlePlayerLoading () {
+ if (isLoaded || (!IsPlayerLoadComplete()))
return;
isLoaded = true;
@@ -292,7 +291,7 @@ public class Video {
Base.UpdateFromVideoLoaded(player.VideoUri);
}
- private bool isPlayerLoadComplete () {
+ private bool IsPlayerLoadComplete () {
return (player != null) && (player.State != MediaStatus.Unloaded) && (player.HasVideoInfo) &&
(player.HasDuration);
}
@@ -318,17 +317,17 @@ public class Video {
}
private void OnPlayerFoundVideoInfo (VideoInfoEventArgs args) {
- handlePlayerLoading();
+ HandlePlayerLoading();
}
private void OnPlayerStateChanged (StateEventArgs args) {
if (args.State == MediaStatus.Loaded) {
- handlePlayerLoading();
+ HandlePlayerLoading();
}
}
private void OnPlayerFoundDuration (TimeSpan duration) {
- handlePlayerLoading();
+ HandlePlayerLoading();
}
private void OnPlayerEndOfStream () {
@@ -356,11 +355,11 @@ public class Video {
if (!(Base.IsDocumentLoaded))
return;
- Subtitle firstSubtitle = Core.Base.Ui.View.Selection.FirstSubtitle;
+ Subtitle firstSubtitle = Base.Ui.View.Selection.FirstSubtitle;
if (firstSubtitle == null)
return;
- Subtitle lastSubtitle = Core.Base.Ui.View.Selection.LastSubtitle;
+ Subtitle lastSubtitle = Base.Ui.View.Selection.LastSubtitle;
if ((position < firstSubtitle.Times.Start) || (position > lastSubtitle.Times.End))
SeekToSelection();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]