Commit e0e846aa authored by Meg Ford's avatar Meg Ford

code cleanup

parent e89f4239
...@@ -61,10 +61,16 @@ const FileUtil = new Lang.Class({ ...@@ -61,10 +61,16 @@ const FileUtil = new Lang.Class({
_deleteFileCallback: function(obj, res) { _deleteFileCallback: function(obj, res) {
this._deleted = obj.delete_finish(res); this._deleted = obj.delete_finish(res);
//this._list = new Listview.Listview(); //this._list = new Listview.Listview();
//this._list.enumerateDirectory(); //this._list.refreshListview();
// Application.offsetController.resetOffset(); //MainWindow.offsetController.resetOffset();
//Application.add_named(groupGrid, name); //MainWindow.view.listBoxAdd();
},
getDirPath: function() {
let path = MainWindow.path;
let dirName = GLib.build_filenamev(path);
let dir = Gio.file_new_for_path(dirName);
return dir;
} }
}); });
...@@ -118,16 +124,14 @@ const OffsetController = new Lang.Class({ ...@@ -118,16 +124,14 @@ const OffsetController = new Lang.Class({
log(this.totItems); log(this.totItems);
this.ensureCount = this._offset + _OFFSET_STEP - 1; this.ensureCount = this._offset + _OFFSET_STEP - 1;
log(this.ensureCount); log(this.ensureCount);
log("counitn");
this.getItemCount(); this.getItemCount();
if (this.ensureCount < this.totItems) { if (this.ensureCount < this.totItems) {
this.endIdx = this.ensureCount; this.endIdx = this.ensureCount;
log(this.endIdx); log(this.endIdx);
log("wtf");} } else {
else {
this.endIdx = this.totItems - 1; this.endIdx = this.totItems - 1;
log(this.endIdx); log(this.endIdx);
log("ttt");} }
CurrentEndIdx = this.endIdx; CurrentEndIdx = this.endIdx;
this.getcidx(); this.getcidx();
...@@ -137,6 +141,5 @@ const OffsetController = new Lang.Class({ ...@@ -137,6 +141,5 @@ const OffsetController = new Lang.Class({
return CurrentEndIdx; return CurrentEndIdx;
} }
}); });
Signals.addSignalMethods(OffsetController.prototype); //Do I use this?
...@@ -46,24 +46,45 @@ const mediaTypeMap = { ...@@ -46,24 +46,45 @@ const mediaTypeMap = {
FLAC: "FLAC", FLAC: "FLAC",
MP3: "MP3", MP3: "MP3",
MP4: "MP4" MP4: "MP4"
}; };
const ListType = {
NEW: 0,
REFRESH: 1
};
const CurrentlyEnumerating = {
TRUE: 0,
FALSE: 1
};
let currentlyEnumerating = null;
let stopVal = null;
let allFilesInfo = null;
let fileInfo = null;
let listType = null;
let startRecording = false;
const Listview = new Lang.Class({ const Listview = new Lang.Class({
Name: "Listview", Name: "Listview",
_init: function() { _init: function() {
this._stopVal = EnumeratorState.ACTIVE; stopVal = EnumeratorState.ACTIVE;
this._allFilesInfo = []; allFilesInfo = [];
this.mp3Caps = Gst.Caps.from_string("audio/mpeg, mpegversion=(int)1"); this.mp3Caps = Gst.Caps.from_string("audio/mpeg, mpegversion=(int)1");
this.oggCaps = Gst.Caps.from_string("audio/ogg"); this.oggCaps = Gst.Caps.from_string("audio/ogg");
this.mp4Caps = Gst.Caps.from_string("video/quicktime, variant=(string)iso"); this.mp4Caps = Gst.Caps.from_string("video/quicktime, variant=(string)iso");
this.flacCaps = Gst.Caps.from_string("audio/x-flac"); this.flacCaps = Gst.Caps.from_string("audio/x-flac");
},
monitorListview: function() {
let dir = MainWindow.fileUtil.getDirPath();
this.dirMonitor = dir.monitor_directory(Gio.FileMonitorFlags.NONE, null);
this.dirMonitor.connect('changed', this._onDirChanged);
}, },
enumerateDirectory: function() { enumerateDirectory: function() {
let path = MainWindow.path; let dir = MainWindow.fileUtil.getDirPath();
let dirName = GLib.build_filenamev(path);
let dir = Gio.file_new_for_path(dirName);
dir.enumerate_children_async('standard::name,time::created,time::modified', dir.enumerate_children_async('standard::name,time::created,time::modified',
Gio.FileQueryInfoFlags.NONE, Gio.FileQueryInfoFlags.NONE,
...@@ -82,7 +103,7 @@ const Listview = new Lang.Class({ ...@@ -82,7 +103,7 @@ const Listview = new Lang.Class({
}, },
_onNextFileComplete: function () { _onNextFileComplete: function () {
this._fileInfo = []; fileInfo = [];
try{ try{
this._enumerator.next_files_async(10, GLib.PRIORITY_DEFAULT, null, Lang.bind(this, this._enumerator.next_files_async(10, GLib.PRIORITY_DEFAULT, null, Lang.bind(this,
function(obj, res) { function(obj, res) {
...@@ -107,8 +128,8 @@ const Listview = new Lang.Class({ ...@@ -107,8 +128,8 @@ const Listview = new Lang.Class({
this.dateCreatedString = dateCreated.format(_("%Y-%m-%d %H:%M:%S")); this.dateCreatedString = dateCreated.format(_("%Y-%m-%d %H:%M:%S"));
} }
this._fileInfo = fileInfo =
this._fileInfo.concat({ appName: null, fileInfo.concat({ appName: null,
dateCreated: null, dateCreated: null,
dateForSort: dateModifiedSortString, dateForSort: dateModifiedSortString,
dateModified: dateModifiedDisplayString, dateModified: dateModifiedDisplayString,
...@@ -118,10 +139,10 @@ const Listview = new Lang.Class({ ...@@ -118,10 +139,10 @@ const Listview = new Lang.Class({
title: null, title: null,
uri: null }); uri: null });
})); }));
this._sortItems(this._fileInfo); this._sortItems(fileInfo);
} else { } else {
//log("done"); log("done");
this._stopVal = EnumeratorState.CLOSED; stopVal = EnumeratorState.CLOSED;
this._enumerator.close(null); this._enumerator.close(null);
this._setDiscover(); this._setDiscover();
...@@ -133,27 +154,30 @@ const Listview = new Lang.Class({ ...@@ -133,27 +154,30 @@ const Listview = new Lang.Class({
} }
}, },
_sortItems: function(fileArr) { _sortItems: function(fileArr) {
log("sort");
this._fileArr = fileArr; this._fileArr = fileArr;
this._allFilesInfo = this._allFilesInfo.concat(this._fileArr); allFilesInfo = allFilesInfo.concat(this._fileArr);
this._allFilesInfo.sort(function(a, b) { allFilesInfo.sort(function(a, b) {
return b.dateForSort - a.dateForSort; return b.dateForSort - a.dateForSort;
}); });
log("this._stopVal " + stopVal);
if (this._stopVal == EnumeratorState.ACTIVE) if (stopVal == EnumeratorState.ACTIVE) {
this._onNextFileComplete(); this._onNextFileComplete();
log("sort done");
}
}, },
getItemCount: function() { getItemCount: function() {
//log(this._allFilesInfo.length); log(allFilesInfo.length);
return this._allFilesInfo.length; return allFilesInfo.length;
}, },
_setDiscover: function() { _setDiscover: function() {
this._controller = MainWindow.offsetController; this._controller = MainWindow.offsetController;
this.totItems = this.getItemCount(); this.totItems = this.getItemCount();
this.startIdx = this._controller.getOffset(); this.startIdx = this._controller.getOffset();
//log(this.startIdx); log("this.startIdx" + this.startIdx);
this.ensureCount = this.startIdx + this._controller.getOffsetStep() - 1; this.ensureCount = this.startIdx + this._controller.getOffsetStep() - 1;
if (this.ensureCount < this.totItems) if (this.ensureCount < this.totItems)
...@@ -167,14 +191,14 @@ const Listview = new Lang.Class({ ...@@ -167,14 +191,14 @@ const Listview = new Lang.Class({
}, },
_runDiscover: function() { _runDiscover: function() {
this.file = this._allFilesInfo[this.idx]; this.file = allFilesInfo[this.idx];
this._buildFileName = new Record.BuildFileName(); this._buildFileName = new Record.BuildFileName();
let initialFileName = this._buildFileName.buildPath(); let initialFileName = this._buildFileName.buildPath();
initialFileName.push(this.file.fileName); initialFileName.push(this.file.fileName);
let finalFileName = GLib.build_filenamev(initialFileName); let finalFileName = GLib.build_filenamev(initialFileName);
let uri = GLib.filename_to_uri(finalFileName, null); let uri = GLib.filename_to_uri(finalFileName, null);
this.file.uri = uri; this.file.uri = uri;
//log(this.file.uri); log(this.file.uri);
this._discoverer = new GstPbutils.Discoverer(); this._discoverer = new GstPbutils.Discoverer();
this._discoverer.start(); this._discoverer.start();
this._discoverer.discover_uri_async(uri); this._discoverer.discover_uri_async(uri);
...@@ -222,21 +246,57 @@ const Listview = new Lang.Class({ ...@@ -222,21 +246,57 @@ const Listview = new Lang.Class({
} }
this._getCapsForList(info); this._getCapsForList(info);
if (this.idx < this.endIdx && this.idx >= 0) {
this.idx++;
//log(this.idx);
this._runDiscover();
} else {
this._discoverer.stop();
MainWindow.offsetController.setEndIdx();
//Application.view.list();
MainWindow.view.listBoxAdd();
}
} else { } else {
// don't index files we can't play // don't index files we can't play
log("File cannot be played"); log("File cannot be played");
} }
if (this.idx < this.endIdx && this.idx >= 0) {
this.idx++;
log("this.listType discovering" + listType);
this._runDiscover();
} else {
this._discoverer.stop();
log("this.listType discovering" + listType);
MainWindow.offsetController.setEndIdx();
if (listType == ListType.NEW) {
MainWindow.view.listBoxAdd();
MainWindow.view.scrolledWinAdd();
currentlyEnumerating = CurrentlyEnumerating.FALSE;
log("this.currentlyEnumerating new" +currentlyEnumerating);
} else if (listType == ListType.REFRESH){
MainWindow.view.scrolledWinDelete();
currentlyEnumerating = CurrentlyEnumerating.FALSE;
log("this.currentlyEnumerating " +currentlyEnumerating);
}
}
},
setListTypeNew: function() {
listType = ListType.NEW;
},
_onDirChanged: function(dirMonitor, file1, file2, eventType) {
log("eventType" + eventType);
if (eventType == Gio.FileMonitorEvent.DELETED ||
(eventType == Gio.FileMonitorEvent.CHANGES_DONE_HINT && MainWindow.recordPipeline == MainWindow.RecordPipelineStates.STOPPED)) {
stopVal = EnumeratorState.ACTIVE;
allFilesInfo.length = 0;
fileInfo.length = 0;
log(stopVal + "this._stopVal");
listType = ListType.REFRESH;
log("this.listType" + listType);
log("this.currentlyEnumerating " + currentlyEnumerating);
if(currentlyEnumerating == CurrentlyEnumerating.FALSE) {
currentlyEnumerating = CurrentlyEnumerating.TRUE;
MainWindow.view.listBoxRefresh();
}
}
if (eventType == Gio.FileMonitorEvent.CREATED)
startRecording = true;
log("MainWindow.recordPipeline" + MainWindow.recordPipeline);
}, },
_getCapsForList: function(info) { _getCapsForList: function(info) {
...@@ -285,7 +345,7 @@ const Listview = new Lang.Class({ ...@@ -285,7 +345,7 @@ const Listview = new Lang.Class({
}, },
getFilesInfoForList: function() { getFilesInfoForList: function() {
return this._allFilesInfo;//return return allFilesInfo;
}, },
getEndIdx: function() { getEndIdx: function() {
......
...@@ -37,8 +37,8 @@ const Record = imports.record; ...@@ -37,8 +37,8 @@ const Record = imports.record;
const Waveform = imports.waveform; const Waveform = imports.waveform;
let audioProfile = null; let audioProfile = null;
let fileManager = null; // do I use this?
let fileUtil = null; let fileUtil = null;
let grid = null;
let groupGrid; let groupGrid;
let list = null; let list = null;
let offsetController = null; let offsetController = null;
...@@ -47,6 +47,8 @@ let play = null; ...@@ -47,6 +47,8 @@ let play = null;
let selectable = null; let selectable = null;
let view = null; let view = null;
let wave = null; let wave = null;
let recordPipeline = null;
let recordButton = null;
const ActiveArea = { const ActiveArea = {
RECORD: 0, RECORD: 0,
...@@ -64,6 +66,12 @@ const PipelineStates = { ...@@ -64,6 +66,12 @@ const PipelineStates = {
STOPPED: 2 STOPPED: 2
}; };
const RecordPipelineStates = {
PLAYING: 0,
PAUSED: 1,
STOPPED: 2
};
const _TIME_DIVISOR = 60; const _TIME_DIVISOR = 60;
const _SEC_TIMEOUT = 100; const _SEC_TIMEOUT = 100;
...@@ -76,19 +84,23 @@ const MainWindow = new Lang.Class({ ...@@ -76,19 +84,23 @@ const MainWindow = new Lang.Class({
this._buildFileName = new Record.BuildFileName() this._buildFileName = new Record.BuildFileName()
path = this._buildFileName.buildPath(); path = this._buildFileName.buildPath();
this._buildFileName.ensureDirectory(path); this._buildFileName.ensureDirectory(path);
offsetController = new FileUtil.OffsetController;
fileUtil = new FileUtil.FileUtil(); fileUtil = new FileUtil.FileUtil();
offsetController = new FileUtil.OffsetController;
view = new MainView(); view = new MainView();
play = new Play.Play(); play = new Play.Play();
params = Params.fill(params, { title: GLib.get_application_name(), //change this params = Params.fill(params, { title: GLib.get_application_name(), //change this
default_width: 700, default_width: 700,
default_height: 480, default_height: 480 });
border_width: 12 });
this.parent(params); this.parent(params);
let grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
halign: Gtk.Align.CENTER }); halign: Gtk.Align.CENTER,
height_request: 109,
width_request: 900,
border_width: 12,
vexpand: false });
grid.set_row_homogeneous(true);
let stackSwitcher = Gtk.StackSwitcher.new(); let stackSwitcher = Gtk.StackSwitcher.new();
stackSwitcher.set_stack(view); stackSwitcher.set_stack(view);
let header = new Gtk.HeaderBar({ hexpand: true }); let header = new Gtk.HeaderBar({ hexpand: true });
...@@ -98,7 +110,7 @@ const MainWindow = new Lang.Class({ ...@@ -98,7 +110,7 @@ const MainWindow = new Lang.Class({
let recordToolbar = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL, let recordToolbar = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 0 }); spacing: 0 });
header.pack_start(recordToolbar); header.pack_start(recordToolbar);
let recordButton = new RecordButton({ label: "Record", recordButton = new RecordButton({ label: "Record",
margin_bottom: 4, margin_bottom: 4,
margin_top: 6, margin_top: 6,
margin_left: 6, margin_left: 6,
...@@ -115,11 +127,11 @@ const MainWindow = new Lang.Class({ ...@@ -115,11 +127,11 @@ const MainWindow = new Lang.Class({
this.add(grid); this.add(grid);
grid.show_all(); grid.show_all();
this.show_all(); this.show_all();
log("grid" + grid.get_preferred_height());
}, },
_defineThemes: function() { _defineThemes: function() {
let settings = Gtk.Settings.get_default(); let settings = Gtk.Settings.get_default();
//settings.gtk_application_prefer_dark_theme = true;
} }
}); });
...@@ -137,19 +149,15 @@ const MainView = new Lang.Class({ ...@@ -137,19 +149,15 @@ const MainView = new Lang.Class({
let listviewPage = this._addListviewPage('listviewPage'); let listviewPage = this._addListviewPage('listviewPage');
this.visible_child_name = 'playerPage'; this.visible_child_name = 'playerPage';
let recorderPage = this._addRecorderPage('recorderPage');
this.visible_child_name = 'listviewPage';
let playerPage = this._addPlayerPage('playerPage');
this.visible_child_name = 'recorderPage';
this.labelID = null; this.labelID = null;
}, },
_addListviewPage: function(name) { _addListviewPage: function(name) {
list = new Listview.Listview(); list = new Listview.Listview();
list.setListTypeNew();
list.enumerateDirectory(); list.enumerateDirectory();
this._record = new Record.Record(audioProfile);
let initialPage = new Gtk.EventBox(); let initialPage = new Gtk.EventBox();
groupGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, groupGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
...@@ -160,84 +168,6 @@ const MainView = new Lang.Class({ ...@@ -160,84 +168,6 @@ const MainView = new Lang.Class({
groupGrid.add(initialPage); groupGrid.add(initialPage);
this.add_titled(groupGrid, name, "View"); this.add_titled(groupGrid, name, "View");
}, },
_addRecorderPage: function(name) {
this._record = new Record.Record(audioProfile);
this.recordBox = new Gtk.EventBox();
this._comboBoxText = new EncoderComboBox();
//recordGrid.attach(this._comboBoxText, 20, 1, 3, 1);
// this.recordTimeLabel = new Gtk.Label();
//recordGrid.attach(this.recordTimeLabel, 20, 2, 3, 1);
this.recordVolume = new Gtk.VolumeButton();
this.recordRange = Gtk.Adjustment.new(0.2, 0, 1.0, 0.05, 0.0, 0.0);
this.recordVolume.set_adjustment(this.recordRange);
this.recordVolume.connect ("value-changed", Lang.bind(this, this.setVolume));
//recordGrid.attach(this.recordVolume, 20, 4, 3, 1);
this.add_titled(this.recordBox, name, "Record");
},
_addPlayerPage: function(name) {
this.playBox = new Gtk.EventBox();
let playGrid = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
halign: Gtk.Align.CENTER,
valign: Gtk.Align.CENTER,
column_homogeneous: true,
column_spacing: 15 });
this.playBox.add(playGrid);
let playToolbar = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
spacing: 0 });
playToolbar.get_style_context().add_class(Gtk.STYLE_CLASS_LINKED);
playGrid.attach(playToolbar, 20, 0, 2, 1);
let loadButton = new LoadMoreButton(playGrid);
this.progressScale = new Gtk.Scale();
this.progressScale.sensitive = false;
this.progressScale.connect("button-press-event", Lang.bind(this,
function() {
MainWindow.play.onProgressScaleConnect();
return false;
}));
this.progressScale.connect("button-release-event", Lang.bind(this,
function() {
this.setProgressScaleInsensitive();
this.onProgressScaleChangeValue();
this._updatePositionCallback();
return false;
}));
playGrid.attach(this.progressScale, 20, 3, 3, 1);
/*this.playVolume = new Gtk.VolumeButton();
this.range = Gtk.Adjustment.new(0.90, 0, 1.0, 0.05, 0.0, 0.0);
this.playVolume.set_adjustment(this.range);
this.playVolume.connect("value-changed", Lang.bind(this, this.setVolume));
playGrid.attach(this.playVolume, 20, 4, 3, 1);*/
//this.playButton = new PlayPauseButton();
//playToolbar.pack_end(this.playButton, false, true, 0);
let stopPlay = new Gtk.Button();
this.stopImage = Gtk.Image.new_from_icon_name("media-playback-stop-symbolic", Gtk.IconSize.BUTTON);
stopPlay.set_image(this.stopImage);
stopPlay.connect("clicked", Lang.bind(this, this.onPlayStopClicked));
playToolbar.pack_end(stopPlay, true, true, 0);
this.add_titled(this.playBox, name, "Play");
},
onPlayStopClicked: function() { onPlayStopClicked: function() {
//this.playButton.set_active(false); //this.playButton.set_active(false);
...@@ -247,23 +177,8 @@ const MainView = new Lang.Class({ ...@@ -247,23 +177,8 @@ const MainView = new Lang.Class({
onRecordStopClicked: function() { onRecordStopClicked: function() {
this._record.stopRecording(); this._record.stopRecording();
this.recordGrid.hide(); this.recordGrid.hide();
wave.resize(); recordPipeline = RecordPipelineStates.STOPPED;
}, recordButton.set_sensitive(true);
setProgressScaleSensitive: function() {
this.progressScale.sensitive = true;
},
setProgressScaleInsensitive: function() {
this.progressScale.sensitive = false;
},
onProgressScaleChangeValue: function() {
let seconds = Math.ceil(this.progressScale.get_value());
MainWindow.play.progressScaleValueChanged(seconds);
return true;
}, },
_formatTime: function(unformattedTime) { _formatTime: function(unformattedTime) {
...@@ -356,13 +271,15 @@ const MainView = new Lang.Class({ ...@@ -356,13 +271,15 @@ const MainView = new Lang.Class({
stopRecord.connect("clicked", Lang.bind(this, this.onRecordStopClicked)); stopRecord.connect("clicked", Lang.bind(this, this.onRecordStopClicked));
this.toolbarStart.pack_start(stopRecord, true, true, 0); this.toolbarStart.pack_start(stopRecord, true, true, 0);
this.recordGrid.attach(this.toolbarStart, 5, 1, 1, 2); this.recordGrid.attach(this.toolbarStart, 5, 1, 1, 2);
},
scrolledWinAdd: function() {
this._scrolledWin = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN, this._scrolledWin = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN,
margin_bottom: 3, margin_bottom: 3,
margin_top: 5, margin_top: 5,
hexpand: false, hexpand: false,
vexpand: false, vexpand: false,
width_request: 800, width_request: 900,
height_request: 400 }); height_request: 400 });
this._scrolledWin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this._scrolledWin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
this._scrolledWin.get_style_context().add_class('view'); this._scrolledWin.get_style_context().add_class('view');
...@@ -391,7 +308,7 @@ const MainView = new Lang.Class({ ...@@ -391,7 +308,7 @@ const MainView = new Lang.Class({
for (let i = this._startIdx; i <= this._endIdx; i++) { for (let i = this._startIdx; i <= this._endIdx; i++) {
this.rowGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, this.rowGrid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
height_request: 45, height_request: 45,
width_request: 400, width_request: 900,
name: i.toString() }); name: i.toString() });
this.rowGrid.set_orientation(Gtk.Orientation.HORIZONTAL); this.rowGrid.set_orientation(Gtk.Orientation.HORIZONTAL);
this.listBox.add(this.rowGrid); this.listBox.add(this.rowGrid);
...@@ -549,9 +466,23 @@ const MainView = new Lang.Class({ ...@@ -549,9 +466,23 @@ const MainView = new Lang.Class({
this.selectionRow = this._separator.get_parent(); this.selectionRow = this._separator.get_parent();
this.selectionRow.set_sensitive(false); this.selectionRow.set_sensitive(false);
this._separator.show(); this._separator.show();
list.monitorListview();
} }
}, },
listBoxRefresh: function() {
fileUtil = new FileUtil.FileUtil();
list.enumerateDirectory();
},
scrolledWinDelete: function() {
let w = this.rowGrid.get_allocated_width();
this._scrolledWin.destroy();
this.scrolledWinAdd();
log("destroy " + w);
},
rowGridCallback: function(selectedRow) { rowGridCallback: function(selectedRow) {
if (selectedRow) { if (selectedRow) {
...@@ -620,7 +551,6 @@ const MainView = new Lang.Class({ ...@@ -620,7 +551,6 @@ const MainView = new Lang.Class({
_onInfoButton: function(selected) { _onInfoButton: function(selected) {
this._selected = selected; this._selected = selected;
//let fileForInfo = this._getFileNameFromRow(this._selected);
let infoDialog = new Info.InfoDialog(selected); let infoDialog = new Info.InfoDialog(selected);
infoDialog.widget.connect('response', Lang.bind(this, infoDialog.widget.connect('response', Lang.bind(this,
...@@ -629,18 +559,10 @@ const MainView = new Lang.Class({ ...@@ -629,18 +559,10 @@ const MainView = new Lang.Class({
})); }));
}, },
setLabel: function(time, duration) { setLabel: function(time) {
this.time = time this.time = time
this.duration = duration;
this.playPipeState = play.getPipeStates(); this.playPipeState = play.getPipeStates();
/* if (this.playPipeState != PipelineStates.STOPPED) { //test this
if (this.playDurationLabel.label == "0:00" && duration != 0)
this.durationString = this._formatTime(duration);
} else {
this.durationString = this._formatTime(duration);
}*/
this.timeLabelString = this._formatTime(time); this.timeLabelString = this._formatTime(time);
if (this.setVisibleID == ActiveArea.RECORD) { if (this.setVisibleID == ActiveArea.RECORD) {
...@@ -648,13 +570,6 @@ const MainView = new Lang.Class({ ...@@ -648,13 +570,6 @@ const MainView = new Lang.Class({
this.recordTimeLabel.get_style_context().add_class('dim-label'); this.recordTimeLabel.get_style_context().add_class('dim-label');
} else if (this.setVisibleID == ActiveArea.PLAY) { } else if (this.setVisibleID == ActiveArea.PLAY) {
this.playTimeLabel.label = this.timeLabelString; this.playTimeLabel.label = this.timeLabelString;
if (this.playDurationLabel.label == "0:00" || this.playPipeState == PipelineStates.STOPPED) {
//this.playDurationLabel.label = this.durationString;
this.setProgressScaleSensitive();