- change: Disable undo limit by default.

This commit is contained in:
Roy Qu 2023-01-06 11:59:21 +08:00
parent b01a51ab91
commit 32088a18d0
8 changed files with 316 additions and 221 deletions

View File

@ -17,6 +17,7 @@ Red Panda C++ Version 2.8
- enhancement: Print current selection can be used in the print dialog. - enhancement: Print current selection can be used in the print dialog.
- enhancement: Print syntax colored content. - enhancement: Print syntax colored content.
- enhancement: Correctly handle tab in the exported RTF. - enhancement: Correctly handle tab in the exported RTF.
- change: Disable undo limit by default.
Red Panda C++ Version 2.7 Red Panda C++ Version 2.7

View File

@ -2817,6 +2817,7 @@ void Editor::reparse(bool resetParser)
return; return;
if (!mParser->enabled()) if (!mParser->enabled())
return; return;
//mParser->setEnabled(pSettings->codeCompletion().enabled()); //mParser->setEnabled(pSettings->codeCompletion().enabled());
ParserLanguage language = mUseCppSyntax?ParserLanguage::CPlusPlus:ParserLanguage::C; ParserLanguage language = mUseCppSyntax?ParserLanguage::CPlusPlus:ParserLanguage::C;
if (!inProject()) { if (!inProject()) {

View File

@ -1529,7 +1529,7 @@ void Settings::Editor::doLoad()
mDefaultEncoding = value("default_encoding", ENCODING_UTF8).toByteArray(); mDefaultEncoding = value("default_encoding", ENCODING_UTF8).toByteArray();
mAutoDetectFileEncoding = boolValue("auto_detect_file_encoding",true); mAutoDetectFileEncoding = boolValue("auto_detect_file_encoding",true);
mUndoLimit = intValue("undo_limit",0); mUndoLimit = intValue("undo_limit",0);
mUndoMemoryUsage = intValue("undo_memory_usage", 10); mUndoMemoryUsage = intValue("undo_memory_usage", 0);
mAutoFormatWhenSaved = boolValue("auto_format_when_saved", false); mAutoFormatWhenSaved = boolValue("auto_format_when_saved", false);
mRemoveTrailingSpacesWhenSaved = boolValue("remove_trailing_spaces_when_saved",false); mRemoveTrailingSpacesWhenSaved = boolValue("remove_trailing_spaces_when_saved",false);
mParseTodos = boolValue("parse_todos",true); mParseTodos = boolValue("parse_todos",true);

View File

@ -33,26 +33,27 @@ EnvironmentPerformanceWidget::~EnvironmentPerformanceWidget()
void EnvironmentPerformanceWidget::doLoad() void EnvironmentPerformanceWidget::doLoad()
{ {
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden()); ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
#ifdef Q_OS_WIN //#ifdef Q_OS_WIN
MEMORYSTATUSEX statex; // MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex); // statex.dwLength = sizeof (statex);
GlobalMemoryStatusEx (&statex); // GlobalMemoryStatusEx (&statex);
if (statex.ullTotalPhys < (long long int)2*1024*1024*1024) { // if (statex.ullTotalPhys < (long long int)2*1024*1024*1024) {
ui->chkClearWhenEditorHidden->setEnabled(false); // ui->chkClearWhenEditorHidden->setEnabled(false);
ui->chkClearWhenEditorHidden->setChecked(true); // ui->chkClearWhenEditorHidden->setChecked(true);
pSettings->codeCompletion().setClearWhenEditorHidden(true); // pSettings->codeCompletion().setClearWhenEditorHidden(true);
pSettings->codeCompletion().save(); // pSettings->codeCompletion().save();
} // }
if (statex.ullTotalPhys < (long long int)1024*1024*1024) { // if (statex.ullTotalPhys < (long long int)1024*1024*1024) {
ui->chkEditorsShareParser->setEnabled(false); // ui->chkEditorsShareParser->setEnabled(false);
ui->chkEditorsShareParser->setChecked(true); // ui->chkEditorsShareParser->setChecked(true);
pSettings->codeCompletion().setShareParser(true); // pSettings->codeCompletion().setShareParser(true);
pSettings->codeCompletion().save(); // pSettings->codeCompletion().save();
} // }
#endif //#endif
ui->chkEditorsShareParser->setChecked(pSettings->codeCompletion().shareParser()); ui->chkEditorsShareParser->setChecked(pSettings->codeCompletion().shareParser());
ui->spinMaxUndoMemory->setValue(pSettings->editor().undoMemoryUsage());
} }
void EnvironmentPerformanceWidget::doSave() void EnvironmentPerformanceWidget::doSave()
@ -61,4 +62,6 @@ void EnvironmentPerformanceWidget::doSave()
pSettings->codeCompletion().setShareParser(ui->chkEditorsShareParser->isChecked()); pSettings->codeCompletion().setShareParser(ui->chkEditorsShareParser->isChecked());
pSettings->codeCompletion().save(); pSettings->codeCompletion().save();
pSettings->editor().setUndoMemoryUsage(ui->spinMaxUndoMemory->value());
pSettings->editor().save();
} }

View File

@ -13,25 +13,76 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Reduce Memory Usage</string> <string>Reduce Memory Usage</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="1" column="0"> <item>
<widget class="QCheckBox" name="chkEditorsShareParser">
<property name="text">
<string>Editors share one code parser</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkClearWhenEditorHidden"> <widget class="QCheckBox" name="chkClearWhenEditorHidden">
<property name="text"> <property name="text">
<string>Auto clear parsed symbols when editor hidden</string> <string>Auto clear parsed symbols when editor hidden</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item>
<widget class="QCheckBox" name="chkEditorsShareParser"> <widget class="QWidget" name="widget" native="true">
<property name="text"> <layout class="QHBoxLayout" name="horizontalLayout">
<string>Editors share one code parser</string> <property name="leftMargin">
<number>0</number>
</property> </property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max undo memory for each editor:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinMaxUndoMemory">
<property name="suffix">
<string>MB</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -1819,6 +1819,14 @@
<source>Editors share one code parser</source> <source>Editors share one code parser</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Max undo memory for each editor:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MB</source>
<translation type="unfinished">MB</translation>
</message>
</context> </context>
<context> <context>
<name>EnvironmentProgramsWidget</name> <name>EnvironmentProgramsWidget</name>
@ -4928,6 +4936,10 @@
<source>Line: %1 Col: %2 Lines: %3</source> <source>Line: %1 Col: %2 Lines: %3</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Newline</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>NewClassDialog</name> <name>NewClassDialog</name>

File diff suppressed because it is too large Load Diff

View File

@ -1692,6 +1692,14 @@
<source>Editors share one code parser</source> <source>Editors share one code parser</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Max undo memory for each editor:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>MB</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EnvironmentProgramsWidget</name> <name>EnvironmentProgramsWidget</name>
@ -4741,6 +4749,10 @@
<source>Line: %1 Col: %2 Lines: %3</source> <source>Line: %1 Col: %2 Lines: %3</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Newline</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>NewClassDialog</name> <name>NewClassDialog</name>