Compare commits

..

1 Commits

Author SHA1 Message Date
Berthold Stoeger
520cc5311b tests: work on sorted dive lists
The dive list will be changed to an always-sorted list where one can
use binary search.

However, this makes some tests fail, because they only use parse_dive(),
which doesn't do any sorting.

To fix this future problem, sort the tables before performing the tests.
This provides a more realistic setup, as in the actual application,
the dive list will always be sorted on import.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-06-08 12:28:12 +02:00
34 changed files with 10886 additions and 10846 deletions

View File

@ -135,7 +135,7 @@ msgid ""
"mailto:subsurface@subsurface-divelog.org[our mailing list] and report bugs " "mailto:subsurface@subsurface-divelog.org[our mailing list] and report bugs "
"at https://github.com/Subsurface/subsurface/issues[our bugtracker]. " "at https://github.com/Subsurface/subsurface/issues[our bugtracker]. "
"For instructions on how to build the software and (if needed) its " "For instructions on how to build the software and (if needed) its "
"dependencies please consult the INSTALL.md file included with the source code." "dependencies please consult the INSTALL file included with the source code."
msgstr "" msgstr ""
#. type: Plain text #. type: Plain text

View File

@ -175,7 +175,7 @@ msgid ""
"an email to mailto:subsurface@subsurface-divelog.org[our mailing list] and " "an email to mailto:subsurface@subsurface-divelog.org[our mailing list] and "
"report bugs at https://github.com/Subsurface-divelog/subsurface/issues[our " "report bugs at https://github.com/Subsurface-divelog/subsurface/issues[our "
"bugtracker]. For instructions on how to build the software and (if needed) " "bugtracker]. For instructions on how to build the software and (if needed) "
"its dependencies please consult the INSTALL.md file included with the source " "its dependencies please consult the INSTALL file included with the source "
"code." "code."
msgstr "" msgstr ""
"Ce manuel explique comment utiliser le programme _Subsurface_. Pour " "Ce manuel explique comment utiliser le programme _Subsurface_. Pour "
@ -184,7 +184,7 @@ msgstr ""
"pouvez envoyer un e-mail sur mailto:subsurface@subsurface-divelog.org[notre " "pouvez envoyer un e-mail sur mailto:subsurface@subsurface-divelog.org[notre "
"liste de diffusion] et rapportez les bogues sur http://trac.hohndel." "liste de diffusion] et rapportez les bogues sur http://trac.hohndel."
"org[notre bugtracker]. Pour des instructions de compilation du logiciel et " "org[notre bugtracker]. Pour des instructions de compilation du logiciel et "
"(si besoin) de ses dépendances, merci de consulter le fichier INSTALL.md inclus " "(si besoin) de ses dépendances, merci de consulter le fichier INSTALL inclus "
"dans les sources logicielles." "dans les sources logicielles."
#. type: Plain text #. type: Plain text

View File

@ -460,7 +460,7 @@ the software, consult the <em>Downloads</em> page on the
Please discuss issues with this program by sending an email to Please discuss issues with this program by sending an email to
<a href="mailto:subsurface@subsurface-divelog.org">our mailing list</a> and report bugs at <a href="mailto:subsurface@subsurface-divelog.org">our mailing list</a> and report bugs at
<a href="https://github.com/Subsurface/subsurface/issues">our bugtracker</a>. For instructions on how to build the <a href="https://github.com/Subsurface/subsurface/issues">our bugtracker</a>. For instructions on how to build the
software and (if needed) its dependencies please consult the INSTALL.md file software and (if needed) its dependencies please consult the INSTALL file
included with the source code.</p></div> included with the source code.</p></div>
<div class="paragraph"><p><strong>Audience</strong>: Recreational Scuba Divers, Free Divers, Tec Divers, Professional <div class="paragraph"><p><strong>Audience</strong>: Recreational Scuba Divers, Free Divers, Tec Divers, Professional
Divers</p></div> Divers</p></div>

View File

@ -34,7 +34,7 @@ https://subsurface-divelog.org/[_Subsurface_ web site].
Please discuss issues with this program by sending an email to Please discuss issues with this program by sending an email to
mailto:subsurface@subsurface-divelog.org[our mailing list] and report bugs at mailto:subsurface@subsurface-divelog.org[our mailing list] and report bugs at
https://github.com/Subsurface/subsurface/issues[our bugtracker]. For instructions on how to build the https://github.com/Subsurface/subsurface/issues[our bugtracker]. For instructions on how to build the
software and (if needed) its dependencies please consult the INSTALL.md file software and (if needed) its dependencies please consult the INSTALL file
included with the source code. included with the source code.
*Audience*: Recreational Scuba Divers, Free Divers, Tec Divers, Professional *Audience*: Recreational Scuba Divers, Free Divers, Tec Divers, Professional

View File

@ -517,7 +517,7 @@ web</a>. Por favor, comenta los problemas que tengas con este programa enviando
mail a <a href="mailto:subsurface@subsurface-divelog.org">nuestra lista de correo</a> e informa de mail a <a href="mailto:subsurface@subsurface-divelog.org">nuestra lista de correo</a> e informa de
fallos en <a href="https://github.com/Subsurface/subsurface/issues">nuestro bugtracker</a>. fallos en <a href="https://github.com/Subsurface/subsurface/issues">nuestro bugtracker</a>.
Para instrucciones acerca de como compilar el software y (en caso necesario) Para instrucciones acerca de como compilar el software y (en caso necesario)
sus dependencias, por favor, consulta el archivo INSTALL.md incluido con el código sus dependencias, por favor, consulta el archivo INSTALL incluido con el código
fuente.</p></div> fuente.</p></div>
<div class="paragraph"><p><strong>Audiencia</strong>: Buceadores recreativos, Buceadores en apnea, Buceadores técnicos, <div class="paragraph"><p><strong>Audiencia</strong>: Buceadores recreativos, Buceadores en apnea, Buceadores técnicos,
Buceadores profesionales.</p></div> Buceadores profesionales.</p></div>

View File

@ -61,7 +61,7 @@ web]. Por favor, comenta los problemas que tengas con este programa enviando un
mail a mailto:subsurface@subsurface-divelog.org[nuestra lista de correo] e informa de mail a mailto:subsurface@subsurface-divelog.org[nuestra lista de correo] e informa de
fallos en https://github.com/Subsurface/subsurface/issues[nuestro bugtracker]. fallos en https://github.com/Subsurface/subsurface/issues[nuestro bugtracker].
Para instrucciones acerca de como compilar el software y (en caso necesario) Para instrucciones acerca de como compilar el software y (en caso necesario)
sus dependencias, por favor, consulta el archivo INSTALL.md incluido con el código sus dependencias, por favor, consulta el archivo INSTALL incluido con el código
fuente. fuente.
*Audiencia*: Buceadores recreativos, Buceadores en apnea, Buceadores técnicos, *Audiencia*: Buceadores recreativos, Buceadores en apnea, Buceadores técnicos,

