Dive site: remove [start|stop]FilterDiveSite signals

This is another case of a weird pattern where an object would
connect it's own signal to the slot of a different object.
There seems to be no reason why the former couldn't simply
call the latter.

Remove the [start|stop]FilterDiveSite signals of LocationInformationWidget
and call the corresponding functions of MultiFilterSortModel directly.
While doing so, replace the UUID argument by a pointer-to-divesite.
It will be converted anyway right at the beginning of the function.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-26 16:57:08 +02:00 committed by Dirk Hohndel
parent f41bb32428
commit acd44467c1
4 changed files with 5 additions and 9 deletions

View file

@ -33,8 +33,6 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
ui.diveSiteMessage->addAction(acceptAction);
ui.diveSiteMessage->addAction(rejectAction);
connect(this, SIGNAL(startFilterDiveSite(uint32_t)), MultiFilterSortModel::instance(), SLOT(startFilterDiveSite(uint32_t)));
connect(this, SIGNAL(stopFilterDiveSite()), MultiFilterSortModel::instance(), SLOT(stopFilterDiveSite()));
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
connect(this, SIGNAL(nameChanged(const QString &, const QString &)),
LocationFilterModel::instance(), SLOT(changeName(const QString &, const QString &)));
@ -229,7 +227,7 @@ void LocationInformationWidget::initFields(dive_site *ds)
updateLabels();
enableLocationButtons(dive_site_has_gps_location(ds));
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel *>(ui.diveSiteListView->model());
emit startFilterDiveSite(ds->uuid);
MultiFilterSortModel::instance()->startFilterDiveSite(ds);
if (m)
m->invalidate();
} else {
@ -261,7 +259,7 @@ void LocationInformationWidget::resetState()
ui.diveSiteMessage->setText(tr("Dive site management"));
MapWidget::instance()->endGetDiveCoordinates();
MapWidget::instance()->repopulateLabels();
emit stopFilterDiveSite();
MultiFilterSortModel::instance()->stopFilterDiveSite();
emit endEditDiveSite();
updateLocationOnMap();
}

View file

@ -41,8 +41,6 @@ private slots:
void updateLocationOnMap();
signals:
void endEditDiveSite();
void startFilterDiveSite(uint32_t uuid);
void stopFilterDiveSite();
void nameChanged(const QString &oldName, const QString &newName);
private:

View file

@ -684,9 +684,9 @@ void MultiFilterSortModel::clearFilter()
myInvalidate();
}
void MultiFilterSortModel::startFilterDiveSite(uint32_t uuid)
void MultiFilterSortModel::startFilterDiveSite(struct dive_site *ds)
{
curr_dive_site = get_dive_site_by_uuid(uuid);
curr_dive_site = ds;
myInvalidate();
}

View file

@ -129,7 +129,7 @@ public
slots:
void myInvalidate();
void clearFilter();
void startFilterDiveSite(uint32_t uuid);
void startFilterDiveSite(struct dive_site *ds);
void stopFilterDiveSite();
void filterChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles);