]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Merge branch 'ui-improvements' of https://github.com/nathansamson/diveclog
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 4 Sep 2011 18:49:49 +0000 (11:49 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 4 Sep 2011 18:49:49 +0000 (11:49 -0700)
* 'ui-improvements' of https://github.com/nathansamson/diveclog:
  Split the dive list in columns. Columns are sortable now (name = date, depth, duration)
  Remove the redundant frames in the notebook. Closes #9
  Use a pane so the dive list can be made wider or smaller to the users wishes

dive.c
dive.h
save-xml.c

diff --git a/dive.c b/dive.c
index 8c81a3d516702bb9ecac67f2ee40fb82088d6e0a..757622fe7076cf10a43a70aa9b1ec6facd5fc816 100644 (file)
--- a/dive.c
+++ b/dive.c
@@ -34,9 +34,10 @@ struct dive *fixup_dive(struct dive *dive)
        int lasttime = 0;
        int start = -1, end = -1;
        int startpress = 0, endpress = 0;
-       int starttemp = 0, endtemp = 0;
        int maxdepth = 0, mintemp = 0;
        int lastdepth = 0;
+       int lasttemp = 0;
+       temperature_t *redundant_temp = NULL;
 
        for (i = 0; i < dive->samples; i++) {
                struct sample *sample = dive->sample + i;
@@ -60,9 +61,21 @@ struct dive *fixup_dive(struct dive *dive)
                                startpress = press;
                }
                if (temp) {
-                       endtemp = temp;
-                       if (!starttemp)
-                               starttemp = temp;
+                       /*
+                        * If we have consecutive identical
+                        * temperature readings, throw away
+                        * the redundant ones. We care about
+                        * the "edges" only.
+                        */
+                       if (lasttemp == temp) {
+                               if (redundant_temp)
+                                       redundant_temp->mkelvin = 0;
+                               redundant_temp = &sample->temperature;
+                       } else {
+                               redundant_temp = NULL;
+                               lasttemp = temp;
+                       }
+
                        if (!mintemp || temp < mintemp)
                                mintemp = temp;
                }
diff --git a/dive.h b/dive.h
index c6c545dcc11e133a748113f8529fce9a5128aeb6..2d03ee7cd7d0db4c364ed51a9a1fd1cee37e2c94 100644 (file)
--- a/dive.h
+++ b/dive.h
@@ -75,6 +75,7 @@ typedef struct {
 typedef struct {
        volume_t size;
        pressure_t workingpressure;
+       const char *description;        /* "LP85", "AL72", "AL80", "HP100+" or whatever */
 } cylinder_type_t;
 
 typedef struct {
index 5c05723b71e1ebf5df39a0c9f977d6d0f6ccb6e5..c33cbb0ddaae0def1daac898109efa5c595531f6 100644 (file)
@@ -127,7 +127,6 @@ static void save_cylinder_info(FILE *f, struct dive *dive)
        for (i = 0; i < MAX_CYLINDERS; i++) {
                cylinder_t *cylinder = dive->cylinder+i;
                int volume = cylinder->type.size.mliter;
-               int pressure = cylinder->type.workingpressure.mbar;
                int o2 = cylinder->gasmix.o2.permille;
                int he = cylinder->gasmix.he.permille;
 
@@ -140,11 +139,8 @@ static void save_cylinder_info(FILE *f, struct dive *dive)
                        if (he)
                                fprintf(f, " he='%u.%u%%'", FRACTION(he, 10));
                }
-               if (volume) {
+               if (volume)
                        fprintf(f, " size='%u.%03u l'", FRACTION(volume, 1000));
-                       if (pressure)
-                               fprintf(f, " workpressure='%u.%03u bar'", FRACTION(pressure, 1000));
-               }
                fprintf(f, " />\n");
        }
 }