mirror of
https://github.com/huderlem/porymap.git
synced 2026-04-25 07:18:02 -05:00
Fix map navigation persisting between projects
This commit is contained in:
parent
77a7acd529
commit
6f42f86289
|
|
@ -400,7 +400,8 @@ private:
|
|||
void openMapListItem(const QModelIndex &index);
|
||||
void onMapListTabChanged(int index);
|
||||
QString getActiveItemName();
|
||||
void recordNavigation(const QString &itemName);
|
||||
void recordMapNavigation(const QString &itemName);
|
||||
void resetMapNavigation();
|
||||
void openMapFromHistory(bool previous);
|
||||
void openPreviousMap();
|
||||
void openNextMap();
|
||||
|
|
|
|||
|
|
@ -1046,7 +1046,7 @@ void MainWindow::openMapFromHistory(bool previous) {
|
|||
this->ignoreNavigationRecords = false;
|
||||
}
|
||||
|
||||
void MainWindow::recordNavigation(const QString &itemName) {
|
||||
void MainWindow::recordMapNavigation(const QString &itemName) {
|
||||
if (this->ignoreNavigationRecords)
|
||||
return;
|
||||
|
||||
|
|
@ -1057,6 +1057,13 @@ void MainWindow::recordNavigation(const QString &itemName) {
|
|||
this->forwardNavigation.button->setEnabled(false);
|
||||
}
|
||||
|
||||
void MainWindow::resetMapNavigation() {
|
||||
this->backNavigation.stack.clear();
|
||||
this->backNavigation.button->setEnabled(false);
|
||||
this->forwardNavigation.stack.clear();
|
||||
this->forwardNavigation.button->setEnabled(false);
|
||||
}
|
||||
|
||||
// setMap, but with a visible error message in case of failure.
|
||||
// Use when the user is specifically requesting a map to open.
|
||||
bool MainWindow::userSetMap(const QString &mapName) {
|
||||
|
|
@ -1081,7 +1088,7 @@ bool MainWindow::userSetMap(const QString &mapName) {
|
|||
RecentErrorMessage::show(QString("There was an error opening map '%1'.").arg(mapName), this);
|
||||
return false;
|
||||
}
|
||||
recordNavigation(prevItem);
|
||||
recordMapNavigation(prevItem);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1161,7 +1168,7 @@ bool MainWindow::userSetLayout(const QString &layoutId) {
|
|||
return false;
|
||||
}
|
||||
|
||||
recordNavigation(prevItem);
|
||||
recordMapNavigation(prevItem);
|
||||
|
||||
// Only the Layouts tab of the map list shows Layouts, so if we're not already on that tab we'll open it now.
|
||||
ui->mapListContainer->setCurrentIndex(MapListTab::Layouts);
|
||||
|
|
@ -1459,6 +1466,7 @@ void MainWindow::clearProjectUI() {
|
|||
delete this->layoutTreeModel;
|
||||
delete this->layoutListProxyModel;
|
||||
resetMapListFilters();
|
||||
resetMapNavigation();
|
||||
}
|
||||
|
||||
void MainWindow::scrollMapList(MapTree *list, const QString &itemName) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user