mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:03:23 +00:00
Undo: update map when dive site location is changed by undo command
Simply hook into the appropriate signal. Thus, the "update dive site location" button can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fa4fedbb48
commit
0b851d723e
5 changed files with 6 additions and 36 deletions
|
@ -36,8 +36,6 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
|||
ui.diveSiteMessage->addAction(rejectAction);
|
||||
|
||||
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
||||
connect(ui.updateLocationButton, SIGNAL(clicked()), this, SLOT(updateLocationOnMap()));
|
||||
connect(ui.diveSiteCoordinates, SIGNAL(returnPressed()), this, SLOT(updateLocationOnMap()));
|
||||
ui.diveSiteCoordinates->installEventFilter(this);
|
||||
|
||||
connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &LocationInformationWidget::diveSiteChanged);
|
||||
|
@ -58,8 +56,6 @@ bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev)
|
|||
contextMenu.addAction(tr("Merge into current site"), this, SLOT(mergeSelectedDiveSites()));
|
||||
contextMenu.exec(ctx->globalPos());
|
||||
return true;
|
||||
} else if (ev->type() == QEvent::FocusOut && object == ui.diveSiteCoordinates) {
|
||||
updateLocationOnMap();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -67,7 +63,6 @@ bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev)
|
|||
void LocationInformationWidget::enableLocationButtons(bool enable)
|
||||
{
|
||||
ui.geoCodeButton->setEnabled(enable);
|
||||
ui.updateLocationButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
void LocationInformationWidget::mergeSelectedDiveSites()
|
||||
|
@ -241,7 +236,6 @@ void LocationInformationWidget::resetState()
|
|||
MapWidget::instance()->repopulateLabels();
|
||||
MultiFilterSortModel::instance()->stopFilterDiveSite();
|
||||
emit endEditDiveSite();
|
||||
updateLocationOnMap();
|
||||
}
|
||||
|
||||
void LocationInformationWidget::enableEdition()
|
||||
|
@ -301,17 +295,6 @@ void LocationInformationWidget::reverseGeocode()
|
|||
ui.locationTags->setText(constructLocationTags(&taxonomy, false));
|
||||
}
|
||||
|
||||
void LocationInformationWidget::updateLocationOnMap()
|
||||
{
|
||||
if (!diveSite)
|
||||
return;
|
||||
location_t location;
|
||||
if (!parseGpsText(ui.diveSiteCoordinates->text(), location))
|
||||
return;
|
||||
MapWidget::instance()->updateDiveSiteCoordinates(diveSite, location);
|
||||
filter_model.setCoordinates(location);
|
||||
}
|
||||
|
||||
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject*)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ public slots:
|
|||
void mergeSelectedDiveSites();
|
||||
private slots:
|
||||
void updateLabels();
|
||||
void updateLocationOnMap();
|
||||
void diveSiteChanged(struct dive_site *ds, int field);
|
||||
signals:
|
||||
void endEditDiveSite();
|
||||
|
|
|
@ -156,20 +156,6 @@
|
|||
<item row="2" column="2" colspan="3">
|
||||
<widget class="QLineEdit" name="diveSiteCountry"/>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QToolButton" name="updateLocationButton">
|
||||
<property name="toolTip">
|
||||
<string>Update location on map</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../subsurface.qrc">
|
||||
<normaloff>:dive-location-marker-selected-icon</normaloff>:dive-location-marker-selected-icon</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
@ -188,7 +174,6 @@
|
|||
<tabstop>diveSiteName</tabstop>
|
||||
<tabstop>diveSiteCountry</tabstop>
|
||||
<tabstop>diveSiteCoordinates</tabstop>
|
||||
<tabstop>updateLocationButton</tabstop>
|
||||
<tabstop>geoCodeButton</tabstop>
|
||||
<tabstop>diveSiteDescription</tabstop>
|
||||
<tabstop>diveSiteNotes</tabstop>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "mapwidget.h"
|
||||
#include "core/divesite.h"
|
||||
#include "core/subsurface-qt/DiveListNotifier.h"
|
||||
#include "map-widget/qmlmapwidgethelper.h"
|
||||
#include "qt-models/maplocationmodel.h"
|
||||
#include "qt-models/divelocationmodel.h"
|
||||
|
@ -28,6 +29,7 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
|
|||
m_mapHelper = nullptr;
|
||||
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
connect(this, &QQuickWidget::statusChanged, this, &MapWidget::doneLoading);
|
||||
connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &MapWidget::diveSiteChanged);
|
||||
setSource(urlMapWidget);
|
||||
}
|
||||
|
||||
|
@ -116,10 +118,11 @@ void MapWidget::coordinatesChangedLocal(const location_t &location)
|
|||
emit coordinatesChanged(location);
|
||||
}
|
||||
|
||||
void MapWidget::updateDiveSiteCoordinates(struct dive_site *ds, const location_t &location)
|
||||
void MapWidget::diveSiteChanged(struct dive_site *ds, int field)
|
||||
{
|
||||
CHECK_IS_READY_RETURN_VOID();
|
||||
m_mapHelper->updateDiveSiteCoordinates(ds, location);
|
||||
if (field == LocationInformationModel::LOCATION)
|
||||
m_mapHelper->updateDiveSiteCoordinates(ds, ds->location);
|
||||
}
|
||||
|
||||
MapWidget::~MapWidget()
|
||||
|
|
|
@ -37,7 +37,7 @@ public slots:
|
|||
void selectedDivesChanged(QList<int>);
|
||||
void coordinatesChangedLocal(const location_t &);
|
||||
void doneLoading(QQuickWidget::Status status);
|
||||
void updateDiveSiteCoordinates(struct dive_site *ds, const location_t &);
|
||||
void diveSiteChanged(struct dive_site *ds, int field);
|
||||
|
||||
private:
|
||||
static MapWidget *m_instance;
|
||||
|
|
Loading…
Add table
Reference in a new issue