mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Merge branch 'moreDivePlanner' of https://github.com/tcanabrava/subsurface
This commit is contained in:
commit
167a55f6f5
3 changed files with 30 additions and 7 deletions
|
@ -426,13 +426,10 @@ void DivePlannerGraphics::createDecoStops()
|
|||
// Get the user-input and calculate the dive info
|
||||
// Not sure if this is the place to create the diveplan...
|
||||
// We just start with a surface node at time = 0
|
||||
struct diveplan diveplan;
|
||||
struct diveplan diveplan = plannerModel->getDiveplan();
|
||||
struct divedatapoint *dp = create_dp(0, 0, 209, 0, 0);
|
||||
dp->entered = TRUE;
|
||||
diveplan.dp = dp;
|
||||
diveplan.gflow = 30;
|
||||
diveplan.gfhigh = 70;
|
||||
diveplan.surface_pressure = 1013;
|
||||
|
||||
int rowCount = plannerModel->rowCount();
|
||||
int lastIndex = -1;
|
||||
|
@ -841,6 +838,15 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
|
|||
connect(ui->lowGF, SIGNAL(textChanged(QString)), this, SLOT(gflowChanged(QString)));
|
||||
connect(ui->highGF, SIGNAL(textChanged(QString)), this, SLOT(gfhighChanged(QString)));
|
||||
connect(ui->lastStop, SIGNAL(toggled(bool)), this, SLOT(lastStopChanged(bool)));
|
||||
|
||||
/* set defaults. */
|
||||
ui->startTime->setTime( QTime(1, 0) );
|
||||
ui->ATMPressure->setText( "1013" );
|
||||
ui->bottomSAC->setText("20");
|
||||
ui->decoStopSAC->setText("17");
|
||||
ui->lowGF->setText("30");
|
||||
ui->highGF->setText("75");
|
||||
|
||||
}
|
||||
|
||||
void DivePlannerWidget::startTimeChanged(const QTime& time)
|
||||
|
@ -888,7 +894,7 @@ QVariant DivePlannerPointsModel::data(const QModelIndex& index, int role) const
|
|||
if(role == Qt::DisplayRole){
|
||||
divedatapoint p = divepoints.at(index.row());
|
||||
switch(index.column()){
|
||||
case CCSETPOINT: return 0;
|
||||
case CCSETPOINT: return p.po2;
|
||||
case DEPTH: return p.depth / 1000;
|
||||
case DURATION: return p.time / 60;
|
||||
case GAS: return strForAir(p);
|
||||
|
@ -912,7 +918,12 @@ bool DivePlannerPointsModel::setData(const QModelIndex& index, const QVariant& v
|
|||
switch(index.column()){
|
||||
case DEPTH: p.depth = value.toInt() * 1000; break;
|
||||
case DURATION: p.time = value.toInt() * 60; break;
|
||||
case CCSETPOINT: /* what do I do here? */
|
||||
case CCSETPOINT:{
|
||||
int po2 = 0;
|
||||
QByteArray gasv = value.toByteArray();
|
||||
if (validate_po2(gasv.data(), &po2))
|
||||
p.po2 = po2;
|
||||
} break;
|
||||
case GAS: {
|
||||
int o2 = 0;
|
||||
int he = 0;
|
||||
|
@ -972,26 +983,31 @@ void DivePlannerPointsModel::createPlan()
|
|||
void DivePlannerPointsModel::setBottomSac(int sac)
|
||||
{
|
||||
diveplan.bottomsac = sac;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setDecoSac(int sac)
|
||||
{
|
||||
diveplan.decosac = sac;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setGFHigh(short int gfhigh)
|
||||
{
|
||||
diveplan.gfhigh = gfhigh;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setGFLow(short int ghflow)
|
||||
{
|
||||
diveplan.gflow = ghflow;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setSurfacePressure(int pressure)
|
||||
{
|
||||
diveplan.surface_pressure = pressure;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setLastStop6m(bool value)
|
||||
|
@ -1001,6 +1017,7 @@ void DivePlannerPointsModel::setLastStop6m(bool value)
|
|||
void DivePlannerPointsModel::setStartTime(const QTime& t)
|
||||
{
|
||||
diveplan.when = t.msec();
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount()-1, COLUMNS-1));
|
||||
}
|
||||
|
||||
bool divePointsLessThan(const divedatapoint& p1, const divedatapoint& p2){
|
||||
|
@ -1053,3 +1070,8 @@ void DivePlannerPointsModel::remove(const QModelIndex& index)
|
|||
divepoints.remove(index.row());
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
struct diveplan DivePlannerPointsModel::getDiveplan()
|
||||
{
|
||||
return diveplan;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
int addStop(int meters, int minutes,const QString& gas, int ccpoint );
|
||||
void editStop(int row, divedatapoint newData );
|
||||
divedatapoint at(int row);
|
||||
struct diveplan getDiveplan();
|
||||
public slots:
|
||||
void setGFHigh(short gfhigh);
|
||||
void setGFLow(short ghflow);
|
||||
|
|
|
@ -108,7 +108,7 @@ void ComboBoxDelegate::testActivation(const QString& s)
|
|||
bool ComboBoxDelegate::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
// Reacts on Key_UP and Key_DOWN to show the QComboBox - list of choices.
|
||||
if (event->type() == QEvent::KeyPress){
|
||||
if (event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride){
|
||||
if (object == currCombo.comboEditor){ // the 'LineEdit' part
|
||||
QKeyEvent *ev = static_cast<QKeyEvent*>(event);
|
||||
if(ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down){
|
||||
|
|
Loading…
Add table
Reference in a new issue