Commit d7d4b41f authored by Meg Ford's avatar Meg Ford

fix merge conflict in mainWindow.js

parents f5b4bc27 14289609
......@@ -80,12 +80,13 @@ const OffsetController = new Lang.Class({
this._offset = 0;
this._itemCount = 0;
this._context = context;
CurrentEndIdx = _OFFSET_STEP;
},
// to be called to load more files into the listview
increaseOffset: function() {
this._offset += _OFFSET_STEP;
this.emit('offset-changed', this._offset);
//this.emit('offset-changed', this._offset);
},
// to be called when a recording is made/deleted
......@@ -97,12 +98,6 @@ const OffsetController = new Lang.Class({
this._offset = 0;
},
getItemCount: function() {
this._itemCount = MainWindow.list.getItemCount();
log("itemCount");
log(this._itemCount);
},
getRemainingFiles: function() {
return (this._itemCount - (this._offset + _OFFSET_STEP));
},
......@@ -115,14 +110,11 @@ const OffsetController = new Lang.Class({
return this._offset;
},
setEndIdx: function() {
getEndIdx: function() {
this.totItems = MainWindow.list.getItemCount();
log(this.totItems);
this.ensureCount = this._offset + _OFFSET_STEP - 1;
log(this.ensureCount);
this.getItemCount();
if (this.ensureCount < this.totItems) {
this.endIdx = this.ensureCount;
if (CurrentEndIdx < this.totItems) {
this.endIdx = CurrentEndIdx;
log(this.endIdx);
} else {
this.endIdx = this.totItems - 1;
......@@ -130,7 +122,12 @@ const OffsetController = new Lang.Class({
}
CurrentEndIdx = this.endIdx;
this.getcidx();
return CurrentEndIdx;
},
increaseEndIdxStep: function() {
CurrentEndIdx += _OFFSET_STEP;
},
getcidx: function() {
......
......@@ -169,22 +169,15 @@ const Listview = new Lang.Class({
},
getItemCount: function() {
log(allFilesInfo.length);
log(allFilesInfo.length + "item count");
return allFilesInfo.length;
},
_setDiscover: function() {
this._controller = MainWindow.offsetController;
this.totItems = this.getItemCount();
this.startIdx = this._controller.getOffset();
this.startIdx = 0;
log("this.startIdx" + this.startIdx);
this.ensureCount = this.startIdx + this._controller.getOffsetStep() - 1;
if (this.ensureCount < this.totItems)
this.endIdx = this.ensureCount;
else
this.endIdx = this.totItems - 1;
this.endIdx = this._controller.getEndIdx();
this.idx = this.startIdx;
this._runDiscover();
return false;
......@@ -220,7 +213,7 @@ const Listview = new Lang.Class({
let dateTimeTag = this.tagInfo.get_date_time('datetime')[1];
let title = this.tagInfo.get_string('title')[1];
let durationInfo = info.get_duration();
//log(durationInfo);
log(durationInfo + "duration from listview");
this.file.duration = durationInfo;
if (title != null) {
......@@ -258,7 +251,6 @@ const Listview = new Lang.Class({
} else {
this._discoverer.stop();
log("this.listType discovering" + listType);
MainWindow.offsetController.setEndIdx();
if (listType == ListType.NEW) {
MainWindow.view.listBoxAdd();
......@@ -275,23 +267,28 @@ const Listview = new Lang.Class({
setListTypeNew: function() {
listType = ListType.NEW;
},
},
setListTypeRefresh: function() {
listType = ListType.REFRESH;
},
_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();
}
stopVal = EnumeratorState.ACTIVE;
allFilesInfo.length = 0;
fileInfo.length = 0;
log(stopVal + "this._stopVal");
this.setListTypeRefresh();
log("this.listType" + listType);
log("this.currentlyEnumerating " + currentlyEnumerating);
if (currentlyEnumerating == CurrentlyEnumerating.FALSE) {
currentlyEnumerating = CurrentlyEnumerating.TRUE;
MainWindow.view.listBoxRefresh();
}
}
if (eventType == Gio.FileMonitorEvent.CREATED)
......@@ -348,11 +345,11 @@ const Listview = new Lang.Class({
return allFilesInfo;
},
getEndIdx: function() {
log(this.endIdx);
log("endidx");
/*getEndIdx: function() {
log(this.endIdx);
log("endidx");
return this.endIdx;
}
} */
});
......@@ -43,18 +43,21 @@ let fileUtil = null;
let grid = null;
let groupGrid;
let list = null;
let loadMoreButton = null;
let offsetController = null;
let path = null;
let play = null;
let previousSelRow = null;
let recordPipeline = null;
let recordButton = null;
let selectable = null;
let previousSelRow = null;
let setVisibleID = null;
let UpperBoundVal = 182;
let view = null;
let volumeValue = [];
let wave = null;
const ActiveArea = {
RECORD: 0,
PLAY: 1
......@@ -159,6 +162,7 @@ const MainView = new Lang.Class({
},
_addListviewPage: function(name) {
fileUtil = new FileUtil.FileUtil();
list = new Listview.Listview();
list.setListTypeNew();
list.enumerateDirectory();
......@@ -294,6 +298,20 @@ const MainView = new Lang.Class({
height_request: 400 });
this._scrolledWin.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
this._scrolledWin.get_style_context().add_class('view');
this.scrollbar = this._scrolledWin.get_vadjustment();
this.scrollbar.connect("value_changed", Lang.bind(this,
function() {
this.currentBound = this.scrollbar.get_value();
UpperBoundVal = this.scrollbar.upper - this.scrollbar.page_size;
if (UpperBoundVal == this.currentBound && loadMoreButton == null) {
this.addLoadMoreButton();
} else if (UpperBoundVal != this.currentBound && loadMoreButton) {
loadMoreButton.destroy();
loadMoreButton = null;
}
}));
this.groupGrid.add(this._scrolledWin);
this._scrolledWin.show();
......@@ -308,7 +326,7 @@ const MainView = new Lang.Class({
}));
this.listBox.show();
this._startIdx = offsetController.getOffset();
this._startIdx = 0;
log(this._startIdx);
log("start");
this._endIdx = offsetController.getcidx();
......@@ -354,7 +372,7 @@ const MainView = new Lang.Class({
let idx = parseInt(gridForName.name);
let file = this._files[idx];
this._playListButton._onPlayPauseToggled(row, file);
this._playListButton.onPlayPauseToggled(row, file);
}));
this._fileName = new Gtk.Label({ use_markup: true,
......@@ -384,6 +402,8 @@ const MainView = new Lang.Class({
margin_top: 5,
name: "PlayDurationLabel" });
this.fileDuration = this._formatTime(this._files[i].duration/Gst.SECOND);
log(this.fileDuration + "FILEDURATION");
log(this._files[i].duration);
this.playDurationLabel.label = this.fileDuration;
this._playLabelBox.pack_start(this.playDurationLabel, false, true, 0);
this.playDurationLabel.show();
......@@ -477,16 +497,32 @@ const MainView = new Lang.Class({
this.selectionRow = this._separator.get_parent();
this.selectionRow.set_sensitive(false);
this._separator.show();
list.monitorListview();
}
list.monitorListview();
},
addLoadMoreButton: function() {
loadMoreButton = new LoadMoreButton();
loadMoreButton.connect('clicked', Lang.bind(this, loadMoreButton.onLoadMore));
this.groupGrid.add(loadMoreButton);
loadMoreButton.show();
},
listBoxRefresh: function() {
previousSelRow = null;
this.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
fileUtil = new FileUtil.FileUtil();
list.enumerateDirectory();
//this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
//this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
},
listBoxLoadMore: function() {
loadMoreButton.destroy();
loeadMoreButton = null;
this.listBox.set_selection_mode(Gtk.SelectionMode.NONE);
offsetController.increaseEndIdxStep();
list.setListTypeRefresh();
list._setDiscover();
this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
},
scrolledWinDelete: function() {
......@@ -629,7 +665,7 @@ const PlayPauseButton = new Lang.Class({
//this.set_image(playImage);
},
_onPlayPauseToggled: function(listRow, selFile) {
onPlayPauseToggled: function(listRow, selFile) {
this.activeState = play.getPipeStates();
setVisibleID = ActiveArea.PLAY;
log(listRow);
......@@ -705,28 +741,24 @@ const EncoderComboBox = new Lang.Class({
const LoadMoreButton = new Lang.Class({
Name: 'LoadMoreButton',
Extends: Gtk.Button,
_init: function(playgr) {
_init: function() {
this.parent();
this._block = false;
this._controller = offsetController;
// Translators: "more" refers to recordings in this context
this._label = new Gtk.Label({ label: _("Load More"),
visible: true });
playgr.add(this._label);
let label = new Gtk.Label({ label: _("Load More"),
visible: true });
this.widget = new Gtk.Button();
this.widget.get_style_context().add_class('documents-load-more');
playgr.add(this.widget);
this.widget.connect('clicked', Lang.bind(this,
function() {
this._label.label = _("Loading…");
this._controller.increaseOffset();
list._setDiscover();
}));
this.label = _("Load More");
this.get_style_context().add_class('documents-load-more');
},
onLoadMore: function() {
//offsetController.increaseOffset();
UpperBoundVal += 182;
view.scrollbar.set_upper(UpperBoundVal);
view.listBoxLoadMore();
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment