Centralize file-changed logic in the callback. Ignore watched files for 5 seconds, when saving them. On Windows, there is a fuzzy delay between the time a file is written and when the signal fires in Qt, and we can't rely on blocking signals or temporarily removing the watched filepaths. It also fires three or four duplicate times for a single file.

This commit is contained in:
Marcus Huderle
2020-04-25 16:11:14 -05:00
parent b849ace6e2
commit b9522c24f5
3 changed files with 29 additions and 13 deletions

View File

@@ -314,6 +314,7 @@ bool MainWindow::openProject(QString dir) {
&& setMap(getDefaultMap(), true);
} else {
QString open_map = editor->map->name;
editor->project->fileWatcher.removePaths(editor->project->fileWatcher.files());
editor->project->clearMapCache();
editor->project->clearTilesetCache();
success = loadDataStructures() && populateMapList() && setMap(open_map, true);
@@ -1260,7 +1261,6 @@ void MainWindow::on_actionUse_Encounter_Json_triggered(bool checked)
void MainWindow::on_actionMonitor_Project_Files_triggered(bool checked)
{
editor->project->fileWatcher.blockSignals(!checked);
porymapConfig.setMonitorFiles(checked);
}