diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.qm b/RedPandaIDE/RedPandaIDE_zh_CN.qm index f0faa842..6bd1c580 100644 Binary files a/RedPandaIDE/RedPandaIDE_zh_CN.qm and b/RedPandaIDE/RedPandaIDE_zh_CN.qm differ diff --git a/RedPandaIDE/RedPandaIDE_zh_CN.ts b/RedPandaIDE/RedPandaIDE_zh_CN.ts index 319a6bb4..f91456ad 100644 --- a/RedPandaIDE/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/RedPandaIDE_zh_CN.ts @@ -1003,7 +1003,7 @@ Are you really want to continue? Open - 打开打开 + 打开 diff --git a/RedPandaIDE/colorscheme.cpp b/RedPandaIDE/colorscheme.cpp index 4ea93439..421c5bcd 100644 --- a/RedPandaIDE/colorscheme.cpp +++ b/RedPandaIDE/colorscheme.cpp @@ -575,6 +575,7 @@ bool ColorManager::add(const QString &name, PColorScheme scheme) scheme->setCustomed(false); mSchemes[name] = scheme; saveScheme(name); + return true; } PColorScheme ColorManager::get(const QString &name) @@ -634,6 +635,7 @@ bool ColorManager::saveScheme(const QString &name) return false; QString newFilepath = generateFullPathname(name,scheme->bundled(),scheme->customed()); scheme->save(newFilepath); + return true; } QString ColorManager::generateFullPathname(const QString &name, bool isBundled, bool isCustomed) diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index b807285f..9ad4501e 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -252,7 +252,7 @@ void Editor::keyPressEvent(QKeyEvent *event) bool handled = false; QString t = event->text(); if (!t.isEmpty()) { - QChar ch = t; + QChar ch = t[0]; switch (ch.unicode()) { case '"': case '\'': diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 3c385cc4..54225385 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -94,9 +94,9 @@ private: // QWidget interface protected: void wheelEvent(QWheelEvent *event) override; - void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); - void keyPressEvent(QKeyEvent *event); + void focusInEvent(QFocusEvent *event) override; + void focusOutEvent(QFocusEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; }; #endif // EDITOR_H diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 20e6ea6c..251440cc 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -84,5 +84,6 @@ int main(int argc, char *argv[]) return retCode; } catch (BaseError e) { QMessageBox::critical(nullptr,QApplication::tr("Error"),e.reason()); + return -1; } } diff --git a/RedPandaIDE/qsynedit/CodeFolding.cpp b/RedPandaIDE/qsynedit/CodeFolding.cpp index ef3a1111..7eb65b99 100644 --- a/RedPandaIDE/qsynedit/CodeFolding.cpp +++ b/RedPandaIDE/qsynedit/CodeFolding.cpp @@ -6,7 +6,7 @@ int SynEditFoldRegions::count() return fRegions.size(); } -int SynEditFoldRegions::add(bool addEnding, const QChar &openSymbol, const QChar &closeSymbol, const QString &highlight) +PSynEditFoldRegion SynEditFoldRegions::add(bool addEnding, const QChar &openSymbol, const QChar &closeSymbol, const QString &highlight) { PSynEditFoldRegion region = std::make_shared(); region->addEnding = addEnding; @@ -14,6 +14,7 @@ int SynEditFoldRegions::add(bool addEnding, const QChar &openSymbol, const QChar region->closeSymbol = closeSymbol; region->highlight = highlight; fRegions.push_back(region); + return region; } PSynEditFoldRegion SynEditFoldRegions::get(int index) @@ -104,7 +105,7 @@ void SynEditFoldRanges::insert(int index, PSynEditFoldRange range) mRanges.insert(index,range); } -int SynEditFoldRanges::remove(int index) +void SynEditFoldRanges::remove(int index) { mRanges.remove(index); } diff --git a/RedPandaIDE/qsynedit/CodeFolding.h b/RedPandaIDE/qsynedit/CodeFolding.h index f2604b97..1dbf6689 100644 --- a/RedPandaIDE/qsynedit/CodeFolding.h +++ b/RedPandaIDE/qsynedit/CodeFolding.h @@ -13,7 +13,7 @@ private: std::vector fRegions; public: int count(); - int add(bool addEnding, const QChar& openSymbol, const QChar& closeSymbol, const QString& highlight); + PSynEditFoldRegion add(bool addEnding, const QChar& openSymbol, const QChar& closeSymbol, const QString& highlight); PSynEditFoldRegion get(int index); }; typedef std::shared_ptr PSynFoldRegions; @@ -54,7 +54,7 @@ public: int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine); void insert(int index, PSynEditFoldRange range); - int remove(int index); + void remove(int index); void add(PSynEditFoldRange foldRange); PSynEditFoldRange operator[](int index) const; }; diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 63ab14eb..0e64211d 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -553,6 +553,7 @@ int SynEdit::charToColumn(int aLine, int aChar) const QString s = mLines->getString(aLine - 1); return charToColumn(s,aChar); } + return aChar; } int SynEdit::charToColumn(const QString &s, int aChar) const @@ -587,6 +588,7 @@ int SynEdit::columnToChar(int aLine, int aColumn) const } return i+1; } + return aColumn; } int SynEdit::stringColumns(const QString &line, int colsBefore) const @@ -2537,6 +2539,7 @@ QString SynEdit::expandAtWideGlyphs(const QString &S) j++; } Result.resize(j); + return Result; } void SynEdit::updateModifiedStatus() @@ -2577,7 +2580,7 @@ int SynEdit::scanFrom(int Index) return Result; } -int SynEdit::scanRanges() +void SynEdit::scanRanges() { if (mHighlighter && !mLines->empty()) { mHighlighter->resetState(); @@ -4227,6 +4230,7 @@ int SynEdit::InsertTextByColumnMode(const QString &Value, bool AddToUndoList) } while (P 0) { mIndexOfLongestLine = -1; @@ -739,7 +739,7 @@ SynChangeReason SynEditUndoList::LastChangeReason() if (mItems.count() == 0) return SynChangeReason::crNothing; else - mItems.last()->changeReason(); + return mItems.last()->changeReason(); } void SynEditUndoList::Lock() diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/RedPandaIDE/qsynedit/TextBuffer.h index 84d59847..89122a5e 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.h +++ b/RedPandaIDE/qsynedit/TextBuffer.h @@ -75,7 +75,7 @@ public: void endUpdate(); int add(const QString& s); - int addStrings(const QStringList& Strings); + void addStrings(const QStringList& Strings); int getTextLength(); void clear(); diff --git a/RedPandaIDE/qsynedit/highlighter/base.cpp b/RedPandaIDE/qsynedit/highlighter/base.cpp index 4e55c3e0..c431cb73 100644 --- a/RedPandaIDE/qsynedit/highlighter/base.cpp +++ b/RedPandaIDE/qsynedit/highlighter/base.cpp @@ -89,13 +89,13 @@ bool SynHighlighter::isIdentChar(const QChar &ch) const if (ch == '_') { return true; } - if (ch>='0' && ch <= '9') { + if ((ch>='0') && (ch <= '9')) { return true; } - if (ch>='a' && ch <= 'z') { + if ((ch>='a') && (ch <= 'z')) { return true; } - if (ch>='A' && ch <= 'Z') { + if ((ch>='A') && (ch <= 'Z')) { return true; } diff --git a/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.cpp b/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.cpp index 5dceb274..05e3f50c 100644 --- a/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorsymbolcompletionwidget.cpp @@ -1,5 +1,6 @@ #include "editorsymbolcompletionwidget.h" #include "ui_editorsymbolcompletionwidget.h" +#include "../settings.h" EditorSymbolCompletionWidget::EditorSymbolCompletionWidget(const QString& name, const QString& group, QWidget *parent) : SettingsWidget(name,group,parent), @@ -12,3 +13,33 @@ EditorSymbolCompletionWidget::~EditorSymbolCompletionWidget() { delete ui; } + +void EditorSymbolCompletionWidget::doLoad() +{ + ui->grpCompleSymbols->setChecked(pSettings->editor().completeSymbols()); + ui->chkCompleteBrace->setChecked(pSettings->editor().completeBrace()); + ui->chkCompleteBracket->setChecked(pSettings->editor().completeBracket()); + ui->chkCompleteComments->setChecked(pSettings->editor().completeComment()); + ui->chkCompleteDoubleQuotation->setChecked(pSettings->editor().completeDoubleQuote()); + ui->chkCompleteGlobalInclude->setChecked(pSettings->editor().completeGlobalInclude()); + ui->chkCompleteParenthesis->setChecked(pSettings->editor().completeParenthese()); + ui->chkCompleteSingleQuotation->setChecked(pSettings->editor().completeSingleQuote()); + ui->chkRemoveMatchingSymbols->setChecked(pSettings->editor().removeMathcingSymbol()); + ui->chkSkipMathingSymbols->setChecked(pSettings->editor().overwriteSymbols()); +} + +void EditorSymbolCompletionWidget::doSave() +{ + pSettings->editor().setCompleteSymbols(ui->grpCompleSymbols->isChecked()); + pSettings->editor().setCompleteBrace(ui->chkCompleteBrace->isChecked()); + pSettings->editor().setCompleteBracket(ui->chkCompleteBracket->isChecked()); + pSettings->editor().setCompleteComment(ui->chkCompleteComments->isChecked()); + pSettings->editor().setCompleteDoubleQuote(ui->chkCompleteDoubleQuotation->isChecked()); + pSettings->editor().setCompleteGlobalInclude(ui->chkCompleteGlobalInclude->isChecked()); + pSettings->editor().setCompleteParenthese(ui->chkCompleteParenthesis->isChecked()); + pSettings->editor().setCompleteSingleQuote(ui->chkCompleteSingleQuotation->isChecked()); + pSettings->editor().setRemoveMathcingSymbol(ui->chkRemoveMatchingSymbols->isChecked()); + pSettings->editor().setOverwriteSymbols(ui->chkSkipMathingSymbols->isChecked()); + + pSettings->editor().save(); +}