mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Avoid Import perspective lockup (#4858)
When a wrong perspective file is imported into a view
This commit is contained in:
@@ -476,11 +476,8 @@ AbstractView::importPerspective(QString filename)
|
|||||||
if (newone) {
|
if (newone) {
|
||||||
appendPerspective(newone);
|
appendPerspective(newone);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
// no valid perspective found for this view... (maybe its for another type of view)
|
|
||||||
QMessageBox::information(this, tr("Perspective Import"), tr("No perspectives found that are appropriate for the current view."));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -965,13 +965,16 @@ MainWindow::importPerspective()
|
|||||||
pactive = true;
|
pactive = true;
|
||||||
if (current->importPerspective(fileName)) {
|
if (current->importPerspective(fileName)) {
|
||||||
|
|
||||||
// on success we select the new one
|
// on success we select the new one forcefully, as the view hasn't changed.
|
||||||
resetPerspective(view);
|
resetPerspective(view, true);
|
||||||
//current->setPerspectives(perspectiveSelector);
|
//current->setPerspectives(perspectiveSelector);
|
||||||
|
|
||||||
// and select remember pactive is true, so we do the heavy lifting here
|
// and select remember pactive is true, so we do the heavy lifting here
|
||||||
perspectiveSelector->setCurrentIndex(current->perspectives_.count()-1);
|
perspectiveSelector->setCurrentIndex(current->perspectives_.count()-1);
|
||||||
current->perspectiveSelected(perspectiveSelector->currentIndex());
|
current->perspectiveSelected(perspectiveSelector->currentIndex());
|
||||||
|
} else {
|
||||||
|
// no valid perspective found for this view... (maybe its for another type of view)
|
||||||
|
QMessageBox::information(this, tr("Perspective Import"), tr("No perspectives found that are appropriate for the current view."));
|
||||||
}
|
}
|
||||||
pactive = false;
|
pactive = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,6 +330,9 @@ PerspectiveDialog::importPerspectiveClicked()
|
|||||||
|
|
||||||
// new one added
|
// new one added
|
||||||
emit perspectivesChanged();
|
emit perspectivesChanged();
|
||||||
|
} else {
|
||||||
|
// no valid perspective found for this view... (maybe its for another type of view)
|
||||||
|
QMessageBox::information(this, tr("Perspective Import"), tr("No perspectives found that are appropriate for the current view."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user