diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/cylindermodel.cpp | 14 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 34 | ||||
-rw-r--r-- | qt-models/diveplannermodel.h | 2 | ||||
-rw-r--r-- | qt-models/divetripmodel.cpp | 14 |
4 files changed, 40 insertions, 24 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index 59d993374..4ae98da5b 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -20,7 +20,7 @@ CylindersModel::CylindersModel(QObject *parent) : QVariant CylindersModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (role == Qt::DisplayRole && in_planner() && section == WORKINGPRESS) + if (role == Qt::DisplayRole && orientation == Qt::Horizontal && in_planner() && section == WORKINGPRESS) return tr("Start press."); else return CleanerTableModel::headerData(section, orientation, role); @@ -143,7 +143,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const // seem implausible case START: case END: - if ((cyl->start.mbar && !cyl->end.mbar) || + if ((cyl->start.mbar && !cyl->end.mbar && !cyl->sample_end.mbar) || (cyl->end.mbar && cyl->start.mbar <= cyl->end.mbar)) ret = REDORANGE1_HIGH_TRANS; break; @@ -157,7 +157,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const font.setItalic(!cyl->start.mbar); break; case END: - font.setItalic(!cyl->end.mbar); + font.setItalic(!cyl->end.mbar && !cyl->sample_end.mbar); break; } ret = font; @@ -256,10 +256,10 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const ret = tr("Switch depth for deco gas. Calculated using Deco pO₂ preference, unless set manually."); break; case MOD: - ret = tr("Calculated using Bottom pO₂ preference. Setting MOD adjusts O₂%, set to '*' for best O₂% for max depth."); + ret = tr("Calculated using Bottom pO₂ preference. Setting MOD adjusts O₂%, set to '*' for best O₂% for max. depth."); break; case MND: - ret = tr("Calculated using Best Mix END preference. Setting MND adjusts He%, set to '*' for best He% for max depth."); + ret = tr("Calculated using Best Mix END preference. Setting MND adjusts He%, set to '*' for best He% for max. depth."); break; } break; @@ -383,7 +383,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in if (CHANGED()) { if (QString::compare(vString.toUtf8().data(), "*") == 0) { cyl->bestmix_o2 = true; - // Calculate fO2 for max depth + // Calculate fO2 for max. depth cyl->gasmix.o2 = best_o2(displayed_dive.maxdepth, &displayed_dive); } else { cyl->bestmix_o2 = false; @@ -400,7 +400,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in if (CHANGED()) { if (QString::compare(vString.toUtf8().data(), "*") == 0) { cyl->bestmix_he = true; - // Calculate fO2 for max depth + // Calculate fO2 for max. depth cyl->gasmix.he = best_he(displayed_dive.maxdepth, &displayed_dive); } else { cyl->bestmix_he = false; diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 46326c678..f4b821e6e 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -152,15 +152,15 @@ void DivePlannerPointsModel::setupCylinders() CylindersModel::instance()->copyFromDive(&displayed_dive); } -// Update the dive's maximum depth. Returns true if max depth changed +// Update the dive's maximum depth. Returns true if max. depth changed bool DivePlannerPointsModel::updateMaxDepth() { int prevMaxDepth = displayed_dive.maxdepth.mm; displayed_dive.maxdepth.mm = 0; for (int i = 0; i < rowCount(); i++) { divedatapoint p = at(i); - if (p.depth > displayed_dive.maxdepth.mm) - displayed_dive.maxdepth.mm = p.depth; + if (p.depth.mm > displayed_dive.maxdepth.mm) + displayed_dive.maxdepth.mm = p.depth.mm; } return (displayed_dive.maxdepth.mm != prevMaxDepth); } @@ -241,7 +241,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const case CCSETPOINT: return (double)p.setpoint / 1000; case DEPTH: - return (int) lrint(get_depth_units(p.depth, NULL, NULL)); + return (int) lrint(get_depth_units(p.depth.mm, NULL, NULL)); case RUNTIME: return p.time / 60; case DURATION: @@ -401,6 +401,20 @@ void DivePlannerPointsModel::setDecoSac(double sac) emitDataChanged(); } +void DivePlannerPointsModel::setSacFactor(double factor) +{ + auto planner = SettingsObjectWrapper::instance()->planner_settings; + planner->setSacFactor((int) round(factor * 100)); + emitDataChanged(); +} + +void DivePlannerPointsModel::setProblemSolvingTime(int minutes) +{ + auto planner = SettingsObjectWrapper::instance()->planner_settings; + planner->setProblemSolvingTime(minutes); + emitDataChanged(); +} + void DivePlannerPointsModel::setGFHigh(const int gfhigh) { tempGFHigh = gfhigh; @@ -542,7 +556,7 @@ void DivePlannerPointsModel::setDropStoneMode(bool value) beginInsertRows(QModelIndex(), 0, 0); /* Copy the first current point */ divedatapoint p = divepoints.at(0); - p.time = p.depth / prefs.descrate; + p.time = p.depth.mm / prefs.descrate; divepoints.push_front(p); endInsertRows(); } @@ -609,7 +623,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_ if (seconds == 0 && milimeters == 0 && row != 0) { /* this is only possible if the user clicked on the 'plus' sign on the DivePoints Table */ const divedatapoint t = divepoints.at(lastEnteredPoint()); - milimeters = t.depth; + milimeters = t.depth.mm; seconds = t.time + 600; // 10 minutes. cylinderid = t.cylinderid; ccpoint = t.setpoint; @@ -648,7 +662,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_ // add the new stop beginInsertRows(QModelIndex(), row, row); divedatapoint point; - point.depth = milimeters; + point.depth.mm = milimeters; point.time = seconds; point.cylinderid = cylinderid; point.setpoint = ccpoint; @@ -793,11 +807,11 @@ void DivePlannerPointsModel::createTemporaryPlan() lastIndex = i; if (i == 0 && mode == PLAN && prefs.drop_stone_mode) { /* Okay, we add a first segment where we go down to depth */ - plan_add_segment(&diveplan, p.depth / prefs.descrate, p.depth, p.cylinderid, p.setpoint, true); - deltaT -= p.depth / prefs.descrate; + plan_add_segment(&diveplan, p.depth.mm / prefs.descrate, p.depth.mm, p.cylinderid, p.setpoint, true); + deltaT -= p.depth.mm / prefs.descrate; } if (p.entered) - plan_add_segment(&diveplan, deltaT, p.depth, p.cylinderid, p.setpoint, true); + plan_add_segment(&diveplan, deltaT, p.depth.mm, p.cylinderid, p.setpoint, true); } // what does the cache do??? diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h index e9227f671..bc3458ffd 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -91,6 +91,8 @@ slots: void setReserveGas(int reserve); void setSwitchAtReqStop(bool value); void setMinSwitchDuration(int duration); + void setSacFactor(double factor); + void setProblemSolvingTime(int minutes); signals: void planCreated(); diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 20bdc3666..435d72a0b 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -223,7 +223,7 @@ QVariant DiveItem::data(int column, int role) const retVal = tr("Duration"); break; case TEMPERATURE: - retVal = tr("Temp(%1%2)").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F"); + retVal = tr("Temp.(%1%2)").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F"); break; case TOTALWEIGHT: retVal = tr("Weight(%1)").arg((get_units()->weight == units::KG) ? tr("kg") : tr("lbs")); @@ -232,7 +232,7 @@ QVariant DiveItem::data(int column, int role) const retVal = tr("Suit"); break; case CYLINDER: - retVal = tr("Cyl"); + retVal = tr("Cylinder"); break; case GAS: retVal = tr("Gas"); @@ -246,7 +246,7 @@ QVariant DiveItem::data(int column, int role) const retVal = tr("OTU"); break; case MAXCNS: - retVal = tr("Max CNS"); + retVal = tr("Max. CNS"); break; case PHOTOS: retVal = tr("Photos before/during/after dive"); @@ -445,7 +445,7 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int ret = tr("Duration"); break; case TEMPERATURE: - ret = tr("Temp"); + ret = tr("Temp."); break; case TOTALWEIGHT: ret = tr("Weight"); @@ -454,7 +454,7 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int ret = tr("Suit"); break; case CYLINDER: - ret = tr("Cyl"); + ret = tr("Cylinder"); break; case GAS: ret = tr("Gas"); @@ -494,7 +494,7 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int ret = tr("Duration"); break; case TEMPERATURE: - ret = tr("Temp(%1%2)").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F"); + ret = tr("Temp.(%1%2)").arg(UTF8_DEGREE).arg((get_units()->temperature == units::CELSIUS) ? "C" : "F"); break; case TOTALWEIGHT: ret = tr("Weight(%1)").arg((get_units()->weight == units::KG) ? tr("kg") : tr("lbs")); @@ -503,7 +503,7 @@ QVariant DiveTripModel::headerData(int section, Qt::Orientation orientation, int ret = tr("Suit"); break; case CYLINDER: - ret = tr("Cyl"); + ret = tr("Cylinder"); break; case GAS: ret = tr("Gas"); |