diff options
Diffstat (limited to 'desktop-widgets/filterwidget2.cpp')
-rw-r--r-- | desktop-widgets/filterwidget2.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp index 9bf526a88..50cad019a 100644 --- a/desktop-widgets/filterwidget2.cpp +++ b/desktop-widgets/filterwidget2.cpp @@ -8,10 +8,17 @@ FilterWidget2::FilterWidget2(QWidget* parent) , ui(new Ui::FilterWidget2()) { ui->setupUi(this); - ui->minRating->setCurrentStars(0); - ui->maxRating->setCurrentStars(5); - ui->minVisibility->setCurrentStars(0); - ui->maxVisibility->setCurrentStars(5); + + FilterData data; + ui->minRating->setCurrentStars(data.minRating); + ui->maxRating->setCurrentStars(data.maxRating); + ui->minVisibility->setCurrentStars(data.minVisibility); + ui->maxVisibility->setCurrentStars(data.maxVisibility); + ui->minAirTemp->setValue(data.minAirTemp); + ui->maxAirTemp->setValue(data.maxAirTemp); + ui->minWaterTemp->setValue(data.minWaterTemp); + ui->maxWaterTemp->setValue(data.maxWaterTemp); + ui->to->setDate(data.to.date()); connect(ui->maxRating, &StarWidget::valueChanged, this, &FilterWidget2::updateFilter); @@ -55,5 +62,24 @@ FilterWidget2::FilterWidget2(QWidget* parent) void FilterWidget2::updateFilter() { - + FilterData data; + + data.validFilter = true; + data.minVisibility = ui->minVisibility->currentStars(); + data.maxVisibility = ui->maxVisibility->currentStars(); + data.minRating = ui->minRating->currentStars(); + data.maxRating = ui->maxRating->currentStars(); + data.minWaterTemp = ui->minWaterTemp->value(); + data.maxWaterTemp = ui->maxWaterTemp->value(); + data.minAirTemp = ui->minAirTemp->value(); + data.maxWaterTemp = ui->maxWaterTemp->value(); + data.from = ui->from->dateTime(); + data.to = ui->to->dateTime(); + data.tags = ui->tags->text().split(",", QString::SkipEmptyParts); + data.people = ui->people->text().split(",", QString::SkipEmptyParts); + data.location = ui->location->text().split(",", QString::SkipEmptyParts); + data.equipment = ui->equipment->text().split(",", QString::SkipEmptyParts); + data.invertFilter = ui->invertFilter->isChecked(); + + emit filterDataChanged(data); } |