View File

@ -526,7 +526,7 @@ problème, vous pouvez envoyer un e-mail sur
<a href="mailto:subsurface@subsurface-divelog.org">notre liste de diffusion</a> et <a href="mailto:subsurface@subsurface-divelog.org">notre liste de diffusion</a> et
rapportez les bogues sur <a href="http://trac.hohndel.org">notre bugtracker</a>. Pour rapportez les bogues sur <a href="http://trac.hohndel.org">notre bugtracker</a>. Pour
des instructions de compilation du logiciel et (si besoin) de ses des instructions de compilation du logiciel et (si besoin) de ses
dépendances, merci de consulter le fichier INSTALL.md inclus dans les sources dépendances, merci de consulter le fichier INSTALL inclus dans les sources
logicielles.</p></div> logicielles.</p></div>
<div class="paragraph"><p><strong>Public</strong> : Plongeurs loisirs, apnéistes, plongeurs Tek et plongeurs <div class="paragraph"><p><strong>Public</strong> : Plongeurs loisirs, apnéistes, plongeurs Tek et plongeurs
professionnels</p></div> professionnels</p></div>

View File

@ -61,7 +61,7 @@ problème, vous pouvez envoyer un e-mail sur
mailto:subsurface@subsurface-divelog.org[notre liste de diffusion] et mailto:subsurface@subsurface-divelog.org[notre liste de diffusion] et
rapportez les bogues sur http://trac.hohndel.org[notre bugtracker]. Pour rapportez les bogues sur http://trac.hohndel.org[notre bugtracker]. Pour
des instructions de compilation du logiciel et (si besoin) de ses des instructions de compilation du logiciel et (si besoin) de ses
dépendances, merci de consulter le fichier INSTALL.md inclus dans les sources dépendances, merci de consulter le fichier INSTALL inclus dans les sources
logicielles. logicielles.
*Public* : Plongeurs loisirs, apnéistes, plongeurs Tek et plongeurs *Public* : Plongeurs loisirs, apnéistes, plongeurs Tek et plongeurs

View File

@ -516,7 +516,7 @@ het programma kunnen bij de ontwikkelaars gemeld worden via email op
<a href="mailto:subsurface@subsurface-divelog.org">onze mailinglijst</a>. Fouten kunnen <a href="mailto:subsurface@subsurface-divelog.org">onze mailinglijst</a>. Fouten kunnen
ook gemeld worden op <a href="https://github.com/Subsurface/subsurface/issues">onze bugtracker</a>. ook gemeld worden op <a href="https://github.com/Subsurface/subsurface/issues">onze bugtracker</a>.
Instructies hoe <em>Subsurface</em> zelf te compileren vanuit de broncode staan ook op Instructies hoe <em>Subsurface</em> zelf te compileren vanuit de broncode staan ook op
onze website en in het INSTALL.md bestand in de broncode.</p></div> onze website en in het INSTALL bestand in de broncode.</p></div>
<div class="paragraph"><p><strong>Doelgroep</strong>: Recreatieve duikers, Tec duikers, Apneu duikers, <div class="paragraph"><p><strong>Doelgroep</strong>: Recreatieve duikers, Tec duikers, Apneu duikers,
Professionele duikers.</p></div> Professionele duikers.</p></div>
<div id="toc"> <div id="toc">

View File

@ -59,7 +59,7 @@ het programma kunnen bij de ontwikkelaars gemeld worden via email op
mailto:subsurface@subsurface-divelog.org[onze mailinglijst]. Fouten kunnen mailto:subsurface@subsurface-divelog.org[onze mailinglijst]. Fouten kunnen
ook gemeld worden op https://github.com/Subsurface/subsurface/issues[onze bugtracker]. ook gemeld worden op https://github.com/Subsurface/subsurface/issues[onze bugtracker].
Instructies hoe _Subsurface_ zelf te compileren vanuit de broncode staan ook op Instructies hoe _Subsurface_ zelf te compileren vanuit de broncode staan ook op
onze website en in het INSTALL.md bestand in de broncode. onze website en in het INSTALL bestand in de broncode.
*Doelgroep*: Recreatieve duikers, Tec duikers, Apneu duikers, *Doelgroep*: Recreatieve duikers, Tec duikers, Apneu duikers,
Professionele duikers. Professionele duikers.

View File

