mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:33:24 +00:00
Map: replace enterEditMode()/exitEditMode() by updateEditMode()
There weree two functions in MapWidgetHelper: one to enter and one to exit edit mode. Both functions set the flag and emitted a signal if the flag had changed. Since the edit mode only depends on a flag of the filter this can be simplified to a simple function that updates the flag and raises the signal if the flag changed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a921acb3ce
commit
f818ac3352
2 changed files with 11 additions and 24 deletions
|
@ -96,16 +96,21 @@ void MapWidgetHelper::centerOnSelectedDiveSite()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidgetHelper::reloadMapLocations()
|
void MapWidgetHelper::updateEditMode()
|
||||||
{
|
{
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
// The filter being set to dive site is the signal that we are in dive site edit mode.
|
// The filter being set to dive site is the signal that we are in dive site edit mode.
|
||||||
// This is the case when either the dive site edit tab or the dive site list tab are active.
|
// This is the case when either the dive site edit tab or the dive site list tab are active.
|
||||||
if (MultiFilterSortModel::instance()->diveSiteMode())
|
bool old = m_editMode;
|
||||||
enterEditMode();
|
m_editMode = MultiFilterSortModel::instance()->diveSiteMode();
|
||||||
else
|
if (old != m_editMode)
|
||||||
exitEditMode();
|
emit editModeChanged();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapWidgetHelper::reloadMapLocations()
|
||||||
|
{
|
||||||
|
updateEditMode();
|
||||||
m_mapLocationModel->reload(m_map);
|
m_mapLocationModel->reload(m_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,23 +230,6 @@ void MapWidgetHelper::diveSiteChanged(struct dive_site *ds, int field)
|
||||||
centerOnDiveSite(ds);
|
centerOnDiveSite(ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidgetHelper::exitEditMode()
|
|
||||||
{
|
|
||||||
if (!m_editMode)
|
|
||||||
return;
|
|
||||||
m_editMode = false;
|
|
||||||
emit editModeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MapWidgetHelper::enterEditMode()
|
|
||||||
{
|
|
||||||
if (m_editMode)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_editMode = true;
|
|
||||||
emit editModeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MapWidgetHelper::pluginObject()
|
QString MapWidgetHelper::pluginObject()
|
||||||
{
|
{
|
||||||
QString lang = uiLanguage(NULL).replace('_', '-');
|
QString lang = uiLanguage(NULL).replace('_', '-');
|
||||||
|
|
|
@ -38,8 +38,7 @@ public:
|
||||||
QString pluginObject();
|
QString pluginObject();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void enterEditMode();
|
void updateEditMode();
|
||||||
void exitEditMode();
|
|
||||||
QObject *m_map;
|
QObject *m_map;
|
||||||
MapLocationModel *m_mapLocationModel;
|
MapLocationModel *m_mapLocationModel;
|
||||||
qreal m_smallCircleRadius;
|
qreal m_smallCircleRadius;
|
||||||
|
|
Loading…
Add table
Reference in a new issue