diff --git a/RedPandaIDE/HighlighterManager.cpp b/RedPandaIDE/HighlighterManager.cpp index 44e8fe9b..1be23a49 100644 --- a/RedPandaIDE/HighlighterManager.cpp +++ b/RedPandaIDE/HighlighterManager.cpp @@ -61,25 +61,25 @@ PSynHighlighter HighlighterManager::getCppHighlighter() { SynEditCppHighlighter* highlighter = new SynEditCppHighlighter(); PSynHighlighter pHighlighter(highlighter); - highlighter->asmAttribute()->setForeground(QColorConstants::Blue); - highlighter->charAttribute()->setForeground(QColorConstants::Black); + highlighter->asmAttribute()->setForeground(Qt::blue); + highlighter->charAttribute()->setForeground(Qt::black); highlighter->commentAttribute()->setForeground(0x8C8C8C); highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic); highlighter->classAttribute()->setForeground(0x008080); - highlighter->floatAttribute()->setForeground(QColorConstants::Svg::purple); + highlighter->floatAttribute()->setForeground(Qt::darkMagenta); highlighter->functionAttribute()->setForeground(0x00627A); highlighter->globalVarAttribute()->setForeground(0x660E7A); - highlighter->hexAttribute()->setForeground(QColorConstants::Svg::purple); + highlighter->hexAttribute()->setForeground(Qt::darkMagenta); highlighter->identifierAttribute()->setForeground(0x080808); - highlighter->invalidAttribute()->setForeground(QColorConstants::Svg::red); - highlighter->localVarAttribute()->setForeground(QColorConstants::Black); + highlighter->invalidAttribute()->setForeground(Qt::red); + highlighter->localVarAttribute()->setForeground(Qt::black); highlighter->numberAttribute()->setForeground(0x1750EB); - highlighter->octAttribute()->setForeground(QColorConstants::Svg::purple); + highlighter->octAttribute()->setForeground(Qt::darkMagenta); highlighter->preprocessorAttribute()->setForeground(0x1f542e); highlighter->keywordAttribute()->setForeground(0x0033b3); - highlighter->whitespaceAttribute()->setForeground(QColorConstants::Svg::silver); + highlighter->whitespaceAttribute()->setForeground(Qt::lightGray); highlighter->stringAttribute()->setForeground(0x007d17); - highlighter->stringEscapeSequenceAttribute()->setForeground(QColorConstants::Svg::red); + highlighter->stringEscapeSequenceAttribute()->setForeground(Qt::red); highlighter->symbolAttribute()->setForeground(0xc10000); highlighter->variableAttribute()->setForeground(0x400080); return pHighlighter; @@ -94,7 +94,7 @@ PSynHighlighter HighlighterManager::getAsmHighlighter() highlighter->identifierAttribute()->setForeground(0x080808); highlighter->keywordAttribute()->setForeground(0x0033b3); highlighter->numberAttribute()->setForeground(0x1750EB); - highlighter->whitespaceAttribute()->setForeground(QColorConstants::Svg::silver); + highlighter->whitespaceAttribute()->setForeground(Qt::lightGray); highlighter->stringAttribute()->setForeground(0x007d17); highlighter->symbolAttribute()->setForeground(0xc10000); return pHighlighter; diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index 2ac450b7..a5f61ebb 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -557,7 +557,7 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q } env.insert("LANG","en"); process.setProcessEnvironment(env); - process.setArguments(QProcess::splitCommand(arguments)); + process.setArguments(splitProcessCommand(arguments)); process.setWorkingDirectory(workingDir); process.connect(&process, &QProcess::errorOccurred, diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 767d0a18..058eabe0 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -31,7 +31,11 @@ enum RunProgramFlag { RPF_REDIRECT_INPUT = 0x0002 }; -CompilerManager::CompilerManager(QObject *parent) : QObject(parent) +CompilerManager::CompilerManager(QObject *parent) : QObject(parent), + mCompileMutex(QMutex::Recursive), + mBackgroundSyntaxCheckMutex(QMutex::Recursive), + mRunnerMutex(QMutex::Recursive) + { mCompiler = nullptr; mBackgroundSyntaxChecker = nullptr; diff --git a/RedPandaIDE/compiler/compilermanager.h b/RedPandaIDE/compiler/compilermanager.h index 4e81e849..2fa563fb 100644 --- a/RedPandaIDE/compiler/compilermanager.h +++ b/RedPandaIDE/compiler/compilermanager.h @@ -78,9 +78,9 @@ private: int mSyntaxCheckIssueCount; Compiler* mBackgroundSyntaxChecker; Runner* mRunner; - QRecursiveMutex mCompileMutex; - QRecursiveMutex mBackgroundSyntaxCheckMutex; - QRecursiveMutex mRunnerMutex; + QMutex mCompileMutex; + QMutex mBackgroundSyntaxCheckMutex; + QMutex mRunnerMutex; }; class CompileError : public BaseError { diff --git a/RedPandaIDE/compiler/executablerunner.cpp b/RedPandaIDE/compiler/executablerunner.cpp index fa7e419a..cc47099b 100644 --- a/RedPandaIDE/compiler/executablerunner.cpp +++ b/RedPandaIDE/compiler/executablerunner.cpp @@ -83,7 +83,7 @@ void ExecutableRunner::run() mProcess = std::make_shared(); mProcess->setProgram(mFilename); - mProcess->setArguments(QProcess::splitCommand(mArguments)); + mProcess->setArguments(splitProcessCommand(mArguments)); mProcess->setWorkingDirectory(mWorkDir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path = env.value("PATH"); diff --git a/RedPandaIDE/compiler/ojproblemcasesrunner.cpp b/RedPandaIDE/compiler/ojproblemcasesrunner.cpp index fd24c2ea..32129fd4 100644 --- a/RedPandaIDE/compiler/ojproblemcasesrunner.cpp +++ b/RedPandaIDE/compiler/ojproblemcasesrunner.cpp @@ -46,7 +46,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase) bool errorOccurred = false; process.setProgram(mFilename); - process.setArguments(QProcess::splitCommand(mArguments)); + process.setArguments(splitProcessCommand(mArguments)); process.setWorkingDirectory(mWorkDir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString path = env.value("PATH"); diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 3f0157cf..dec2fd61 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -355,16 +355,16 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file) if (unit->encoding() == ENCODING_AUTO_DETECT) { if (unit->editor() && unit->editor()->fileEncoding()!=ENCODING_ASCII) encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2") - .arg(unit->editor()->fileEncoding(), - defaultSystemEncoding); + .arg(QString(unit->editor()->fileEncoding()), + QString(defaultSystemEncoding)); } else if (unit->encoding()==ENCODING_SYSTEM_DEFAULT) { encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2") - .arg(defaultSystemEncoding, - defaultSystemEncoding); + .arg(QString(defaultSystemEncoding), + QString(defaultSystemEncoding)); } else if (unit->encoding()!=ENCODING_ASCII && !unit->encoding().isEmpty()) { encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2") - .arg(unit->encoding(), - defaultSystemEncoding); + .arg(QString(unit->encoding()), + QString(defaultSystemEncoding)); } } diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index 89d02b35..9654bf85 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -606,6 +606,7 @@ bool Debugger::executing() const } DebugReader::DebugReader(Debugger* debugger, QObject *parent) : QThread(parent), + mCmdQueueMutex(QMutex::Recursive), mStartSemaphore(0) { mDebugger = debugger; @@ -1115,8 +1116,12 @@ void DebugReader::handleLocalVariables(const QListsetProgram(cmd); - mProcess->setArguments(QProcess::splitCommand(arguments)); + mProcess->setArguments(splitProcessCommand(arguments)); mProcess->setProcessChannelMode(QProcess::MergedChannels); QString cmdDir = extractFileDir(cmd); if (!cmdDir.isEmpty()) { @@ -2279,7 +2284,7 @@ void DebugTarget::run() mProcess.reset(); }); mProcess->setProgram(cmd); - mProcess->setArguments(QProcess::splitCommand(arguments)); + mProcess->setArguments(splitProcessCommand(arguments)); mProcess->setProcessChannelMode(QProcess::MergedChannels); QString cmdDir = extractFileDir(cmd); if (!cmdDir.isEmpty()) { diff --git a/RedPandaIDE/debugger.h b/RedPandaIDE/debugger.h index ba85cde0..680b73d0 100644 --- a/RedPandaIDE/debugger.h +++ b/RedPandaIDE/debugger.h @@ -437,7 +437,7 @@ private slots: private: Debugger *mDebugger; QString mDebuggerPath; - QRecursiveMutex mCmdQueueMutex; + QMutex mCmdQueueMutex; QSemaphore mStartSemaphore; QQueue mCmdQueue; bool mErrorOccured; diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index cf9d7827..8b3ce5db 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -83,7 +83,7 @@ Editor::Editor(QWidget *parent, const QString& filename, mInProject(inProject), mIsNew(isNew), mSyntaxIssues(), - mSyntaxErrorColor(QColorConstants::Red), + mSyntaxErrorColor(Qt::red), mSyntaxWarningColor("orange"), mLineCount(0), mActiveBreakpointLine(-1), diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 6ce02b47..6bcb7e18 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "common.h" #include "widgets/searchresultview.h" #include "widgets/classbrowser.h" diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index f913ce6f..4dd91712 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -27,7 +27,8 @@ #include static QAtomicInt cppParserCount(0); -CppParser::CppParser(QObject *parent) : QObject(parent) +CppParser::CppParser(QObject *parent) : QObject(parent), + mMutex(QMutex::Recursive) { mParserId = cppParserCount.fetchAndAddRelaxed(1); mSerialCount = 0; diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h index e0e6e8d3..cee4e6d6 100644 --- a/RedPandaIDE/parser/cppparser.h +++ b/RedPandaIDE/parser/cppparser.h @@ -20,6 +20,7 @@ #include #include #include +#include #include "statementmodel.h" #include "cpptokenizer.h" #include "cpppreprocessor.h" @@ -465,7 +466,7 @@ private: QSet mInlineNamespaces; //fRemovedStatements: THashedStringList; //THashedStringList - QRecursiveMutex mMutex; + QMutex mMutex; GetFileStreamCallBack mOnGetFileStream; QMap mCppKeywords; QSet mCppTypeKeywords; diff --git a/RedPandaIDE/parser/cpppreprocessor.cpp b/RedPandaIDE/parser/cpppreprocessor.cpp index e6b53aab..cc911144 100644 --- a/RedPandaIDE/parser/cpppreprocessor.cpp +++ b/RedPandaIDE/parser/cpppreprocessor.cpp @@ -162,9 +162,10 @@ void CppPreprocessor::reset() void CppPreprocessor::resetDefines() { - mDefines.clear(); + mDefines = mHardDefines; +// mDefines.clear(); - mDefines.insert(mHardDefines); +// mDefines.insert(mHardDefines); } void CppPreprocessor::setScanOptions(bool parseSystem, bool parseLocal) @@ -207,7 +208,7 @@ void CppPreprocessor::dumpDefinesTo(const QString &fileName) const stream<name,define->args,define->value) .arg(define->hardCoded).arg(define->formatValue) - <baseFile<<" : "<baseFile<<" : "<includeFiles.keys()) { - stream<<"\t--"+s<dependingFiles) { - stream<<"\t^^"+s<dependedFiles) { - stream<<"\t&&"+s<usings) { - stream<<"\t++"+s<statements) { if (statement) { stream<command,statement->fullName)<command,statement->fullName)<fileIncludes->includeFiles.insert(fileIncludes->includeFiles); + file->fileIncludes->includeFiles = + file->fileIncludes->includeFiles.unite(fileIncludes->includeFiles); + // file->fileIncludes->includeFiles.insert(fileIncludes->includeFiles); } } mIncludes.append(parsedFile); diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp index 99fc3221..933fbad7 100644 --- a/RedPandaIDE/parser/cpptokenizer.cpp +++ b/RedPandaIDE/parser/cpptokenizer.cpp @@ -67,7 +67,7 @@ void CppTokenizer::dumpTokens(const QString &fileName) if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { QTextStream stream(&file); foreach (const PToken& token,mTokenList) { - stream<line).arg(token->text)<line).arg(token->text)< #include #include +#include #include struct CodeSnippet { diff --git a/RedPandaIDE/parser/statementmodel.cpp b/RedPandaIDE/parser/statementmodel.cpp index 00901dd6..cb960a90 100644 --- a/RedPandaIDE/parser/statementmodel.cpp +++ b/RedPandaIDE/parser/statementmodel.cpp @@ -107,7 +107,7 @@ void StatementModel::dumpAll(const QString &logFile) .arg(statement->endLine) .arg(statement->definitionFileName) .arg(statement->definitionLine) - .arg(statement->definitionEndLine)<definitionEndLine)<endLine) .arg(statement->definitionFileName) .arg(statement->definitionLine) - .arg(statement->definitionEndLine)<definitionEndLine)<children.isEmpty()) continue; - out<command<<" {"<command<<" {"<children,out,level+1); - out<compilerSets().defaultIndex()); @@ -1453,9 +1453,9 @@ void Project::loadOptions(SimpleIni& ini) mOptions.type = ProjectType::GUI; mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", "")); - mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",Qt::SkipEmptyParts); - mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",Qt::SkipEmptyParts); - mOptions.includes = fromByteArray(ini.GetValue("Project", "IncludeDirs", "")).split(";",Qt::SkipEmptyParts); + mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts); + mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts); + mOptions.includes = fromByteArray(ini.GetValue("Project", "IncludeDirs", "")).split(";",QString::SkipEmptyParts); mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "CompilerOptions", "")); mOptions.useGPP = ini.GetBoolValue("Project", "Use_GPP", false); mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", "")); diff --git a/RedPandaIDE/projecttemplate.cpp b/RedPandaIDE/projecttemplate.cpp index f5f26793..60b6ba8d 100644 --- a/RedPandaIDE/projecttemplate.cpp +++ b/RedPandaIDE/projecttemplate.cpp @@ -113,10 +113,10 @@ void ProjectTemplate::readTemplateFile(const QString &fileName) mOptions.icon = mIni->GetValue("Project", "Icon", ""); mOptions.type = static_cast(mIni->GetLongValue("Project", "Type", 0)); // default = gui - mOptions.objFiles = fromByteArray(mIni->GetValue("Project", "ObjFiles", "")).split(";",Qt::SkipEmptyParts); - mOptions.includes = fromByteArray(mIni->GetValue("Project", "Includes", "")).split(";",Qt::SkipEmptyParts); - mOptions.libs = fromByteArray(mIni->GetValue("Project", "Libs", "")).split(";",Qt::SkipEmptyParts); - mOptions.resourceIncludes = fromByteArray(mIni->GetValue("Project", "ResourceIncludes", "")).split(";",Qt::SkipEmptyParts); + mOptions.objFiles = fromByteArray(mIni->GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts); + mOptions.includes = fromByteArray(mIni->GetValue("Project", "Includes", "")).split(";",QString::SkipEmptyParts); + mOptions.libs = fromByteArray(mIni->GetValue("Project", "Libs", "")).split(";",QString::SkipEmptyParts); + mOptions.resourceIncludes = fromByteArray(mIni->GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts); mOptions.compilerCmd = fromByteArray(mIni->GetValue("Project", "Compiler", "")); mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", "")); mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker","")); diff --git a/RedPandaIDE/qsynedit/MiscClasses.cpp b/RedPandaIDE/qsynedit/MiscClasses.cpp index f66bbcab..fad76cda 100644 --- a/RedPandaIDE/qsynedit/MiscClasses.cpp +++ b/RedPandaIDE/qsynedit/MiscClasses.cpp @@ -21,9 +21,9 @@ SynGutter::SynGutter(QObject *parent): QObject(parent) { mFont = QFont("Courier New",10); - mColor= QColorConstants::Svg::lightgray; - mBorderColor = QColorConstants::Transparent; - mTextColor = QColorConstants::Svg::black; + mColor= Qt::lightGray; + mBorderColor = Qt::transparent; + mTextColor = Qt::black; mShowLineNumbers = true; mDigitCount = 1; mLeadingZeros = false; @@ -36,8 +36,8 @@ SynGutter::SynGutter(QObject *parent): mBorderStyle = SynGutterBorderStyle::Middle; mLineNumberStart = 1; mGradient = false; - mGradientStartColor = QColorConstants::Transparent; - mGradientEndColor = QColorConstants::Transparent; + mGradientStartColor = Qt::transparent; + mGradientEndColor = Qt::transparent; mGradientSteps = 48; } diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 0f3e0c79..76e7df5b 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -78,9 +78,9 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) mForegroundColor=palette().color(QPalette::Text); mBackgroundColor=palette().color(QPalette::Base); - mCaretColor = QColorConstants::Red; + mCaretColor = Qt::red; mCaretUseTextColor = false; - mActiveLineColor = QColorConstants::Svg::lightblue; + mActiveLineColor = Qt::blue; mSelectedBackground = palette().color(QPalette::Highlight); mSelectedForeground = palette().color(QPalette::HighlightedText); @@ -117,7 +117,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) //fKbdHandler := TSynEditKbdHandler.Create; //fMarkList.OnChange := MarkListChange; setDefaultKeystrokes(); - mRightEdgeColor = QColorConstants::Svg::silver; + mRightEdgeColor = Qt::lightGray; /* IME input */ mImeCount = 0; @@ -143,7 +143,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) //mScrollTimer->setInterval(100); connect(mScrollTimer, &QTimer::timeout,this, &SynEdit::onScrollTimeout); - mScrollHintColor = QColorConstants::Yellow; + mScrollHintColor = Qt::yellow; mScrollHintFormat = SynScrollHintFormat::shfTopLineOnly; mContentImage = std::make_shared(clientWidth(),clientHeight(),QImage::Format_ARGB32); @@ -1242,11 +1242,6 @@ int SynEdit::charColumns(QChar ch) const return std::ceil((int)(fontMetrics().horizontalAdvance(ch)) / (double)mCharWidth); } -double SynEdit::dpiFactor() const -{ - return fontMetrics().fontDpi() / 96.0; -} - void SynEdit::showCaret() { if (m_blinkTimerId==0) diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 9536449a..d4689b0d 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -212,7 +212,7 @@ public: QString wordAtRowCol(const BufferCoord& XY); int charColumns(QChar ch) const; - double dpiFactor() const; + bool isPointInSelection(const BufferCoord& Value) const; BufferCoord nextWordPos(); BufferCoord nextWordPosEx(const BufferCoord& XY); diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/RedPandaIDE/qsynedit/TextBuffer.cpp index dcd1d51d..c5196e8a 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.cpp +++ b/RedPandaIDE/qsynedit/TextBuffer.cpp @@ -28,7 +28,8 @@ SynEditStringList::SynEditStringList(SynEdit *pEdit, QObject *parent): QObject(parent), - mEdit(pEdit) + mEdit(pEdit), + mMutex(QMutex::Recursive) { mAppendNewLineAtEOF = true; mFileEndingType = FileEndingType::Windows; @@ -364,7 +365,10 @@ void SynEditStringList::exchange(int Index1, int Index2) ListIndexOutOfBounds(Index2); } beginUpdate(); - mList.swapItemsAt(Index1,Index2); + PSynEditStringRec temp = mList[Index1]; + mList[Index1]=mList[Index2]; + mList[Index2]=temp; + //mList.swapItemsAt(Index1,Index2); if (mIndexOfLongestLine == Index1) { mIndexOfLongestLine = Index2; } else if (mIndexOfLongestLine == Index2) { diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/RedPandaIDE/qsynedit/TextBuffer.h index d09dfc50..f18f3eb1 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.h +++ b/RedPandaIDE/qsynedit/TextBuffer.h @@ -142,7 +142,7 @@ private: bool mAppendNewLineAtEOF; int mIndexOfLongestLine; int mUpdateCount; - QRecursiveMutex mMutex; + QMutex mMutex; int calculateLineColumns(int Index); }; diff --git a/RedPandaIDE/qsynedit/Types.h b/RedPandaIDE/qsynedit/Types.h index 0ae00528..f44ada29 100644 --- a/RedPandaIDE/qsynedit/Types.h +++ b/RedPandaIDE/qsynedit/Types.h @@ -20,6 +20,7 @@ #include #include #include +#include enum class SynSelectionMode {smNormal, smLine, smColumn}; diff --git a/RedPandaIDE/qsynedit/highlighter/composition.cpp b/RedPandaIDE/qsynedit/highlighter/composition.cpp index 3889dce7..05f04635 100644 --- a/RedPandaIDE/qsynedit/highlighter/composition.cpp +++ b/RedPandaIDE/qsynedit/highlighter/composition.cpp @@ -37,7 +37,7 @@ SynScheme::SynScheme(QObject *parent): mCaseSensitive(true) { mMarkerAttribute = std::make_shared(SYNS_AttrMarker); - mMarkerAttribute->setForeground(QColorConstants::Yellow); + mMarkerAttribute->setForeground(Qt::yellow); mMarkerAttribute->setStyles(SynFontStyle::fsBold); } diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index a771cfbc..ce4265f1 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1162,7 +1162,7 @@ void Settings::Editor::doLoad() mTabToSpaces = boolValue("tab_to_spaces",false); mTabWidth = intValue("tab_width",4); mShowIndentLines = boolValue("show_indent_lines",true); - mIndentLineColor = colorValue("indent_line_color",QColorConstants::Svg::silver); + mIndentLineColor = colorValue("indent_line_color",Qt::lightGray); mfillIndents = boolValue("fill_indents", false); // caret mEnhanceHomeKey = boolValue("enhance_home_key", true); @@ -1171,7 +1171,7 @@ void Settings::Editor::doLoad() mCaretForInsert = static_cast( intValue("caret_for_insert",static_cast(SynEditCaretType::ctVerticalLine))); mCaretForOverwrite = static_cast( intValue("caret_for_overwrite",static_cast(SynEditCaretType::ctBlock))); mCaretUseTextColor = boolValue("caret_use_text_color",true); - mCaretColor = colorValue("caret_color",QColorConstants::Svg::yellow); + mCaretColor = colorValue("caret_color",Qt::yellow); //highlight mHighlightMathingBraces = boolValue("highlight_matching_braces",true); @@ -1189,7 +1189,7 @@ void Settings::Editor::doLoad() //right edge mShowRightEdgeLine = boolValue("show_right_edge_line",false); mRightEdgeWidth = intValue("right_edge_width",80); - mRightEdgeLineColor = colorValue("right_edge_line_color",QColorConstants::Svg::yellow); + mRightEdgeLineColor = colorValue("right_edge_line_color",Qt::yellow); //Font #ifdef Q_OS_WIN diff --git a/RedPandaIDE/settingsdialog/editorclipboardwidget.ui b/RedPandaIDE/settingsdialog/editorclipboardwidget.ui index 400856b5..a01ceaba 100644 --- a/RedPandaIDE/settingsdialog/editorclipboardwidget.ui +++ b/RedPandaIDE/settingsdialog/editorclipboardwidget.ui @@ -109,11 +109,7 @@ - - - - - + diff --git a/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp b/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp index 887c4ff7..d12748d2 100644 --- a/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp @@ -103,7 +103,7 @@ void ProjectGeneralWidget::doSave() project->options().useGPP = ui->cbDefaultCpp->isChecked(); project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked(); if (mIconPath.isEmpty() - || ui->lblICon->pixmap(Qt::ReturnByValue).isNull()) { + || !ui->lblICon->pixmap() || ui->lblICon->pixmap()->isNull()) { project->options().icon = ""; } else { QString iconPath = changeFileExt(project->filename(),"ico"); diff --git a/RedPandaIDE/settingsdialog/settingsdialog.h b/RedPandaIDE/settingsdialog/settingsdialog.h index 4d311ddb..59d89d4f 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.h +++ b/RedPandaIDE/settingsdialog/settingsdialog.h @@ -20,6 +20,7 @@ #include #include #include +#include class SettingsWidget; namespace Ui { diff --git a/RedPandaIDE/thememanager.h b/RedPandaIDE/thememanager.h index 6c0f481d..573a53db 100644 --- a/RedPandaIDE/thememanager.h +++ b/RedPandaIDE/thememanager.h @@ -20,7 +20,7 @@ #include #include #include - +#include class AppTheme:public QObject { Q_OBJECT diff --git a/RedPandaIDE/todoparser.cpp b/RedPandaIDE/todoparser.cpp index 3aae7d4a..481c032c 100644 --- a/RedPandaIDE/todoparser.cpp +++ b/RedPandaIDE/todoparser.cpp @@ -21,7 +21,8 @@ #include "HighlighterManager.h" #include "qsynedit/Constants.h" -TodoParser::TodoParser(QObject *parent) : QObject(parent) +TodoParser::TodoParser(QObject *parent) : QObject(parent), + mMutex(QMutex::Recursive) { mThread = nullptr; } diff --git a/RedPandaIDE/todoparser.h b/RedPandaIDE/todoparser.h index 385aa4c3..825ec870 100644 --- a/RedPandaIDE/todoparser.h +++ b/RedPandaIDE/todoparser.h @@ -82,7 +82,7 @@ public: private: TodoThread* mThread; - QRecursiveMutex mMutex; + QMutex mMutex; }; using PTodoParser = std::shared_ptr; diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index 0360da73..0659d8fe 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -300,7 +300,7 @@ void splitStringArguments(const QString &arguments, QStringList &argumentList) } } -bool programHasConsole(const QString &filename) +bool programHasConsole(const QString & filename) { #ifdef Q_OS_WIN bool result = false; @@ -582,7 +582,7 @@ void stringsToFile(const QStringList &list, const QString &fileName) if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { QTextStream stream(&file); for (QString s:list) { - stream<desktop()->logicalDpiY(); } + + +QStringList splitProcessCommand(const QString &cmd) +{ + QStringList result; + SplitProcessCommandQuoteType quoteType = SplitProcessCommandQuoteType::None; + int i=0; + QString current; + while (idesktop()->logicalDpiY(); +} diff --git a/RedPandaIDE/utils.h b/RedPandaIDE/utils.h index da9d78de..0a7871ce 100644 --- a/RedPandaIDE/utils.h +++ b/RedPandaIDE/utils.h @@ -214,6 +214,14 @@ QString fromByteArray(const QByteArray& s); int getNewFileNumber(); +enum class SplitProcessCommandQuoteType { + None, + Single, + Double +}; + +QStringList splitProcessCommand(const QString& cmd); + #ifdef Q_OS_WIN bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QString& value); @@ -222,6 +230,7 @@ bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QSt class CppParser; void resetCppParser(std::shared_ptr parser); +float desktopDpi(); float pointToPixel(float point); float pixelToPoint(float pixel); diff --git a/RedPandaIDE/widgets/classbrowser.cpp b/RedPandaIDE/widgets/classbrowser.cpp index 95e51353..b0a6c60d 100644 --- a/RedPandaIDE/widgets/classbrowser.cpp +++ b/RedPandaIDE/widgets/classbrowser.cpp @@ -25,7 +25,8 @@ #include "../utils.h" #include "../iconsmanager.h" -ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent) +ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent), + mMutex(QMutex::Recursive) { mRoot = new ClassBrowserNode(); mRoot->parent = nullptr; diff --git a/RedPandaIDE/widgets/classbrowser.h b/RedPandaIDE/widgets/classbrowser.h index 6fe8b476..7274b3ca 100644 --- a/RedPandaIDE/widgets/classbrowser.h +++ b/RedPandaIDE/widgets/classbrowser.h @@ -73,7 +73,7 @@ private: PCppParser mParser; bool mUpdating; int mUpdateCount; - QRecursiveMutex mMutex; + QMutex mMutex; QString mCurrentFile; std::shared_ptr > > mColors; diff --git a/RedPandaIDE/widgets/codecompletionpopup.cpp b/RedPandaIDE/widgets/codecompletionpopup.cpp index 68eeff90..835e7995 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.cpp +++ b/RedPandaIDE/widgets/codecompletionpopup.cpp @@ -28,7 +28,8 @@ #include CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) : - QWidget(parent) + QWidget(parent), + mMutex(QMutex::Recursive) { setWindowFlags(Qt::Popup); mListView = new CodeCompletionListView(this); diff --git a/RedPandaIDE/widgets/codecompletionpopup.h b/RedPandaIDE/widgets/codecompletionpopup.h index 5cb44889..b30dbb54 100644 --- a/RedPandaIDE/widgets/codecompletionpopup.h +++ b/RedPandaIDE/widgets/codecompletionpopup.h @@ -117,7 +117,7 @@ private: QSet mAddedStatements; QString mMemberPhrase; QString mMemberOperator; - QRecursiveMutex mMutex; + QMutex mMutex; std::shared_ptr > > mColors; PCppParser mParser; diff --git a/RedPandaIDE/widgets/coloredit.cpp b/RedPandaIDE/widgets/coloredit.cpp index 1f0f5f0c..f96b862a 100644 --- a/RedPandaIDE/widgets/coloredit.cpp +++ b/RedPandaIDE/widgets/coloredit.cpp @@ -25,7 +25,7 @@ ColorEdit::ColorEdit(QWidget *parent):QFrame(parent) { setFrameStyle(QFrame::Panel); setLineWidth(1); - mColor = QColorConstants::Black; + mColor = Qt::black; } QColor ColorEdit::color() diff --git a/RedPandaIDE/widgets/darkfusionstyle.cpp b/RedPandaIDE/widgets/darkfusionstyle.cpp index 70fd8aaa..65f0fc4e 100644 --- a/RedPandaIDE/widgets/darkfusionstyle.cpp +++ b/RedPandaIDE/widgets/darkfusionstyle.cpp @@ -86,13 +86,14 @@ static QString uniqueName(const QString &key, const QStyleOption *option, const return tmp; } -Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option); +static qreal calcDpi() { + return desktopDpi(); +} -Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi); +static qreal calcDpiScaled(qreal value, qreal dpi) { + return value*96/dpi; +} -Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QPaintDevice *device); - -Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, const QStyleOption *option); } @@ -574,13 +575,15 @@ void DarkFusionStyle::drawPrimitive(PrimitiveElement elem, const QStyleOption *o painter->drawRect(rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding)); } else if (checkbox->state & State_On) { - const qreal dpi = QStyleHelper::dpi(option); - qreal penWidth = QStyleHelper::dpiScaled(1.5, dpi); + + const qreal dpi = QStyleHelper::calcDpi(); + + qreal penWidth = QStyleHelper::calcDpiScaled(1.5, dpi); penWidth = qMax(penWidth, 0.13 * rect.height()); penWidth = qMin(penWidth, 0.20 * rect.height()); QPen checkPen = QPen(checkMarkColor, penWidth); checkMarkColor.setAlpha(210); - painter->translate(QStyleHelper::dpiScaled(-0.8, dpi), QStyleHelper::dpiScaled(0.5, dpi)); + painter->translate(QStyleHelper::calcDpiScaled(-0.8, dpi), QStyleHelper::calcDpiScaled(0.5, dpi)); painter->setPen(checkPen); painter->setBrush(Qt::NoBrush); @@ -683,7 +686,7 @@ void DarkFusionStyle::drawPrimitive(PrimitiveElement elem, const QStyleOption *o if (isFlat && !isDown) { if (isDefault) { r = option->rect.adjusted(0, 1, 0, -1); - painter->setPen(QPen(QColorConstants::Svg::lightgray)); + painter->setPen(QPen(Qt::lightGray)); const QLine lines[4] = { QLine(QPoint(r.left() + 2, r.top()), QPoint(r.right() - 2, r.top())), @@ -854,7 +857,8 @@ void DarkFusionStyle::drawControl(ControlElement element, const QStyleOption *op if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { painter->save(); int w = 0; - const int margin = int(QStyleHelper::dpiScaled(5, option)); + qreal dpi = QStyleHelper::calcDpi(); + const int margin = int(QStyleHelper::calcDpiScaled(5, dpi)); if (!menuItem->text.isEmpty()) { painter->setFont(menuItem->font); proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter, diff --git a/RedPandaIDE/widgets/functiontooltipwidget.h b/RedPandaIDE/widgets/functiontooltipwidget.h index f85bf737..3ea5ac09 100644 --- a/RedPandaIDE/widgets/functiontooltipwidget.h +++ b/RedPandaIDE/widgets/functiontooltipwidget.h @@ -19,6 +19,7 @@ #include #include #include +#include struct FunctionInfo { QString name; diff --git a/RedPandaIDE/widgets/qconsole.h b/RedPandaIDE/widgets/qconsole.h index 507acbe3..e2d8f908 100644 --- a/RedPandaIDE/widgets/qconsole.h +++ b/RedPandaIDE/widgets/qconsole.h @@ -19,6 +19,7 @@ #include #include +#include struct ConsoleLine { QString text;