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