mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-14 12:57:06 -05:00
add File>Reload Project
This commit is contained in:
@@ -306,7 +306,10 @@ bool MainWindow::openProject(QString dir) {
|
||||
&& populateMapList()
|
||||
&& setMap(getDefaultMap(), true);
|
||||
} else {
|
||||
success = loadDataStructures() && populateMapList() && setMap(editor->map->name, true);
|
||||
QString open_map = editor->map->name;
|
||||
editor->project->clearMapCache();
|
||||
editor->project->clearTilesetCache();
|
||||
success = loadDataStructures() && populateMapList() && setMap(open_map, true);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
@@ -373,6 +376,19 @@ void MainWindow::on_action_Open_Project_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_Reload_Project_triggered() {
|
||||
// TODO: when undo history is complete show only if has unsaved changes
|
||||
QMessageBox warning(this);
|
||||
warning.setText("WARNING");
|
||||
warning.setInformativeText("Reloading this project will discard any unsaved changes.");
|
||||
warning.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||
warning.setIcon(QMessageBox::Warning);
|
||||
|
||||
if (warning.exec() == QMessageBox::Ok) {
|
||||
openProject(editor->project->root);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::setMap(QString map_name, bool scrollTreeView) {
|
||||
logInfo(QString("Setting map to '%1'").arg(map_name));
|
||||
if (map_name.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user