- change: Remove option "clear all symbols when current editor is hidden".
- fix: When opening multiple files, only the active file should be parsed.
This commit is contained in:
parent
62f7c0a495
commit
739f382f46
2
NEWS.md
2
NEWS.md
|
@ -22,6 +22,8 @@ Red Panda C++ Version 2.24
|
|||
- fix: Wrong code suggestion while inputing numbers in assembly files.
|
||||
- fix: Defines in all files are wrongly cleared when reparsing.
|
||||
- change: New file created by file template is set as unmodified by default.
|
||||
- change: Remove option "clear all symbols when current editor is hidden".
|
||||
- fix: When opening multiple files, only the active file should be parsed.
|
||||
|
||||
Red Panda C++ Version 2.23
|
||||
|
||||
|
|
|
@ -217,9 +217,12 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
this, &Editor::onScrollBarValueChanged);
|
||||
mInited=true;
|
||||
|
||||
reparse(false);
|
||||
checkSyntaxInBack();
|
||||
reparseTodo();
|
||||
// if (!pMainWindow->openingFiles()
|
||||
// && !pMainWindow->openingProject()) {
|
||||
// reparse(false);
|
||||
// checkSyntaxInBack();
|
||||
// reparseTodo();
|
||||
// }
|
||||
}
|
||||
|
||||
Editor::~Editor() {
|
||||
|
@ -1386,6 +1389,7 @@ void Editor::showEvent(QShowEvent */*event*/)
|
|||
&CppParser::onEndParsing,
|
||||
this,
|
||||
&Editor::onEndParsing);
|
||||
if (!pMainWindow->openingFiles() && !pMainWindow->openingProject())
|
||||
reparse(false);
|
||||
}
|
||||
if (mParentPageControl) {
|
||||
|
@ -1395,7 +1399,9 @@ void Editor::showEvent(QShowEvent */*event*/)
|
|||
}
|
||||
|
||||
if (!pMainWindow->isClosingAll()
|
||||
&& !pMainWindow->isQuitting()) {
|
||||
&& !pMainWindow->isQuitting()
|
||||
&& !pMainWindow->openingFiles()
|
||||
&& !pMainWindow->openingProject()) {
|
||||
if (!inProject() || !pMainWindow->closingProject()) {
|
||||
checkSyntaxInBack();
|
||||
reparseTodo();
|
||||
|
@ -1418,12 +1424,13 @@ void Editor::showEvent(QShowEvent */*event*/)
|
|||
|
||||
void Editor::hideEvent(QHideEvent */*event*/)
|
||||
{
|
||||
if (pSettings->codeCompletion().clearWhenEditorHidden()
|
||||
&& !inProject() && mParser
|
||||
&& !pMainWindow->isMinimized()) {
|
||||
//recreate a parser, to totally clean memories the parser uses;
|
||||
resetCppParser(mParser);
|
||||
}
|
||||
// if (pSettings->codeCompletion().clearWhenEditorHidden()
|
||||
// && !inProject() && mParser
|
||||
// && !pMainWindow->isMinimized()) {
|
||||
// //recreate a parser, to totally clean memories the parser uses;
|
||||
// if (!pMainWindow->openingFiles() && !pMainWindow->openingProject())
|
||||
// resetCppParser(mParser);
|
||||
// }
|
||||
if (mParser) {
|
||||
disconnect(mParser.get(),
|
||||
&CppParser::onEndParsing,
|
||||
|
|
|
@ -117,6 +117,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
mSearchInFilesDialog{nullptr},
|
||||
mSearchDialog{nullptr},
|
||||
mQuitting{false},
|
||||
mOpeningFiles{false},
|
||||
mOpeningProject{false},
|
||||
mClosingProject{false},
|
||||
mCheckSyntaxInBack{false},
|
||||
mShouldRemoveAllSettings{false},
|
||||
|
@ -445,8 +447,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(ui->EditorTabsRight, &EditorsTabWidget::middleButtonClicked,
|
||||
this, &MainWindow::on_EditorTabsRight_tabCloseRequested);
|
||||
|
||||
//git menu
|
||||
#ifdef ENABLE_VCS
|
||||
//git menu
|
||||
connect(ui->menuGit, &QMenu::aboutToShow,
|
||||
this, &MainWindow::updateVCSActions);
|
||||
#endif
|
||||
|
@ -1442,6 +1444,10 @@ void MainWindow::setProjectCurrentFile(const QString &filename)
|
|||
|
||||
void MainWindow::openFiles(const QStringList &files)
|
||||
{
|
||||
mOpeningFiles=true;
|
||||
auto action=finally([this]{
|
||||
mOpeningFiles=false;
|
||||
});
|
||||
mEditorList->beginUpdate();
|
||||
mOpenningFiles = true;
|
||||
auto end = finally([this] {
|
||||
|
@ -1464,9 +1470,13 @@ void MainWindow::openFiles(const QStringList &files)
|
|||
}
|
||||
mEditorList->endUpdate();
|
||||
Editor* e=mEditorList->getEditor();
|
||||
if (e)
|
||||
if (e) {
|
||||
e->reparse(false);
|
||||
e->checkSyntaxInBack();
|
||||
e->reparseTodo();
|
||||
e->activate();
|
||||
}
|
||||
}
|
||||
|
||||
Editor* MainWindow::openFile(QString filename, bool activate, QTabWidget* page)
|
||||
{
|
||||
|
@ -1523,6 +1533,10 @@ Editor* MainWindow::openFile(QString filename, bool activate, QTabWidget* page)
|
|||
|
||||
void MainWindow::openProject(QString filename, bool openFiles)
|
||||
{
|
||||
mOpeningProject=true;
|
||||
auto action=finally([this]{
|
||||
mOpeningProject=false;
|
||||
});
|
||||
if (!fileExists(filename)) {
|
||||
return;
|
||||
}
|
||||
|
@ -3189,6 +3203,10 @@ bool MainWindow::saveLastOpens()
|
|||
|
||||
void MainWindow::loadLastOpens()
|
||||
{
|
||||
mOpeningFiles=true;
|
||||
auto action=finally([this]{
|
||||
mOpeningFiles=false;
|
||||
});
|
||||
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_LASTOPENS_FILE;
|
||||
if (!fileExists(filename))
|
||||
return;
|
||||
|
@ -3275,9 +3293,16 @@ void MainWindow::loadLastOpens()
|
|||
updateEditorActions();
|
||||
//updateForEncodingInfo();
|
||||
}
|
||||
if (focusedEditor)
|
||||
if (!focusedEditor) {
|
||||
focusedEditor = mEditorList->getEditor();
|
||||
}
|
||||
if (focusedEditor) {
|
||||
focusedEditor->reparse(false);
|
||||
focusedEditor->checkSyntaxInBack();
|
||||
focusedEditor->reparseTodo();
|
||||
focusedEditor->activate();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateTools()
|
||||
{
|
||||
|
@ -7548,7 +7573,8 @@ void MainWindow::reparseNonProjectEditors()
|
|||
for (int i=0;i<mEditorList->pageCount();i++) {
|
||||
Editor* e=(*mEditorList)[i];
|
||||
if (!e->inProject()) {
|
||||
if (!pSettings->codeCompletion().clearWhenEditorHidden() || e->isVisible()) {
|
||||
// if (!pSettings->codeCompletion().clearWhenEditorHidden() || e->isVisible()) {
|
||||
if (e->isVisible()) {
|
||||
e->reparse(true);
|
||||
e->checkSyntaxInBack();
|
||||
}
|
||||
|
@ -7959,6 +7985,7 @@ void MainWindow::on_actionRename_Symbol_triggered()
|
|||
refactor.renameSymbol(editor,oldCaretXY,newWord);
|
||||
editor->reparse(true);
|
||||
editor->checkSyntaxInBack();
|
||||
editor->reparseTodo();
|
||||
}
|
||||
|
||||
|
||||
|
@ -10014,3 +10041,13 @@ void MainWindow::on_actionTurtle_Graphics_Manual_triggered()
|
|||
QDesktopServices::openUrl(QUrl("https://zhuanlan.zhihu.com/p/538666844"));
|
||||
}
|
||||
|
||||
bool MainWindow::openingProject() const
|
||||
{
|
||||
return mOpeningProject;
|
||||
}
|
||||
|
||||
bool MainWindow::openingFiles() const
|
||||
{
|
||||
return mOpeningFiles;
|
||||
}
|
||||
|
||||
|
|
|
@ -872,6 +872,8 @@ private:
|
|||
SearchInFileDialog *mSearchInFilesDialog;
|
||||
SearchDialog *mSearchDialog;
|
||||
bool mQuitting;
|
||||
bool mOpeningFiles;
|
||||
bool mOpeningProject;
|
||||
bool mClosingProject;
|
||||
QElapsedTimer mParserTimer;
|
||||
QFileSystemWatcher mFileSystemWatcher;
|
||||
|
@ -1028,6 +1030,8 @@ public:
|
|||
bool isQuitting() const;
|
||||
const std::shared_ptr<VisitHistoryManager> &visitHistoryManager() const;
|
||||
bool closingProject() const;
|
||||
bool openingFiles() const;
|
||||
bool openingProject() const;
|
||||
};
|
||||
|
||||
extern MainWindow* pMainWindow;
|
||||
|
|
|
@ -6526,6 +6526,7 @@ void parseFile(PCppParser parser, const QString& fileName, bool inProject, bool
|
|||
return;
|
||||
if (!parser->enabled())
|
||||
return;
|
||||
// qDebug()<<"parsing "<<fileName;
|
||||
//delete when finished
|
||||
CppFileParserThread* thread = new CppFileParserThread(parser,fileName,inProject,onlyIfNotParsed,updateView);
|
||||
thread->connect(thread,
|
||||
|
|
|
@ -4166,32 +4166,32 @@ void Settings::CodeCompletion::setShowCodeIns(bool newShowCodeIns)
|
|||
mShowCodeIns = newShowCodeIns;
|
||||
}
|
||||
|
||||
bool Settings::CodeCompletion::clearWhenEditorHidden()
|
||||
{
|
||||
if (!mShareParser) {
|
||||
#ifdef Q_OS_WIN
|
||||
MEMORYSTATUSEX statex;
|
||||
statex.dwLength = sizeof (statex);
|
||||
GlobalMemoryStatusEx (&statex);
|
||||
//bool Settings::CodeCompletion::clearWhenEditorHidden()
|
||||
//{
|
||||
// if (!mShareParser) {
|
||||
//#ifdef Q_OS_WIN
|
||||
// MEMORYSTATUSEX statex;
|
||||
// statex.dwLength = sizeof (statex);
|
||||
// GlobalMemoryStatusEx (&statex);
|
||||
|
||||
if (statex.ullAvailPhys < (long long int)2*1024*1024*1024) {
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
struct sysinfo si;
|
||||
sysinfo(&si);
|
||||
if (si.freeram < (long long int)2*1024*1024*1024) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return mClearWhenEditorHidden;
|
||||
}
|
||||
// if (statex.ullAvailPhys < (long long int)2*1024*1024*1024) {
|
||||
// return true;
|
||||
// }
|
||||
//#elif defined(Q_OS_LINUX)
|
||||
// struct sysinfo si;
|
||||
// sysinfo(&si);
|
||||
// if (si.freeram < (long long int)2*1024*1024*1024) {
|
||||
// return true;
|
||||
// }
|
||||
//#endif
|
||||
// }
|
||||
// return mClearWhenEditorHidden;
|
||||
//}
|
||||
|
||||
void Settings::CodeCompletion::setClearWhenEditorHidden(bool newClearWhenEditorHidden)
|
||||
{
|
||||
mClearWhenEditorHidden = newClearWhenEditorHidden;
|
||||
}
|
||||
//void Settings::CodeCompletion::setClearWhenEditorHidden(bool newClearWhenEditorHidden)
|
||||
//{
|
||||
// mClearWhenEditorHidden = newClearWhenEditorHidden;
|
||||
//}
|
||||
|
||||
int Settings::CodeCompletion::minCharRequired() const
|
||||
{
|
||||
|
@ -4357,7 +4357,7 @@ void Settings::CodeCompletion::doSave()
|
|||
saveValue("ignore_case",mIgnoreCase);
|
||||
saveValue("append_func",mAppendFunc);
|
||||
saveValue("show_code_ins",mShowCodeIns);
|
||||
saveValue("clear_when_editor_hidden",mClearWhenEditorHidden);
|
||||
//saveValue("clear_when_editor_hidden",mClearWhenEditorHidden);
|
||||
saveValue("min_char_required",mMinCharRequired);
|
||||
saveValue("hide_symbols_start_with_two_underline", mHideSymbolsStartsWithTwoUnderLine);
|
||||
saveValue("hide_symbols_start_with_underline", mHideSymbolsStartsWithUnderLine);
|
||||
|
@ -4412,7 +4412,7 @@ void Settings::CodeCompletion::doLoad()
|
|||
// shouldShare = false;
|
||||
// }
|
||||
//#endif
|
||||
mClearWhenEditorHidden = boolValue("clear_when_editor_hidden",doClear);
|
||||
//mClearWhenEditorHidden = boolValue("clear_when_editor_hidden",doClear);
|
||||
mShareParser = boolValue("share_parser",shouldShare);
|
||||
}
|
||||
|
||||
|
|
|
@ -653,8 +653,8 @@ public:
|
|||
bool showCodeIns() const;
|
||||
void setShowCodeIns(bool newShowCodeIns);
|
||||
|
||||
bool clearWhenEditorHidden();
|
||||
void setClearWhenEditorHidden(bool newClearWhenEditorHidden);
|
||||
//bool clearWhenEditorHidden();
|
||||
//void setClearWhenEditorHidden(bool newClearWhenEditorHidden);
|
||||
|
||||
int minCharRequired() const;
|
||||
void setMinCharRequired(int newMinCharRequired);
|
||||
|
@ -684,7 +684,7 @@ public:
|
|||
int mMinCharRequired;
|
||||
bool mHideSymbolsStartsWithTwoUnderLine;
|
||||
bool mHideSymbolsStartsWithUnderLine;
|
||||
bool mClearWhenEditorHidden;
|
||||
//bool mClearWhenEditorHidden;
|
||||
bool mShareParser;
|
||||
|
||||
// _Base interface
|
||||
|
|
|
@ -26,6 +26,7 @@ EditorCodeCompletionWidget::EditorCodeCompletionWidget(const QString& name, cons
|
|||
ui(new Ui::EditorCodeCompletionWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->chkClearWhenEditorHidden->setVisible(false);
|
||||
}
|
||||
|
||||
EditorCodeCompletionWidget::~EditorCodeCompletionWidget()
|
||||
|
@ -50,7 +51,7 @@ void EditorCodeCompletionWidget::doLoad()
|
|||
ui->chkIgnoreCases->setChecked(pSettings->codeCompletion().ignoreCase());
|
||||
ui->chkAppendFunc->setChecked(pSettings->codeCompletion().appendFunc());
|
||||
ui->chkShowCodeIns->setChecked(pSettings->codeCompletion().showCodeIns());
|
||||
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
|
||||
// ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
|
||||
ui->chkHideSymbolsStartWithTwoUnderline->setChecked(pSettings->codeCompletion().hideSymbolsStartsWithTwoUnderLine());
|
||||
ui->chkHideSymbolsStartWithUnderline->setChecked(pSettings->codeCompletion().hideSymbolsStartsWithUnderLine());
|
||||
|
||||
|
@ -78,7 +79,7 @@ void EditorCodeCompletionWidget::doSave()
|
|||
pSettings->codeCompletion().setShowCodeIns(ui->chkShowCodeIns->isChecked());
|
||||
pSettings->codeCompletion().setMinCharRequired(ui->spinMinCharRequired->value());
|
||||
|
||||
pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
|
||||
//pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
|
||||
|
||||
pSettings->codeCompletion().setHideSymbolsStartsWithTwoUnderLine(ui->chkHideSymbolsStartWithTwoUnderline->isChecked());
|
||||
pSettings->codeCompletion().setHideSymbolsStartsWithUnderLine(ui->chkHideSymbolsStartWithUnderline->isChecked());
|
||||
|
|
|
@ -23,6 +23,7 @@ EnvironmentPerformanceWidget::EnvironmentPerformanceWidget(const QString& name,
|
|||
ui(new Ui::EnvironmentPerformanceWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->chkClearWhenEditorHidden->setVisible(false);
|
||||
}
|
||||
|
||||
EnvironmentPerformanceWidget::~EnvironmentPerformanceWidget()
|
||||
|
@ -32,7 +33,7 @@ EnvironmentPerformanceWidget::~EnvironmentPerformanceWidget()
|
|||
|
||||
void EnvironmentPerformanceWidget::doLoad()
|
||||
{
|
||||
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
|
||||
// ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
|
||||
//#ifdef Q_OS_WIN
|
||||
// MEMORYSTATUSEX statex;
|
||||
|
||||
|
@ -58,7 +59,7 @@ void EnvironmentPerformanceWidget::doLoad()
|
|||
|
||||
void EnvironmentPerformanceWidget::doSave()
|
||||
{
|
||||
pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
|
||||
//pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
|
||||
pSettings->codeCompletion().setShareParser(ui->chkEditorsShareParser->isChecked());
|
||||
|
||||
pSettings->codeCompletion().save();
|
||||
|
|
Loading…
Reference in New Issue