mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-18 19:52:09 +01:00
Yet another map load crash fix
This commit is contained in:
parent
743a937f41
commit
0f03ef4af7
@ -1527,7 +1527,7 @@ void GUI::mapLoaded()
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::mapLoadedNoTrigger()
|
||||
void GUI::mapLoadedDir()
|
||||
{
|
||||
MapAction *action = static_cast<MapAction*>(QObject::sender());
|
||||
Map *map = action->data().value<Map*>();
|
||||
@ -1535,6 +1535,9 @@ void GUI::mapLoadedNoTrigger()
|
||||
if (map->isValid()) {
|
||||
_showMapAction->setEnabled(true);
|
||||
_clearMapCacheAction->setEnabled(true);
|
||||
QList<MapAction*> actions;
|
||||
actions.append(action);
|
||||
_mapView->loadMaps(actions);
|
||||
} else {
|
||||
QString error = tr("Error loading map:") + "\n\n" + map->path() + "\n\n"
|
||||
+ map->errorString();
|
||||
@ -1568,17 +1571,19 @@ void GUI::loadMapDir()
|
||||
} else {
|
||||
a = createMapAction(map);
|
||||
menu->addAction(a);
|
||||
actions.append(a);
|
||||
|
||||
if (map->isReady()) {
|
||||
_showMapAction->setEnabled(true);
|
||||
_clearMapCacheAction->setEnabled(true);
|
||||
actions.append(a);
|
||||
} else
|
||||
connect(a, SIGNAL(loaded()), this,
|
||||
SLOT(mapLoadedNoTrigger()));
|
||||
connect(a, SIGNAL(loaded()), this, SLOT(mapLoadedDir()));
|
||||
}
|
||||
} else
|
||||
actions.append(a);
|
||||
} else {
|
||||
map = a->data().value<Map*>();
|
||||
if (map->isReady())
|
||||
actions.append(a);
|
||||
}
|
||||
}
|
||||
|
||||
_mapView->loadMaps(actions);
|
||||
|
@ -96,7 +96,7 @@ private slots:
|
||||
void logicalDotsPerInchChanged(qreal dpi);
|
||||
|
||||
void mapLoaded();
|
||||
void mapLoadedNoTrigger();
|
||||
void mapLoadedDir();
|
||||
void mapInitialized();
|
||||
|
||||
private:
|
||||
|
@ -279,11 +279,9 @@ void MapView::loadMaps(const QList<MapAction *> &maps)
|
||||
for (int i = 0; i < maps.size(); i++) {
|
||||
MapAction *a = maps.at(i);
|
||||
Map *map = a->data().value<Map*>();
|
||||
if (map->isReady()) {
|
||||
MapItem *mi = addMap(map);
|
||||
connect(mi, SIGNAL(triggered()), a, SLOT(trigger()));
|
||||
} else
|
||||
connect(a, SIGNAL(loaded()), this, SLOT(mapLoaded()));
|
||||
Q_ASSERT(map->isReady());
|
||||
MapItem *mi = addMap(map);
|
||||
connect(mi, SIGNAL(triggered()), a, SLOT(trigger()));
|
||||
}
|
||||
|
||||
if (fitMapZoom() != zoom)
|
||||
@ -296,29 +294,6 @@ void MapView::loadMaps(const QList<MapAction *> &maps)
|
||||
centerOn(contentCenter());
|
||||
}
|
||||
|
||||
void MapView::mapLoaded()
|
||||
{
|
||||
MapAction *action = static_cast<MapAction*>(QObject::sender());
|
||||
Map *map = action->data().value<Map*>();
|
||||
|
||||
if (!map->isValid())
|
||||
return;
|
||||
|
||||
int zoom = _map->zoom();
|
||||
|
||||
MapItem *mi = addMap(map);
|
||||
connect(mi, SIGNAL(triggered()), action, SLOT(trigger()));
|
||||
|
||||
if (fitMapZoom() != zoom)
|
||||
rescale();
|
||||
else
|
||||
updatePOIVisibility();
|
||||
|
||||
updateZValues(_areas);
|
||||
|
||||
centerOn(contentCenter());
|
||||
}
|
||||
|
||||
int MapView::fitMapZoom() const
|
||||
{
|
||||
RectC br = _tr | _rr | _wr | _ar;
|
||||
|
@ -105,7 +105,6 @@ public slots:
|
||||
private slots:
|
||||
void updatePOI();
|
||||
void reloadMap();
|
||||
void mapLoaded();
|
||||
|
||||
private:
|
||||
typedef QHash<SearchPointer<Waypoint>, WaypointItem*> POIHash;
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
void draw(QPainter *, const QRectF &, Flags) {}
|
||||
|
||||
bool isValid() const {return false;}
|
||||
bool isReady() const {return false;}
|
||||
QString errorString() const {return _errorString;}
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user