2017-04-27 18:25:32 +00:00
|
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-05-28 19:23:49 +00:00
|
|
|
|
#include "cylindermodel.h"
|
|
|
|
|
#include "models.h"
|
2020-02-28 19:38:04 +00:00
|
|
|
|
#include "commands/command.h"
|
2018-06-03 20:15:19 +00:00
|
|
|
|
#include "core/qthelper.h"
|
2016-04-05 05:02:03 +00:00
|
|
|
|
#include "core/color.h"
|
|
|
|
|
#include "qt-models/diveplannermodel.h"
|
|
|
|
|
#include "core/gettextfromc.h"
|
2024-05-28 19:31:11 +00:00
|
|
|
|
#include "core/range.h"
|
2022-02-19 17:47:25 +00:00
|
|
|
|
#include "core/sample.h"
|
2022-04-04 16:57:28 +00:00
|
|
|
|
#include "core/selection.h"
|
2020-02-03 18:33:06 +00:00
|
|
|
|
#include "core/subsurface-qt/divelistnotifier.h"
|
2020-02-28 13:01:47 +00:00
|
|
|
|
#include "core/subsurface-string.h"
|
2020-03-01 14:32:24 +00:00
|
|
|
|
#include <string>
|
2015-05-28 19:23:49 +00:00
|
|
|
|
|
2023-07-09 00:14:27 +00:00
|
|
|
|
CylindersModel::CylindersModel(bool planner, QObject *parent) : CleanerTableModel(parent),
|
2020-02-28 19:38:04 +00:00
|
|
|
|
d(nullptr),
|
2024-01-16 16:39:19 +00:00
|
|
|
|
dcNr(-1),
|
2020-03-01 15:12:13 +00:00
|
|
|
|
inPlanner(planner),
|
2021-11-20 08:37:28 +00:00
|
|
|
|
numRows(0),
|
2024-05-04 17:15:47 +00:00
|
|
|
|
tempRow(-1)
|
2015-05-28 19:23:49 +00:00
|
|
|
|
{
|
2022-02-19 17:47:25 +00:00
|
|
|
|
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH, MOD, MND, USE, WORKINGPRESS_INT, SIZE_INT, SENSORS};
|
2015-05-28 19:23:49 +00:00
|
|
|
|
setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << tr("Work press.") << tr("Start press.") << tr("End press.") << tr("O₂%") << tr("He%")
|
2022-02-19 17:47:25 +00:00
|
|
|
|
<< tr("Deco switch at") << tr("Bot. MOD") << tr("MND") << tr("Use") << ""
|
|
|
|
|
<< "" << tr("Sensors"));
|
2015-05-28 19:23:49 +00:00
|
|
|
|
|
2019-02-23 21:09:34 +00:00
|
|
|
|
connect(&diveListNotifier, &DiveListNotifier::cylindersReset, this, &CylindersModel::cylindersReset);
|
2020-02-26 21:32:04 +00:00
|
|
|
|
connect(&diveListNotifier, &DiveListNotifier::cylinderAdded, this, &CylindersModel::cylinderAdded);
|
|
|
|
|
connect(&diveListNotifier, &DiveListNotifier::cylinderRemoved, this, &CylindersModel::cylinderRemoved);
|
|
|
|
|
connect(&diveListNotifier, &DiveListNotifier::cylinderEdited, this, &CylindersModel::cylinderEdited);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-26 12:34:17 +00:00
|
|
|
|
QVariant CylindersModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
|
|
|
{
|
2020-03-01 15:12:13 +00:00
|
|
|
|
if (role == Qt::DisplayRole && orientation == Qt::Horizontal && inPlanner && section == WORKINGPRESS)
|
2017-02-26 12:34:17 +00:00
|
|
|
|
return tr("Start press.");
|
|
|
|
|
else
|
|
|
|
|
return CleanerTableModel::headerData(section, orientation, role);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QString get_cylinder_string(const cylinder_t *cyl)
|
Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one
that did the obvious "show this volume as a string", and one that tried
to show a cylinder size.
The function used a magic third argument (the working pressure of the
cylinder) to distinguish between the two cases, but it still got it
wrong.
A metric cylinder doesn't necessarily have a working pressure at all,
and the size is a wet size in liters. We'd pass in zero as the working
pressure, and if the volume units were set to cubic feet, the logic in
"get_volume_string()" would happily convert the metric wet size into the
wet size in cubic feet.
But that's completely wrong. An imperial cylinder size simply isn't a
wet size. If you don't have a working pressure, you cannot convert the
cylinder size to cubic feet. End of story.
So instead of having "get_volume_string()" have magical behavior
depending on working pressure, and getting it wrong anyway, just make
get_volume_string do a pure volume conversion, and create a whole new
function for showing the size of a cylinder.
Now, if the cylinder doesn't have a working pressure, we just show the
metric size, even if the user had asked for cubic feet.
[Dirk Hohndel: added call to translation functions for the units]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-24 22:42:56 +00:00
|
|
|
|
{
|
|
|
|
|
QString unit;
|
|
|
|
|
int decimals;
|
|
|
|
|
unsigned int ml = cyl->type.size.mliter;
|
|
|
|
|
pressure_t wp = cyl->type.workingpressure;
|
|
|
|
|
double value;
|
|
|
|
|
|
|
|
|
|
// We cannot use "get_volume_units()", because even when
|
|
|
|
|
// using imperial units we may need to show the size in
|
|
|
|
|
// liters: if we don't have a working pressure, we cannot
|
|
|
|
|
// convert the cylinder size to cuft.
|
|
|
|
|
if (wp.mbar && prefs.units.volume == units::CUFT) {
|
|
|
|
|
value = ml_to_cuft(ml) * bar_to_atm(wp.mbar / 1000.0);
|
|
|
|
|
decimals = (value > 20.0) ? 0 : (value > 2.0) ? 1 : 2;
|
2017-01-16 11:30:57 +00:00
|
|
|
|
unit = CylindersModel::tr("cuft");
|
Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one
that did the obvious "show this volume as a string", and one that tried
to show a cylinder size.
The function used a magic third argument (the working pressure of the
cylinder) to distinguish between the two cases, but it still got it
wrong.
A metric cylinder doesn't necessarily have a working pressure at all,
and the size is a wet size in liters. We'd pass in zero as the working
pressure, and if the volume units were set to cubic feet, the logic in
"get_volume_string()" would happily convert the metric wet size into the
wet size in cubic feet.
But that's completely wrong. An imperial cylinder size simply isn't a
wet size. If you don't have a working pressure, you cannot convert the
cylinder size to cubic feet. End of story.
So instead of having "get_volume_string()" have magical behavior
depending on working pressure, and getting it wrong anyway, just make
get_volume_string do a pure volume conversion, and create a whole new
function for showing the size of a cylinder.
Now, if the cylinder doesn't have a working pressure, we just show the
metric size, even if the user had asked for cubic feet.
[Dirk Hohndel: added call to translation functions for the units]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-24 22:42:56 +00:00
|
|
|
|
} else {
|
|
|
|
|
value = ml / 1000.0;
|
|
|
|
|
decimals = 1;
|
|
|
|
|
unit = CylindersModel::tr("ℓ");
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-19 20:55:18 +00:00
|
|
|
|
return QString("%L1").arg(value, 0, 'f', decimals) + unit;
|
Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one
that did the obvious "show this volume as a string", and one that tried
to show a cylinder size.
The function used a magic third argument (the working pressure of the
cylinder) to distinguish between the two cases, but it still got it
wrong.
A metric cylinder doesn't necessarily have a working pressure at all,
and the size is a wet size in liters. We'd pass in zero as the working
pressure, and if the volume units were set to cubic feet, the logic in
"get_volume_string()" would happily convert the metric wet size into the
wet size in cubic feet.
But that's completely wrong. An imperial cylinder size simply isn't a
wet size. If you don't have a working pressure, you cannot convert the
cylinder size to cubic feet. End of story.
So instead of having "get_volume_string()" have magical behavior
depending on working pressure, and getting it wrong anyway, just make
get_volume_string do a pure volume conversion, and create a whole new
function for showing the size of a cylinder.
Now, if the cylinder doesn't have a working pressure, we just show the
metric size, even if the user had asked for cubic feet.
[Dirk Hohndel: added call to translation functions for the units]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-24 22:42:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-07-02 09:12:27 +00:00
|
|
|
|
static QString gas_volume_string(volume_t volume, const char *tail)
|
2017-01-11 17:22:41 +00:00
|
|
|
|
{
|
|
|
|
|
double vol;
|
|
|
|
|
const char *unit;
|
|
|
|
|
int decimals;
|
|
|
|
|
|
2024-07-02 09:12:27 +00:00
|
|
|
|
vol = get_volume_units(volume.mliter, NULL, &unit);
|
2017-01-11 17:22:41 +00:00
|
|
|
|
decimals = (vol > 20.0) ? 0 : (vol > 2.0) ? 1 : 2;
|
|
|
|
|
|
2018-02-19 20:55:18 +00:00
|
|
|
|
return QString("%L1 %2 %3").arg(vol, 0, 'f', decimals).arg(unit).arg(tail);
|
2017-01-11 17:22:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QVariant gas_wp_tooltip(const cylinder_t *cyl);
|
Tweak cylinder equipment tooltips
While playing around with the current subsurface, I realized that while we
give the gas volume and Z factor for the beginning/end pressures in the
newly added tooltips, there is no way to actually see that same
information for the working pressure.
So if you have filled in cylinder type information, but don't have any
actual gas usage information, there will be no cylinder tooltips at all.
But you might still want to know what the actual volume for a particular
cylinder is, and what the Z value for that working pressure is.
So this tweaks the tool-tips a bit.
When mousing over the pressure fields (ie "working pressure", "start" and
"end"), it now always gives the cylinder gas volume and Z factor for that
pressure, so for example on an AL72 that has a working pressure of 3000
psi and that contains air the tooltip will say:
69 cuft, Z=1.040
when you mouse over the working pressure field (that's obviously with
imperial units, in metric you'll see liters of gas).
When mousing over the type/size field, it gives the used gas amounts, ie
something like this:
37 cuft (82 cuft -> 45 cuft)
but if the cylinder doesn't have starting/ending pressures (and thus no
used gas information), this patch will make subsurface show the working
pressure data instead, so that you at least get something.
This all seems more useful than what my first version gave.
NOTE! This makes commit adaeb506b7a1 ("Show both the nominal and "real"
size for an imperial cylinder") kind of pointless. You now see the real
size in the tooltip when you mouse over the size, and now it actually
works both for imperial and metric people, so the tooltip is in many ways
the better model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-16 00:07:35 +00:00
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QVariant gas_usage_tooltip(const cylinder_t *cyl)
|
2017-01-11 17:22:41 +00:00
|
|
|
|
{
|
|
|
|
|
pressure_t startp = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
|
|
|
|
pressure_t endp = cyl->end.mbar ? cyl->end : cyl->sample_end;
|
|
|
|
|
|
2024-07-02 09:12:27 +00:00
|
|
|
|
volume_t start = cyl->gas_volume(startp);
|
|
|
|
|
volume_t end = cyl->gas_volume(endp);
|
|
|
|
|
// TOOO: implement comparison and subtraction on units.h types.
|
2024-09-01 19:48:31 +00:00
|
|
|
|
volume_t used = (end.mliter && start.mliter > end.mliter) ? volume_t { .mliter = start.mliter - end.mliter } : volume_t();
|
2017-01-11 17:22:41 +00:00
|
|
|
|
|
2024-07-02 09:12:27 +00:00
|
|
|
|
if (!used.mliter)
|
Tweak cylinder equipment tooltips
While playing around with the current subsurface, I realized that while we
give the gas volume and Z factor for the beginning/end pressures in the
newly added tooltips, there is no way to actually see that same
information for the working pressure.
So if you have filled in cylinder type information, but don't have any
actual gas usage information, there will be no cylinder tooltips at all.
But you might still want to know what the actual volume for a particular
cylinder is, and what the Z value for that working pressure is.
So this tweaks the tool-tips a bit.
When mousing over the pressure fields (ie "working pressure", "start" and
"end"), it now always gives the cylinder gas volume and Z factor for that
pressure, so for example on an AL72 that has a working pressure of 3000
psi and that contains air the tooltip will say:
69 cuft, Z=1.040
when you mouse over the working pressure field (that's obviously with
imperial units, in metric you'll see liters of gas).
When mousing over the type/size field, it gives the used gas amounts, ie
something like this:
37 cuft (82 cuft -> 45 cuft)
but if the cylinder doesn't have starting/ending pressures (and thus no
used gas information), this patch will make subsurface show the working
pressure data instead, so that you at least get something.
This all seems more useful than what my first version gave.
NOTE! This makes commit adaeb506b7a1 ("Show both the nominal and "real"
size for an imperial cylinder") kind of pointless. You now see the real
size in the tooltip when you mouse over the size, and now it actually
works both for imperial and metric people, so the tooltip is in many ways
the better model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-16 00:07:35 +00:00
|
|
|
|
return gas_wp_tooltip(cyl);
|
2017-01-11 17:22:41 +00:00
|
|
|
|
|
|
|
|
|
return gas_volume_string(used, "(") +
|
|
|
|
|
gas_volume_string(start, " -> ") +
|
|
|
|
|
gas_volume_string(end, ")");
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QVariant gas_volume_tooltip(const cylinder_t *cyl, pressure_t p)
|
2017-01-11 17:22:41 +00:00
|
|
|
|
{
|
2024-07-02 09:12:27 +00:00
|
|
|
|
volume_t vol = cyl->gas_volume(p);
|
2017-01-11 17:22:41 +00:00
|
|
|
|
double Z;
|
|
|
|
|
|
2024-07-02 09:12:27 +00:00
|
|
|
|
if (!vol.mliter)
|
2017-01-11 17:22:41 +00:00
|
|
|
|
return QVariant();
|
|
|
|
|
|
2018-08-16 17:10:10 +00:00
|
|
|
|
Z = gas_compressibility_factor(cyl->gasmix, p.mbar / 1000.0);
|
2017-01-11 17:22:41 +00:00
|
|
|
|
return gas_volume_string(vol, "(Z=") + QString("%1)").arg(Z, 0, 'f', 3);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QVariant gas_wp_tooltip(const cylinder_t *cyl)
|
Tweak cylinder equipment tooltips
While playing around with the current subsurface, I realized that while we
give the gas volume and Z factor for the beginning/end pressures in the
newly added tooltips, there is no way to actually see that same
information for the working pressure.
So if you have filled in cylinder type information, but don't have any
actual gas usage information, there will be no cylinder tooltips at all.
But you might still want to know what the actual volume for a particular
cylinder is, and what the Z value for that working pressure is.
So this tweaks the tool-tips a bit.
When mousing over the pressure fields (ie "working pressure", "start" and
"end"), it now always gives the cylinder gas volume and Z factor for that
pressure, so for example on an AL72 that has a working pressure of 3000
psi and that contains air the tooltip will say:
69 cuft, Z=1.040
when you mouse over the working pressure field (that's obviously with
imperial units, in metric you'll see liters of gas).
When mousing over the type/size field, it gives the used gas amounts, ie
something like this:
37 cuft (82 cuft -> 45 cuft)
but if the cylinder doesn't have starting/ending pressures (and thus no
used gas information), this patch will make subsurface show the working
pressure data instead, so that you at least get something.
This all seems more useful than what my first version gave.
NOTE! This makes commit adaeb506b7a1 ("Show both the nominal and "real"
size for an imperial cylinder") kind of pointless. You now see the real
size in the tooltip when you mouse over the size, and now it actually
works both for imperial and metric people, so the tooltip is in many ways
the better model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-16 00:07:35 +00:00
|
|
|
|
{
|
|
|
|
|
return gas_volume_tooltip(cyl, cyl->type.workingpressure);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QVariant gas_start_tooltip(const cylinder_t *cyl)
|
2017-01-11 17:22:41 +00:00
|
|
|
|
{
|
|
|
|
|
return gas_volume_tooltip(cyl, cyl->start.mbar ? cyl->start : cyl->sample_start);
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-04 14:28:16 +00:00
|
|
|
|
static QVariant gas_end_tooltip(const cylinder_t *cyl)
|
2017-01-11 17:22:41 +00:00
|
|
|
|
{
|
|
|
|
|
return gas_volume_tooltip(cyl, cyl->end.mbar ? cyl->end : cyl->sample_end);
|
|
|
|
|
}
|
Don't use "get_volume_string()" for cylinder size string
We had two totally different usage cases for "get_volume_string()": one
that did the obvious "show this volume as a string", and one that tried
to show a cylinder size.
The function used a magic third argument (the working pressure of the
cylinder) to distinguish between the two cases, but it still got it
wrong.
A metric cylinder doesn't necessarily have a working pressure at all,
and the size is a wet size in liters. We'd pass in zero as the working
pressure, and if the volume units were set to cubic feet, the logic in
"get_volume_string()" would happily convert the metric wet size into the
wet size in cubic feet.
But that's completely wrong. An imperial cylinder size simply isn't a
wet size. If you don't have a working pressure, you cannot convert the
cylinder size to cubic feet. End of story.
So instead of having "get_volume_string()" have magical behavior
depending on working pressure, and getting it wrong anyway, just make
get_volume_string do a pure volume conversion, and create a whole new
function for showing the size of a cylinder.
Now, if the cylinder doesn't have a working pressure, we just show the
metric size, even if the user had asked for cubic feet.
[Dirk Hohndel: added call to translation functions for the units]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-24 22:42:56 +00:00
|
|
|
|
|
2015-05-28 19:23:49 +00:00
|
|
|
|
static QVariant percent_string(fraction_t fraction)
|
|
|
|
|
{
|
|
|
|
|
int permille = fraction.permille;
|
|
|
|
|
|
|
|
|
|
if (!permille)
|
|
|
|
|
return QVariant();
|
2018-02-19 20:55:18 +00:00
|
|
|
|
return QString("%L1%").arg(permille / 10.0, 0, 'f', 1);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-09 00:14:27 +00:00
|
|
|
|
// Calculate the number of displayed cylinders: If we are in planner
|
|
|
|
|
// or prefs.include_unused_tanks is set we show unused cylinders
|
|
|
|
|
// at the end of the list.
|
2021-11-20 08:37:28 +00:00
|
|
|
|
int CylindersModel::calcNumRows() const
|
|
|
|
|
{
|
|
|
|
|
if (!d)
|
|
|
|
|
return 0;
|
2023-07-09 00:14:27 +00:00
|
|
|
|
if (inPlanner || prefs.include_unused_tanks)
|
2024-05-28 19:31:11 +00:00
|
|
|
|
return static_cast<int>(d->cylinders.size());
|
2021-11-21 10:39:02 +00:00
|
|
|
|
return first_hidden_cylinder(d);
|
2021-11-20 08:37:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-05-28 19:23:49 +00:00
|
|
|
|
QVariant CylindersModel::data(const QModelIndex &index, int role) const
|
|
|
|
|
{
|
2021-11-20 08:00:15 +00:00
|
|
|
|
if (!d || !index.isValid())
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return QVariant();
|
2017-10-20 21:25:18 +00:00
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (index.row() >= numRows) {
|
2020-02-23 11:44:09 +00:00
|
|
|
|
qWarning("CylindersModel and dive are out of sync!");
|
2020-01-30 13:33:27 +00:00
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-25 05:43:32 +00:00
|
|
|
|
const cylinder_t *cyl = index.row() == tempRow ? &tempCyl : d->get_cylinder(index.row());
|
2017-10-20 21:25:18 +00:00
|
|
|
|
|
2024-05-15 05:23:39 +00:00
|
|
|
|
bool isInappropriateUse = !is_cylinder_use_appropriate(*d->get_dc(dcNr), *cyl, true);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
switch (role) {
|
2024-05-15 05:23:39 +00:00
|
|
|
|
case Qt::BackgroundRole:
|
2015-05-28 19:23:49 +00:00
|
|
|
|
switch (index.column()) {
|
|
|
|
|
// mark the cylinder start / end pressure in red if the values
|
|
|
|
|
// seem implausible
|
|
|
|
|
case START:
|
|
|
|
|
case END:
|
2024-05-15 05:23:39 +00:00
|
|
|
|
{
|
|
|
|
|
pressure_t startp = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
|
|
|
|
pressure_t endp = cyl->end.mbar ? cyl->end : cyl->sample_end;
|
|
|
|
|
if ((startp.mbar && !endp.mbar) ||
|
|
|
|
|
(endp.mbar && startp.mbar <= endp.mbar))
|
|
|
|
|
return REDORANGE1_HIGH_TRANS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case USE:
|
|
|
|
|
if (isInappropriateUse)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return REDORANGE1_HIGH_TRANS;
|
2024-05-15 05:23:39 +00:00
|
|
|
|
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-05-15 05:23:39 +00:00
|
|
|
|
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case Qt::FontRole: {
|
|
|
|
|
QFont font = defaultModelFont();
|
2024-05-15 05:23:39 +00:00
|
|
|
|
|
2015-05-28 19:23:49 +00:00
|
|
|
|
switch (index.column()) {
|
2017-03-20 21:10:42 +00:00
|
|
|
|
// if we don't have manually set pressure data use italic font
|
2015-05-28 19:23:49 +00:00
|
|
|
|
case START:
|
|
|
|
|
font.setItalic(!cyl->start.mbar);
|
|
|
|
|
break;
|
|
|
|
|
case END:
|
2017-03-20 21:10:42 +00:00
|
|
|
|
font.setItalic(!cyl->end.mbar);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2024-05-15 05:23:39 +00:00
|
|
|
|
|
|
|
|
|
font.setItalic(isInappropriateUse);
|
|
|
|
|
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return font;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
case Qt::TextAlignmentRole:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return Qt::AlignCenter;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
case Qt::DisplayRole:
|
|
|
|
|
case Qt::EditRole:
|
|
|
|
|
switch (index.column()) {
|
|
|
|
|
case TYPE:
|
2024-05-28 19:31:11 +00:00
|
|
|
|
return QString::fromStdString(cyl->type.description);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
case SIZE:
|
|
|
|
|
if (cyl->type.size.mliter)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_cylinder_string(cyl);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case WORKINGPRESS:
|
|
|
|
|
if (cyl->type.workingpressure.mbar)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_pressure_string(cyl->type.workingpressure, true);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case START:
|
|
|
|
|
if (cyl->start.mbar)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_pressure_string(cyl->start, true);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
else if (cyl->sample_start.mbar)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_pressure_string(cyl->sample_start, true);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case END:
|
|
|
|
|
if (cyl->end.mbar)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_pressure_string(cyl->end, true);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
else if (cyl->sample_end.mbar)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_pressure_string(cyl->sample_end, true);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case O2:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return percent_string(cyl->gasmix.o2);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
case HE:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return percent_string(cyl->gasmix.he);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
case DEPTH:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return get_depth_string(cyl->depth, true);
|
2016-07-06 12:40:32 +00:00
|
|
|
|
case MOD:
|
2016-07-06 12:40:35 +00:00
|
|
|
|
if (cyl->bestmix_o2) {
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return QStringLiteral("*");
|
2016-07-06 12:40:35 +00:00
|
|
|
|
} else {
|
|
|
|
|
pressure_t modpO2;
|
2021-10-16 19:01:40 +00:00
|
|
|
|
modpO2.mbar = inPlanner ? prefs.bottompo2 : (int)(prefs.modpO2 * 1000.0);
|
2024-06-30 14:17:20 +00:00
|
|
|
|
return get_depth_string(d->gas_mod(cyl->gasmix, modpO2, M_OR_FT(1,1)), true);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
}
|
2016-07-06 12:40:32 +00:00
|
|
|
|
case MND:
|
2016-07-06 12:40:35 +00:00
|
|
|
|
if (cyl->bestmix_he)
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return QStringLiteral("*");
|
2016-07-06 12:40:35 +00:00
|
|
|
|
else
|
2024-06-30 14:17:20 +00:00
|
|
|
|
return get_depth_string(d->gas_mnd(cyl->gasmix, prefs.bestmixend, M_OR_FT(1,1)), true);
|
2016-07-06 12:40:32 +00:00
|
|
|
|
break;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
case USE:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return gettextFromC::tr(cylinderuse_text[cyl->cylinder_use]);
|
2020-02-27 18:46:48 +00:00
|
|
|
|
case WORKINGPRESS_INT:
|
|
|
|
|
return static_cast<int>(cyl->type.workingpressure.mbar);
|
|
|
|
|
case SIZE_INT:
|
|
|
|
|
return static_cast<int>(cyl->type.size.mliter);
|
2022-02-19 17:47:25 +00:00
|
|
|
|
case SENSORS: {
|
2022-05-21 20:08:46 +00:00
|
|
|
|
std::vector<int16_t> sensors;
|
2024-06-30 18:38:12 +00:00
|
|
|
|
const struct divecomputer *currentdc = d->get_dc(dcNr);
|
2024-05-19 10:38:38 +00:00
|
|
|
|
for (const auto &sample: currentdc->samples) {
|
2022-09-02 20:51:19 +00:00
|
|
|
|
for (int s = 0; s < MAX_SENSORS; ++s) {
|
2022-02-19 17:47:25 +00:00
|
|
|
|
if (sample.pressure[s].mbar) {
|
|
|
|
|
if (sample.sensor[s] == index.row())
|
2022-09-02 20:51:19 +00:00
|
|
|
|
return QString::number(sample.sensor[s]);
|
2022-02-19 17:47:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-02 20:51:19 +00:00
|
|
|
|
return QString();
|
2022-02-19 17:47:25 +00:00
|
|
|
|
}
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Qt::DecorationRole:
|
|
|
|
|
case Qt::SizeHintRole:
|
2015-10-21 22:17:05 +00:00
|
|
|
|
if (index.column() == REMOVE) {
|
2020-03-01 15:12:13 +00:00
|
|
|
|
if ((inPlanner && DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
|
2024-06-25 05:43:32 +00:00
|
|
|
|
(!inPlanner && d->is_cylinder_prot(index.row()))) {
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return trashForbiddenIcon();
|
2017-03-11 09:39:48 +00:00
|
|
|
|
}
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return trashIcon();
|
2015-10-21 22:17:05 +00:00
|
|
|
|
}
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case Qt::ToolTipRole:
|
2016-08-02 01:02:14 +00:00
|
|
|
|
switch (index.column()) {
|
|
|
|
|
case REMOVE:
|
2020-03-01 15:12:13 +00:00
|
|
|
|
if ((inPlanner && DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
|
2024-06-25 05:43:32 +00:00
|
|
|
|
(!inPlanner && d->is_cylinder_prot(index.row()))) {
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return tr("This gas is in use. Only cylinders that are not used in the dive can be removed.");
|
2017-03-11 09:39:48 +00:00
|
|
|
|
}
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return tr("Clicking here will remove this cylinder.");
|
Tweak cylinder equipment tooltips
While playing around with the current subsurface, I realized that while we
give the gas volume and Z factor for the beginning/end pressures in the
newly added tooltips, there is no way to actually see that same
information for the working pressure.
So if you have filled in cylinder type information, but don't have any
actual gas usage information, there will be no cylinder tooltips at all.
But you might still want to know what the actual volume for a particular
cylinder is, and what the Z value for that working pressure is.
So this tweaks the tool-tips a bit.
When mousing over the pressure fields (ie "working pressure", "start" and
"end"), it now always gives the cylinder gas volume and Z factor for that
pressure, so for example on an AL72 that has a working pressure of 3000
psi and that contains air the tooltip will say:
69 cuft, Z=1.040
when you mouse over the working pressure field (that's obviously with
imperial units, in metric you'll see liters of gas).
When mousing over the type/size field, it gives the used gas amounts, ie
something like this:
37 cuft (82 cuft -> 45 cuft)
but if the cylinder doesn't have starting/ending pressures (and thus no
used gas information), this patch will make subsurface show the working
pressure data instead, so that you at least get something.
This all seems more useful than what my first version gave.
NOTE! This makes commit adaeb506b7a1 ("Show both the nominal and "real"
size for an imperial cylinder") kind of pointless. You now see the real
size in the tooltip when you mouse over the size, and now it actually
works both for imperial and metric people, so the tooltip is in many ways
the better model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-16 00:07:35 +00:00
|
|
|
|
case TYPE:
|
2017-01-11 17:22:41 +00:00
|
|
|
|
case SIZE:
|
|
|
|
|
return gas_usage_tooltip(cyl);
|
Tweak cylinder equipment tooltips
While playing around with the current subsurface, I realized that while we
give the gas volume and Z factor for the beginning/end pressures in the
newly added tooltips, there is no way to actually see that same
information for the working pressure.
So if you have filled in cylinder type information, but don't have any
actual gas usage information, there will be no cylinder tooltips at all.
But you might still want to know what the actual volume for a particular
cylinder is, and what the Z value for that working pressure is.
So this tweaks the tool-tips a bit.
When mousing over the pressure fields (ie "working pressure", "start" and
"end"), it now always gives the cylinder gas volume and Z factor for that
pressure, so for example on an AL72 that has a working pressure of 3000
psi and that contains air the tooltip will say:
69 cuft, Z=1.040
when you mouse over the working pressure field (that's obviously with
imperial units, in metric you'll see liters of gas).
When mousing over the type/size field, it gives the used gas amounts, ie
something like this:
37 cuft (82 cuft -> 45 cuft)
but if the cylinder doesn't have starting/ending pressures (and thus no
used gas information), this patch will make subsurface show the working
pressure data instead, so that you at least get something.
This all seems more useful than what my first version gave.
NOTE! This makes commit adaeb506b7a1 ("Show both the nominal and "real"
size for an imperial cylinder") kind of pointless. You now see the real
size in the tooltip when you mouse over the size, and now it actually
works both for imperial and metric people, so the tooltip is in many ways
the better model.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-16 00:07:35 +00:00
|
|
|
|
case WORKINGPRESS:
|
|
|
|
|
return gas_wp_tooltip(cyl);
|
2017-01-11 17:22:41 +00:00
|
|
|
|
case START:
|
|
|
|
|
return gas_start_tooltip(cyl);
|
|
|
|
|
case END:
|
|
|
|
|
return gas_end_tooltip(cyl);
|
2016-08-02 01:02:14 +00:00
|
|
|
|
case DEPTH:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return tr("Switch depth for deco gas. Calculated using Deco pO₂ preference, unless set manually.");
|
2016-08-02 01:02:14 +00:00
|
|
|
|
case MOD:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return tr("Calculated using Bottom pO₂ preference. Setting MOD adjusts O₂%, set to '*' for best O₂% for max. depth.");
|
2016-08-02 01:02:14 +00:00
|
|
|
|
case MND:
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return tr("Calculated using Best Mix END preference. Setting MND adjusts He%, set to '*' for best He% for max. depth.");
|
2022-02-19 17:47:25 +00:00
|
|
|
|
case SENSORS:
|
|
|
|
|
return tr("Index of cylinder that you want to move sensor data from.");
|
2016-08-02 01:02:14 +00:00
|
|
|
|
}
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-08 06:49:12 +00:00
|
|
|
|
return QVariant();
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cylinder_t *CylindersModel::cylinderAt(const QModelIndex &index)
|
|
|
|
|
{
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (!d)
|
|
|
|
|
return nullptr;
|
2024-06-25 05:43:32 +00:00
|
|
|
|
return d->get_cylinder(index.row());
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
|
|
|
|
{
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (!d)
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-03-01 14:32:24 +00:00
|
|
|
|
int row = index.row();
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (row < 0 || row >= numRows)
|
2020-02-27 18:46:48 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2020-02-28 19:38:04 +00:00
|
|
|
|
// Here we handle a few cases that allow us to set / commit / revert
|
|
|
|
|
// a temporary row. This is a horribly misuse of the model/view system.
|
|
|
|
|
// The reason it is done this way is that the planner and the equipment
|
|
|
|
|
// tab use different model-classes which are not in a superclass / subclass
|
|
|
|
|
// relationship.
|
|
|
|
|
switch (role) {
|
|
|
|
|
case TEMP_ROLE:
|
|
|
|
|
// TEMP_ROLE means that we are not supposed to write through to the
|
|
|
|
|
// actual dive, but a temporary cylinder that is displayed while the
|
|
|
|
|
// user browses throught the cylinder types.
|
|
|
|
|
initTempCyl(index.row());
|
|
|
|
|
|
2020-02-27 18:46:48 +00:00
|
|
|
|
switch (index.column()) {
|
2020-02-28 19:38:04 +00:00
|
|
|
|
case TYPE: {
|
2024-05-28 19:31:11 +00:00
|
|
|
|
std::string type = value.toString().toStdString();
|
|
|
|
|
if (type != tempCyl.type.description) {
|
|
|
|
|
tempCyl.type.description = type;
|
2020-02-28 19:38:04 +00:00
|
|
|
|
dataChanged(index, index);
|
|
|
|
|
}
|
2020-03-27 20:09:59 +00:00
|
|
|
|
return true;
|
2020-02-28 19:38:04 +00:00
|
|
|
|
}
|
2020-02-27 18:46:48 +00:00
|
|
|
|
case SIZE:
|
2020-02-28 19:38:04 +00:00
|
|
|
|
if (tempCyl.type.size.mliter != value.toInt()) {
|
|
|
|
|
tempCyl.type.size.mliter = value.toInt();
|
2020-02-27 18:46:48 +00:00
|
|
|
|
dataChanged(index, index);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
case WORKINGPRESS:
|
2020-02-28 19:38:04 +00:00
|
|
|
|
if (tempCyl.type.workingpressure.mbar != value.toInt()) {
|
|
|
|
|
tempCyl.type.workingpressure.mbar = value.toInt();
|
2020-02-27 18:46:48 +00:00
|
|
|
|
dataChanged(index, index);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2020-02-28 19:38:04 +00:00
|
|
|
|
case COMMIT_ROLE:
|
|
|
|
|
commitTempCyl(index.row());
|
|
|
|
|
return true;
|
|
|
|
|
case REVERT_ROLE:
|
|
|
|
|
clearTempCyl();
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2020-02-27 18:46:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-27 18:07:11 +00:00
|
|
|
|
QString vString = value.toString();
|
|
|
|
|
bool changed = vString != data(index, role).toString();
|
|
|
|
|
|
2020-03-01 14:32:24 +00:00
|
|
|
|
// First, we make a shallow copy of the old cylinder. Then we modify the fields inside that copy.
|
|
|
|
|
// At the end, we either place an EditCylinder undo command (EquipmentTab) or copy the cylinder back (planner).
|
|
|
|
|
// Yes, this is not ideal, but the pragmatic thing to do for now.
|
2024-06-25 05:43:32 +00:00
|
|
|
|
cylinder_t cyl = *d->get_cylinder(row);
|
2020-03-01 14:32:24 +00:00
|
|
|
|
|
2020-02-27 18:01:43 +00:00
|
|
|
|
if (index.column() != TYPE && !changed)
|
|
|
|
|
return false;
|
|
|
|
|
|
2020-03-27 20:09:59 +00:00
|
|
|
|
Command::EditCylinderType type = Command::EditCylinderType::TYPE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
switch (index.column()) {
|
2020-02-27 18:01:43 +00:00
|
|
|
|
case TYPE:
|
2024-05-28 19:31:11 +00:00
|
|
|
|
cyl.type.description = vString.toStdString();
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::TYPE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
2024-03-30 12:40:00 +00:00
|
|
|
|
case SIZE:
|
|
|
|
|
cyl.type.size = string_to_volume(qPrintable(vString), cyl.type.workingpressure);
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::TYPE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
2024-03-30 12:40:00 +00:00
|
|
|
|
case WORKINGPRESS:
|
|
|
|
|
cyl.type.workingpressure = string_to_pressure(qPrintable(vString));
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::TYPE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case START:
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.start = string_to_pressure(qPrintable(vString));
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::PRESSURE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case END:
|
2020-02-27 18:01:43 +00:00
|
|
|
|
//if (!cyl->start.mbar || string_to_pressure(qPrintable(vString)).mbar <= cyl->start.mbar) {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.end = string_to_pressure(qPrintable(vString));
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::PRESSURE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
2020-02-27 18:01:43 +00:00
|
|
|
|
case O2: {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.gasmix.o2 = string_to_fraction(qPrintable(vString));
|
2016-05-22 01:00:22 +00:00
|
|
|
|
// fO2 + fHe must not be greater than 1
|
2020-03-01 14:32:24 +00:00
|
|
|
|
if (get_o2(cyl.gasmix) + get_he(cyl.gasmix) > 1000)
|
|
|
|
|
cyl.gasmix.he.permille = 1000 - get_o2(cyl.gasmix);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
pressure_t modpO2;
|
2024-05-27 15:09:48 +00:00
|
|
|
|
if (d->dcs[0].divemode == PSCR)
|
2020-03-01 14:32:24 +00:00
|
|
|
|
modpO2.mbar = prefs.decopo2 + (1000 - get_o2(cyl.gasmix)) * SURFACE_PRESSURE *
|
2015-05-28 19:23:49 +00:00
|
|
|
|
prefs.o2consumption / prefs.decosac / prefs.pscr_ratio;
|
|
|
|
|
else
|
|
|
|
|
modpO2.mbar = prefs.decopo2;
|
2024-06-30 14:17:20 +00:00
|
|
|
|
cyl.depth = d->gas_mod(cyl.gasmix, modpO2, M_OR_FT(3, 10));
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.bestmix_o2 = false;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::GASMIX;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case HE:
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.gasmix.he = string_to_fraction(qPrintable(vString));
|
2020-02-27 18:01:43 +00:00
|
|
|
|
// fO2 + fHe must not be greater than 1
|
2020-03-01 14:32:24 +00:00
|
|
|
|
if (get_o2(cyl.gasmix) + get_he(cyl.gasmix) > 1000)
|
|
|
|
|
cyl.gasmix.o2.permille = 1000 - get_he(cyl.gasmix);
|
|
|
|
|
cyl.bestmix_he = false;
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::GASMIX;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case DEPTH:
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.depth = string_to_depth(qPrintable(vString));
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::GASMIX;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
2020-02-27 18:01:43 +00:00
|
|
|
|
case MOD: {
|
2018-02-25 12:51:41 +00:00
|
|
|
|
if (QString::compare(qPrintable(vString), "*") == 0) {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.bestmix_o2 = true;
|
2017-03-06 12:27:39 +00:00
|
|
|
|
// Calculate fO2 for max. depth
|
2024-06-30 19:38:32 +00:00
|
|
|
|
cyl.gasmix.o2 = d->best_o2(d->maxdepth, inPlanner);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
} else {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.bestmix_o2 = false;
|
2016-07-06 12:40:35 +00:00
|
|
|
|
// Calculate fO2 for input depth
|
2024-06-30 19:38:32 +00:00
|
|
|
|
cyl.gasmix.o2 = d->best_o2(string_to_depth(qPrintable(vString)), inPlanner);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
}
|
|
|
|
|
pressure_t modpO2;
|
|
|
|
|
modpO2.mbar = prefs.decopo2;
|
2024-06-30 14:17:20 +00:00
|
|
|
|
cyl.depth = d->gas_mod(cyl.gasmix, modpO2, M_OR_FT(3, 10));
|
2016-07-06 12:40:32 +00:00
|
|
|
|
}
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::GASMIX;
|
2016-07-06 12:40:32 +00:00
|
|
|
|
break;
|
|
|
|
|
case MND:
|
2020-02-27 18:01:43 +00:00
|
|
|
|
if (QString::compare(qPrintable(vString), "*") == 0) {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.bestmix_he = true;
|
2020-02-27 18:01:43 +00:00
|
|
|
|
// Calculate fO2 for max. depth
|
2024-06-30 19:38:32 +00:00
|
|
|
|
cyl.gasmix.he = d->best_he(d->maxdepth, prefs.o2narcotic, make_fraction(get_o2(cyl.gasmix)));
|
2020-02-27 18:01:43 +00:00
|
|
|
|
} else {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.bestmix_he = false;
|
2020-02-27 18:01:43 +00:00
|
|
|
|
// Calculate fHe for input depth
|
2024-06-30 19:38:32 +00:00
|
|
|
|
cyl.gasmix.he = d->best_he(string_to_depth(qPrintable(vString)), prefs.o2narcotic, make_fraction(get_o2(cyl.gasmix)));
|
2016-07-06 12:40:32 +00:00
|
|
|
|
}
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::GASMIX;
|
2016-07-06 12:40:32 +00:00
|
|
|
|
break;
|
2020-02-27 18:01:43 +00:00
|
|
|
|
case USE: {
|
2016-04-28 14:33:05 +00:00
|
|
|
|
int use = vString.toInt();
|
|
|
|
|
if (use > NUM_GAS_USE - 1 || use < 0)
|
|
|
|
|
use = 0;
|
2020-03-01 14:32:24 +00:00
|
|
|
|
cyl.cylinder_use = (enum cylinderuse)use;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
2020-03-27 20:09:59 +00:00
|
|
|
|
type = Command::EditCylinderType::TYPE;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
break;
|
2022-02-19 17:47:25 +00:00
|
|
|
|
case SENSORS: {
|
|
|
|
|
bool ok = false;
|
|
|
|
|
int s = vString.toInt(&ok);
|
|
|
|
|
if (ok) {
|
2022-05-21 20:08:46 +00:00
|
|
|
|
Command::editSensors(index.row(), s, dcNr);
|
2022-02-19 17:47:25 +00:00
|
|
|
|
// We don't use the edit cylinder command and editing sensors is not relevant for planner
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
2020-03-01 14:32:24 +00:00
|
|
|
|
|
2020-03-01 15:12:13 +00:00
|
|
|
|
if (inPlanner) {
|
2020-03-01 14:32:24 +00:00
|
|
|
|
// In the planner - simply overwrite the cylinder in the dive with the modified cylinder.
|
2024-08-17 20:00:41 +00:00
|
|
|
|
*d->get_cylinder(row) = std::move(cyl);
|
2020-03-01 14:32:24 +00:00
|
|
|
|
dataChanged(index, index);
|
|
|
|
|
} else {
|
|
|
|
|
// On the EquipmentTab - place an editCylinder command.
|
2024-08-17 20:00:41 +00:00
|
|
|
|
int count = Command::editCylinder(index.row(), std::move(cyl), type, false);
|
2020-03-27 20:49:19 +00:00
|
|
|
|
emit divesEdited(count);
|
2020-03-01 14:32:24 +00:00
|
|
|
|
}
|
2015-05-28 19:23:49 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-21 15:53:42 +00:00
|
|
|
|
int CylindersModel::rowCount(const QModelIndex&) const
|
2015-05-28 19:23:49 +00:00
|
|
|
|
{
|
2021-11-20 08:37:28 +00:00
|
|
|
|
return numRows;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
// Only invoked from planner.
|
2015-05-28 19:23:49 +00:00
|
|
|
|
void CylindersModel::add()
|
|
|
|
|
{
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (!d)
|
|
|
|
|
return;
|
2024-05-28 19:31:11 +00:00
|
|
|
|
int row = static_cast<int>(d->cylinders.size());
|
2024-05-25 07:03:39 +00:00
|
|
|
|
cylinder_t cyl = create_new_manual_cylinder(d);
|
2015-05-28 19:23:49 +00:00
|
|
|
|
beginInsertRows(QModelIndex(), row, row);
|
2024-07-02 12:49:25 +00:00
|
|
|
|
d->cylinders.add(row, std::move(cyl));
|
2022-01-12 20:27:35 +00:00
|
|
|
|
++numRows;
|
2015-05-28 19:23:49 +00:00
|
|
|
|
endInsertRows();
|
2017-10-20 10:01:59 +00:00
|
|
|
|
emit dataChanged(createIndex(row, 0), createIndex(row, COLUMNS - 1));
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CylindersModel::clear()
|
|
|
|
|
{
|
2020-02-23 11:52:45 +00:00
|
|
|
|
beginResetModel();
|
|
|
|
|
d = nullptr;
|
2022-05-21 20:08:46 +00:00
|
|
|
|
dcNr = -1;
|
2020-02-23 11:52:45 +00:00
|
|
|
|
endResetModel();
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-21 20:08:46 +00:00
|
|
|
|
void CylindersModel::updateDive(dive *dIn, int dcNrIn)
|
2015-05-28 19:23:49 +00:00
|
|
|
|
{
|
2017-11-27 11:36:20 +00:00
|
|
|
|
#ifdef DEBUG_CYL
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (d)
|
|
|
|
|
dump_cylinders(dIn, true);
|
2017-11-27 11:36:20 +00:00
|
|
|
|
#endif
|
2019-08-04 16:44:57 +00:00
|
|
|
|
beginResetModel();
|
2020-02-23 11:44:09 +00:00
|
|
|
|
d = dIn;
|
2022-05-21 20:08:46 +00:00
|
|
|
|
dcNr = dcNrIn;
|
2021-11-20 08:37:28 +00:00
|
|
|
|
numRows = calcNumRows();
|
2019-08-04 16:44:57 +00:00
|
|
|
|
endResetModel();
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Qt::ItemFlags CylindersModel::flags(const QModelIndex &index) const
|
|
|
|
|
{
|
2023-01-21 00:09:44 +00:00
|
|
|
|
if (index.column() == REMOVE)
|
2015-05-28 19:23:49 +00:00
|
|
|
|
return Qt::ItemIsEnabled;
|
|
|
|
|
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-24 10:21:27 +00:00
|
|
|
|
// This function is only invoked from the planner! Therefore, there is
|
|
|
|
|
// no need to check whether we are in the planner. Perhaps move some
|
|
|
|
|
// of this functionality to the planner itself.
|
2019-11-26 22:41:56 +00:00
|
|
|
|
void CylindersModel::remove(QModelIndex index)
|
2015-05-28 19:23:49 +00:00
|
|
|
|
{
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (!d)
|
|
|
|
|
return;
|
2019-08-04 16:44:57 +00:00
|
|
|
|
|
|
|
|
|
if (index.column() != REMOVE)
|
2015-05-28 19:23:49 +00:00
|
|
|
|
return;
|
2017-10-08 03:14:57 +00:00
|
|
|
|
|
2020-02-24 10:21:27 +00:00
|
|
|
|
if (DivePlannerPointsModel::instance()->tankInUse(index.row()))
|
2017-10-20 11:30:04 +00:00
|
|
|
|
return;
|
2017-03-11 09:39:48 +00:00
|
|
|
|
|
2019-08-04 16:44:57 +00:00
|
|
|
|
beginRemoveRows(QModelIndex(), index.row(), index.row());
|
2020-02-23 11:44:09 +00:00
|
|
|
|
remove_cylinder(d, index.row());
|
2022-01-12 20:27:35 +00:00
|
|
|
|
--numRows;
|
2019-08-04 16:44:57 +00:00
|
|
|
|
endRemoveRows();
|
|
|
|
|
|
2024-05-28 19:31:11 +00:00
|
|
|
|
std::vector<int> mapping = get_cylinder_map_for_remove(static_cast<int>(d->cylinders.size() + 1), index.row());
|
2024-06-04 11:22:25 +00:00
|
|
|
|
cylinder_renumber(*d, mapping.data());
|
2020-04-21 07:34:40 +00:00
|
|
|
|
DivePlannerPointsModel::instance()->cylinderRenumber(mapping.data());
|
2015-05-28 19:23:49 +00:00
|
|
|
|
}
|
2016-07-06 12:40:30 +00:00
|
|
|
|
|
2020-02-26 21:32:04 +00:00
|
|
|
|
void CylindersModel::cylinderAdded(struct dive *changed, int pos)
|
|
|
|
|
{
|
|
|
|
|
if (d != changed)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// The row was already inserted by the undo command. Just inform the model.
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (pos < numRows) {
|
|
|
|
|
beginInsertRows(QModelIndex(), pos, pos);
|
|
|
|
|
++numRows;
|
|
|
|
|
endInsertRows();
|
|
|
|
|
}
|
|
|
|
|
updateNumRows();
|
2020-02-26 21:32:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CylindersModel::cylinderRemoved(struct dive *changed, int pos)
|
|
|
|
|
{
|
|
|
|
|
if (d != changed)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// The row was already deleted by the undo command. Just inform the model.
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (pos < numRows) {
|
|
|
|
|
beginRemoveRows(QModelIndex(), pos, pos);
|
|
|
|
|
--numRows;
|
|
|
|
|
endRemoveRows();
|
|
|
|
|
}
|
|
|
|
|
updateNumRows();
|
2020-02-26 21:32:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CylindersModel::cylinderEdited(struct dive *changed, int pos)
|
|
|
|
|
{
|
|
|
|
|
if (d != changed)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (pos < numRows)
|
|
|
|
|
dataChanged(index(pos, TYPE), index(pos, USE));
|
|
|
|
|
updateNumRows();
|
2020-02-26 21:32:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
void CylindersModel::updateNumRows()
|
|
|
|
|
{
|
|
|
|
|
int numRowsNew = calcNumRows();
|
|
|
|
|
if (numRowsNew < numRows) {
|
|
|
|
|
beginRemoveRows(QModelIndex(), numRowsNew, numRows - 1);
|
|
|
|
|
numRows = numRowsNew;
|
|
|
|
|
endRemoveRows();
|
|
|
|
|
} else if (numRowsNew > numRows) {
|
|
|
|
|
beginInsertRows(QModelIndex(), numRows, numRowsNew - 1);
|
|
|
|
|
numRows = numRowsNew;
|
|
|
|
|
endInsertRows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Only invoked from planner.
|
2017-10-11 19:29:47 +00:00
|
|
|
|
void CylindersModel::moveAtFirst(int cylid)
|
|
|
|
|
{
|
2024-05-28 19:31:11 +00:00
|
|
|
|
if (!d || cylid <= 0 || cylid >= static_cast<int>(d->cylinders.size()))
|
2020-02-23 11:44:09 +00:00
|
|
|
|
return;
|
2017-10-11 19:29:47 +00:00
|
|
|
|
cylinder_t temp_cyl;
|
|
|
|
|
|
|
|
|
|
beginMoveRows(QModelIndex(), cylid, cylid, QModelIndex(), 0);
|
2024-05-28 19:31:11 +00:00
|
|
|
|
move_in_range(d->cylinders, cylid, cylid + 1, 0);
|
2019-08-04 16:44:57 +00:00
|
|
|
|
|
2020-03-11 10:30:51 +00:00
|
|
|
|
// Create a mapping of cylinder indices:
|
2019-08-04 16:44:57 +00:00
|
|
|
|
// 1) Fill mapping[0]..mapping[cyl] with 0..index
|
|
|
|
|
// 2) Set mapping[cyl] to 0
|
|
|
|
|
// 3) Fill mapping[cyl+1]..mapping[end] with cyl..
|
2024-05-28 19:31:11 +00:00
|
|
|
|
std::vector<int> mapping(d->cylinders.size());
|
2019-08-04 16:44:57 +00:00
|
|
|
|
std::iota(mapping.begin(), mapping.begin() + cylid, 1);
|
2017-10-11 19:29:47 +00:00
|
|
|
|
mapping[cylid] = 0;
|
2019-08-04 16:44:57 +00:00
|
|
|
|
std::iota(mapping.begin() + (cylid + 1), mapping.end(), cylid);
|
2024-06-04 11:22:25 +00:00
|
|
|
|
cylinder_renumber(*d, mapping.data());
|
2020-03-01 15:12:13 +00:00
|
|
|
|
if (inPlanner)
|
2020-04-21 07:34:40 +00:00
|
|
|
|
DivePlannerPointsModel::instance()->cylinderRenumber(mapping.data());
|
2017-10-20 14:54:14 +00:00
|
|
|
|
endMoveRows();
|
2017-10-11 19:29:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
// Only invoked from planner.
|
2016-07-06 12:40:30 +00:00
|
|
|
|
void CylindersModel::updateDecoDepths(pressure_t olddecopo2)
|
|
|
|
|
{
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (!d || numRows <= 0)
|
2020-02-23 11:44:09 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2016-07-06 12:40:30 +00:00
|
|
|
|
pressure_t decopo2;
|
|
|
|
|
decopo2.mbar = prefs.decopo2;
|
2024-05-28 19:31:11 +00:00
|
|
|
|
for (auto &cyl: d->cylinders) {
|
2016-07-06 12:40:30 +00:00
|
|
|
|
/* If the gas's deco MOD matches the old pO2, it will have been automatically calculated and should be updated.
|
|
|
|
|
* If they don't match, we should leave the user entered depth as it is */
|
2024-06-30 14:17:20 +00:00
|
|
|
|
if (cyl.depth.mm == d->gas_mod(cyl.gasmix, olddecopo2, M_OR_FT(3, 10)).mm) {
|
|
|
|
|
cyl.depth = d->gas_mod(cyl.gasmix, decopo2, M_OR_FT(3, 10));
|
2016-07-06 12:40:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-20 08:37:28 +00:00
|
|
|
|
emit dataChanged(createIndex(0, 0), createIndex(numRows - 1, COLUMNS - 1));
|
2016-07-06 12:40:30 +00:00
|
|
|
|
}
|
2016-07-06 12:40:35 +00:00
|
|
|
|
|
2017-03-13 07:25:32 +00:00
|
|
|
|
void CylindersModel::updateTrashIcon()
|
|
|
|
|
{
|
2021-11-20 08:37:28 +00:00
|
|
|
|
if (!d || numRows <= 0)
|
2020-02-23 11:44:09 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
emit dataChanged(createIndex(0, 0), createIndex(numRows - 1, 0));
|
2017-03-13 07:25:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
// Only invoked from planner.
|
2016-07-06 12:40:35 +00:00
|
|
|
|
bool CylindersModel::updateBestMixes()
|
|
|
|
|
{
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (!d)
|
|
|
|
|
return false;
|
|
|
|
|
|
2016-07-06 12:40:35 +00:00
|
|
|
|
// Check if any of the cylinders are best mixes, update if needed
|
|
|
|
|
bool gasUpdated = false;
|
2024-05-28 19:31:11 +00:00
|
|
|
|
for (auto &cyl: d->cylinders) {
|
|
|
|
|
if (cyl.bestmix_o2) {
|
2024-06-30 19:38:32 +00:00
|
|
|
|
cyl.gasmix.o2 = d->best_o2(d->maxdepth, inPlanner);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
// fO2 + fHe must not be greater than 1
|
2024-05-28 19:31:11 +00:00
|
|
|
|
if (get_o2(cyl.gasmix) + get_he(cyl.gasmix) > 1000)
|
|
|
|
|
cyl.gasmix.he.permille = 1000 - get_o2(cyl.gasmix);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
pressure_t modpO2;
|
|
|
|
|
modpO2.mbar = prefs.decopo2;
|
2024-06-30 14:17:20 +00:00
|
|
|
|
cyl.depth = d->gas_mod(cyl.gasmix, modpO2, M_OR_FT(3, 10));
|
2016-07-06 12:40:35 +00:00
|
|
|
|
gasUpdated = true;
|
|
|
|
|
}
|
2024-05-28 19:31:11 +00:00
|
|
|
|
if (cyl.bestmix_he) {
|
2024-06-30 19:38:32 +00:00
|
|
|
|
cyl.gasmix.he = d->best_he(d->maxdepth, prefs.o2narcotic, cyl.gasmix.o2);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
// fO2 + fHe must not be greater than 1
|
2024-05-28 19:31:11 +00:00
|
|
|
|
if (get_o2(cyl.gasmix) + get_he(cyl.gasmix) > 1000)
|
|
|
|
|
cyl.gasmix.o2.permille = 1000 - get_he(cyl.gasmix);
|
2016-07-06 12:40:35 +00:00
|
|
|
|
gasUpdated = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-07-06 12:40:37 +00:00
|
|
|
|
/* This slot is called when the bottom pO2 and END preferences are updated, we want to
|
|
|
|
|
* emit dataChanged so MOD and MND are refreshed, even if the gas mix hasn't been changed */
|
2017-12-01 11:49:38 +00:00
|
|
|
|
if (gasUpdated)
|
2020-07-11 11:15:21 +00:00
|
|
|
|
emitDataChanged();
|
2016-07-06 12:40:35 +00:00
|
|
|
|
return gasUpdated;
|
|
|
|
|
}
|
2019-02-23 21:09:34 +00:00
|
|
|
|
|
2021-11-20 08:37:28 +00:00
|
|
|
|
void CylindersModel::emitDataChanged()
|
|
|
|
|
{
|
|
|
|
|
emit dataChanged(createIndex(0, 0), createIndex(numRows - 1, COLUMNS - 1));
|
2020-07-11 11:15:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-23 07:22:26 +00:00
|
|
|
|
void CylindersModel::cylindersReset(const QVector<dive *> &dives)
|
2019-02-23 21:09:34 +00:00
|
|
|
|
{
|
|
|
|
|
// This model only concerns the currently displayed dive. If this is not among the
|
|
|
|
|
// dives that had their cylinders reset, exit.
|
2020-02-23 11:44:09 +00:00
|
|
|
|
if (!d || std::find(dives.begin(), dives.end(), d) == dives.end())
|
2019-02-23 21:09:34 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2020-02-23 11:44:09 +00:00
|
|
|
|
// And update the model (the actual change was already performed in the backend)..
|
|
|
|
|
beginResetModel();
|
2021-11-20 08:37:28 +00:00
|
|
|
|
numRows = calcNumRows();
|
2020-02-23 11:44:09 +00:00
|
|
|
|
endResetModel();
|
2019-02-23 21:09:34 +00:00
|
|
|
|
}
|
2020-01-30 19:12:11 +00:00
|
|
|
|
|
2020-02-28 19:38:04 +00:00
|
|
|
|
// Save the cylinder in the given row so that we can revert if the user cancels a type-editing action.
|
|
|
|
|
void CylindersModel::initTempCyl(int row)
|
|
|
|
|
{
|
|
|
|
|
if (!d || tempRow == row)
|
|
|
|
|
return;
|
|
|
|
|
clearTempCyl();
|
2024-06-25 05:43:32 +00:00
|
|
|
|
const cylinder_t *cyl = d->get_cylinder(row);
|
2020-02-28 19:38:04 +00:00
|
|
|
|
if (!cyl)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
tempRow = row;
|
2024-05-28 19:31:11 +00:00
|
|
|
|
tempCyl = *cyl;
|
2020-02-28 19:38:04 +00:00
|
|
|
|
|
|
|
|
|
dataChanged(index(row, TYPE), index(row, USE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CylindersModel::clearTempCyl()
|
|
|
|
|
{
|
|
|
|
|
if (tempRow < 0)
|
|
|
|
|
return;
|
|
|
|
|
int oldRow = tempRow;
|
|
|
|
|
tempRow = -1;
|
2024-05-28 19:31:11 +00:00
|
|
|
|
tempCyl = cylinder_t();
|
2020-02-28 19:38:04 +00:00
|
|
|
|
dataChanged(index(oldRow, TYPE), index(oldRow, USE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CylindersModel::commitTempCyl(int row)
|
|
|
|
|
{
|
|
|
|
|
if (tempRow < 0)
|
|
|
|
|
return;
|
|
|
|
|
if (row != tempRow)
|
|
|
|
|
return clearTempCyl(); // Huh? We are supposed to commit a different row than the one we stored?
|
2024-06-25 05:43:32 +00:00
|
|
|
|
cylinder_t *cyl = d->get_cylinder(tempRow);
|
2020-02-28 19:38:04 +00:00
|
|
|
|
if (!cyl)
|
|
|
|
|
return;
|
|
|
|
|
// Only submit a command if the type changed
|
2024-05-28 19:31:11 +00:00
|
|
|
|
if (cyl->type.description != tempCyl.type.description || gettextFromC::tr(cyl->type.description.c_str()) != QString::fromStdString(tempCyl.type.description)) {
|
2020-03-27 20:49:19 +00:00
|
|
|
|
if (inPlanner) {
|
2020-02-28 19:38:04 +00:00
|
|
|
|
std::swap(*cyl, tempCyl);
|
2020-03-27 20:49:19 +00:00
|
|
|
|
} else {
|
|
|
|
|
int count = Command::editCylinder(tempRow, tempCyl, Command::EditCylinderType::TYPE, false);
|
|
|
|
|
emit divesEdited(count);
|
|
|
|
|
}
|
2020-02-28 19:38:04 +00:00
|
|
|
|
}
|
2024-05-28 19:31:11 +00:00
|
|
|
|
tempCyl = cylinder_t();
|
2020-02-28 19:38:04 +00:00
|
|
|
|
tempRow = -1;
|
|
|
|
|
}
|