mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-13 12:42:20 +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) {
|
||||
appendPerspective(newone);
|
||||
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
|
||||
|
||||
@@ -965,13 +965,16 @@ MainWindow::importPerspective()
|
||||
pactive = true;
|
||||
if (current->importPerspective(fileName)) {
|
||||
|
||||
// on success we select the new one
|
||||
resetPerspective(view);
|
||||
// on success we select the new one forcefully, as the view hasn't changed.
|
||||
resetPerspective(view, true);
|
||||
//current->setPerspectives(perspectiveSelector);
|
||||
|
||||
// and select remember pactive is true, so we do the heavy lifting here
|
||||
perspectiveSelector->setCurrentIndex(current->perspectives_.count()-1);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -330,6 +330,9 @@ PerspectiveDialog::importPerspectiveClicked()
|
||||
|
||||
// new one added
|
||||
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