mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Filter: extend range of allowed temperatures
The temperature range 0-100 was inadequate in both supported scales (Celsius and Fahrenheit). Extend the range to encompass all physically meaningful values in both scales. Use the default-values to set the minimum and maximum of the UI-fields. Thus, these values are configurable in a single place. In the future we should use a scale-independent representation (e.g. mkelvin as in the rest of the code base). But this would mean implementing a custom widget with a conversion function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b28e0bf0b9
commit
1470048773
2 changed files with 14 additions and 4 deletions
|
@ -10,6 +10,13 @@ FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent)
|
|||
ui.setupUi(this);
|
||||
|
||||
FilterData data;
|
||||
|
||||
// Use default values to set minimum and maximum air and water temperature.
|
||||
ui.minAirTemp->setRange(data.minAirTemp, data.maxAirTemp);
|
||||
ui.maxAirTemp->setRange(data.minAirTemp, data.maxAirTemp);
|
||||
ui.minWaterTemp->setRange(data.minWaterTemp, data.maxWaterTemp);
|
||||
ui.maxWaterTemp->setRange(data.minWaterTemp, data.maxWaterTemp);
|
||||
|
||||
ui.minRating->setCurrentStars(data.minRating);
|
||||
ui.maxRating->setCurrentStars(data.maxRating);
|
||||
ui.minVisibility->setCurrentStars(data.minVisibility);
|
||||
|
|
|
@ -20,10 +20,13 @@ struct FilterData {
|
|||
int maxVisibility = 5;
|
||||
int minRating = 0;
|
||||
int maxRating = 5;
|
||||
double minWaterTemp = 0;
|
||||
double maxWaterTemp = 100;
|
||||
double minAirTemp = 0;
|
||||
double maxAirTemp = 100;
|
||||
// The default minimum and maximum temperatures are set such that all
|
||||
// physically reasonable dives are shown. Note that these values should
|
||||
// work for both Celcius and Fahrenheit scales.
|
||||
double minWaterTemp = -10;
|
||||
double maxWaterTemp = 200;
|
||||
double minAirTemp = -50;
|
||||
double maxAirTemp = 200;
|
||||
QDateTime fromDate;
|
||||
QTime fromTime;
|
||||
QDateTime toDate = QDateTime::currentDateTime();
|
||||
|
|
Loading…
Reference in a new issue