[gnome-sound-recorder/issue_17: 6/6] Fix minor warnings and coding errors



commit 5e964f4e4e54a6106cb3c08103ed648312340bd7
Author: Meg Ford <megford gnome org>
Date:   Mon Feb 18 23:40:22 2019 -0600

    Fix minor warnings and coding errors

 src/listview.js   | 4 ++--
 src/mainWindow.js | 1 +
 src/record.js     | 3 +--
 src/waveform.js   | 7 +++----
 4 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/listview.js b/src/listview.js
index 28466c4..b601620 100644
--- a/src/listview.js
+++ b/src/listview.js
@@ -103,7 +103,7 @@ var Listview = class Listview {
                     files.forEach((file) => {
                         let returnedName = file.get_attribute_as_string("standard::display-name");
                         try {
-                            let returnedNumber = parseInt(returnedName.split(" ")[1]);
+                            let returnedNumber = parseInt(returnedName.split(" ").pop());
                             if (returnedNumber > trackNumber)
                                 trackNumber = returnedNumber;
 
@@ -348,4 +348,4 @@ var Listview = class Listview {
     getFilesInfoForList() {
         return allFilesInfo;
     }
-}
+}
\ No newline at end of file
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7c9fd7c..3f7272e 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -222,6 +222,7 @@ const MainView = GObject.registerClass(class MainView extends Gtk.Stack {
         this.recordGrid.hide();
         recordPipeline = RecordPipelineStates.STOPPED;
         recordButton.set_sensitive(true);
+
         if (this.listBox != null)
             this.listBox.set_selection_mode(Gtk.SelectionMode.SINGLE);
     }
diff --git a/src/record.js b/src/record.js
index ca3fbc2..274db7d 100644
--- a/src/record.js
+++ b/src/record.js
@@ -261,7 +261,7 @@ var Record = class Record {
                             if (this.baseTime == 0)
                                 this.baseTime = this.absoluteTime;
 
-                            this.runTime = this.absoluteTime- this.baseTime;
+                            this.runTime = this.absoluteTime - this.baseTime;
                             let approxTime = Math.round(this.runTime/_TENTH_SEC);
                             MainWindow.wave._drawEvent(approxTime, this.peak);
                             }
@@ -292,7 +292,6 @@ var Record = class Record {
     }
 
     _getChannels() {
-
         let channels = null;
         let channelsPref = Application.application.getChannelsPreferences();
 
diff --git a/src/waveform.js b/src/waveform.js
index 6813884..d0346cb 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -50,6 +50,7 @@ var WaveForm = class WaveForm {
         this._grid = grid;
 
         let placeHolder = -100;
+        this.recordTime = placeHolder;
         for (let i = 0; i < 40; i++)
             peaks.push(placeHolder);
         if (file) {
@@ -166,7 +167,7 @@ var WaveForm = class WaveForm {
             }
             start = Math.floor(this.playTime);
         } else {
-            if (this.recordTime >= 0) {
+            if (this.recordTime && this.recordTime >= 0) {
                 start = this.recordTime;
             }
         }
@@ -191,7 +192,7 @@ var WaveForm = class WaveForm {
             cr.setSourceRGBA(0.0, 185, 161, 255);
         }
 
-        for(i = start; i <= end; i++) {
+        for(i = start; i < end; i++) {
 
             // Keep moving until we get to a non-null array member
             if (peaks[i] < 0) {
@@ -236,11 +237,9 @@ var WaveForm = class WaveForm {
 
         } else {
             peaks.push(recPeaks);
-            lastTime = this.recordTime;
             this.recordTime = playTime;
 
             if (peaks.length < this.recordTime) {
-                log("error");
                 return true;
             }
             if (this.drawing)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]