diff --git a/NEWS.md b/NEWS.md index c598d9da..0f01c6e0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ Version 0.6.8 - enhancement: add link to cppreference in the help menu + - fix: add mutex lock to prevent editor crash in rare conditions Version 0.6.7 - fix: messages send to the gdb process's standard error are not received diff --git a/RedPandaIDE/cpprefacter.cpp b/RedPandaIDE/cpprefacter.cpp index a48d14aa..4475cd8e 100644 --- a/RedPandaIDE/cpprefacter.cpp +++ b/RedPandaIDE/cpprefacter.cpp @@ -121,7 +121,7 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile( editor.lines()->setContents(buffer); } else { QByteArray encoding; - editor.lines()->LoadFromFile(filename,ENCODING_AUTO_DETECT,encoding); + editor.lines()->loadFromFile(filename,ENCODING_AUTO_DETECT,encoding); } editor.setHighlighter(HighlighterManager().getCppHighlighter()); int posY = 0; @@ -182,7 +182,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement & editor.lines()->setContents(buffer); } else { QByteArray encoding; - editor.lines()->LoadFromFile(filename,ENCODING_AUTO_DETECT,encoding); + editor.lines()->loadFromFile(filename,ENCODING_AUTO_DETECT,encoding); } QStringList newContents; editor.setHighlighter(HighlighterManager().getCppHighlighter()); @@ -235,7 +235,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement & } else { QByteArray realEncoding; QFile file(filename); - editor.lines()->SaveToFile(file,ENCODING_AUTO_DETECT, realEncoding); + editor.lines()->saveToFile(file,ENCODING_AUTO_DETECT, realEncoding); } } diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 01cde49e..cdc7001f 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -163,9 +163,9 @@ Editor::~Editor() { void Editor::loadFile(const QString& filename) { if (filename.isEmpty()) { - this->lines()->LoadFromFile(mFilename,mEncodingOption,mFileEncoding); + this->lines()->loadFromFile(mFilename,mEncodingOption,mFileEncoding); } else { - this->lines()->LoadFromFile(filename,mEncodingOption,mFileEncoding); + this->lines()->loadFromFile(filename,mEncodingOption,mFileEncoding); } //this->setModified(false); updateCaption(); @@ -192,7 +192,7 @@ void Editor::loadFile(const QString& filename) { void Editor::saveFile(const QString &filename) { QFile file(filename); - this->lines()->SaveToFile(file,mEncodingOption,mFileEncoding); + this->lines()->saveToFile(file,mEncodingOption,mFileEncoding); pMainWindow->updateForEncodingInfo(); } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index e5947d35..1bbb75be 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2032,6 +2032,8 @@ void MainWindow::openShell(const QString &folder, const QString &shellCommand) void MainWindow::onAutoSaveTimeout() { + if (mQuitting) + return; if (!pSettings->editor().enableAutoSave()) return; int updateCount = 0; @@ -2050,6 +2052,15 @@ void MainWindow::onAutoSaveTimeout() } break; case astAllProjectFiles: + if (!mProject) + return; + for (int i=0;ipageCount();i++) { + Editor *e = (*mEditorList)[i]; + if (!e->inProject()) + return; + doAutoSave(e); + updateCount++; + } //todo: auto save project files break; } diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index ff05f4c0..51e19c3a 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -536,13 +536,11 @@ BufferCoord SynEdit::getMatchingBracketEx(BufferCoord APoint) QStringList SynEdit::contents() { - //QMutexLocker locker(&mMutex); return lines()->contents(); } QString SynEdit::text() { - //QMutexLocker locker(&mMutex); return lines()->text(); } @@ -1750,7 +1748,7 @@ void SynEdit::doDuplicateLine() { if (!mReadOnly && (mLines->count() > 0)) { doOnPaintTransient(SynTransientType::ttBefore); - mLines->Insert(mCaretY, lineText()); + mLines->insert(mCaretY, lineText()); doLinesInserted(mCaretY + 1, 1); mUndoList->AddChange(SynChangeReason::crLineBreak, caretXY(), caretXY(), "", SynSelectionMode::smNormal); @@ -1774,7 +1772,7 @@ void SynEdit::doMoveSelUp() doLinesDeleted(OrigBlockBegin.Line - 1, 1); // before start, 1 based // Insert line below selection - mLines->Insert(OrigBlockEnd.Line - 1, s); + mLines->insert(OrigBlockEnd.Line - 1, s); doLinesInserted(OrigBlockEnd.Line, 1); // Restore caret and selection @@ -1820,7 +1818,7 @@ void SynEdit::doMoveSelDown() doLinesDeleted(OrigBlockEnd.Line, 1); // before start, 1 based // Insert line above selection - mLines->Insert(OrigBlockBegin.Line - 1, s); + mLines->insert(OrigBlockBegin.Line - 1, s); doLinesInserted(OrigBlockBegin.Line, 1); // Restore caret and selection @@ -1895,7 +1893,7 @@ void SynEdit::insertLine(bool moveCaret) if (Len > 0) { if (Len >= mCaretX) { if (mCaretX <= 1) { - mLines->Insert(mCaretY - 1, ""); + mLines->insert(mCaretY - 1, ""); nLinesInserted++; mUndoList->AddChange(SynChangeReason::crLineBreak, caretXY(), caretXY(), Temp2, SynSelectionMode::smNormal); @@ -1925,7 +1923,7 @@ void SynEdit::insertLine(bool moveCaret) } } QString indentSpacesForRightLineText = GetLeftSpacing(indentSpaces,true); - mLines->Insert(mCaretY, indentSpacesForRightLineText+rightLineText); + mLines->insert(mCaretY, indentSpacesForRightLineText+rightLineText); nLinesInserted++; //SpaceCount1 = mLines->getString(mCaretY).length(); //??? @@ -1936,7 +1934,7 @@ void SynEdit::insertLine(bool moveCaret) indentSpaces = indentSpacesOfLeftLineText; indentSpaces += mTabWidth; indentSpacesForRightLineText = GetLeftSpacing(indentSpaces,true); - mLines->Insert(mCaretY, indentSpacesForRightLineText); + mLines->insert(mCaretY, indentSpacesForRightLineText); nLinesInserted++; mUndoList->AddChange(SynChangeReason::crLineBreak, caretXY(), caretXY(), "", SynSelectionMode::smNormal); @@ -1954,7 +1952,7 @@ void SynEdit::insertLine(bool moveCaret) SpaceCount2 = leftSpaces(Temp); } while ((BackCounter != 0) && (Temp == "")); } - mLines->Insert(mCaretY, ""); + mLines->insert(mCaretY, ""); nLinesInserted++; BufferCoord Caret = caretXY(); if (moveCaret) { @@ -1988,7 +1986,7 @@ void SynEdit::insertLine(bool moveCaret) BackCounter--; } } - mLines->Insert(mCaretY - 1, ""); + mLines->insert(mCaretY - 1, ""); nLinesInserted++; mUndoList->AddChange(SynChangeReason::crLineBreak, caretXY(), caretXY(), "", SynSelectionMode::smNormal); @@ -4690,7 +4688,7 @@ int SynEdit::insertTextByNormalMode(const QString &Value) if (PInsertLines(mCaretY, CountLines(Value,P)); + mLines->insertLines(mCaretY, CountLines(Value,P)); } else { Str = sLeftSide + Value + sRightSide; properSetLine(mCaretY - 1, Str); @@ -4810,7 +4808,7 @@ int SynEdit::insertTextByLineMode(const QString &Value) else Str = ""; if ((mCaretY == mLines->count()) || mInserting) { - mLines->Insert(mCaretY - 1, ""); + mLines->insert(mCaretY - 1, ""); Result++; } properSetLine(mCaretY - 1, Str); @@ -4886,7 +4884,6 @@ void SynEdit::onCommandProcessed(SynEditorCommand , QChar , void *) void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData) { - QMutexLocker locker(&mMutex); incPaintLock(); auto action=finally([this] { decPaintLock(); @@ -5924,8 +5921,6 @@ void SynEdit::setSelLength(int Value) void SynEdit::setSelText(const QString &text) { - QMutexLocker locker(&mMutex); - doSetSelText(text); } diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index ae524d95..7dcf576e 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -678,8 +677,6 @@ private: QString mInputPreeditString; - QRecursiveMutex mMutex; - friend class SynEditTextPainter; // QWidget interface diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/RedPandaIDE/qsynedit/TextBuffer.cpp index c69d96a2..127fc019 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.cpp +++ b/RedPandaIDE/qsynedit/TextBuffer.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "SynEdit.h" #include "../utils.h" @@ -25,24 +26,27 @@ static void ListIndexOutOfBounds(int index) { -int SynEditStringList::parenthesisLevels(int Index) const +int SynEditStringList::parenthesisLevels(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { return mList[Index]->fRange.parenthesisLevel; } else return 0; } -int SynEditStringList::bracketLevels(int Index) const +int SynEditStringList::bracketLevels(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { return mList[Index]->fRange.bracketLevel; } else return 0; } -int SynEditStringList::braceLevels(int Index) const +int SynEditStringList::braceLevels(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { return mList[Index]->fRange.braceLevel; } else @@ -62,6 +66,7 @@ int SynEditStringList::braceLevels(int Index) const int SynEditStringList::lineColumns(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { if (mList[Index]->fColumns == -1) { return calculateLineColumns(Index); @@ -71,16 +76,18 @@ int SynEditStringList::lineColumns(int Index) return 0; } -int SynEditStringList::leftBraces(int Index) const +int SynEditStringList::leftBraces(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { return mList[Index]->fLeftBraces; } else return 0; } -int SynEditStringList::rightBraces(int Index) const +int SynEditStringList::rightBraces(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { return mList[Index]->fRightBraces; } else @@ -88,6 +95,7 @@ int SynEditStringList::rightBraces(int Index) const } int SynEditStringList::lengthOfLongestLine() { + QMutexLocker locker(&mMutex); if (mIndexOfLongestLine < 0) { int MaxLen = -1; mIndexOfLongestLine = -1; @@ -120,8 +128,9 @@ QString SynEditStringList::lineBreak() const return "\n"; } -const SynRangeState& SynEditStringList::ranges(int Index) const +const SynRangeState& SynEditStringList::ranges(int Index) { + QMutexLocker locker(&mMutex); if (Index>=0 && Index < mList.size()) { return mList[Index]->fRange; } else { @@ -130,7 +139,7 @@ const SynRangeState& SynEditStringList::ranges(int Index) const return {0}; } -void SynEditStringList::InsertItem(int Index, const QString &s) +void SynEditStringList::insertItem(int Index, const QString &s) { beginUpdate(); PSynEditStringRec line = std::make_shared(); @@ -150,23 +159,21 @@ void SynEditStringList::addItem(const QString &s) endUpdate(); } -ConvertTabsProcEx SynEditStringList::getConvertTabsProc() const -{ - return mConvertTabsProc; -} - -bool SynEditStringList::getAppendNewLineAtEOF() const +bool SynEditStringList::getAppendNewLineAtEOF() { + QMutexLocker locker(&mMutex); return mAppendNewLineAtEOF; } void SynEditStringList::setAppendNewLineAtEOF(bool appendNewLineAtEOF) { + QMutexLocker locker(&mMutex); mAppendNewLineAtEOF = appendNewLineAtEOF; } void SynEditStringList::setRange(int Index, const SynRangeState& ARange, int ALeftBraces, int ARightBraces) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>=mList.count()) { ListIndexOutOfBounds(Index); } @@ -177,44 +184,50 @@ void SynEditStringList::setRange(int Index, const SynRangeState& ARange, int ALe endUpdate(); } -QString SynEditStringList::getString(int Index) const +QString SynEditStringList::getString(int Index) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>=mList.count()) { return QString(); } return mList[Index]->fString; } -int SynEditStringList::count() const +int SynEditStringList::count() { + QMutexLocker locker(&mMutex); return mList.count(); } -void *SynEditStringList::getObject(int Index) const +void *SynEditStringList::getObject(int Index) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>=mList.count()) { return nullptr; } return mList[Index]->fObject; } -QString SynEditStringList::text() const +QString SynEditStringList::text() { + QMutexLocker locker(&mMutex); return getTextStr(); } void SynEditStringList::setText(const QString &text) { - PutTextStr(text); + QMutexLocker locker(&mMutex); + putTextStr(text); } void SynEditStringList::setContents(const QStringList &text) { + QMutexLocker locker(&mMutex); beginUpdate(); auto action = finally([this]{ endUpdate(); }); - clear(); + internalClear(); if (text.count() > 0) { mIndexOfLongestLine = -1; int FirstAdded = mList.count(); @@ -226,8 +239,9 @@ void SynEditStringList::setContents(const QStringList &text) } } -QStringList SynEditStringList::contents() const +QStringList SynEditStringList::contents() { + QMutexLocker locker(&mMutex); QStringList Result; SynEditStringRecList list = mList; foreach (const PSynEditStringRec& line, list) { @@ -239,7 +253,7 @@ QStringList SynEditStringList::contents() const void SynEditStringList::beginUpdate() { if (mUpdateCount == 0) { - SetUpdateState(true); + setUpdateState(true); } mUpdateCount++; } @@ -248,16 +262,17 @@ void SynEditStringList::endUpdate() { mUpdateCount--; if (mUpdateCount == 0) { - SetUpdateState(false); + setUpdateState(false); } } int SynEditStringList::add(const QString &s) { + QMutexLocker locker(&mMutex); beginUpdate(); int Result = mList.count(); - InsertItem(Result, s); + insertItem(Result, s); emit inserted(Result,1); endUpdate(); return Result; @@ -265,6 +280,7 @@ int SynEditStringList::add(const QString &s) void SynEditStringList::addStrings(const QStringList &Strings) { + QMutexLocker locker(&mMutex); if (Strings.count() > 0) { mIndexOfLongestLine = -1; beginUpdate(); @@ -282,6 +298,7 @@ void SynEditStringList::addStrings(const QStringList &Strings) int SynEditStringList::getTextLength() { + QMutexLocker locker(&mMutex); int Result = 0; foreach (const PSynEditStringRec& line, mList ) { Result += line->fString.length(); @@ -296,18 +313,13 @@ int SynEditStringList::getTextLength() void SynEditStringList::clear() { - if (!mList.isEmpty()) { - beginUpdate(); - int oldCount = mList.count(); - mIndexOfLongestLine = -1; - mList.clear(); - emit deleted(0,oldCount); - endUpdate(); - } + QMutexLocker locker(&mMutex); + internalClear(); } void SynEditStringList::deleteLines(int Index, int NumLines) { + QMutexLocker locker(&mMutex); if (NumLines<=0) return; if ((Index < 0) || (Index >= mList.count())) { @@ -328,8 +340,9 @@ void SynEditStringList::deleteLines(int Index, int NumLines) emit deleted(Index,NumLines); } -void SynEditStringList::Exchange(int Index1, int Index2) +void SynEditStringList::exchange(int Index1, int Index2) { + QMutexLocker locker(&mMutex); if ((Index1 < 0) || (Index1 >= mList.count())) { ListIndexOutOfBounds(Index1); } @@ -346,19 +359,21 @@ void SynEditStringList::Exchange(int Index1, int Index2) endUpdate(); } -void SynEditStringList::Insert(int Index, const QString &s) +void SynEditStringList::insert(int Index, const QString &s) { + QMutexLocker locker(&mMutex); if ((Index < 0) || (Index > mList.count())) { ListIndexOutOfBounds(Index); } beginUpdate(); - InsertItem(Index, s); + insertItem(Index, s); emit inserted(Index,1); endUpdate(); } void SynEditStringList::deleteAt(int Index) { + QMutexLocker locker(&mMutex); if ((Index < 0) || (Index >= mList.count())) { ListIndexOutOfBounds(Index); } @@ -385,6 +400,7 @@ QString SynEditStringList::getTextStr() const } void SynEditStringList::putString(int Index, const QString &s) { + QMutexLocker locker(&mMutex); if (Index == mList.count()) { add(s); } else { @@ -402,6 +418,7 @@ void SynEditStringList::putString(int Index, const QString &s) { void SynEditStringList::putObject(int Index, void *AObject) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>=mList.count()) { ListIndexOutOfBounds(Index); } @@ -410,7 +427,7 @@ void SynEditStringList::putObject(int Index, void *AObject) endUpdate(); } -void SynEditStringList::SetUpdateState(bool Updating) +void SynEditStringList::setUpdateState(bool Updating) { if (Updating) emit changing(); @@ -426,8 +443,9 @@ int SynEditStringList::calculateLineColumns(int Index) return line->fColumns; } -void SynEditStringList::InsertLines(int Index, int NumLines) +void SynEditStringList::insertLines(int Index, int NumLines) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>mList.count()) { ListIndexOutOfBounds(Index); } @@ -446,8 +464,9 @@ void SynEditStringList::InsertLines(int Index, int NumLines) emit inserted(Index,NumLines); } -void SynEditStringList::InsertStrings(int Index, const QStringList &NewStrings) +void SynEditStringList::insertStrings(int Index, const QStringList &NewStrings) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>mList.count()) { ListIndexOutOfBounds(Index); } @@ -467,19 +486,21 @@ void SynEditStringList::InsertStrings(int Index, const QStringList &NewStrings) emit inserted(Index,NewStrings.length()); } -void SynEditStringList::InsertText(int Index, const QString &NewText) +void SynEditStringList::insertText(int Index, const QString &NewText) { + QMutexLocker locker(&mMutex); if (Index<0 || Index>=mList.count()) { ListIndexOutOfBounds(Index); } if (NewText.isEmpty()) return; QStringList lines = TextToLines(NewText); - InsertStrings(Index,lines); + insertStrings(Index,lines); } -void SynEditStringList::LoadFromFile(const QString& filename, const QByteArray& encoding, QByteArray& realEncoding) +void SynEditStringList::loadFromFile(const QString& filename, const QByteArray& encoding, QByteArray& realEncoding) { + QMutexLocker locker(&mMutex); QFile file(filename); if (!file.open(QFile::ReadOnly )) throw FileError(tr("Can't open file '%1' for read!").arg(file.fileName())); @@ -514,7 +535,7 @@ void SynEditStringList::LoadFromFile(const QString& filename, const QByteArray& } else if (line.endsWith("\r")) { mFileEndingType = FileEndingType::Mac; } - clear(); + internalClear(); while (true) { if (allAscii) { allAscii = isTextAllAscii(line); @@ -558,7 +579,7 @@ void SynEditStringList::LoadFromFile(const QString& filename, const QByteArray& textStream.setCodec(realEncoding); } QString line; - clear(); + internalClear(); while (textStream.readLineInto(&line)) { addItem(TrimRight(line)); } @@ -567,8 +588,9 @@ void SynEditStringList::LoadFromFile(const QString& filename, const QByteArray& -void SynEditStringList::SaveToFile(QFile &file, const QByteArray& encoding, QByteArray& realEncoding) +void SynEditStringList::saveToFile(QFile &file, const QByteArray& encoding, QByteArray& realEncoding) { + QMutexLocker locker(&mMutex); if (!file.open(QFile::WriteOnly | QFile::Truncate)) throw FileError(tr("Can't open file '%1' for save!").arg(file.fileName())); if (mList.isEmpty()) @@ -611,13 +633,13 @@ void SynEditStringList::SaveToFile(QFile &file, const QByteArray& encoding, QByt } } -void SynEditStringList::PutTextStr(const QString &text) +void SynEditStringList::putTextStr(const QString &text) { beginUpdate(); auto action = finally([this]{ endUpdate(); }); - clear(); + internalClear(); int pos = 0; int start; while (pos < text.length()) { @@ -638,23 +660,39 @@ void SynEditStringList::PutTextStr(const QString &text) } } -FileEndingType SynEditStringList::getFileEndingType() const +void SynEditStringList::internalClear() { + if (!mList.isEmpty()) { + beginUpdate(); + int oldCount = mList.count(); + mIndexOfLongestLine = -1; + mList.clear(); + emit deleted(0,oldCount); + endUpdate(); + } +} + +FileEndingType SynEditStringList::getFileEndingType() +{ + QMutexLocker locker(&mMutex); return mFileEndingType; } void SynEditStringList::setFileEndingType(const FileEndingType &fileEndingType) { + QMutexLocker locker(&mMutex); mFileEndingType = fileEndingType; } bool SynEditStringList::empty() { - return count()==0; + QMutexLocker locker(&mMutex); + return mList.count()==0; } void SynEditStringList::resetColumns() { + QMutexLocker locker(&mMutex); mIndexOfLongestLine = -1; if (mList.count() > 0 ) { for (int i=0;ifColumns = -1; diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/RedPandaIDE/qsynedit/TextBuffer.h index 7f6e6179..c607a916 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.h +++ b/RedPandaIDE/qsynedit/TextBuffer.h @@ -3,6 +3,7 @@ #include #include "highlighter/base.h" +#include #include #include #include "MiscProcs.h" @@ -50,23 +51,23 @@ class SynEditStringList : public QObject public: explicit SynEditStringList(SynEdit* pEdit,QObject* parent=nullptr); - int parenthesisLevels(int Index) const; - int bracketLevels(int Index) const; - int braceLevels(int Index) const; + int parenthesisLevels(int Index); + int bracketLevels(int Index); + int braceLevels(int Index); int lineColumns(int Index); - int leftBraces(int Index) const; - int rightBraces(int Index) const; + int leftBraces(int Index); + int rightBraces(int Index); int lengthOfLongestLine(); QString lineBreak() const; - const SynRangeState& ranges(int Index) const; + const SynRangeState& ranges(int Index); void setRange(int Index, const SynRangeState& ARange, int leftBraces, int rightBraces); - QString getString(int Index) const; - int count() const ; - void* getObject(int Index) const; - QString text() const; + QString getString(int Index); + int count(); + void* getObject(int Index); + QString text(); void setText(const QString& text); void setContents(const QStringList& text); - QStringList contents() const; + QStringList contents(); void putString(int Index, const QString& s); void putObject(int Index, void * AObject); @@ -81,20 +82,18 @@ public: void clear(); void deleteAt(int Index); void deleteLines(int Index, int NumLines); - void Exchange(int Index1, int Index2); - void Insert(int Index, const QString& s); - void InsertLines(int Index, int NumLines); - void InsertStrings(int Index, const QStringList& NewStrings); - void InsertText(int Index,const QString& NewText); - void LoadFromFile(const QString& filename, const QByteArray& encoding, QByteArray& realEncoding); - void SaveToFile(QFile& file, const QByteArray& encoding, QByteArray& realEncoding); + void exchange(int Index1, int Index2); + void insert(int Index, const QString& s); + void insertLines(int Index, int NumLines); + void insertStrings(int Index, const QStringList& NewStrings); + void insertText(int Index,const QString& NewText); + void loadFromFile(const QString& filename, const QByteArray& encoding, QByteArray& realEncoding); + void saveToFile(QFile& file, const QByteArray& encoding, QByteArray& realEncoding); - bool getAppendNewLineAtEOF() const; + bool getAppendNewLineAtEOF(); void setAppendNewLineAtEOF(bool appendNewLineAtEOF); - ConvertTabsProcEx getConvertTabsProc() const; - - FileEndingType getFileEndingType() const; + FileEndingType getFileEndingType(); void setFileEndingType(const FileEndingType &fileEndingType); bool empty(); @@ -112,10 +111,11 @@ signals: void putted(int index, int count); protected: QString getTextStr() const; - void SetUpdateState(bool Updating); - void InsertItem(int Index, const QString& s); + void setUpdateState(bool Updating); + void insertItem(int Index, const QString& s); void addItem(const QString& s); - void PutTextStr(const QString& text); + void putTextStr(const QString& text); + void internalClear(); private: SynEditStringRecList mList; @@ -125,9 +125,9 @@ private: //int mCapacity; FileEndingType mFileEndingType; bool mAppendNewLineAtEOF; - ConvertTabsProcEx mConvertTabsProc; int mIndexOfLongestLine; int mUpdateCount; + QRecursiveMutex mMutex; int calculateLineColumns(int Index); }; diff --git a/RedPandaIDE/thememanager.h b/RedPandaIDE/thememanager.h index 0c843772..f2d65772 100644 --- a/RedPandaIDE/thememanager.h +++ b/RedPandaIDE/thememanager.h @@ -3,10 +3,6 @@ #include -class AppTheme { - QPalette -}; - class ThemeManager : public QObject { Q_OBJECT