From 67e686652d86a4c0c578ecd881484d0f80ef5d0c Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 8 Jun 2022 16:18:06 +0800 Subject: [PATCH] - enhancement: mark editor as modified, if the editing file is changed by other applications. - enhancement: When the editing files is changed by other applications, only show one notification dialog for each file. --- NEWS.md | 2 ++ RedPandaIDE/mainwindow.cpp | 5 +++++ RedPandaIDE/mainwindow.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/NEWS.md b/NEWS.md index be87ea26..422bae9c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ Red Panda C++ Version 1.1.0 - enhancement: when ctrl+mouse cursor hovered an identifier or header name, use underline to highlight it + - enhancement: mark editor as modified, if the editing file is changed by other applications. + - enhancement: When the editing files is changed by other applications, only show one notification dialog for each file. Red Panda C++ Version 1.0.10 - fix: modify watch doesn't work diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index fac394d2..e3faf21b 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -4151,8 +4151,12 @@ void MainWindow::updateProjectView() void MainWindow::onFileChanged(const QString &path) { + if (mFilesChangedNotifying.contains(path)) + return; + mFilesChangedNotifying.insert(path); Editor *e = mEditorList->getOpenedEditorByFilename(path); if (e) { + e->setModified(true); if (fileExists(path)) { e->activate(); if (QMessageBox::question(this,tr("File Changed"), @@ -4178,6 +4182,7 @@ void MainWindow::onFileChanged(const QString &path) } } } + mFilesChangedNotifying.remove(path); } void MainWindow::onFilesViewPathChanged() diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 7815c84f..95bdd01b 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -740,6 +740,8 @@ private: QTcpServer mTcpServer; QColor mErrorColor; + QSet mFilesChangedNotifying; + //actions for compile issue table QAction * mTableIssuesCopyAction; QAction * mTableIssuesCopyAllAction;