Merge branch 'master' of github.com:royqh1979/RedPanda-CPP
This commit is contained in:
commit
60c93d2f39
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -83,7 +83,7 @@ void ExecutableRunner::run()
|
|||
|
||||
mProcess = std::make_shared<QProcess>();
|
||||
mProcess->setProgram(mFilename);
|
||||
mProcess->setArguments(QProcess::splitCommand(mArguments));
|
||||
mProcess->setArguments(splitProcessCommand(mArguments));
|
||||
mProcess->setWorkingDirectory(mWorkDir);
|
||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
QString path = env.value("PATH");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 QList<GDBMIResultParser::ParseValue
|
|||
QStringList locals;
|
||||
foreach (const GDBMIResultParser::ParseValue& varValue, variables) {
|
||||
GDBMIResultParser::ParseObject varObject = varValue.object();
|
||||
locals.append(QString("%1 = %2")
|
||||
.arg(varObject["name"].value(),varObject["value"].value()));
|
||||
locals.append(
|
||||
QString("%1 = %2")
|
||||
.arg(
|
||||
QString(varObject["name"].value()),
|
||||
QString(varObject["value"].value())
|
||||
));
|
||||
}
|
||||
emit localsUpdated(locals);
|
||||
}
|
||||
|
@ -1339,7 +1344,7 @@ void DebugReader::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()) {
|
||||
|
@ -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()) {
|
||||
|
|
|
@ -437,7 +437,7 @@ private slots:
|
|||
private:
|
||||
Debugger *mDebugger;
|
||||
QString mDebuggerPath;
|
||||
QRecursiveMutex mCmdQueueMutex;
|
||||
QMutex mCmdQueueMutex;
|
||||
QSemaphore mStartSemaphore;
|
||||
QQueue<PDebugCommand> mCmdQueue;
|
||||
bool mErrorOccured;
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <QTimer>
|
||||
#include <QFileSystemModel>
|
||||
#include <QTcpServer>
|
||||
#include <QElapsedTimer>
|
||||
#include "common.h"
|
||||
#include "widgets/searchresultview.h"
|
||||
#include "widgets/classbrowser.h"
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#include <QTime>
|
||||
|
||||
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;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QVector>
|
||||
#include "statementmodel.h"
|
||||
#include "cpptokenizer.h"
|
||||
#include "cpppreprocessor.h"
|
||||
|
@ -465,7 +466,7 @@ private:
|
|||
QSet<QString> mInlineNamespaces;
|
||||
//fRemovedStatements: THashedStringList; //THashedStringList<String,PRemovedStatements>
|
||||
|
||||
QRecursiveMutex mMutex;
|
||||
QMutex mMutex;
|
||||
GetFileStreamCallBack mOnGetFileStream;
|
||||
QMap<QString,SkipType> mCppKeywords;
|
||||
QSet<QString> mCppTypeKeywords;
|
||||
|
|
|
@ -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<<QString("%1 %2 %3 %4 %5\n")
|
||||
.arg(define->name,define->args,define->value)
|
||||
.arg(define->hardCoded).arg(define->formatValue)
|
||||
<<Qt::endl;
|
||||
<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -218,28 +219,28 @@ void CppPreprocessor::dumpIncludesListTo(const QString &fileName) const
|
|||
if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
||||
QTextStream stream(&file);
|
||||
for (const PFileIncludes& fileIncludes:mIncludesList) {
|
||||
stream<<fileIncludes->baseFile<<" : "<<Qt::endl;
|
||||
stream<<"\t**includes:**"<<Qt::endl;
|
||||
stream<<fileIncludes->baseFile<<" : "<<endl;
|
||||
stream<<"\t**includes:**"<<endl;
|
||||
foreach (const QString& s,fileIncludes->includeFiles.keys()) {
|
||||
stream<<"\t--"+s<<Qt::endl;
|
||||
stream<<"\t--"+s<<endl;
|
||||
}
|
||||
stream<<"\t**depends on:**"<<Qt::endl;
|
||||
stream<<"\t**depends on:**"<<endl;
|
||||
foreach (const QString& s,fileIncludes->dependingFiles) {
|
||||
stream<<"\t^^"+s<<Qt::endl;
|
||||
stream<<"\t^^"+s<<endl;
|
||||
}
|
||||
stream<<"\t**depended by:**"<<Qt::endl;
|
||||
stream<<"\t**depended by:**"<<endl;
|
||||
foreach (const QString& s,fileIncludes->dependedFiles) {
|
||||
stream<<"\t&&"+s<<Qt::endl;
|
||||
stream<<"\t&&"+s<<endl;
|
||||
}
|
||||
stream<<"\t**using:**"<<Qt::endl;
|
||||
stream<<"\t**using:**"<<endl;
|
||||
foreach (const QString& s,fileIncludes->usings) {
|
||||
stream<<"\t++"+s<<Qt::endl;
|
||||
stream<<"\t++"+s<<endl;
|
||||
}
|
||||
stream<<"\t**statements:**"<<Qt::endl;
|
||||
stream<<"\t**statements:**"<<endl;
|
||||
foreach (const PStatement& statement,fileIncludes->statements) {
|
||||
if (statement) {
|
||||
stream<<QString("\t**%1 , %2")
|
||||
.arg(statement->command,statement->fullName)<<Qt::endl;
|
||||
.arg(statement->command,statement->fullName)<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -704,7 +705,9 @@ void CppPreprocessor::openInclude(const QString &fileName, QStringList bufferedT
|
|||
addDefinesInFile(fileName);
|
||||
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
||||
for (PParsedFile& file:mIncludes) {
|
||||
file->fileIncludes->includeFiles.insert(fileIncludes->includeFiles);
|
||||
file->fileIncludes->includeFiles =
|
||||
file->fileIncludes->includeFiles.unite(fileIncludes->includeFiles);
|
||||
// file->fileIncludes->includeFiles.insert(fileIncludes->includeFiles);
|
||||
}
|
||||
}
|
||||
mIncludes.append(parsedFile);
|
||||
|
|
|
@ -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<<QString("%1,%2").arg(token->line).arg(token->text)<<Qt::endl;
|
||||
stream<<QString("%1,%2").arg(token->line).arg(token->text)<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
struct CodeSnippet {
|
||||
|
|
|
@ -107,7 +107,7 @@ void StatementModel::dumpAll(const QString &logFile)
|
|||
.arg(statement->endLine)
|
||||
.arg(statement->definitionFileName)
|
||||
.arg(statement->definitionLine)
|
||||
.arg(statement->definitionEndLine)<<Qt::endl;
|
||||
.arg(statement->definitionEndLine)<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,11 +147,11 @@ void StatementModel::dumpStatementMap(StatementMap &map, QTextStream &out, int l
|
|||
.arg(statement->endLine)
|
||||
.arg(statement->definitionFileName)
|
||||
.arg(statement->definitionLine)
|
||||
.arg(statement->definitionEndLine)<<Qt::endl;
|
||||
.arg(statement->definitionEndLine)<<endl;
|
||||
if (statement->children.isEmpty())
|
||||
continue;
|
||||
out<<indent<<statement->command<<" {"<<Qt::endl;
|
||||
out<<indent<<statement->command<<" {"<<endl;
|
||||
dumpStatementMap(statement->children,out,level+1);
|
||||
out<<indent<<"}"<<Qt::endl;
|
||||
out<<indent<<"}"<<endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1145,7 +1145,7 @@ void Project::checkProjectFileForUpdate(SimpleIni &ini)
|
|||
if (!oldRes.isEmpty()) {
|
||||
QFile::copy(mFilename,mFilename+".bak");
|
||||
QStringList sl;
|
||||
sl = oldRes.split(';',Qt::SkipEmptyParts);
|
||||
sl = oldRes.split(';',QString::SkipEmptyParts);
|
||||
for (int i=0;i<sl.count();i++){
|
||||
const QString& s = sl[i];
|
||||
QByteArray groupName = toByteArray(QString("Unit%1").arg(uCount+i));
|
||||
|
@ -1323,7 +1323,7 @@ void Project::loadLayout()
|
|||
int topLeft = layIni.GetLongValue("Editors","Focused",1);
|
||||
//TopRight := layIni.ReadInteger('Editors', 'FocusedRight', -1);
|
||||
QString temp =layIni.GetValue("Editors","Order", "");
|
||||
QStringList sl = temp.split(",",Qt::SkipEmptyParts);
|
||||
QStringList sl = temp.split(",",QString::SkipEmptyParts);
|
||||
|
||||
foreach (const QString& s,sl) {
|
||||
bool ok;
|
||||
|
@ -1362,12 +1362,12 @@ void Project::loadOptions(SimpleIni& ini)
|
|||
mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "Compiler", ""));
|
||||
mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", ""));
|
||||
mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", ""));
|
||||
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",Qt::SkipEmptyParts);
|
||||
mOptions.libs = fromByteArray(ini.GetValue("Project", "Libs", "")).split(";",Qt::SkipEmptyParts);
|
||||
mOptions.includes = fromByteArray(ini.GetValue("Project", "Includes", "")).split(";",Qt::SkipEmptyParts);
|
||||
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts);
|
||||
mOptions.libs = fromByteArray(ini.GetValue("Project", "Libs", "")).split(";",QString::SkipEmptyParts);
|
||||
mOptions.includes = fromByteArray(ini.GetValue("Project", "Includes", "")).split(";",QString::SkipEmptyParts);
|
||||
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
|
||||
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",Qt::SkipEmptyParts);
|
||||
mOptions.makeIncludes = fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";",Qt::SkipEmptyParts);
|
||||
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts);
|
||||
mOptions.makeIncludes = fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";",QString::SkipEmptyParts);
|
||||
mOptions.useGPP = ini.GetBoolValue("Project", "IsCpp", false);
|
||||
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
|
||||
mOptions.objectOutput = fromByteArray(ini.GetValue("Project", "ObjectOutput", ""));
|
||||
|
@ -1381,7 +1381,7 @@ void Project::loadOptions(SimpleIni& ini)
|
|||
mOptions.usePrecompiledHeader = ini.GetBoolValue("Project", "UsePrecompiledHeader", false);
|
||||
mOptions.precompiledHeader = fromByteArray(ini.GetValue("Project", "PrecompiledHeader", ""));
|
||||
mOptions.cmdLineArgs = fromByteArray(ini.GetValue("Project", "CommandLine", ""));
|
||||
mFolders = fromByteArray(ini.GetValue("Project", "Folders", "")).split(";",Qt::SkipEmptyParts);
|
||||
mFolders = fromByteArray(ini.GetValue("Project", "Folders", "")).split(";",QString::SkipEmptyParts);
|
||||
mOptions.includeVersionInfo = ini.GetBoolValue("Project", "IncludeVersionInfo", false);
|
||||
mOptions.supportXPThemes = ini.GetBoolValue("Project", "SupportXPThemes", false);
|
||||
mOptions.compilerSet = ini.GetLongValue("Project", "CompilerSet", pSettings->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", ""));
|
||||
|
|
|
@ -113,10 +113,10 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
|
|||
|
||||
mOptions.icon = mIni->GetValue("Project", "Icon", "");
|
||||
mOptions.type = static_cast<ProjectType>(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",""));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<QImage>(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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -142,7 +142,7 @@ private:
|
|||
bool mAppendNewLineAtEOF;
|
||||
int mIndexOfLongestLine;
|
||||
int mUpdateCount;
|
||||
QRecursiveMutex mMutex;
|
||||
QMutex mMutex;
|
||||
|
||||
int calculateLineColumns(int Index);
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QIcon>
|
||||
#include <QList>
|
||||
#include <QFlags>
|
||||
#include <memory>
|
||||
|
||||
enum class SynSelectionMode {smNormal, smLine, smColumn};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ SynScheme::SynScheme(QObject *parent):
|
|||
mCaseSensitive(true)
|
||||
{
|
||||
mMarkerAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrMarker);
|
||||
mMarkerAttribute->setForeground(QColorConstants::Yellow);
|
||||
mMarkerAttribute->setForeground(Qt::yellow);
|
||||
mMarkerAttribute->setStyles(SynFontStyle::fsBold);
|
||||
}
|
||||
|
||||
|
|
|
@ -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<SynEditCaretType>( intValue("caret_for_insert",static_cast<int>(SynEditCaretType::ctVerticalLine)));
|
||||
mCaretForOverwrite = static_cast<SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(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
|
||||
|
|
|
@ -109,11 +109,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbCopyWithFormatAs">
|
||||
<property name="placeholderText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cbCopyWithFormatAs" />
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QAbstractItemModel>
|
||||
#include <QDialog>
|
||||
#include <QStandardItemModel>
|
||||
#include <memory>
|
||||
|
||||
class SettingsWidget;
|
||||
namespace Ui {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <QPalette>
|
||||
#include <QHash>
|
||||
#include <QColor>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class AppTheme:public QObject {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
private:
|
||||
TodoThread* mThread;
|
||||
QRecursiveMutex mMutex;
|
||||
QMutex mMutex;
|
||||
};
|
||||
|
||||
using PTodoParser = std::shared_ptr<TodoParser>;
|
||||
|
|
|
@ -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<<s<<Qt::endl;
|
||||
stream<<s<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ void logToFile(const QString &s, const QString &filename, bool append)
|
|||
}
|
||||
if (file.open(mode)) {
|
||||
QTextStream ts(&file);
|
||||
ts<<s<<Qt::endl;
|
||||
ts<<s<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -998,3 +998,75 @@ float pixelToPoint(float pixel)
|
|||
{
|
||||
return pixel * 72 / qApp->desktop()->logicalDpiY();
|
||||
}
|
||||
|
||||
|
||||
QStringList splitProcessCommand(const QString &cmd)
|
||||
{
|
||||
QStringList result;
|
||||
SplitProcessCommandQuoteType quoteType = SplitProcessCommandQuoteType::None;
|
||||
int i=0;
|
||||
QString current;
|
||||
while (i<cmd.length()) {
|
||||
switch (cmd[i].unicode()) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
if (quoteType == SplitProcessCommandQuoteType::None) {
|
||||
if (!current.isEmpty()) {
|
||||
result.append(current);
|
||||
}
|
||||
current = "";
|
||||
} else {
|
||||
current += cmd[i];
|
||||
}
|
||||
i++;
|
||||
break;
|
||||
case '\"':
|
||||
switch(quoteType) {
|
||||
case SplitProcessCommandQuoteType::None:
|
||||
quoteType = SplitProcessCommandQuoteType::Double;
|
||||
break;
|
||||
case SplitProcessCommandQuoteType::Double:
|
||||
quoteType = SplitProcessCommandQuoteType::None;
|
||||
break;
|
||||
default:
|
||||
current+=cmd[i];
|
||||
}
|
||||
i++;
|
||||
break;
|
||||
case '\'':
|
||||
switch(quoteType) {
|
||||
case SplitProcessCommandQuoteType::None:
|
||||
quoteType = SplitProcessCommandQuoteType::Single;
|
||||
break;
|
||||
case SplitProcessCommandQuoteType::Single:
|
||||
quoteType = SplitProcessCommandQuoteType::None;
|
||||
break;
|
||||
default:
|
||||
current+=cmd[i];
|
||||
}
|
||||
i++;
|
||||
break;
|
||||
case '\\':
|
||||
current += cmd[i];
|
||||
i++;
|
||||
if (i<cmd.length()) {
|
||||
current += cmd[i];
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
current += cmd[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (!current.isEmpty())
|
||||
result.append(current);
|
||||
return result;
|
||||
}
|
||||
|
||||
float desktopDpi()
|
||||
{
|
||||
return qApp->desktop()->logicalDpiY();
|
||||
}
|
||||
|
|
|
@ -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<CppParser> parser);
|
||||
|
||||
float desktopDpi();
|
||||
float pointToPixel(float point);
|
||||
float pixelToPoint(float pixel);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -73,7 +73,7 @@ private:
|
|||
PCppParser mParser;
|
||||
bool mUpdating;
|
||||
int mUpdateCount;
|
||||
QRecursiveMutex mMutex;
|
||||
QMutex mMutex;
|
||||
QString mCurrentFile;
|
||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
#include <QApplication>
|
||||
|
||||
CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent),
|
||||
mMutex(QMutex::Recursive)
|
||||
{
|
||||
setWindowFlags(Qt::Popup);
|
||||
mListView = new CodeCompletionListView(this);
|
||||
|
|
|
@ -117,7 +117,7 @@ private:
|
|||
QSet<QString> mAddedStatements;
|
||||
QString mMemberPhrase;
|
||||
QString mMemberOperator;
|
||||
QRecursiveMutex mMutex;
|
||||
QMutex mMutex;
|
||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||
|
||||
PCppParser mParser;
|
||||
|
|
|
@ -25,7 +25,7 @@ ColorEdit::ColorEdit(QWidget *parent):QFrame(parent)
|
|||
{
|
||||
setFrameStyle(QFrame::Panel);
|
||||
setLineWidth(1);
|
||||
mColor = QColorConstants::Black;
|
||||
mColor = Qt::black;
|
||||
}
|
||||
|
||||
QColor ColorEdit::color()
|
||||
|
|
|
@ -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<qreal>(penWidth, 0.13 * rect.height());
|
||||
penWidth = qMin<qreal>(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,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
struct FunctionInfo {
|
||||
QString name;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
struct ConsoleLine {
|
||||
QString text;
|
||||
|
|
Loading…
Reference in New Issue