- enhancement: when closing project, prevent all editors that belongs to the project check syntax and parse todos.

This commit is contained in:
Roy Qu 2022-10-24 22:53:46 +08:00
parent f20a979885
commit b958cdc00c
4 changed files with 16 additions and 3 deletions

View File

@ -21,6 +21,7 @@ Red Panda C++ Version 2.0
- enhancement: separate compiler's language standard option for C / C++
- fix: compiler settings not correctly handled when create makefile
- enhancement: auto locate current open file in the project view panel
- enhancement: when closing project, prevent all editors that belongs to the project check syntax and parse todos.
Red Panda C++ Version 1.5

View File

@ -1289,16 +1289,18 @@ void Editor::showEvent(QShowEvent */*event*/)
// }
if (!pMainWindow->isClosingAll()
&& !pMainWindow->isQuitting()) {
if (!inProject() || !pMainWindow->closingProject()) {
checkSyntaxInBack();
reparseTodo();
}
}
pMainWindow->updateClassBrowserForEditor(this);
pMainWindow->updateAppTitle(this);
pMainWindow->updateEditorActions(this);
pMainWindow->updateForEncodingInfo(this);
pMainWindow->updateStatusbarForLineCol(this);
pMainWindow->updateForStatusbarModeInfo(this);
if (inProject()) {
if (inProject() && !pMainWindow->closingProject()) {
pMainWindow->setProjectCurrentFile(mFilename);
}

View File

@ -109,6 +109,7 @@ MainWindow::MainWindow(QWidget *parent)
ui(new Ui::MainWindow),
mSearchDialog(nullptr),
mQuitting(false),
mClosingProject(false),
mCheckSyntaxInBack(false),
mShouldRemoveAllSettings(false),
mClosing(false),
@ -4602,6 +4603,7 @@ void MainWindow::closeProject(bool refreshEditor)
} else
mProject->saveLayout(); // always save layout, but not when SaveAll has been called
mClosingProject=true;
mBookmarkModel->saveProjectBookmarks(
changeFileExt(mProject->filename(), PROJECT_BOOKMARKS_EXT),
mProject->directory());
@ -4640,6 +4642,7 @@ void MainWindow::closeProject(bool refreshEditor)
clearIssues();
updateProjectView();
}
mClosingProject=false;
}
}
@ -8581,6 +8584,11 @@ void MainWindow::on_actionNew_Template_triggered()
}
}
bool MainWindow::closingProject() const
{
return mClosingProject;
}
const std::shared_ptr<VisitHistoryManager> &MainWindow::visitHistoryManager() const
{
return mVisitHistoryManager;

View File

@ -746,6 +746,7 @@ private:
CPUDialog *mCPUDialog;
SearchDialog *mSearchDialog;
bool mQuitting;
bool mClosingProject;
QElapsedTimer mParserTimer;
QFileSystemWatcher mFileSystemWatcher;
std::shared_ptr<Project> mProject;
@ -880,6 +881,7 @@ public:
bool isClosingAll() const;
bool isQuitting() const;
const std::shared_ptr<VisitHistoryManager> &visitHistoryManager() const;
bool closingProject() const;
};
extern MainWindow* pMainWindow;