summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/filterwidget2.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-01-17 23:01:57 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-19 13:59:24 -0800
commit424f1e98af6c8b868305fc3dcbe44118fd780ce7 (patch)
tree3916bf65bfa9fb2ce8d2f82ac1d39c80c10eda43 /desktop-widgets/filterwidget2.cpp
parented09e6a9097546de33dc48e4af1390efd37adda5 (diff)
downloadsubsurface-424f1e98af6c8b868305fc3dcbe44118fd780ce7.tar.gz
Filter widget: make Ui class subobject of widget
Commit 8e81d3f10087fa7ac600dcb18cfebf27716c4209 changed a bunch of Ui classes to be subobject of the widget. For consistency do the same with the filter widget. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/filterwidget2.cpp')
-rw-r--r--desktop-widgets/filterwidget2.cpp104
1 files changed, 50 insertions, 54 deletions
diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp
index 4b4e722fe..4a1d2e807 100644
--- a/desktop-widgets/filterwidget2.cpp
+++ b/desktop-widgets/filterwidget2.cpp
@@ -3,113 +3,109 @@
#include <QDoubleSpinBox>
-FilterWidget2::FilterWidget2(QWidget* parent)
-: QWidget(parent)
-, ui(new Ui::FilterWidget2())
+FilterWidget2::FilterWidget2(QWidget* parent) : QWidget(parent)
{
- ui->setupUi(this);
+ ui.setupUi(this);
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->planned->setChecked(data.logged);
- ui->planned->setChecked(data.planned);
+ 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.planned->setChecked(data.logged);
+ ui.planned->setChecked(data.planned);
// TODO: unhide this when we discover how to search for equipment.
- ui->equipment->hide();
- ui->labelEquipment->hide();
- ui->invertFilter->hide();
+ ui.equipment->hide();
+ ui.labelEquipment->hide();
+ ui.invertFilter->hide();
- ui->to->setDate(data.to.date());
+ ui.to->setDate(data.to.date());
- connect(ui->maxRating, &StarWidget::valueChanged,
+ connect(ui.maxRating, &StarWidget::valueChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->minRating, &StarWidget::valueChanged,
+ connect(ui.minRating, &StarWidget::valueChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->maxVisibility, &StarWidget::valueChanged,
+ connect(ui.maxVisibility, &StarWidget::valueChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->minVisibility, &StarWidget::valueChanged,
+ connect(ui.minVisibility, &StarWidget::valueChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->maxAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
+ connect(ui.maxAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &FilterWidget2::updateFilter);
- connect(ui->minAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
+ connect(ui.minAirTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &FilterWidget2::updateFilter);
- connect(ui->maxWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
+ connect(ui.maxWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &FilterWidget2::updateFilter);
- connect(ui->minWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
+ connect(ui.minWaterTemp, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged),
this, &FilterWidget2::updateFilter);
- connect(ui->from, &QDateTimeEdit::dateTimeChanged,
+ connect(ui.from, &QDateTimeEdit::dateTimeChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->to, &QDateTimeEdit::dateTimeChanged,
+ connect(ui.to, &QDateTimeEdit::dateTimeChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->tags, &QLineEdit::textChanged,
+ connect(ui.tags, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->people, &QLineEdit::textChanged,
+ connect(ui.people, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->location, &QLineEdit::textChanged,
+ connect(ui.location, &QLineEdit::textChanged,
this, &FilterWidget2::updateFilter);
- connect(ui->logged, SIGNAL(stateChanged(int)), this, SLOT(updateLogged(int)));
-
- connect(ui->planned, SIGNAL(stateChanged(int)), this, SLOT(updatePlanned(int)));
+ connect(ui.logged, SIGNAL(stateChanged(int)), this, SLOT(updateLogged(int)));
+ connect(ui.planned, SIGNAL(stateChanged(int)), this, SLOT(updatePlanned(int)));
}
void FilterWidget2::updateFilter()
{
filterData.validFilter = true;
- filterData.minVisibility = ui->minVisibility->currentStars();
- filterData.maxVisibility = ui->maxVisibility->currentStars();
- filterData.minRating = ui->minRating->currentStars();
- filterData.maxRating = ui->maxRating->currentStars();
- filterData.minWaterTemp = ui->minWaterTemp->value();
- filterData.maxWaterTemp = ui->maxWaterTemp->value();
- filterData.minAirTemp = ui->minAirTemp->value();
- filterData.maxWaterTemp = ui->maxWaterTemp->value();
- filterData.from = ui->from->dateTime();
- filterData.to = ui->to->dateTime();
- filterData.tags = ui->tags->text().split(",", QString::SkipEmptyParts);
- filterData.people = ui->people->text().split(",", QString::SkipEmptyParts);
- filterData.location = ui->location->text().split(",", QString::SkipEmptyParts);
- filterData.equipment = ui->equipment->text().split(",", QString::SkipEmptyParts);
- filterData.invertFilter = ui->invertFilter->isChecked();
- filterData.logged = ui->logged->isChecked();
- filterData.planned = ui->planned->isChecked();
+ filterData.minVisibility = ui.minVisibility->currentStars();
+ filterData.maxVisibility = ui.maxVisibility->currentStars();
+ filterData.minRating = ui.minRating->currentStars();
+ filterData.maxRating = ui.maxRating->currentStars();
+ filterData.minWaterTemp = ui.minWaterTemp->value();
+ filterData.maxWaterTemp = ui.maxWaterTemp->value();
+ filterData.minAirTemp = ui.minAirTemp->value();
+ filterData.maxWaterTemp = ui.maxWaterTemp->value();
+ filterData.from = ui.from->dateTime();
+ filterData.to = ui.to->dateTime();
+ filterData.tags = ui.tags->text().split(",", QString::SkipEmptyParts);
+ filterData.people = ui.people->text().split(",", QString::SkipEmptyParts);
+ filterData.location = ui.location->text().split(",", QString::SkipEmptyParts);
+ filterData.equipment = ui.equipment->text().split(",", QString::SkipEmptyParts);
+ filterData.invertFilter = ui.invertFilter->isChecked();
+ filterData.logged = ui.logged->isChecked();
+ filterData.planned = ui.planned->isChecked();
filterDataChanged(filterData);
}
void FilterWidget2::updateLogged(int value) {
if (value == Qt::Unchecked)
- ui->planned->setChecked(true);
+ ui.planned->setChecked(true);
updateFilter();
}
void FilterWidget2::updatePlanned(int value) {
if (value == Qt::Unchecked)
- ui->logged->setChecked(true);
+ ui.logged->setChecked(true);
updateFilter();
}
-
void FilterWidget2::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);