diff --git a/NEWS.md b/NEWS.md index ca13a872..640bb224 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,8 @@ Red Panda C++ Version 2.9 - fix: Save may crash app if the encoding codec is failed to load. - enhancement: support open and save utf-16/utf-32 BOM files. (but gcc can't compile) - enhancement: Create a temporary copy of the current file when saving files (it's removed after the saving sucessfully finished). + - enhancement: Auto backup editing contents. (Save editing contents 3 seconds after input stopped. Auto delete when editor successfully closed) + - enhancement: Add "Auto backup editing contents" option in options/editor/auto save Red Panda C++ Version 2.8 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 0d289371..8d3c2858 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include "qsynedit/syntaxer/cpp.h" #include "syntaxermanager.h" #include "qsynedit/exporter/rtfexporter.h" @@ -83,6 +84,7 @@ Editor::Editor(QWidget *parent, const QString& filename, mSaving(false), mHoverModifiedLine(-1) { + mBackupFile=nullptr; mHighlightCharPos1 = QSynedit::BufferCoord{0,0}; mHighlightCharPos2 = QSynedit::BufferCoord{0,0}; mCurrentLineModified = false; @@ -93,7 +95,13 @@ Editor::Editor(QWidget *parent, const QString& filename, QFileInfo fileInfo(mFilename); QSynedit::PSyntaxer syntaxer; if (!isNew) { - loadFile(); + try { + loadFile(); + } catch (FileError& e) { + QMessageBox::critical(nullptr, + tr("Error Load File"), + e.reason()); + } syntaxer = syntaxerManager.getSyntaxer(mFilename); } else { mFileEncoding = ENCODING_ASCII; @@ -176,9 +184,13 @@ Editor::Editor(QWidget *parent, const QString& filename, setExtraKeystrokes(); } - if (mParentPageControl) + if (mParentPageControl) { connect(&mFunctionTipTimer, &QTimer::timeout, this, &Editor::onFunctionTipsTimer); + mAutoBackupTimer.setInterval(1); + connect(&mAutoBackupTimer, &QTimer::timeout, + this, &Editor::onAutoBackupTimer); + } connect(horizontalScrollBar(), &QScrollBar::valueChanged, this, &Editor::onScrollBarValueChanged); @@ -188,15 +200,33 @@ Editor::Editor(QWidget *parent, const QString& filename, Editor::~Editor() { //qDebug()<<"editor "<document()->loadFromFile(mFilename,mEncodingOption,mFileEncoding); + filename=mFilename; + for (int i=0;i<100;i++) { + QString backfilename = filename+".savebak"; + if (i>0) + backfilename += QString("%1").arg(i); + if (fileExists(backfilename)) { + if (QMessageBox::question(this,tr("Restore backup"), + tr("Backup file '%1' detected.").arg(backfilename) + +"
" + +tr("Error occurred at last save.") + +"
" + +tr("Do you want to load the backup file?"), + QMessageBox::Yes | QMessageBox::No)==QMessageBox::Yes) + filename = backfilename; + break; + } + } } else { filename = QFileInfo(filename).absoluteFilePath(); - this->document()->loadFromFile(filename,mEncodingOption,mFileEncoding); } + + this->document()->loadFromFile(filename,mEncodingOption,mFileEncoding); //this->setModified(false); updateCaption(); if (mParentPageControl) @@ -219,6 +249,7 @@ void Editor::loadFile(QString filename) { reparseTodo(); } mLastIdCharPressed = 0; + saveAutoBackup(); } void Editor::saveFile(QString filename) { @@ -450,6 +481,8 @@ bool Editor::saveAs(const QString &name, bool fromProject){ updateCaption(); emit renamed(oldName, newName , firstSave); + + initAutoBackup(); return true; } @@ -467,9 +500,15 @@ void Editor::setEncodingOption(const QByteArray& encoding) noexcept{ if (mEncodingOption == encoding) return; mEncodingOption = encoding; - if (!isNew()) - loadFile(); - else if (mParentPageControl) + if (!isNew()) { + try { + loadFile(); + } catch (FileError& e) { + QMessageBox::critical(nullptr, + tr("Error Load File"), + e.reason()); + } + } else if (mParentPageControl) pMainWindow->updateForEncodingInfo(this); if (mProject) { PProjectUnit unit = mProject->findUnit(this); @@ -1800,8 +1839,6 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes) } } - - if (changes.testFlag(QSynedit::scInsertMode) | changes.testFlag(QSynedit::scReadOnly)) pMainWindow->updateForStatusbarModeInfo(); @@ -1866,6 +1903,16 @@ void Editor::onFunctionTipsTimer() updateFunctionTip(true); } +void Editor::onAutoBackupTimer() +{ + if (mBackupTime>lastModifyTime()) + return; + QDateTime current=QDateTime::currentDateTime(); + if (current.toSecsSinceEpoch()-lastModifyTime().toSecsSinceEpoch()<3) + return; + saveAutoBackup(); +} + bool Editor::isBraceChar(QChar ch) { switch( ch.unicode()) { @@ -3268,6 +3315,61 @@ void Editor::showHeaderCompletion(bool autoComplete, bool forceShow) headerCompletionInsert(); // if only have one suggestion, just use it } +void Editor::initAutoBackup() +{ + if (!mParentPageControl) + return; + cleanAutoBackup(); + if (!pSettings->editor().enableEditTempBackup()) + return; + QFileInfo fileInfo(mFilename); + if (fileInfo.isAbsolute()) { + mBackupFile=new QFile(extractFileDir(mFilename) + +QDir::separator() + +extractFileName(mFilename)+QString(".%1.editbackup").arg(QDateTime::currentSecsSinceEpoch())); + if (mBackupFile->open(QFile::Truncate|QFile::WriteOnly)) { + saveAutoBackup(); + } else { + cleanAutoBackup(); + } + } else { + mBackupFile=new QFile( + includeTrailingPathDelimiter(QDir::currentPath()) + +mFilename + +QString(".%1.editbackup").arg(QDateTime::currentSecsSinceEpoch())); + if (!mBackupFile->open(QFile::Truncate|QFile::WriteOnly)) { + mBackupFile->setParent(nullptr); + delete mBackupFile; + mBackupFile=nullptr; + } + } + if (mBackupFile) { + mAutoBackupTimer.start(); + } +} + +void Editor::saveAutoBackup() +{ + if (mBackupFile) { + mBackupFile->reset(); + mBackupTime=QDateTime::currentDateTime(); + mBackupFile->write(text().toUtf8()); + mBackupFile->flush(); + qDebug()<size()<fileName(); + } +} + +void Editor::cleanAutoBackup() +{ + mAutoBackupTimer.stop(); + if (mBackupFile) { + mBackupFile->close(); + mBackupFile->remove(); + delete mBackupFile; + mBackupFile=nullptr; + } +} + bool Editor::testInFunc(int x, int y) { bool result = false; @@ -4841,6 +4943,8 @@ void Editor::applySettings() this->setUndoLimit(pSettings->editor().undoLimit()); this->setUndoMemoryUsage(pSettings->editor().undoMemoryUsage()); + initAutoBackup(); + setMouseWheelScrollSpeed(pSettings->editor().mouseWheelScrollSpeed()); setMouseSelectionScrollSpeed(pSettings->editor().mouseSelectionScrollSpeed()); invalidate(); diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index b1d421e0..5ba2a989 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -39,6 +39,8 @@ struct TabStop { int y; }; +class QTemporaryFile; + using PTabStop = std::shared_ptr; class Editor : public QSynedit::QSynEdit @@ -228,6 +230,7 @@ private slots: void onLinesDeleted(int first,int count); void onLinesInserted(int first,int count); void onFunctionTipsTimer(); + void onAutoBackupTimer(); private: bool isBraceChar(QChar ch); @@ -254,6 +257,10 @@ private: void showCompletion(const QString& preWord, bool autoComplete, CodeCompletionType type); void showHeaderCompletion(bool autoComplete, bool forceShow=false); + void initAutoBackup(); + void saveAutoBackup(); + void cleanAutoBackup(); + bool testInFunc(int x,int y); void completionInsert(bool appendFunc=false); @@ -281,6 +288,8 @@ private: void onScrollBarValueChanged(); static PCppParser sharedParser(ParserLanguage language); private: + QDateTime mBackupTime; + QFile* mBackupFile; QByteArray mEncodingOption; // the encoding type set by the user QByteArray mFileEncoding; // the real encoding of the file (auto detected) QString mFilename; @@ -328,6 +337,7 @@ private: QSynedit::BufferCoord mHighlightCharPos2; std::shared_ptr > > mStatementColors; QTimer mFunctionTipTimer; + QTimer mAutoBackupTimer; int mHoverModifiedLine; static QHash> mSharedParsers; diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 46379629..c5ec06ee 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -760,6 +760,16 @@ void Settings::Editor::setShowLeadingSpaces(bool newShowStartSpaces) mShowLeadingSpaces = newShowStartSpaces; } +bool Settings::Editor::enableEditTempBackup() const +{ + return mEnableEditTempBackup; +} + +void Settings::Editor::setEnableEditTempBackup(bool newEnableEditTempBackup) +{ + mEnableEditTempBackup = newEnableEditTempBackup; +} + bool Settings::Editor::showTrailingSpaces() const { return mShowTrailingSpaces; @@ -1360,6 +1370,7 @@ void Settings::Editor::doSave() saveValue("check_syntax_when_line_changed",mSyntaxCheckWhenLineChanged); //auto save + saveValue("enable_edit_temp_backup",mEnableEditTempBackup); saveValue("enable_auto_save",mEnableAutoSave); saveValue("auto_save_interal",mAutoSaveInterval); saveValue("auto_save_target",mAutoSaveTarget); @@ -1508,6 +1519,7 @@ void Settings::Editor::doLoad() mSyntaxCheckWhenLineChanged = boolValue("check_syntax_when_line_changed",true); //auto save + mEnableEditTempBackup = boolValue("enable_edit_temp_backup",true); mEnableAutoSave = boolValue("enable_auto_save",false); mAutoSaveInterval = intValue("auto_save_interal",10); mAutoSaveTarget = static_cast( diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 76746f3b..a29f7d47 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -398,6 +398,9 @@ public: bool showLeadingSpaces() const; void setShowLeadingSpaces(bool newShowStartSpaces); + bool enableEditTempBackup() const; + void setEnableEditTempBackup(bool newEnableEditTempBackup); + private: //General // indents @@ -497,6 +500,7 @@ public: bool mSyntaxCheckWhenLineChanged; //auto save + bool mEnableEditTempBackup; bool mEnableAutoSave; int mAutoSaveInterval; enum AutoSaveTarget mAutoSaveTarget; diff --git a/RedPandaIDE/settingsdialog/editorautosavewidget.cpp b/RedPandaIDE/settingsdialog/editorautosavewidget.cpp index c35f7d3d..2cadc600 100644 --- a/RedPandaIDE/settingsdialog/editorautosavewidget.cpp +++ b/RedPandaIDE/settingsdialog/editorautosavewidget.cpp @@ -48,8 +48,7 @@ void EditorAutoSaveWidget::onAutoSaveStrategyChanged() void EditorAutoSaveWidget::doLoad() { - //pSettings->editor().load(); - //font + ui->chkAutoBackupEditContents->setChecked(pSettings->editor().enableEditTempBackup()); ui->grpEnableAutoSave->setChecked(pSettings->editor().enableAutoSave()); ui->spinInterval->setValue(pSettings->editor().autoSaveInterval()); switch(pSettings->editor().autoSaveTarget()) { @@ -76,6 +75,7 @@ void EditorAutoSaveWidget::doLoad() void EditorAutoSaveWidget::doSave() { + pSettings->editor().setEnableEditTempBackup(ui->chkAutoBackupEditContents->isChecked()); pSettings->editor().setEnableAutoSave(ui->grpEnableAutoSave->isChecked()); pSettings->editor().setAutoSaveInterval(ui->spinInterval->value()); if (ui->rbCurrentFile->isChecked()) diff --git a/RedPandaIDE/settingsdialog/editorautosavewidget.ui b/RedPandaIDE/settingsdialog/editorautosavewidget.ui index 7e6634dc..7e9ae678 100644 --- a/RedPandaIDE/settingsdialog/editorautosavewidget.ui +++ b/RedPandaIDE/settingsdialog/editorautosavewidget.ui @@ -14,6 +14,13 @@ Form + + + + Auto backup editing contents + + + diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 8bcf636a..62e23cf6 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -1038,6 +1038,30 @@ Can't generate temporary backup file '%1'. + + Restore backup + + + + Backup file '%1' detected. + + + + Continue to save? + + + + Error occurred at last save. + + + + Do you want to load the backup file? + + + + Error Load File + Erro ao carregar arquivo + EditorAutoSaveWidget @@ -1097,6 +1121,10 @@ Demo file name: Nome do arquivo de demonstração: + + Auto backup editing contents + + EditorClipboardWidget diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index ac7868ca..9daadcad 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -1379,14 +1379,15 @@ Are you really want to continue? 失败 - - - - - - - - + + + + + + + + + Error 错误 @@ -1395,49 +1396,82 @@ Are you really want to continue? 无法写入文件"%1" - - Can't generate temporary backup file '%1'. - 无法生成临时备份文件"%1"。 + + + Error Load File + 载入文件错误 - + + Restore backup + 恢复备份文件 + + + + Backup file '%1' detected. + 检测到临时备份文件'%1'。 + + + + Error occurred at last save. + 上次保存时出错。 + + + + Do you want to load the backup file? + 是否载入备份文件? + + + + + Can't generate temporary backup file '%1'. + 无法生成临时备份文件"%1"。 + + + + + Continue to save? + 继续保存? + + + Save As 另存为 - + File %1 already openned! 文件%1已经被打开! - + The text to be copied exceeds count limit! 要复制的内容超过了行数限制! - + The text to be copied exceeds character limit! 要复制的内容超过了字符数限制! - + The text to be cut exceeds count limit! 要剪切的内容超过了行数限制! - + The text to be cut exceeds character limit! 要剪切的内容超过了字符数限制! - + Print Document 打印文档 - - - + + + Ctrl+click for more info Ctrl+单击以获取更多信息 @@ -1446,27 +1480,27 @@ Are you really want to continue? 未找到符号'%1'! - + astyle not found 找不到astyle程序 - + Can't find astyle in "%1". 找不到astyle程序"%1". - + Break point condition 断点条件 - + Enter the condition of the breakpoint: 输入当前断点的生效条件: - + Readonly 只读 @@ -1480,61 +1514,66 @@ Are you really want to continue? + Auto backup editing contents + 自动备份编辑内容 + + + Enable auto save 启用自动保存 - + Time interval: 时间间隔 - + minutes 分钟 - + Objects to save 保存对象 - + Current File 当前文件 - + All files openned 所有打开的文件 - + Project files 项目文件 - + Save strategy 保存策略 - + Overwrite 自动覆盖 - + Append UNIX timestamp 添加Unix时间戳 - + Append formatted timestamp 添加格式化时间戳 - + Demo file name: 示例文件名 @@ -4125,11 +4164,11 @@ Are you really want to continue? - - - - - + + + + + Issues 编译器 @@ -4567,7 +4606,7 @@ Are you really want to continue? - + New Problem Set 新建试题集 @@ -4589,7 +4628,7 @@ Are you really want to continue? - + Save Problem Set 保存试题集 @@ -4597,7 +4636,7 @@ Are you really want to continue? - + Load Problem Set 载入试题集 @@ -4728,14 +4767,14 @@ Are you really want to continue? - + Import FPS Problem Set 导入FPS试题集 - + Export FPS Problem Set 导出FPS试题集 @@ -4977,7 +5016,7 @@ Are you really want to continue? - + Clear all breakpoints 删除所有断点 @@ -5229,7 +5268,7 @@ Are you really want to continue? - + Rename Symbol 重命名符号 @@ -5250,13 +5289,13 @@ Are you really want to continue? - + Export As RTF 导出为RTF - + Export As HTML 导出为HTML @@ -5629,22 +5668,22 @@ Are you really want to continue? - - + + Wrong Compiler Settings 错误的编译器设置 - - + + Compiler is set not to generate executable. 编译器被设置为不生成可执行文件。 - + We need the executabe to run problem case. 我们需要可执行文件来运行试题案例。 @@ -5710,7 +5749,7 @@ Are you really want to continue? - + Please correct this before start debugging 请在调试前改正设置。 @@ -5768,22 +5807,22 @@ Are you really want to continue? 全部复制 - + Go to Line 跳转到行 - + Line - + Template Exists 模板已存在 - + Template %1 already exists. Do you want to overwrite? 模板%1已存在。是否覆盖? @@ -5809,7 +5848,7 @@ Are you really want to continue? - + Problem Set %1 试题集%1 @@ -5883,15 +5922,15 @@ Are you really want to continue? - - + + Bookmark Description 书签描述 - - + + Description: 描述: @@ -6072,7 +6111,7 @@ Are you really want to continue? - + Delete 删除 @@ -6136,17 +6175,17 @@ Are you really want to continue? 中止 - + FPS Problem Set Files (*.fps;*.xml) FPS试题集文件(*.fps;*.xml) - + FPS Problem Set Files (*.fps) FPS试题集文件(*.fps) - + Export Error 导出时出错 @@ -6190,7 +6229,7 @@ Are you really want to continue? - + Do you want to save it? 需要保存吗? @@ -6214,23 +6253,23 @@ Are you really want to continue? - + Save Error 保存失败 - + Change Project Compiler Set 改变项目编译器配置集 - + Change the project's compiler set will lose all custom compiler set options. 改变项目的编译器配置集会导致所有的自定义编译器选项被重置。 - + Do you really want to do that? 你真的想要那么做吗? @@ -6253,78 +6292,78 @@ Are you really want to continue? 无标题%1 - + Modify Watch 修改监视表达式 - + Watch Expression 监视表达式 - + Do you really want to clear all breakpoints in this file? 您真的要清除该文件的所有断点吗? - + New project 新建项目 - + Close %1 and start new project? 关闭'%1'以打开新项目? - + Folder not exist 文件夹不存在 - + Folder '%1' doesn't exist. Create it now? 文件夹'%1'不存在。是否创建? - + Can't create folder 无法创建文件夹 - + Failed to create folder '%1'. 创建文件夹'%1'失败。 - + Save new project as - + Folder %1 is not empty. 文件夹%1不是空的。 - + Do you really want to delete it? 你真的要删除它吗? - + Change working folder 改变工作文件夹 - + File '%1' is not in the current working folder. File '%1' is not in the current working folder 文件'%1'不在当前工作文件夹中。 - + Do you want to change working folder to '%1'? 是否将工作文件夹改设为'%1'? @@ -6333,28 +6372,28 @@ Are you really want to continue? 正在删除试题... - + Can't Commit 无法提交 - + Git needs user info to commit. Git需要用信息进行提交。 - + Choose Input Data File 选择输入数据文件 - - + + All files (*.*) 所有文件 (*.*) - + Choose Expected Output Data File Choose Expected Input Data File 选择期望输出文件 @@ -6366,59 +6405,59 @@ Are you really want to continue? - + Choose Working Folder 选择工作文件夹 - - + + Header Exists 头文件已存在 - - + + Header file "%1" already exists! 头文件"%1"已存在! - + Source Exists 源文件已存在! - + Source file "%1" already exists! 源文件"%1"已存在! - + Can't commit! 无法提交! - + The following files are in conflicting: 下列文件处于冲突状态,请解决后重新添加和提交: - + Commit Message 提交信息 - + Commit Message: 提交信息: - + Commit Failed 提交失败 - + Commit message shouldn't be empty! 提交信息不能为空! @@ -6427,22 +6466,22 @@ Are you really want to continue? 小熊猫Dev-C++项目文件 (*.dev) - + New project fail 新建项目失败 - + Can't assign project template 无法使用模板创建项目 - + Remove file 删除文件 - + Remove the file from disk? 同时从硬盘上删除文件? @@ -6451,27 +6490,27 @@ Are you really want to continue? 无标题 - + New Project File Name 新的项目文件名 - + File Name: 文件名: - + File Already Exists! 文件已存在! - + File '%1' already exists! 文件'%1'已经存在! - + Add to project 添加到项目 @@ -6502,78 +6541,78 @@ Are you really want to continue? 本操作会删除此试题的所有案例。 - + Red Panda C++ project file (*.dev) 小熊猫C++项目文件(*.dev) - + Rename Error 重命名出错 - + Symbol '%1' is defined in system header. 符号'%1'在系统头文件中定义,无法修改。 - + New Name 新名称 - - - - + + + + Replace Error 替换出错 - + Can't open file '%1' for replace! 无法打开文件'%1'进行替换! - + Contents has changed since last search! 内容和上次查找时不一致。 - + Rich Text Format Files (*.rtf) RTF格式文件 (*.rtf) - + HTML Files (*.html) HTML文件 (*.html) - + The current problem set is not empty. 当前的试题集不是空的。 - + Problem %1 试题%1 - - + + Problem Set Files (*.pbs) 试题集文件 (*.pbs) - - + + Load Error 载入失败 - + Problem Case %1 试题案例%1 @@ -6589,11 +6628,9 @@ Are you really want to continue? - - - - - + + + Error 错误 @@ -6645,54 +6682,54 @@ Are you really want to continue? 打开 - + Compile Failed 编译失败 - + Run Failed 运行失败 - - - + + + Confirm Convertion 确认转换 - - - + + + The editing file will be saved using %1 encoding. <br />This operation can't be reverted. <br />Are you sure to continue? 当前编辑器中的文件将会使用%1编码保存。<br />这项操作无法被撤回。<br />你确定要继续吗? - + New Watch Expression 新监视表达式 - + Enter Watch Expression (it is recommended to use 'this->' for class members): 输入监视表达式 - + Parsing file %1 of %2: "%3" (%1/%2)正在解析文件"%3" - - + + Done parsing %1 files in %2 seconds 完成%1个文件的解析,用时%2秒 - + (%1 files per second) (每秒%1个文件) @@ -8137,7 +8174,7 @@ Are you really want to continue? 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -8250,7 +8287,7 @@ Are you really want to continue? 只生成汇编代码(-S) - + Confirm 确认 @@ -8271,13 +8308,13 @@ Are you really want to continue? 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -9357,7 +9394,7 @@ Are you really want to continue? - + Compiler Set @@ -9366,7 +9403,7 @@ Are you really want to continue? - + Compiler @@ -9378,7 +9415,7 @@ Are you really want to continue? 自动链接 - + @@ -9455,15 +9492,15 @@ Are you really want to continue? 杂项 - - + + Program Runner 程序运行 - + Problem Set 试题集 diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index c003e925..20ce7ada 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -931,6 +931,30 @@ Can't generate temporary backup file '%1'. + + Restore backup + + + + Backup file '%1' detected. + + + + Continue to save? + + + + Error occurred at last save. + + + + Do you want to load the backup file? + + + + Error Load File + + EditorAutoSaveWidget @@ -990,6 +1014,10 @@ Demo file name: + + Auto backup editing contents + + EditorClipboardWidget diff --git a/libs/qsynedit/qsynedit/document.cpp b/libs/qsynedit/qsynedit/document.cpp index 25b2267a..8c369338 100644 --- a/libs/qsynedit/qsynedit/document.cpp +++ b/libs/qsynedit/qsynedit/document.cpp @@ -41,7 +41,6 @@ Document::Document(const QFont& font, const QFont& nonAsciiFont, QObject *parent mMutex(QMutex::Recursive) #endif { - mAppendNewLineAtEOF = true; mNewlineType = NewlineType::Windows; mIndexOfLongestLine = -1; diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index 67ec21ad..c0136b1c 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -3972,6 +3972,11 @@ void QSynEdit::onScrolled(int) invalidate(); } +const QDateTime &QSynEdit::lastModifyTime() const +{ + return mLastModifyTime; +} + double QSynEdit::lineSpacingFactor() const { return mLineSpacingFactor; diff --git a/libs/qsynedit/qsynedit/qsynedit.h b/libs/qsynedit/qsynedit/qsynedit.h index 5e33492e..7fb7581b 100644 --- a/libs/qsynedit/qsynedit/qsynedit.h +++ b/libs/qsynedit/qsynedit/qsynedit.h @@ -784,6 +784,8 @@ protected: double lineSpacingFactor() const; void setLineSpacingFactor(double newLineSpacingFactor); + const QDateTime &lastModifyTime() const; + protected: void dragEnterEvent(QDragEnterEvent *event) override; void dropEvent(QDropEvent *event) override;