@ -21,9 +21,16 @@ Report bugs and issues at https://github.com/Subsurface/subsurface/issues
License: GPLv2 License: GPLv2
We are releasing 'nightly' builds of Subsurface that are built from the latest version of the code. Versions of this build for Windows, macOS, Android (requiring sideloading), and a Linux AppImage can be downloaded from the [Latest Dev Release](https://www.subsurface-divelog.org/latest-release/) page on [our website](https://www.subsurface-divelog.org/). Alternatively, they can be downloaded [directly from GitHub](https://github.com/subsurface/nightly-builds/releases). Additionally, those same versions are We frequently make new test versions of Subsurface available at
http://subsurface-divelog.org/downloads/test/ and there you can always get
the latest builds for Mac, Windows, Linux AppImage and Android (with some
caveats about installability). Additionally, those same versions are
posted to the Subsurface-daily repos on Ubuntu Launchpad, Fedora COPR, and posted to the Subsurface-daily repos on Ubuntu Launchpad, Fedora COPR, and
OpenSUSE OBS, and released to [Snapcraft](https://snapcraft.io/subsurface) into the 'edge' channel of subsurface. OpenSUSE OBS.
These tend to contain the latest bug fixes and features, but also
occasionally the latest bugs and issues. Please understand when using them
that these are primarily intended for testing.
You can get the sources to the latest development version from the git You can get the sources to the latest development version from the git
repository: repository:
@ -35,11 +42,17 @@ git clone https://github.com/Subsurface/subsurface.git
You can also fork the repository and browse the sources at the same site, You can also fork the repository and browse the sources at the same site,
simply using https://github.com/Subsurface/subsurface simply using https://github.com/Subsurface/subsurface
Additionally, artifacts for Windows, macOS, Android, Linux AppImage, and iOS (simulator build) are generated for all open pull requests and linked in pull request comments. Use these if you want to test the changes in a specific pull request and provide feedback before it has been merged. If you want the latest release (instead of the bleeding edge
development version) you can either get this via git or the release tar
ball. After cloning run the following command:
If you want a more stable version that is a little bit more tested you can get this from the [Curent Release](https://www.subsurface-divelog.org/current-release/) page on [our website](https://www.subsurface-divelog.org/). ```
git checkout v5.0.10 (or whatever the last release is)
```
Detailed build instructions can be found in the [INSTALL.md](/INSTALL.md) file. or download a tarball from http://subsurface-divelog.org/downloads/Subsurface-5.0.10.tgz
Detailed build instructions can be found in the INSTALL file.
## System Requirements ## System Requirements

View File

@ -1319,7 +1319,8 @@ EditCylinder::EditCylinder(int index, cylinder_t cylIn, EditCylinderType typeIn,
void EditCylinder::redo() void EditCylinder::redo()
{ {
for (size_t i = 0; i < dives.size(); ++i) { for (size_t i = 0; i < dives.size(); ++i) {
set_tank_info_data(&tank_info_table, cyl[i].type.description, cyl[i].type.size, cyl[i].type.workingpressure); set_tank_info_size(&tank_info_table, cyl[i].type.description, cyl[i].type.size);
set_tank_info_workingpressure(&tank_info_table, cyl[i].type.description, cyl[i].type.workingpressure);
std::swap(*get_cylinder(dives[i], indexes[i]), cyl[i]); std::swap(*get_cylinder(dives[i], indexes[i]), cyl[i]);
update_cylinder_related_info(dives[i]); update_cylinder_related_info(dives[i]);
emit diveListNotifier.cylinderEdited(dives[i], indexes[i]); emit diveListNotifier.cylinderEdited(dives[i], indexes[i]);

View File

@ -109,7 +109,7 @@ void add_tank_info_imperial(struct tank_info_table *table, const char *name, int
add_to_tank_info_table(table, table->nr, info); add_to_tank_info_table(table, table->nr, info);
} }
static struct tank_info *get_tank_info(struct tank_info_table *table, const char *name) extern struct tank_info *get_tank_info(struct tank_info_table *table, const char *name)
{ {
for (int i = 0; i < table->nr; ++i) { for (int i = 0; i < table->nr; ++i) {
if (same_string(table->infos[i].name, name)) if (same_string(table->infos[i].name, name))
@ -118,41 +118,34 @@ static struct tank_info *get_tank_info(struct tank_info_table *table, const char
return NULL; return NULL;
} }
extern void set_tank_info_data(struct tank_info_table *table, const char *name, volume_t size, pressure_t working_pressure) extern void set_tank_info_size(struct tank_info_table *table, const char *name, volume_t size)
{ {
struct tank_info *info = get_tank_info(table, name); struct tank_info *info = get_tank_info(table, name);
if (info) { if (info) {
if (info->ml != 0 || info->bar != 0) { // Try to be smart about metric vs. imperial
info->bar = working_pressure.mbar / 1000; if (info->cuft == 0 && info->psi == 0)
info->ml = size.mliter; info->ml = size.mliter;
} else { else
info->psi = lrint(to_PSI(working_pressure)); info->cuft = lrint(ml_to_cuft(size.mliter));
info->cuft = lrint(ml_to_cuft(size.mliter) * mbar_to_atm(working_pressure.mbar));
}
} else { } else {
// Metric is a better choice as the volume is independent of the working pressure // By default add metric...?
add_tank_info_metric(table, name, size.mliter, working_pressure.mbar / 1000); add_tank_info_metric(table, name, size.mliter, 0);
} }
} }
extern void extract_tank_info(const struct tank_info *info, volume_t *size, pressure_t *working_pressure) extern void set_tank_info_workingpressure(struct tank_info_table *table, const char *name, pressure_t working_pressure)
{
working_pressure->mbar = info->bar != 0 ? info->bar * 1000 : psi_to_mbar(info->psi);
if (info->ml != 0)
size->mliter = info->ml;
else if (working_pressure->mbar != 0)
size->mliter = lrint(cuft_to_l(info->cuft) * 1000 / mbar_to_atm(working_pressure->mbar));
}
extern bool get_tank_info_data(struct tank_info_table *table, const char *name, volume_t *size, pressure_t *working_pressure)
{ {
struct tank_info *info = get_tank_info(table, name); struct tank_info *info = get_tank_info(table, name);
if (info) { if (info) {
extract_tank_info(info, size, working_pressure); // Try to be smart about metric vs. imperial
if (info->cuft == 0 && info->psi == 0)
return true; info->bar = working_pressure.mbar / 1000;
else
info->psi = lrint(mbar_to_PSI(working_pressure.mbar));
} else {
// By default add metric...?
add_tank_info_metric(table, name, 0, working_pressure.mbar / 1000);
} }
return false;
} }
/* placeholders for a few functions that we need to redesign for the Qt UI */ /* placeholders for a few functions that we need to redesign for the Qt UI */

View File

@ -126,9 +126,9 @@ extern void reset_tank_info_table(struct tank_info_table *table);
extern void clear_tank_info_table(struct tank_info_table *table); extern void clear_tank_info_table(struct tank_info_table *table);
extern void add_tank_info_metric(struct tank_info_table *table, const char *name, int ml, int bar); extern void add_tank_info_metric(struct tank_info_table *table, const char *name, int ml, int bar);
extern void add_tank_info_imperial(struct tank_info_table *table, const char *name, int cuft, int psi); extern void add_tank_info_imperial(struct tank_info_table *table, const char *name, int cuft, int psi);
extern void extract_tank_info(const struct tank_info *info, volume_t *size, pressure_t *working_pressure); extern void set_tank_info_size(struct tank_info_table *table, const char *name, volume_t size);
extern bool get_tank_info_data(struct tank_info_table *table, const char *name, volume_t *size, pressure_t *pressure); extern void set_tank_info_workingpressure(struct tank_info_table *table, const char *name, pressure_t working_pressure);
extern void set_tank_info_data(struct tank_info_table *table, const char *name, volume_t size, pressure_t working_pressure); extern struct tank_info *get_tank_info(struct tank_info_table *table, const char *name);
struct ws_info_t { struct ws_info_t {
const char *name; const char *name;

View File

@ -153,6 +153,17 @@ dive_trip_t *create_trip_from_dive(struct dive *dive)
return trip; return trip;
} }
dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive, struct trip_table *trip_table_arg)
{
dive_trip_t *dive_trip;
dive_trip = create_trip_from_dive(dive);
add_dive_to_trip(dive, dive_trip);
insert_trip(dive_trip, trip_table_arg);
return dive_trip;
}
/* random threshold: three days without diving -> new trip /* random threshold: three days without diving -> new trip
* this works very well for people who usually dive as part of a trip and don't * this works very well for people who usually dive as part of a trip and don't
* regularly dive at a local facility; this is why trips are an optional feature */ * regularly dive at a local facility; this is why trips are an optional feature */

View File

@ -43,6 +43,7 @@ extern void sort_trip_table(struct trip_table *table);
extern dive_trip_t *alloc_trip(void); extern dive_trip_t *alloc_trip(void);
extern dive_trip_t *create_trip_from_dive(struct dive *dive); extern dive_trip_t *create_trip_from_dive(struct dive *dive);
extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive, struct trip_table *trip_table_arg);
extern dive_trip_t *get_dives_to_autogroup(struct dive_table *table, int start, int *from, int *to, bool *allocated); extern dive_trip_t *get_dives_to_autogroup(struct dive_table *table, int start, int *from, int *to, bool *allocated);
extern dive_trip_t *get_trip_for_new_dive(struct dive *new_dive, bool *allocated); extern dive_trip_t *get_trip_for_new_dive(struct dive *new_dive, bool *allocated);
extern dive_trip_t *get_trip_by_uniq_id(int tripId); extern dive_trip_t *get_trip_by_uniq_id(int tripId);

View File

@ -185,12 +185,13 @@ void DivePlannerWidget::heightChanged(const int height)
void DivePlannerWidget::waterTypeUpdateTexts() void DivePlannerWidget::waterTypeUpdateTexts()
{ {
double density;
/* Do not set text in last/custom element */ /* Do not set text in last/custom element */
for (int i = 0; i < ui.waterType->count()-1; i++) { for (int i = 0; i < ui.waterType->count()-1; i++) {
if (ui.waterType->itemData(i) != QVariant::Invalid) { if (ui.waterType->itemData(i) != QVariant::Invalid) {
QString densityText = ui.waterType->itemText(i).split("(")[0].trimmed(); QString densityText = ui.waterType->itemText(i).split("(")[0].trimmed();
double density = ui.waterType->itemData(i).toInt() / 10000.0; density = ui.waterType->itemData(i).toInt() / 10000.0;
densityText.append(QStringLiteral(" (%L1%2)").arg(density, 0, 'f', 3).arg(tr("kg/"))); densityText.append(QString(" (%L1%2)").arg(density, 0, 'f', 2).arg(tr("kg/")));
ui.waterType->setItemText(i, densityText); ui.waterType->setItemText(i, densityText);
} }
} }

View File

@ -210,7 +210,7 @@
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>100</width> <width>90</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -232,9 +232,6 @@
<property name="value"> <property name="value">
<double>1.000000000000000</double> <double>1.000000000000000</double>
</property> </property>
<property name="decimals">
<double>3</double>
</property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="4"> <item row="4" column="0" colspan="4">

View File

@ -218,13 +218,18 @@ void TankInfoDelegate::setModelData(QWidget *, QAbstractItemModel *model, const
mymodel->setData(IDX(CylindersModel::TYPE), cylinderName, CylindersModel::TEMP_ROLE); mymodel->setData(IDX(CylindersModel::TYPE), cylinderName, CylindersModel::TEMP_ROLE);
return; return;
} }
int tankSize = 0;
int tankPressure = 0;
tank_info *info = get_tank_info(&tank_info_table, qPrintable(cylinderName));
if (info) {
// OMG, the units here are a mess.
tankSize = info->ml != 0 ? info->ml : lrint(cuft_to_l(info->cuft) * 1000.0);
tankPressure = info->bar != 0 ? info->bar * 1000 : psi_to_mbar(info->psi);
}
volume_t tankSize = {0};
pressure_t tankPressure = {0};
get_tank_info_data(&tank_info_table, qPrintable(cylinderName), &tankSize, &tankPressure);
mymodel->setData(IDX(CylindersModel::TYPE), cylinderName, CylindersModel::TEMP_ROLE); mymodel->setData(IDX(CylindersModel::TYPE), cylinderName, CylindersModel::TEMP_ROLE);
mymodel->setData(IDX(CylindersModel::WORKINGPRESS), tankPressure.mbar, CylindersModel::TEMP_ROLE); mymodel->setData(IDX(CylindersModel::WORKINGPRESS), tankPressure, CylindersModel::TEMP_ROLE);
mymodel->setData(IDX(CylindersModel::SIZE), tankSize.mliter, CylindersModel::TEMP_ROLE); mymodel->setData(IDX(CylindersModel::SIZE), tankSize, CylindersModel::TEMP_ROLE);
} }
static QAbstractItemModel *createTankInfoModel(QWidget *parent) static QAbstractItemModel *createTankInfoModel(QWidget *parent)

View File

@ -224,8 +224,11 @@ void TabDiveInformation::updateData(const std::vector<dive *> &, dive *currentDi
setIndexNoSignal(ui->atmPressType, 0); // Set the atmospheric pressure combo box to mbar setIndexNoSignal(ui->atmPressType, 0); // Set the atmospheric pressure combo box to mbar
salinity_value = get_dive_salinity(currentDive); salinity_value = get_dive_salinity(currentDive);
if (salinity_value) { // Set water type indicator (EN13319 = 1.020 g/l) if (salinity_value) { // Set water type indicator (EN13319 = 1.020 g/l)
setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value)); if (ui->waterTypeCombo->isVisible()) { // If water salinity is editable then set correct water type in combobox:
ui->waterTypeText->setText(get_water_type_string(salinity_value)); setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value));
} else { // If water salinity is not editable: show water type as a text label
ui->waterTypeText->setText(get_water_type_string(salinity_value));
}
ui->salinityText->setText(get_salinity_string(salinity_value)); ui->salinityText->setText(get_salinity_string(salinity_value));
} else { } else {
setIndexNoSignal(ui->waterTypeCombo, -1); setIndexNoSignal(ui->waterTypeCombo, -1);
@ -346,7 +349,6 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi
else else
salinity_value = currentDive->salinity; salinity_value = currentDive->salinity;
setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value)); setIndexNoSignal(ui->waterTypeCombo, updateSalinityComboIndex(salinity_value));
ui->waterTypeText->setText(get_water_type_string(salinity_value));
ui->salinityText->setText(QString("%L1g/").arg(salinity_value / 10.0)); ui->salinityText->setText(QString("%L1g/").arg(salinity_value / 10.0));
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -101,97 +101,6 @@
<sample time='76:56 min' depth='0.01 m' ndl='0:00 min' cns='0%' /> <sample time='76:56 min' depth='0.01 m' ndl='0:00 min' cns='0%' />
</divecomputer> </divecomputer>
</dive> </dive>
<dive number='2' otu='40' cns='22%' date='2017-02-03' time='10:24:00' duration='66:00 min'>
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='31.0%' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<divecomputer model='Heinrichs Weikamp OSTC Sport' deviceid='8e8f3f68' diveid='7ab00781'>
<depth max='27.44 m' mean='14.427 m' />
<temperature water='26.2 C' />
<surface pressure='1.009 bar' />
<extradata key='Battery at end' value='1.50' />
<extradata key='Desat time' value='38:03' />
<extradata key='FW Version' value='10.31' />
<extradata key='Serial' value='10321' />
<extradata key='Deco model' value='ZH-L16-GF' />
<extradata key='Deco model info' value='GF 30/80' />
<event time='0:02 min' type='25' flags='2' name='gaschange' cylinder='1' o2='32.0%' />
<sample time='0:02 min' depth='2.505 m' cns='17%' />
<sample time='1:00 min' depth='5.831 m' temp='27.3 C' />
<sample time='2:00 min' depth='7.663 m' />
<sample time='3:00 min' depth='8.059 m' />
<sample time='4:00 min' depth='8.306 m' />
<sample time='5:00 min' depth='8.801 m' temp='27.4 C' />
<sample time='6:00 min' depth='8.772 m' />
<sample time='7:00 min' depth='8.989 m' />
<sample time='8:00 min' depth='9.366 m' />
<sample time='9:00 min' depth='9.504 m' />
<sample time='10:00 min' depth='9.88 m' />
<sample time='11:00 min' depth='9.969 m' />
<sample time='12:00 min' depth='13.464 m' ndl='124:00 min' />
<sample time='13:00 min' depth='16.365 m' temp='26.8 C' ndl='68:00 min' />
<sample time='14:00 min' depth='17.315 m' temp='26.5 C' ndl='59:00 min' />
<sample time='15:00 min' depth='17.81 m' />
<sample time='16:00 min' depth='18.543 m' ndl='48:00 min' />
<sample time='17:00 min' depth='23.265 m' ndl='24:00 min' />
<sample time='18:00 min' depth='26.928 m' temp='26.2 C' ndl='14:00 min' cns='11%' />
<sample time='19:00 min' depth='26.998 m' ndl='13:00 min' />
<sample time='20:00 min' depth='26.909 m' />
<sample time='21:00 min' depth='26.493 m' />
<sample time='22:00 min' depth='24.117 m' />
<sample time='23:00 min' depth='23.176 m' ndl='17:00 min' />
<sample time='24:00 min' depth='21.671 m' ndl='21:00 min' />
<sample time='25:00 min' depth='20.82 m' ndl='23:00 min' />
<sample time='26:00 min' depth='24.414 m' />
<sample time='27:00 min' depth='23.711 m' ndl='13:00 min' />
<sample time='28:00 min' depth='24.513 m' ndl='10:00 min' cns='15%' />
<sample time='29:00 min' depth='24.948 m' />
<sample time='30:00 min' depth='24.315 m' ndl='9:00 min' />
<sample time='31:00 min' depth='21.305 m' />
<sample time='32:00 min' depth='21.582 m' ndl='13:00 min' />
<sample time='33:00 min' depth='20.672 m' />
<sample time='34:00 min' depth='20.483 m' />
<sample time='35:00 min' depth='18.682 m' ndl='21:00 min' />
<sample time='36:00 min' depth='18.79 m' />
<sample time='37:00 min' depth='18.781 m' ndl='19:00 min' />
<sample time='38:00 min' depth='16.563 m' ndl='30:00 min' />
<sample time='39:00 min' depth='15.573 m' ndl='35:00 min' />
<sample time='40:00 min' depth='15.276 m' ndl='38:00 min' />
<sample time='41:00 min' depth='15.078 m' temp='26.4 C' />
<sample time='42:00 min' depth='14.316 m' ndl='47:00 min' />
<sample time='43:00 min' depth='14.217 m' ndl='49:00 min' />
<sample time='44:00 min' depth='14.425 m' ndl='44:00 min' />
<sample time='45:00 min' depth='12.266 m' ndl='104:00 min' />
<sample time='46:00 min' depth='10.831 m' ndl='233:00 min' />
<sample time='47:00 min' depth='11.316 m' ndl='172:00 min' />
<sample time='48:00 min' depth='10.217 m' temp='26.6 C' ndl='240:00 min' />
<sample time='49:00 min' depth='9.771 m' />
<sample time='50:00 min' depth='9.504 m' />
<sample time='51:00 min' depth='9.781 m' />
<sample time='52:00 min' depth='9.979 m' temp='27.0 C' />
<sample time='53:00 min' depth='9.771 m' />
<sample time='54:00 min' depth='9.712 m' />
<sample time='55:00 min' depth='9.435 m' />
<sample time='56:00 min' depth='9.633 m' />
<sample time='57:00 min' depth='9.177 m' />
<sample time='58:00 min' depth='8.682 m' />
<sample time='59:00 min' depth='8.653 m' />
<sample time='60:00 min' depth='8.752 m' cns='22%' />
<sample time='61:00 min' depth='6.188 m' />
<sample time='62:00 min' depth='5.495 m' />
<sample time='63:00 min' depth='5.425 m' />
<sample time='64:00 min' depth='5.326 m' />
<sample time='65:00 min' depth='4.356 m' />
<sample time='66:00 min' depth='0.178 m' />
<sample time='67:00 min' depth='0.238 m' />
<sample time='68:00 min' depth='0.0 m' />
<sample time='69:00 min' depth='0.0 m' />
<sample time='70:00 min' depth='0.0 m' temp='27.3 C' />
<sample time='70:46 min' depth='0.0 m' ndl='0:00 min' cns='0%' />
</divecomputer>
</dive>
<dive number='1' sac='9.026 l/min' otu='54' cns='17%' date='2017-02-03' time='06:59:41' duration='71:40 min'> <dive number='1' sac='9.026 l/min' otu='54' cns='17%' date='2017-02-03' time='06:59:41' duration='71:40 min'>
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' /> <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' />
<divecomputer model='Suunto Vyper Air' deviceid='f95a40f1' diveid='c51cb31b'> <divecomputer model='Suunto Vyper Air' deviceid='f95a40f1' diveid='c51cb31b'>
@ -418,6 +327,97 @@
<sample time='71:40 min' depth='1.5 m' pressure='53.05 bar' cns='0%' /> <sample time='71:40 min' depth='1.5 m' pressure='53.05 bar' cns='0%' />
</divecomputer> </divecomputer>
</dive> </dive>
<dive number='2' otu='40' cns='22%' date='2017-02-03' time='10:24:00' duration='66:00 min'>
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='31.0%' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
<divecomputer model='Heinrichs Weikamp OSTC Sport' deviceid='8e8f3f68' diveid='7ab00781'>
<depth max='27.44 m' mean='14.427 m' />
<temperature water='26.2 C' />
<surface pressure='1.009 bar' />
<extradata key='Battery at end' value='1.50' />
<extradata key='Desat time' value='38:03' />
<extradata key='FW Version' value='10.31' />
<extradata key='Serial' value='10321' />
<extradata key='Deco model' value='ZH-L16-GF' />
<extradata key='Deco model info' value='GF 30/80' />
<event time='0:02 min' type='25' flags='2' name='gaschange' cylinder='1' o2='32.0%' />
<sample time='0:02 min' depth='2.505 m' cns='17%' />
<sample time='1:00 min' depth='5.831 m' temp='27.3 C' />
<sample time='2:00 min' depth='7.663 m' />
<sample time='3:00 min' depth='8.059 m' />
<sample time='4:00 min' depth='8.306 m' />
<sample time='5:00 min' depth='8.801 m' temp='27.4 C' />
<sample time='6:00 min' depth='8.772 m' />
<sample time='7:00 min' depth='8.989 m' />
<sample time='8:00 min' depth='9.366 m' />
<sample time='9:00 min' depth='9.504 m' />
<sample time='10:00 min' depth='9.88 m' />
<sample time='11:00 min' depth='9.969 m' />
<sample time='12:00 min' depth='13.464 m' ndl='124:00 min' />
<sample time='13:00 min' depth='16.365 m' temp='26.8 C' ndl='68:00 min' />
<sample time='14:00 min' depth='17.315 m' temp='26.5 C' ndl='59:00 min' />
<sample time='15:00 min' depth='17.81 m' />
<sample time='16:00 min' depth='18.543 m' ndl='48:00 min' />
<sample time='17:00 min' depth='23.265 m' ndl='24:00 min' />
<sample time='18:00 min' depth='26.928 m' temp='26.2 C' ndl='14:00 min' cns='11%' />
<sample time='19:00 min' depth='26.998 m' ndl='13:00 min' />
<sample time='20:00 min' depth='26.909 m' />
<sample time='21:00 min' depth='26.493 m' />
<sample time='22:00 min' depth='24.117 m' />
<sample time='23:00 min' depth='23.176 m' ndl='17:00 min' />
<sample time='24:00 min' depth='21.671 m' ndl='21:00 min' />
<sample time='25:00 min' depth='20.82 m' ndl='23:00 min' />
<sample time='26:00 min' depth='24.414 m' />
<sample time='27:00 min' depth='23.711 m' ndl='13:00 min' />
<sample time='28:00 min' depth='24.513 m' ndl='10:00 min' cns='15%' />
<sample time='29:00 min' depth='24.948 m' />
<sample time='30:00 min' depth='24.315 m' ndl='9:00 min' />
<sample time='31:00 min' depth='21.305 m' />
<sample time='32:00 min' depth='21.582 m' ndl='13:00 min' />
<sample time='33:00 min' depth='20.672 m' />
<sample time='34:00 min' depth='20.483 m' />
<sample time='35:00 min' depth='18.682 m' ndl='21:00 min' />
<sample time='36:00 min' depth='18.79 m' />
<sample time='37:00 min' depth='18.781 m' ndl='19:00 min' />
<sample time='38:00 min' depth='16.563 m' ndl='30:00 min' />
<sample time='39:00 min' depth='15.573 m' ndl='35:00 min' />
<sample time='40:00 min' depth='15.276 m' ndl='38:00 min' />
<sample time='41:00 min' depth='15.078 m' temp='26.4 C' />
<sample time='42:00 min' depth='14.316 m' ndl='47:00 min' />
<sample time='43:00 min' depth='14.217 m' ndl='49:00 min' />
<sample time='44:00 min' depth='14.425 m' ndl='44:00 min' />
<sample time='45:00 min' depth='12.266 m' ndl='104:00 min' />
<sample time='46:00 min' depth='10.831 m' ndl='233:00 min' />
<sample time='47:00 min' depth='11.316 m' ndl='172:00 min' />
<sample time='48:00 min' depth='10.217 m' temp='26.6 C' ndl='240:00 min' />
<sample time='49:00 min' depth='9.771 m' />
<sample time='50:00 min' depth='9.504 m' />
<sample time='51:00 min' depth='9.781 m' />
<sample time='52:00 min' depth='9.979 m' temp='27.0 C' />
<sample time='53:00 min' depth='9.771 m' />
<sample time='54:00 min' depth='9.712 m' />
<sample time='55:00 min' depth='9.435 m' />
<sample time='56:00 min' depth='9.633 m' />
<sample time='57:00 min' depth='9.177 m' />
<sample time='58:00 min' depth='8.682 m' />
<sample time='59:00 min' depth='8.653 m' />
<sample time='60:00 min' depth='8.752 m' cns='22%' />
<sample time='61:00 min' depth='6.188 m' />
<sample time='62:00 min' depth='5.495 m' />
<sample time='63:00 min' depth='5.425 m' />
<sample time='64:00 min' depth='5.326 m' />
<sample time='65:00 min' depth='4.356 m' />
<sample time='66:00 min' depth='0.178 m' />
<sample time='67:00 min' depth='0.238 m' />
<sample time='68:00 min' depth='0.0 m' />
<sample time='69:00 min' depth='0.0 m' />
<sample time='70:00 min' depth='0.0 m' temp='27.3 C' />
<sample time='70:46 min' depth='0.0 m' ndl='0:00 min' cns='0%' />
</divecomputer>
</dive>
<dive number='2' sac='9.173 l/min' otu='41' cns='17%' date='2017-02-03' time='10:25:16' duration='65:40 min'> <dive number='2' sac='9.173 l/min' otu='41' cns='17%' date='2017-02-03' time='10:25:16' duration='65:40 min'>
<cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' /> <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' o2='32.0%' />
<divecomputer model='Suunto Vyper Air' deviceid='f95a40f1' diveid='5372ae57'> <divecomputer model='Suunto Vyper Air' deviceid='f95a40f1' diveid='5372ae57'>

File diff suppressed because it is too large Load Diff

View File

@ -399,6 +399,8 @@ Kirigami.Page {
delegate: Flickable { delegate: Flickable {
id: internalScrollView id: internalScrollView
width: diveDetailsListView.width width: diveDetailsListView.width
height: diveDetailsListView.height
contentHeight: diveDetails.height
boundsBehavior: Flickable.StopAtBounds boundsBehavior: Flickable.StopAtBounds
property var modelData: model property var modelData: model
DiveDetailsView { DiveDetailsView {
@ -411,7 +413,7 @@ Kirigami.Page {
ScrollIndicator.horizontal: ScrollIndicator { } ScrollIndicator.horizontal: ScrollIndicator { }
Connections { Connections {
target: swipeModel target: swipeModel
function onCurrentDiveChanged(index) { onCurrentDiveChanged: {
currentIndex = index.row currentIndex = index.row
diveDetailsListView.positionViewAtIndex(currentIndex, ListView.End) diveDetailsListView.positionViewAtIndex(currentIndex, ListView.End)
} }
@ -423,6 +425,7 @@ Kirigami.Page {
anchors.fill: parent anchors.fill: parent
leftMargin: Kirigami.Units.smallSpacing leftMargin: Kirigami.Units.smallSpacing
rightMargin: Kirigami.Units.smallSpacing rightMargin: Kirigami.Units.smallSpacing
contentHeight: detailsEdit.height
// start invisible and scaled down, to get the transition // start invisible and scaled down, to get the transition
// off to the right start // off to the right start
visible: false visible: false

View File

@ -19,7 +19,7 @@ Item {
Connections { Connections {
target: rootItem target: rootItem
function onSettingsChanged() { onSettingsChanged: {
qmlProfile.update() qmlProfile.update()
} }
} }

View File

@ -32,10 +32,10 @@ Kirigami.ScrollablePage {
} }
Connections { Connections {
target: Backend target: Backend
function onLengthChanged() { onLengthChanged: {
reload() reload()
} }
function onVolumeChanged() { onVolumeChanged: {
reload() reload()
} }
} }

View File

@ -318,7 +318,7 @@ Kirigami.Page {
Connections { Connections {
target: manager target: manager
function onRestartDownloadSignal() { onRestartDownloadSignal: {
buttonBar.doDownload() buttonBar.doDownload()
} }
} }

View File

@ -111,14 +111,14 @@ TemplatePage {
} }
Connections { Connections {
target: manager target: manager
function onUploadFinish(success, text) { onUploadFinish: {
if (success) { if (success) {
pageStack.pop() pageStack.pop()
} }
statusText.text = text statusText.text = text
progress.value = 0 progress.value = 0
} }
function onUploadProgress(percentage) { onUploadProgress: {
progress.value = percentage progress.value = percentage
} }
} }

View File

@ -110,9 +110,7 @@ Kirigami.Page {
model: statsManager.var1List model: statsManager.var1List
currentIndex: statsManager.var1Index currentIndex: statsManager.var1Index
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (currentIndex != statsManager.var1Index) { statsManager.var1Changed(currentIndex)
statsManager.var1Changed(currentIndex)
}
} }
} }
} }
@ -129,9 +127,7 @@ Kirigami.Page {
model: statsManager.binner1List model: statsManager.binner1List
currentIndex: statsManager.binner1Index currentIndex: statsManager.binner1Index
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (currentIndex != statsManager.binner1Index) { statsManager.var1BinnerChanged(currentIndex)
statsManager.var1BinnerChanged(currentIndex)
}
} }
} }
} }
@ -149,9 +145,7 @@ Kirigami.Page {
currentIndex: statsManager.var2Index currentIndex: statsManager.var2Index
Layout.fillWidth: false Layout.fillWidth: false
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (currentIndex != statsManager.var2Index) { statsManager.var2Changed(currentIndex)
statsManager.var2Changed(currentIndex)
}
} }
} }
} }
@ -169,9 +163,7 @@ Kirigami.Page {
currentIndex: statsManager.binner2Index currentIndex: statsManager.binner2Index
Layout.fillWidth: false Layout.fillWidth: false
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (currentIndex != statsManager.binner2Index) { statsManager.var2BinnerChanged(currentIndex)
statsManager.var2BinnerChanged(currentIndex)
}
} }
} }
} }
@ -189,9 +181,7 @@ Kirigami.Page {
currentIndex: statsManager.operation2Index currentIndex: statsManager.operation2Index
Layout.fillWidth: false Layout.fillWidth: false
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (currentIndex != statsManager.operation2Index) { statsManager.var2OperationChanged(currentIndex)
statsManager.var2OperationChanged(currentIndex)
}
} }
} }
} }

View File

@ -105,7 +105,7 @@ debuild -S -d
# create builds for the newer Ubuntu releases that Launchpad supports # create builds for the newer Ubuntu releases that Launchpad supports
# #
rel=focal rel=focal
others="jammy mantic noble" others="jammy mantic"
for next in $others for next in $others
do do
sed -i "s/${rel}/${next}/g" debian/changelog sed -i "s/${rel}/${next}/g" debian/changelog

View File

@ -13,15 +13,17 @@ QVariant TankInfoModel::data(const QModelIndex &index, int role) const
return defaultModelFont(); return defaultModelFont();
if (role == Qt::DisplayRole || role == Qt::EditRole) { if (role == Qt::DisplayRole || role == Qt::EditRole) {
const struct tank_info &info = tank_info_table.infos[index.row()]; const struct tank_info &info = tank_info_table.infos[index.row()];
volume_t size = {0}; int ml = info.ml;
pressure_t pressure = {0}; double bar = (info.psi) ? psi_to_bar(info.psi) : info.bar;
extract_tank_info(&info, &size, &pressure);
if (info.cuft && info.psi)
ml = lrint(cuft_to_l(info.cuft) * 1000 / bar_to_atm(bar));
switch (index.column()) { switch (index.column()) {
case BAR: case BAR:
return pressure.mbar; return bar * 1000;
case ML: case ML:
return size.mliter; return ml;
case DESCRIPTION: case DESCRIPTION:
return info.name; return info.name;
} }

View File

@ -130,6 +130,8 @@ void TestParse::testParse()
QCOMPARE(parseV3(), 0); QCOMPARE(parseV3(), 0);
fprintf(stderr, "number of dives %d \n", divelog.dives->nr); fprintf(stderr, "number of dives %d \n", divelog.dives->nr);
sort_dive_table(divelog.dives);
QCOMPARE(save_dives("./testout.ssrf"), 0); QCOMPARE(save_dives("./testout.ssrf"), 0);
FILE_COMPARE("./testout.ssrf", FILE_COMPARE("./testout.ssrf",
SUBSURFACE_TEST_DATA "/dives/test40-42.xml"); SUBSURFACE_TEST_DATA "/dives/test40-42.xml");
@ -140,6 +142,8 @@ void TestParse::testParseDM4()
QCOMPARE(sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.db", &_sqlite3_handle), 0); QCOMPARE(sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.db", &_sqlite3_handle), 0);
QCOMPARE(parse_dm4_buffer(_sqlite3_handle, 0, 0, 0, &divelog), 0); QCOMPARE(parse_dm4_buffer(_sqlite3_handle, 0, 0, 0, &divelog), 0);
sort_dive_table(divelog.dives);
QCOMPARE(save_dives("./testdm4out.ssrf"), 0); QCOMPARE(save_dives("./testdm4out.ssrf"), 0);
FILE_COMPARE("./testdm4out.ssrf", FILE_COMPARE("./testdm4out.ssrf",
SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.xml"); SUBSURFACE_TEST_DATA "/dives/TestDiveDM4.xml");
@ -150,6 +154,8 @@ void TestParse::testParseDM5()
QCOMPARE(sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.db", &_sqlite3_handle), 0); QCOMPARE(sqlite3_open(SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.db", &_sqlite3_handle), 0);
QCOMPARE(parse_dm5_buffer(_sqlite3_handle, 0, 0, 0, &divelog), 0); QCOMPARE(parse_dm5_buffer(_sqlite3_handle, 0, 0, 0, &divelog), 0);
sort_dive_table(divelog.dives);
QCOMPARE(save_dives("./testdm5out.ssrf"), 0); QCOMPARE(save_dives("./testdm5out.ssrf"), 0);
FILE_COMPARE("./testdm5out.ssrf", FILE_COMPARE("./testdm5out.ssrf",
SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.xml"); SUBSURFACE_TEST_DATA "/dives/TestDiveDM5.xml");
@ -192,6 +198,8 @@ void TestParse::testParseHUDC()
dive->dc.when = 1255152761; dive->dc.when = 1255152761;
} }
sort_dive_table(divelog.dives);
QCOMPARE(save_dives("./testhudcout.ssrf"), 0); QCOMPARE(save_dives("./testhudcout.ssrf"), 0);
FILE_COMPARE("./testhudcout.ssrf", FILE_COMPARE("./testhudcout.ssrf",
SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.xml"); SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearHUDC.xml");
@ -230,6 +238,8 @@ void TestParse::testParseNewFormat()
fprintf(stderr, "number of dives %d \n", divelog.dives->nr); fprintf(stderr, "number of dives %d \n", divelog.dives->nr);
QCOMPARE(save_dives("./testsbnewout.ssrf"), 0); QCOMPARE(save_dives("./testsbnewout.ssrf"), 0);
sort_dive_table(divelog.dives);
// Currently the CSV parse fails // Currently the CSV parse fails
FILE_COMPARE("./testsbnewout.ssrf", FILE_COMPARE("./testsbnewout.ssrf",
SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearNewFormat.xml"); SUBSURFACE_TEST_DATA "/dives/TestDiveSeabearNewFormat.xml");
@ -245,6 +255,8 @@ void TestParse::testParseDLD()
fprintf(stderr, "number of dives from DLD: %d \n", divelog.dives->nr); fprintf(stderr, "number of dives from DLD: %d \n", divelog.dives->nr);
sort_dive_table(divelog.dives);
// Compare output // Compare output
QCOMPARE(save_dives("./testdldout.ssrf"), 0); QCOMPARE(save_dives("./testdldout.ssrf"), 0);
FILE_COMPARE("./testdldout.ssrf", FILE_COMPARE("./testdldout.ssrf",
@ -258,6 +270,9 @@ void TestParse::testParseMerge()
*/ */
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &divelog), 0); QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/ostc.xml", &divelog), 0);
QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &divelog), 0); QCOMPARE(parse_file(SUBSURFACE_TEST_DATA "/dives/vyper.xml", &divelog), 0);
sort_dive_table(divelog.dives);
QCOMPARE(save_dives("./testmerge.ssrf"), 0); QCOMPARE(save_dives("./testmerge.ssrf"), 0);
FILE_COMPARE("./testmerge.ssrf", FILE_COMPARE("./testmerge.ssrf",
SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml"); SUBSURFACE_TEST_DATA "/dives/mergedVyperOstc.xml");
@ -323,10 +338,9 @@ void TestParse::exportCSVDiveDetails()
dive->sac = saved_sac; dive->sac = saved_sac;
} }
sort_dive_table(divelog.dives);
export_dives_xslt("testcsvexportmanual2.csv", 0, 0, "xml2manualcsv.xslt", false); export_dives_xslt("testcsvexportmanual2.csv", 0, 0, "xml2manualcsv.xslt", false);
FILE_COMPARE("testcsvexportmanual2.csv", FILE_COMPARE("testcsvexportmanual2.csv",
"testcsvexportmanual.csv"); "testcsvexportmanual.csv");
@ -361,8 +375,9 @@ void TestParse::exportSubsurfaceCSV()
dive->sac = saved_sac; dive->sac = saved_sac;
} }
export_dives_xslt("testcsvexportmanual2-cyl.csv", 0, 0, "xml2manualcsv.xslt", false); sort_dive_table(divelog.dives);
export_dives_xslt("testcsvexportmanual2-cyl.csv", 0, 0, "xml2manualcsv.xslt", false);
FILE_COMPARE("testcsvexportmanual2-cyl.csv", FILE_COMPARE("testcsvexportmanual2-cyl.csv",
"testcsvexportmanual-cyl.csv"); "testcsvexportmanual-cyl.csv");
@ -399,8 +414,9 @@ void TestParse::exportCSVDiveProfile()
clear_dive_file_data(); clear_dive_file_data();
parseCSVprofile(1, "testcsvexportprofileimperial.csv"); parseCSVprofile(1, "testcsvexportprofileimperial.csv");
export_dives_xslt("testcsvexportprofile2.csv", 0, 0, "xml2csv.xslt", false); sort_dive_table(divelog.dives);
export_dives_xslt("testcsvexportprofile2.csv", 0, 0, "xml2csv.xslt", false);
FILE_COMPARE("testcsvexportprofile2.csv", FILE_COMPARE("testcsvexportprofile2.csv",
"testcsvexportprofile.csv"); "testcsvexportprofile.csv");
@ -416,8 +432,9 @@ void TestParse::exportUDDF()
clear_dive_file_data(); clear_dive_file_data();
parse_file("testuddfexport.uddf", &divelog); parse_file("testuddfexport.uddf", &divelog);
export_dives_xslt("testuddfexport2.uddf", 0, 1, "uddf-export.xslt", false); sort_dive_table(divelog.dives);
export_dives_xslt("testuddfexport2.uddf", 0, 1, "uddf-export.xslt", false);
FILE_COMPARE("testuddfexport.uddf", FILE_COMPARE("testuddfexport.uddf",
"testuddfexport2.uddf"); "testuddfexport2.uddf");
@ -463,6 +480,8 @@ void TestParse::parseDL7()
0); 0);
QCOMPARE(divelog.dives->nr, 3); QCOMPARE(divelog.dives->nr, 3);
sort_dive_table(divelog.dives);
QCOMPARE(save_dives("./testdl7out.ssrf"), 0); QCOMPARE(save_dives("./testdl7out.ssrf"), 0);
FILE_COMPARE("./testdl7out.ssrf", FILE_COMPARE("./testdl7out.ssrf",
SUBSURFACE_TEST_DATA "/dives/DL7.xml"); SUBSURFACE_TEST_DATA "/dives/DL7.xml");

View File

@ -38,6 +38,7 @@ void TestProfile::testProfileExport()
{ {
prefs.planner_deco_mode = BUEHLMANN; prefs.planner_deco_mode = BUEHLMANN;
parse_file(SUBSURFACE_TEST_DATA "/dives/abitofeverything.ssrf", &divelog); parse_file(SUBSURFACE_TEST_DATA "/dives/abitofeverything.ssrf", &divelog);
sort_dive_table(divelog.dives);
save_profiledata("exportprofile.csv", false); save_profiledata("exportprofile.csv", false);
QFile org(SUBSURFACE_TEST_DATA "/dives/exportprofilereference.csv"); QFile org(SUBSURFACE_TEST_DATA "/dives/exportprofilereference.csv");
QCOMPARE(org.open(QFile::ReadOnly), true); QCOMPARE(org.open(QFile::ReadOnly), true);
@ -54,6 +55,7 @@ void TestProfile::testProfileExportVPMB()
{ {
prefs.planner_deco_mode = VPMB; prefs.planner_deco_mode = VPMB;
parse_file(SUBSURFACE_TEST_DATA "/dives/abitofeverything.ssrf", &divelog); parse_file(SUBSURFACE_TEST_DATA "/dives/abitofeverything.ssrf", &divelog);
sort_dive_table(divelog.dives);
save_profiledata("exportprofileVPMB.csv", false); save_profiledata("exportprofileVPMB.csv", false);
QFile org(SUBSURFACE_TEST_DATA "/dives/exportprofilereferenceVPMB.csv"); QFile org(SUBSURFACE_TEST_DATA "/dives/exportprofilereferenceVPMB.csv");
QCOMPARE(org.open(QFile::ReadOnly), true); QCOMPARE(org.open(QFile::ReadOnly), true);