mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Planner settings ascend and descende rate: Wire up UI elements correctly
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate (1x) correctly so that the profile and calculation is updated immediately after the value is changed (e.g. increased/decresed by 1) by clicking the QSpinBox arrows. Until now one had to click into the profile or change another planner preference first before the change became effective. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
52445ec8f5
commit
cf409b59ba
4 changed files with 67 additions and 25 deletions
|
@ -359,16 +359,16 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
connect(ui.display_variations, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayVariations(bool)));
|
||||
connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
|
||||
connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int)));
|
||||
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRate50, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRateStops, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.descRate, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRate75, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRate50, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRateStops, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRateLast6m, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.descRate, SIGNAL(editingFinished()), plannerModel, SLOT(emitDataChanged()));
|
||||
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(setAscrate75(int)));
|
||||
connect(ui.ascRate50, SIGNAL(valueChanged(int)), plannerModel, SLOT(setAscrate50(int)));
|
||||
connect(ui.ascRateStops, SIGNAL(valueChanged(int)), plannerModel, SLOT(setAscratestops(int)));
|
||||
connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), plannerModel, SLOT(setAscratelast6m(int)));
|
||||
connect(ui.descRate, SIGNAL(valueChanged(int)), plannerModel, SLOT(setDescrate(int)));
|
||||
connect(ui.ascRate75, SIGNAL(editingFinished()), plannerModel, SLOT(setAscrate75(int)));
|
||||
connect(ui.ascRate50, SIGNAL(editingFinished()), plannerModel, SLOT(setAscrate50(int)));
|
||||
connect(ui.ascRateStops, SIGNAL(editingFinished()), plannerModel, SLOT(setAscratestops(int)));
|
||||
connect(ui.ascRateLast6m, SIGNAL(editingFinished()), plannerModel, SLOT(setAscratelast6m(int)));
|
||||
connect(ui.descRate, SIGNAL(editingFinished()), plannerModel, SLOT(setDescrate(int)));
|
||||
connect(ui.drop_stone_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setDropStoneMode(bool)));
|
||||
connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
|
||||
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
|
||||
|
@ -384,11 +384,11 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
connect(ui.bestmixEND, SIGNAL(valueChanged(int)), CylindersModel::instance(), SLOT(updateBestMixes()));
|
||||
|
||||
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(disableDecoElements(int)));
|
||||
connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
|
||||
connect(ui.ascRate50, SIGNAL(valueChanged(int)), this, SLOT(setAscRate50(int)));
|
||||
connect(ui.descRate, SIGNAL(valueChanged(int)), this, SLOT(setDescRate(int)));
|
||||
connect(ui.ascRateStops, SIGNAL(valueChanged(int)), this, SLOT(setAscRateStops(int)));
|
||||
connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), this, SLOT(setAscRateLast6m(int)));
|
||||
connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscrate75(int)));
|
||||
connect(ui.ascRate50, SIGNAL(valueChanged(int)), this, SLOT(setAscrate50(int)));
|
||||
connect(ui.descRate, SIGNAL(valueChanged(int)), this, SLOT(setDescrate(int)));
|
||||
connect(ui.ascRateStops, SIGNAL(valueChanged(int)), this, SLOT(setAscratestops(int)));
|
||||
connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), this, SLOT(setAscratelast6m(int)));
|
||||
connect(ui.sacfactor, SIGNAL(valueChanged(double)), this, SLOT(sacFactorChanged(double)));
|
||||
connect(ui.problemsolvingtime, SIGNAL(valueChanged(int)), this, SLOT(problemSolvingTimeChanged(int)));
|
||||
connect(ui.bottompo2, SIGNAL(valueChanged(double)), this, SLOT(setBottomPo2(double)));
|
||||
|
@ -484,27 +484,27 @@ void PlannerSettingsWidget::printDecoPlan()
|
|||
{
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::setAscRate75(int rate)
|
||||
void PlannerSettingsWidget::setAscrate75(int rate)
|
||||
{
|
||||
SettingsObjectWrapper::instance()->planner_settings->setAscrate75(lrint(rate * UNIT_FACTOR));
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::setAscRate50(int rate)
|
||||
void PlannerSettingsWidget::setAscrate50(int rate)
|
||||
{
|
||||
SettingsObjectWrapper::instance()->planner_settings->setAscrate50(lrint(rate * UNIT_FACTOR));
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::setAscRateStops(int rate)
|
||||
void PlannerSettingsWidget::setAscratestops(int rate)
|
||||
{
|
||||
SettingsObjectWrapper::instance()->planner_settings->setAscratestops(lrint(rate * UNIT_FACTOR));
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::setAscRateLast6m(int rate)
|
||||
void PlannerSettingsWidget::setAscratelast6m(int rate)
|
||||
{
|
||||
SettingsObjectWrapper::instance()->planner_settings->setAscratelast6m(lrint(rate * UNIT_FACTOR));
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::setDescRate(int rate)
|
||||
void PlannerSettingsWidget::setDescrate(int rate)
|
||||
{
|
||||
SettingsObjectWrapper::instance()->planner_settings->setDescrate(lrint(rate * UNIT_FACTOR));
|
||||
}
|
||||
|
|
|
@ -74,11 +74,11 @@ slots:
|
|||
void bottomSacChanged(const double bottomSac);
|
||||
void decoSacChanged(const double decosac);
|
||||
void printDecoPlan();
|
||||
void setAscRate75(int rate);
|
||||
void setAscRate50(int rate);
|
||||
void setAscRateStops(int rate);
|
||||
void setAscRateLast6m(int rate);
|
||||
void setDescRate(int rate);
|
||||
void setAscrate75(int rate);
|
||||
void setAscrate50(int rate);
|
||||
void setAscratestops(int rate);
|
||||
void setAscratelast6m(int rate);
|
||||
void setDescrate(int rate);
|
||||
void sacFactorChanged(const double factor);
|
||||
void problemSolvingTimeChanged(const int min);
|
||||
void setBottomPo2(double po2);
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include <QApplication>
|
||||
#include <QTextDocument>
|
||||
|
||||
#define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0)
|
||||
|
||||
/* TODO: Port this to CleanerTableModel to remove a bit of boilerplate and
|
||||
* use the signal warningMessage() to communicate errors to the MainWindow.
|
||||
*/
|
||||
|
@ -494,6 +496,41 @@ void DivePlannerPointsModel::setLastStop6m(bool value)
|
|||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setAscrate75(int rate)
|
||||
{
|
||||
auto planner = SettingsObjectWrapper::instance()->planner_settings;
|
||||
planner->setAscrate75(lrint(rate * UNIT_FACTOR));
|
||||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setAscrate50(int rate)
|
||||
{
|
||||
auto planner = SettingsObjectWrapper::instance()->planner_settings;
|
||||
planner->setAscrate50(lrint(rate * UNIT_FACTOR));
|
||||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setAscratestops(int rate)
|
||||
{
|
||||
auto planner = SettingsObjectWrapper::instance()->planner_settings;
|
||||
planner->setAscratestops(lrint(rate * UNIT_FACTOR));
|
||||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setAscratelast6m(int rate)
|
||||
{
|
||||
auto planner = SettingsObjectWrapper::instance()->planner_settings;
|
||||
planner->setAscratelast6m(lrint(rate * UNIT_FACTOR));
|
||||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setDescrate(int rate)
|
||||
{
|
||||
auto planner = SettingsObjectWrapper::instance()->planner_settings;
|
||||
planner->setDescrate(lrint(rate * UNIT_FACTOR));
|
||||
emitDataChanged();
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setVerbatim(bool value)
|
||||
{
|
||||
auto planner = SettingsObjectWrapper::instance()->planner_settings;
|
||||
|
|
|
@ -95,6 +95,11 @@ slots:
|
|||
void setMinSwitchDuration(int duration);
|
||||
void setSacFactor(double factor);
|
||||
void setProblemSolvingTime(int minutes);
|
||||
void setAscrate75(int rate);
|
||||
void setAscrate50(int rate);
|
||||
void setAscratestops(int rate);
|
||||
void setAscratelast6m(int rate);
|
||||
void setDescrate(int rate);
|
||||
|
||||
signals:
|
||||
void planCreated();
|
||||
|
|
Loading…
Add table
Reference in a new issue