From 73d527318c646c05dbaaeb810319a5f59c2c158e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 16 Jan 2023 11:35:55 +0800 Subject: [PATCH] - fix: When restored from minimization, info on statusbar not correctly restored. - enhancement: Changes of "auto backup editing contents" is applied immediately. - enhancement: Don't create temp backup for readonly files. --- NEWS.md | 7 +++++++ RedPandaIDE/RedPandaIDE.pro | 2 +- RedPandaIDE/editor.cpp | 13 ++++++++++++- RedPandaIDE/settingsdialog/editorautosavewidget.cpp | 3 +++ Red_Panda_CPP.pro | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index ffe7ea35..8b7aa232 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +Red Panda C++ Version 2.10 + + - fix: When restored from minimization, info on statusbar not correctly restored. + - enhancement: Changes of "auto backup editing contents" is applied immediately. + - enhancement: Don't create temp backup for readonly files. + + Red Panda C++ Version 2.9 - enhancement: set caret to the corresponding line in the editor after "run"/"generate assembly" diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index c79b6902..49f8d507 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -10,7 +10,7 @@ isEmpty(APP_NAME) { } isEmpty(APP_VERSION) { - APP_VERSION = 2.9 + APP_VERSION = 2.10 } macos: { diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 0da76486..8dfed3a6 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -1459,6 +1459,10 @@ void Editor::showEvent(QShowEvent */*event*/) pMainWindow->debugger()->setIsForProject(inProject()); pMainWindow->bookmarkModel()->setIsForProject(inProject()); pMainWindow->todoModel()->setIsForProject(inProject()); + + pMainWindow->updateForEncodingInfo(true); + pMainWindow->updateStatusbarForLineCol(true); + pMainWindow->updateForStatusbarModeInfo(true); } if (!pMainWindow->isClosingAll() @@ -1832,7 +1836,7 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes) invalidate(); mOldHighlightedWord = mCurrentHighlightedWord; } - pMainWindow->updateStatusbarForLineCol(); + pMainWindow->updateStatusbarForLineCol(this); // Update the function tip if (pSettings->editor().showFunctionTips()) { @@ -1852,6 +1856,11 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes) pMainWindow->caretList().addCaret(this,caretY(),caretX()); pMainWindow->updateCaretActions(); } + + if (changes.testFlag(QSynedit::StatusChange::scReadOnly)) { + if (!readOnly()) + initAutoBackup(); + } } void Editor::onGutterClicked(Qt::MouseButton button, int , int , int line) @@ -3326,6 +3335,8 @@ void Editor::initAutoBackup() cleanAutoBackup(); if (!pSettings->editor().enableEditTempBackup()) return; + if (readOnly()) + return; QFileInfo fileInfo(mFilename); if (fileInfo.isAbsolute()) { mBackupFile=new QFile(extractFileDir(mFilename) diff --git a/RedPandaIDE/settingsdialog/editorautosavewidget.cpp b/RedPandaIDE/settingsdialog/editorautosavewidget.cpp index 2cadc600..1efafdb4 100644 --- a/RedPandaIDE/settingsdialog/editorautosavewidget.cpp +++ b/RedPandaIDE/settingsdialog/editorautosavewidget.cpp @@ -75,6 +75,7 @@ void EditorAutoSaveWidget::doLoad() void EditorAutoSaveWidget::doSave() { + bool shouldApplyEditorSettings=(ui->chkAutoBackupEditContents->isChecked()!=pSettings->editor().enableEditTempBackup()); pSettings->editor().setEnableEditTempBackup(ui->chkAutoBackupEditContents->isChecked()); pSettings->editor().setEnableAutoSave(ui->grpEnableAutoSave->isChecked()); pSettings->editor().setAutoSaveInterval(ui->spinInterval->value()); @@ -91,6 +92,8 @@ void EditorAutoSaveWidget::doSave() else pSettings->editor().setAutoSaveStrategy(assAppendFormatedTimeStamp); pSettings->editor().save(); + if (shouldApplyEditorSettings) + pMainWindow->updateEditorSettings(); pMainWindow->resetAutoSaveTimer(); } diff --git a/Red_Panda_CPP.pro b/Red_Panda_CPP.pro index 2ac21336..303f62f1 100644 --- a/Red_Panda_CPP.pro +++ b/Red_Panda_CPP.pro @@ -33,7 +33,7 @@ RedPandaIDE.depends += redpanda-git-askpass APP_NAME = RedPandaCPP -APP_VERSION = 2.9 +APP_VERSION = 2.10 linux: { isEmpty(PREFIX) {