mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Restore initial GUI state after playback
This commit is contained in:
20
src/controls.js
vendored
20
src/controls.js
vendored
@@ -7,6 +7,8 @@ const Revealers = imports.src.revealers;
|
|||||||
const { debug } = Debug;
|
const { debug } = Debug;
|
||||||
const { settings } = Misc;
|
const { settings } = Misc;
|
||||||
|
|
||||||
|
const INITIAL_ELAPSED = '00:00/00:00';
|
||||||
|
|
||||||
var Controls = GObject.registerClass(
|
var Controls = GObject.registerClass(
|
||||||
class ClapperControls extends Gtk.Box
|
class ClapperControls extends Gtk.Box
|
||||||
{
|
{
|
||||||
@@ -21,7 +23,6 @@ class ClapperControls extends Gtk.Box
|
|||||||
this.minFullViewWidth = 560;
|
this.minFullViewWidth = 560;
|
||||||
|
|
||||||
this.currentPosition = 0;
|
this.currentPosition = 0;
|
||||||
this.currentDuration = 0;
|
|
||||||
this.isPositionDragging = false;
|
this.isPositionDragging = false;
|
||||||
this.isMobile = false;
|
this.isMobile = false;
|
||||||
this.isFullscreen = false;
|
this.isFullscreen = false;
|
||||||
@@ -109,6 +110,21 @@ class ClapperControls extends Gtk.Box
|
|||||||
this.positionScale.visible = isSeekable;
|
this.positionScale.visible = isSeekable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setInitialState()
|
||||||
|
{
|
||||||
|
this.currentPosition = 0;
|
||||||
|
this.positionScale.set_value(0);
|
||||||
|
this.positionScale.visible = false;
|
||||||
|
|
||||||
|
this.elapsedButton.set_label(INITIAL_ELAPSED);
|
||||||
|
this.togglePlayButton.setPrimaryIcon();
|
||||||
|
|
||||||
|
for(let type of ['video', 'audio', 'subtitle'])
|
||||||
|
this[`${type}TracksButton`].visible = false;
|
||||||
|
|
||||||
|
this.visualizationsButton.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
updateElapsedLabel(value)
|
updateElapsedLabel(value)
|
||||||
{
|
{
|
||||||
value = value || 0;
|
value = value || 0;
|
||||||
@@ -291,7 +307,7 @@ class ClapperControls extends Gtk.Box
|
|||||||
_addElapsedButton()
|
_addElapsedButton()
|
||||||
{
|
{
|
||||||
const elapsedRevealer = new Revealers.ButtonsRevealer('SLIDE_RIGHT');
|
const elapsedRevealer = new Revealers.ButtonsRevealer('SLIDE_RIGHT');
|
||||||
this.elapsedButton = this.addElapsedPopoverButton('00:00/00:00', elapsedRevealer);
|
this.elapsedButton = this.addElapsedPopoverButton(INITIAL_ELAPSED, elapsedRevealer);
|
||||||
elapsedRevealer.set_reveal_child(true);
|
elapsedRevealer.set_reveal_child(true);
|
||||||
this.revealersArr.push(elapsedRevealer);
|
this.revealersArr.push(elapsedRevealer);
|
||||||
|
|
||||||
|
@@ -431,10 +431,8 @@ class ClapperWidget extends Gtk.Grid
|
|||||||
break;
|
break;
|
||||||
case GstClapper.ClapperState.STOPPED:
|
case GstClapper.ClapperState.STOPPED:
|
||||||
debug('player state changed to: STOPPED');
|
debug('player state changed to: STOPPED');
|
||||||
this.controls.currentPosition = 0;
|
this.controls.setInitialState();
|
||||||
this.controls.positionScale.set_value(0);
|
|
||||||
this.revealerTop.showTitle = false;
|
this.revealerTop.showTitle = false;
|
||||||
this.controls.togglePlayButton.setPrimaryIcon();
|
|
||||||
break;
|
break;
|
||||||
case GstClapper.ClapperState.PAUSED:
|
case GstClapper.ClapperState.PAUSED:
|
||||||
debug('player state changed to: PAUSED');
|
debug('player state changed to: PAUSED');
|
||||||
|
Reference in New Issue
Block a user