mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Information tab: Make air and water tempertatures editable
The undo stack is preserved. This is in preparation of removing temperatures from the Notes tab. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za>
This commit is contained in:
parent
7a4abd7477
commit
2fe1121b1c
3 changed files with 29 additions and 10 deletions
|
@ -63,8 +63,8 @@ void TabDiveInformation::clear()
|
||||||
ui->surfaceIntervalText->clear();
|
ui->surfaceIntervalText->clear();
|
||||||
ui->maximumDepthText->clear();
|
ui->maximumDepthText->clear();
|
||||||
ui->averageDepthText->clear();
|
ui->averageDepthText->clear();
|
||||||
ui->waterTemperatureText->clear();
|
ui->watertemp->clear();
|
||||||
ui->airTemperatureText->clear();
|
ui->airtemp->clear();
|
||||||
ui->atmPressVal->clear();
|
ui->atmPressVal->clear();
|
||||||
ui->salinityText->clear();
|
ui->salinityText->clear();
|
||||||
ui->waterTypeText->clear();
|
ui->waterTypeText->clear();
|
||||||
|
@ -170,8 +170,8 @@ void TabDiveInformation::updateData()
|
||||||
|
|
||||||
updateProfile();
|
updateProfile();
|
||||||
updateWhen();
|
updateWhen();
|
||||||
ui->waterTemperatureText->setText(get_temperature_string(current_dive->watertemp, true));
|
ui->watertemp->setText(get_temperature_string(current_dive->watertemp, true));
|
||||||
ui->airTemperatureText->setText(get_temperature_string(current_dive->airtemp, true));
|
ui->airtemp->setText(get_temperature_string(current_dive->airtemp, true));
|
||||||
ui->atmPressType->setItemText(1, get_depth_unit()); // Check for changes in depth unit (imperial/metric)
|
ui->atmPressType->setItemText(1, get_depth_unit()); // Check for changes in depth unit (imperial/metric)
|
||||||
ui->atmPressType->setCurrentIndex(0); // Set the atmospheric pressure combo box to mbar
|
ui->atmPressType->setCurrentIndex(0); // Set the atmospheric pressure combo box to mbar
|
||||||
updateMode(current_dive);
|
updateMode(current_dive);
|
||||||
|
@ -194,9 +194,9 @@ void TabDiveInformation::divesChanged(const QVector<dive *> &dives, DiveField fi
|
||||||
if (field.duration || field.depth || field.mode)
|
if (field.duration || field.depth || field.mode)
|
||||||
updateProfile();
|
updateProfile();
|
||||||
if (field.air_temp)
|
if (field.air_temp)
|
||||||
ui->airTemperatureText->setText(get_temperature_string(current_dive->airtemp, true));
|
ui->airtemp->setText(get_temperature_string(current_dive->airtemp, true));
|
||||||
if (field.water_temp)
|
if (field.water_temp)
|
||||||
ui->waterTemperatureText->setText(get_temperature_string(current_dive->watertemp, true));
|
ui->watertemp->setText(get_temperature_string(current_dive->watertemp, true));
|
||||||
if (field.atm_press)
|
if (field.atm_press)
|
||||||
ui->atmPressVal->setText(ui->atmPressVal->text().sprintf("%d",current_dive->surface_pressure.mbar));
|
ui->atmPressVal->setText(ui->atmPressVal->text().sprintf("%d",current_dive->surface_pressure.mbar));
|
||||||
if (field.salinity)
|
if (field.salinity)
|
||||||
|
@ -222,6 +222,23 @@ void TabDiveInformation::diveModeChanged(int index)
|
||||||
divesEdited(Command::editMode(dc_number, (enum divemode_t)index, false));
|
divesEdited(Command::editMode(dc_number, (enum divemode_t)index, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabDiveInformation::on_airtemp_editingFinished()
|
||||||
|
{
|
||||||
|
// If the field wasn't modified by the user, don't post a new undo command.
|
||||||
|
// Owing to rounding errors, this might lead to undo commands that have
|
||||||
|
// no user visible effects. These can be very confusing.
|
||||||
|
if (ui->airtemp->isModified() && current_dive)
|
||||||
|
divesEdited(Command::editAirTemp(parseTemperatureToMkelvin(ui->airtemp->text()), false));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TabDiveInformation::on_watertemp_editingFinished()
|
||||||
|
{
|
||||||
|
// If the field wasn't modified by the user, don't post a new undo command.
|
||||||
|
// Owing to rounding errors, this might lead to undo commands that have
|
||||||
|
// no user visible effects. These can be very confusing.
|
||||||
|
if (ui->watertemp->isModified() && current_dive)
|
||||||
|
divesEdited(Command::editWaterTemp(parseTemperatureToMkelvin(ui->watertemp->text()), false));
|
||||||
|
}
|
||||||
void TabDiveInformation::on_atmPressType_currentIndexChanged(int index) { updateTextBox(COMBO_CHANGED); }
|
void TabDiveInformation::on_atmPressType_currentIndexChanged(int index) { updateTextBox(COMBO_CHANGED); }
|
||||||
|
|
||||||
void TabDiveInformation::on_atmPressVal_editingFinished() { updateTextBox(TEXT_EDITED); }
|
void TabDiveInformation::on_atmPressVal_editingFinished() { updateTextBox(TEXT_EDITED); }
|
||||||
|
|
|
@ -22,6 +22,8 @@ private slots:
|
||||||
void on_atmPressVal_editingFinished();
|
void on_atmPressVal_editingFinished();
|
||||||
void on_atmPressType_currentIndexChanged(int index);
|
void on_atmPressType_currentIndexChanged(int index);
|
||||||
void on_visibility_valueChanged(int value);
|
void on_visibility_valueChanged(int value);
|
||||||
|
void on_airtemp_editingFinished();
|
||||||
|
void on_watertemp_editingFinished();
|
||||||
private:
|
private:
|
||||||
Ui::TabDiveInformation *ui;
|
Ui::TabDiveInformation *ui;
|
||||||
void updateProfile();
|
void updateProfile();
|
||||||
|
|
|
@ -374,7 +374,7 @@
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QGroupBox" name="groupBox_9">
|
<widget class="QGroupBox" name="groupBox_airtemp">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Air temp.</string>
|
<string>Air temp.</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -389,7 +389,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="diveInfoAirTempLayout">
|
<layout class="QHBoxLayout" name="diveInfoAirTempLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="airTemperatureText">
|
<widget class="QLineEdit" name="airtemp">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -403,7 +403,7 @@
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QGroupBox" name="groupBox_8">
|
<widget class="QGroupBox" name="groupBox_watertemp">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Water temp.</string>
|
<string>Water temp.</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -418,7 +418,7 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="diveInfoWaterTempLayout">
|
<layout class="QHBoxLayout" name="diveInfoWaterTempLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="waterTemperatureText">
|
<widget class="QLineEdit" name="watertemp">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Reference in a new issue