qt 5.12 compatibility
This commit is contained in:
parent
a79b277d81
commit
bb6a4ed9c8
|
@ -61,25 +61,25 @@ PSynHighlighter HighlighterManager::getCppHighlighter()
|
||||||
{
|
{
|
||||||
SynEditCppHighlighter* highlighter = new SynEditCppHighlighter();
|
SynEditCppHighlighter* highlighter = new SynEditCppHighlighter();
|
||||||
PSynHighlighter pHighlighter(highlighter);
|
PSynHighlighter pHighlighter(highlighter);
|
||||||
highlighter->asmAttribute()->setForeground(QColorConstants::Blue);
|
highlighter->asmAttribute()->setForeground(Qt::blue);
|
||||||
highlighter->charAttribute()->setForeground(QColorConstants::Black);
|
highlighter->charAttribute()->setForeground(Qt::black);
|
||||||
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
||||||
highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic);
|
highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic);
|
||||||
highlighter->classAttribute()->setForeground(0x008080);
|
highlighter->classAttribute()->setForeground(0x008080);
|
||||||
highlighter->floatAttribute()->setForeground(QColorConstants::Svg::purple);
|
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
|
||||||
highlighter->functionAttribute()->setForeground(0x00627A);
|
highlighter->functionAttribute()->setForeground(0x00627A);
|
||||||
highlighter->globalVarAttribute()->setForeground(0x660E7A);
|
highlighter->globalVarAttribute()->setForeground(0x660E7A);
|
||||||
highlighter->hexAttribute()->setForeground(QColorConstants::Svg::purple);
|
highlighter->hexAttribute()->setForeground(Qt::darkMagenta);
|
||||||
highlighter->identifierAttribute()->setForeground(0x080808);
|
highlighter->identifierAttribute()->setForeground(0x080808);
|
||||||
highlighter->invalidAttribute()->setForeground(QColorConstants::Svg::red);
|
highlighter->invalidAttribute()->setForeground(Qt::red);
|
||||||
highlighter->localVarAttribute()->setForeground(QColorConstants::Black);
|
highlighter->localVarAttribute()->setForeground(Qt::black);
|
||||||
highlighter->numberAttribute()->setForeground(0x1750EB);
|
highlighter->numberAttribute()->setForeground(0x1750EB);
|
||||||
highlighter->octAttribute()->setForeground(QColorConstants::Svg::purple);
|
highlighter->octAttribute()->setForeground(Qt::darkMagenta);
|
||||||
highlighter->preprocessorAttribute()->setForeground(0x1f542e);
|
highlighter->preprocessorAttribute()->setForeground(0x1f542e);
|
||||||
highlighter->keywordAttribute()->setForeground(0x0033b3);
|
highlighter->keywordAttribute()->setForeground(0x0033b3);
|
||||||
highlighter->whitespaceAttribute()->setForeground(QColorConstants::Svg::silver);
|
highlighter->whitespaceAttribute()->setForeground(Qt::lightGray);
|
||||||
highlighter->stringAttribute()->setForeground(0x007d17);
|
highlighter->stringAttribute()->setForeground(0x007d17);
|
||||||
highlighter->stringEscapeSequenceAttribute()->setForeground(QColorConstants::Svg::red);
|
highlighter->stringEscapeSequenceAttribute()->setForeground(Qt::red);
|
||||||
highlighter->symbolAttribute()->setForeground(0xc10000);
|
highlighter->symbolAttribute()->setForeground(0xc10000);
|
||||||
highlighter->variableAttribute()->setForeground(0x400080);
|
highlighter->variableAttribute()->setForeground(0x400080);
|
||||||
return pHighlighter;
|
return pHighlighter;
|
||||||
|
@ -94,7 +94,7 @@ PSynHighlighter HighlighterManager::getAsmHighlighter()
|
||||||
highlighter->identifierAttribute()->setForeground(0x080808);
|
highlighter->identifierAttribute()->setForeground(0x080808);
|
||||||
highlighter->keywordAttribute()->setForeground(0x0033b3);
|
highlighter->keywordAttribute()->setForeground(0x0033b3);
|
||||||
highlighter->numberAttribute()->setForeground(0x1750EB);
|
highlighter->numberAttribute()->setForeground(0x1750EB);
|
||||||
highlighter->whitespaceAttribute()->setForeground(QColorConstants::Svg::silver);
|
highlighter->whitespaceAttribute()->setForeground(Qt::lightGray);
|
||||||
highlighter->stringAttribute()->setForeground(0x007d17);
|
highlighter->stringAttribute()->setForeground(0x007d17);
|
||||||
highlighter->symbolAttribute()->setForeground(0xc10000);
|
highlighter->symbolAttribute()->setForeground(0xc10000);
|
||||||
return pHighlighter;
|
return pHighlighter;
|
||||||
|
|
|
@ -557,7 +557,7 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
|
||||||
}
|
}
|
||||||
env.insert("LANG","en");
|
env.insert("LANG","en");
|
||||||
process.setProcessEnvironment(env);
|
process.setProcessEnvironment(env);
|
||||||
process.setArguments(QProcess::splitCommand(arguments));
|
process.setArguments(splitProcessCommand(arguments));
|
||||||
process.setWorkingDirectory(workingDir);
|
process.setWorkingDirectory(workingDir);
|
||||||
|
|
||||||
process.connect(&process, &QProcess::errorOccurred,
|
process.connect(&process, &QProcess::errorOccurred,
|
||||||
|
|
|
@ -31,7 +31,11 @@ enum RunProgramFlag {
|
||||||
RPF_REDIRECT_INPUT = 0x0002
|
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;
|
mCompiler = nullptr;
|
||||||
mBackgroundSyntaxChecker = nullptr;
|
mBackgroundSyntaxChecker = nullptr;
|
||||||
|
|
|
@ -78,9 +78,9 @@ private:
|
||||||
int mSyntaxCheckIssueCount;
|
int mSyntaxCheckIssueCount;
|
||||||
Compiler* mBackgroundSyntaxChecker;
|
Compiler* mBackgroundSyntaxChecker;
|
||||||
Runner* mRunner;
|
Runner* mRunner;
|
||||||
QRecursiveMutex mCompileMutex;
|
QMutex mCompileMutex;
|
||||||
QRecursiveMutex mBackgroundSyntaxCheckMutex;
|
QMutex mBackgroundSyntaxCheckMutex;
|
||||||
QRecursiveMutex mRunnerMutex;
|
QMutex mRunnerMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CompileError : public BaseError {
|
class CompileError : public BaseError {
|
||||||
|
|
|
@ -83,7 +83,7 @@ void ExecutableRunner::run()
|
||||||
|
|
||||||
mProcess = std::make_shared<QProcess>();
|
mProcess = std::make_shared<QProcess>();
|
||||||
mProcess->setProgram(mFilename);
|
mProcess->setProgram(mFilename);
|
||||||
mProcess->setArguments(QProcess::splitCommand(mArguments));
|
mProcess->setArguments(splitProcessCommand(mArguments));
|
||||||
mProcess->setWorkingDirectory(mWorkDir);
|
mProcess->setWorkingDirectory(mWorkDir);
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
QString path = env.value("PATH");
|
QString path = env.value("PATH");
|
||||||
|
|
|
@ -46,7 +46,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
|
||||||
bool errorOccurred = false;
|
bool errorOccurred = false;
|
||||||
|
|
||||||
process.setProgram(mFilename);
|
process.setProgram(mFilename);
|
||||||
process.setArguments(QProcess::splitCommand(mArguments));
|
process.setArguments(splitProcessCommand(mArguments));
|
||||||
process.setWorkingDirectory(mWorkDir);
|
process.setWorkingDirectory(mWorkDir);
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
QString path = env.value("PATH");
|
QString path = env.value("PATH");
|
||||||
|
|
|
@ -355,16 +355,16 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
||||||
if (unit->encoding() == ENCODING_AUTO_DETECT) {
|
if (unit->encoding() == ENCODING_AUTO_DETECT) {
|
||||||
if (unit->editor() && unit->editor()->fileEncoding()!=ENCODING_ASCII)
|
if (unit->editor() && unit->editor()->fileEncoding()!=ENCODING_ASCII)
|
||||||
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
|
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
|
||||||
.arg(unit->editor()->fileEncoding(),
|
.arg(QString(unit->editor()->fileEncoding()),
|
||||||
defaultSystemEncoding);
|
QString(defaultSystemEncoding));
|
||||||
} else if (unit->encoding()==ENCODING_SYSTEM_DEFAULT) {
|
} else if (unit->encoding()==ENCODING_SYSTEM_DEFAULT) {
|
||||||
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
|
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
|
||||||
.arg(defaultSystemEncoding,
|
.arg(QString(defaultSystemEncoding),
|
||||||
defaultSystemEncoding);
|
QString(defaultSystemEncoding));
|
||||||
} else if (unit->encoding()!=ENCODING_ASCII && !unit->encoding().isEmpty()) {
|
} else if (unit->encoding()!=ENCODING_ASCII && !unit->encoding().isEmpty()) {
|
||||||
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
|
encodingStr = QString(" -finput-charset=%1 -fexec-charset=%2")
|
||||||
.arg(unit->encoding(),
|
.arg(QString(unit->encoding()),
|
||||||
defaultSystemEncoding);
|
QString(defaultSystemEncoding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,7 @@ bool Debugger::executing() const
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugReader::DebugReader(Debugger* debugger, QObject *parent) : QThread(parent),
|
DebugReader::DebugReader(Debugger* debugger, QObject *parent) : QThread(parent),
|
||||||
|
mCmdQueueMutex(QMutex::Recursive),
|
||||||
mStartSemaphore(0)
|
mStartSemaphore(0)
|
||||||
{
|
{
|
||||||
mDebugger = debugger;
|
mDebugger = debugger;
|
||||||
|
@ -1115,8 +1116,12 @@ void DebugReader::handleLocalVariables(const QList<GDBMIResultParser::ParseValue
|
||||||
QStringList locals;
|
QStringList locals;
|
||||||
foreach (const GDBMIResultParser::ParseValue& varValue, variables) {
|
foreach (const GDBMIResultParser::ParseValue& varValue, variables) {
|
||||||
GDBMIResultParser::ParseObject varObject = varValue.object();
|
GDBMIResultParser::ParseObject varObject = varValue.object();
|
||||||
locals.append(QString("%1 = %2")
|
locals.append(
|
||||||
.arg(varObject["name"].value(),varObject["value"].value()));
|
QString("%1 = %2")
|
||||||
|
.arg(
|
||||||
|
QString(varObject["name"].value()),
|
||||||
|
QString(varObject["value"].value())
|
||||||
|
));
|
||||||
}
|
}
|
||||||
emit localsUpdated(locals);
|
emit localsUpdated(locals);
|
||||||
}
|
}
|
||||||
|
@ -1339,7 +1344,7 @@ void DebugReader::run()
|
||||||
mProcess.reset();
|
mProcess.reset();
|
||||||
});
|
});
|
||||||
mProcess->setProgram(cmd);
|
mProcess->setProgram(cmd);
|
||||||
mProcess->setArguments(QProcess::splitCommand(arguments));
|
mProcess->setArguments(splitProcessCommand(arguments));
|
||||||
mProcess->setProcessChannelMode(QProcess::MergedChannels);
|
mProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
QString cmdDir = extractFileDir(cmd);
|
QString cmdDir = extractFileDir(cmd);
|
||||||
if (!cmdDir.isEmpty()) {
|
if (!cmdDir.isEmpty()) {
|
||||||
|
@ -2279,7 +2284,7 @@ void DebugTarget::run()
|
||||||
mProcess.reset();
|
mProcess.reset();
|
||||||
});
|
});
|
||||||
mProcess->setProgram(cmd);
|
mProcess->setProgram(cmd);
|
||||||
mProcess->setArguments(QProcess::splitCommand(arguments));
|
mProcess->setArguments(splitProcessCommand(arguments));
|
||||||
mProcess->setProcessChannelMode(QProcess::MergedChannels);
|
mProcess->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
QString cmdDir = extractFileDir(cmd);
|
QString cmdDir = extractFileDir(cmd);
|
||||||
if (!cmdDir.isEmpty()) {
|
if (!cmdDir.isEmpty()) {
|
||||||
|
|
|
@ -437,7 +437,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
Debugger *mDebugger;
|
Debugger *mDebugger;
|
||||||
QString mDebuggerPath;
|
QString mDebuggerPath;
|
||||||
QRecursiveMutex mCmdQueueMutex;
|
QMutex mCmdQueueMutex;
|
||||||
QSemaphore mStartSemaphore;
|
QSemaphore mStartSemaphore;
|
||||||
QQueue<PDebugCommand> mCmdQueue;
|
QQueue<PDebugCommand> mCmdQueue;
|
||||||
bool mErrorOccured;
|
bool mErrorOccured;
|
||||||
|
|
|
@ -83,7 +83,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
mInProject(inProject),
|
mInProject(inProject),
|
||||||
mIsNew(isNew),
|
mIsNew(isNew),
|
||||||
mSyntaxIssues(),
|
mSyntaxIssues(),
|
||||||
mSyntaxErrorColor(QColorConstants::Red),
|
mSyntaxErrorColor(Qt::red),
|
||||||
mSyntaxWarningColor("orange"),
|
mSyntaxWarningColor("orange"),
|
||||||
mLineCount(0),
|
mLineCount(0),
|
||||||
mActiveBreakpointLine(-1),
|
mActiveBreakpointLine(-1),
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFileSystemModel>
|
#include <QFileSystemModel>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
|
#include <QElapsedTimer>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "widgets/searchresultview.h"
|
#include "widgets/searchresultview.h"
|
||||||
#include "widgets/classbrowser.h"
|
#include "widgets/classbrowser.h"
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
static QAtomicInt cppParserCount(0);
|
static QAtomicInt cppParserCount(0);
|
||||||
CppParser::CppParser(QObject *parent) : QObject(parent)
|
CppParser::CppParser(QObject *parent) : QObject(parent),
|
||||||
|
mMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
mParserId = cppParserCount.fetchAndAddRelaxed(1);
|
mParserId = cppParserCount.fetchAndAddRelaxed(1);
|
||||||
mSerialCount = 0;
|
mSerialCount = 0;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <QVector>
|
||||||
#include "statementmodel.h"
|
#include "statementmodel.h"
|
||||||
#include "cpptokenizer.h"
|
#include "cpptokenizer.h"
|
||||||
#include "cpppreprocessor.h"
|
#include "cpppreprocessor.h"
|
||||||
|
@ -465,7 +466,7 @@ private:
|
||||||
QSet<QString> mInlineNamespaces;
|
QSet<QString> mInlineNamespaces;
|
||||||
//fRemovedStatements: THashedStringList; //THashedStringList<String,PRemovedStatements>
|
//fRemovedStatements: THashedStringList; //THashedStringList<String,PRemovedStatements>
|
||||||
|
|
||||||
QRecursiveMutex mMutex;
|
QMutex mMutex;
|
||||||
GetFileStreamCallBack mOnGetFileStream;
|
GetFileStreamCallBack mOnGetFileStream;
|
||||||
QMap<QString,SkipType> mCppKeywords;
|
QMap<QString,SkipType> mCppKeywords;
|
||||||
QSet<QString> mCppTypeKeywords;
|
QSet<QString> mCppTypeKeywords;
|
||||||
|
|
|
@ -162,9 +162,10 @@ void CppPreprocessor::reset()
|
||||||
|
|
||||||
void CppPreprocessor::resetDefines()
|
void CppPreprocessor::resetDefines()
|
||||||
{
|
{
|
||||||
mDefines.clear();
|
mDefines = mHardDefines;
|
||||||
|
// mDefines.clear();
|
||||||
|
|
||||||
mDefines.insert(mHardDefines);
|
// mDefines.insert(mHardDefines);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::setScanOptions(bool parseSystem, bool parseLocal)
|
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")
|
stream<<QString("%1 %2 %3 %4 %5\n")
|
||||||
.arg(define->name,define->args,define->value)
|
.arg(define->name,define->args,define->value)
|
||||||
.arg(define->hardCoded).arg(define->formatValue)
|
.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)) {
|
if (file.open(QIODevice::WriteOnly|QIODevice::Truncate)) {
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
for (const PFileIncludes& fileIncludes:mIncludesList) {
|
for (const PFileIncludes& fileIncludes:mIncludesList) {
|
||||||
stream<<fileIncludes->baseFile<<" : "<<Qt::endl;
|
stream<<fileIncludes->baseFile<<" : "<<endl;
|
||||||
stream<<"\t**includes:**"<<Qt::endl;
|
stream<<"\t**includes:**"<<endl;
|
||||||
foreach (const QString& s,fileIncludes->includeFiles.keys()) {
|
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) {
|
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) {
|
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) {
|
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) {
|
foreach (const PStatement& statement,fileIncludes->statements) {
|
||||||
if (statement) {
|
if (statement) {
|
||||||
stream<<QString("\t**%1 , %2")
|
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);
|
addDefinesInFile(fileName);
|
||||||
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
|
||||||
for (PParsedFile& file:mIncludes) {
|
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);
|
mIncludes.append(parsedFile);
|
||||||
|
|
|
@ -67,7 +67,7 @@ void CppTokenizer::dumpTokens(const QString &fileName)
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
foreach (const PToken& token,mTokenList) {
|
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 <QMap>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <QVector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
struct CodeSnippet {
|
struct CodeSnippet {
|
||||||
|
|
|
@ -107,7 +107,7 @@ void StatementModel::dumpAll(const QString &logFile)
|
||||||
.arg(statement->endLine)
|
.arg(statement->endLine)
|
||||||
.arg(statement->definitionFileName)
|
.arg(statement->definitionFileName)
|
||||||
.arg(statement->definitionLine)
|
.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->endLine)
|
||||||
.arg(statement->definitionFileName)
|
.arg(statement->definitionFileName)
|
||||||
.arg(statement->definitionLine)
|
.arg(statement->definitionLine)
|
||||||
.arg(statement->definitionEndLine)<<Qt::endl;
|
.arg(statement->definitionEndLine)<<endl;
|
||||||
if (statement->children.isEmpty())
|
if (statement->children.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
out<<indent<<statement->command<<" {"<<Qt::endl;
|
out<<indent<<statement->command<<" {"<<endl;
|
||||||
dumpStatementMap(statement->children,out,level+1);
|
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()) {
|
if (!oldRes.isEmpty()) {
|
||||||
QFile::copy(mFilename,mFilename+".bak");
|
QFile::copy(mFilename,mFilename+".bak");
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl = oldRes.split(';',Qt::SkipEmptyParts);
|
sl = oldRes.split(';',QString::SkipEmptyParts);
|
||||||
for (int i=0;i<sl.count();i++){
|
for (int i=0;i<sl.count();i++){
|
||||||
const QString& s = sl[i];
|
const QString& s = sl[i];
|
||||||
QByteArray groupName = toByteArray(QString("Unit%1").arg(uCount+i));
|
QByteArray groupName = toByteArray(QString("Unit%1").arg(uCount+i));
|
||||||
|
@ -1323,7 +1323,7 @@ void Project::loadLayout()
|
||||||
int topLeft = layIni.GetLongValue("Editors","Focused",1);
|
int topLeft = layIni.GetLongValue("Editors","Focused",1);
|
||||||
//TopRight := layIni.ReadInteger('Editors', 'FocusedRight', -1);
|
//TopRight := layIni.ReadInteger('Editors', 'FocusedRight', -1);
|
||||||
QString temp =layIni.GetValue("Editors","Order", "");
|
QString temp =layIni.GetValue("Editors","Order", "");
|
||||||
QStringList sl = temp.split(",",Qt::SkipEmptyParts);
|
QStringList sl = temp.split(",",QString::SkipEmptyParts);
|
||||||
|
|
||||||
foreach (const QString& s,sl) {
|
foreach (const QString& s,sl) {
|
||||||
bool ok;
|
bool ok;
|
||||||
|
@ -1362,12 +1362,12 @@ void Project::loadOptions(SimpleIni& ini)
|
||||||
mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "Compiler", ""));
|
mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "Compiler", ""));
|
||||||
mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", ""));
|
mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", ""));
|
||||||
mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", ""));
|
mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", ""));
|
||||||
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.libs = fromByteArray(ini.GetValue("Project", "Libs", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.libs = fromByteArray(ini.GetValue("Project", "Libs", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.includes = fromByteArray(ini.GetValue("Project", "Includes", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.includes = fromByteArray(ini.GetValue("Project", "Includes", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
|
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
|
||||||
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.makeIncludes = fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.makeIncludes = fromByteArray(ini.GetValue("Project", "MakeIncludes", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.useGPP = ini.GetBoolValue("Project", "IsCpp", false);
|
mOptions.useGPP = ini.GetBoolValue("Project", "IsCpp", false);
|
||||||
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
|
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
|
||||||
mOptions.objectOutput = fromByteArray(ini.GetValue("Project", "ObjectOutput", ""));
|
mOptions.objectOutput = fromByteArray(ini.GetValue("Project", "ObjectOutput", ""));
|
||||||
|
@ -1381,7 +1381,7 @@ void Project::loadOptions(SimpleIni& ini)
|
||||||
mOptions.usePrecompiledHeader = ini.GetBoolValue("Project", "UsePrecompiledHeader", false);
|
mOptions.usePrecompiledHeader = ini.GetBoolValue("Project", "UsePrecompiledHeader", false);
|
||||||
mOptions.precompiledHeader = fromByteArray(ini.GetValue("Project", "PrecompiledHeader", ""));
|
mOptions.precompiledHeader = fromByteArray(ini.GetValue("Project", "PrecompiledHeader", ""));
|
||||||
mOptions.cmdLineArgs = fromByteArray(ini.GetValue("Project", "CommandLine", ""));
|
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.includeVersionInfo = ini.GetBoolValue("Project", "IncludeVersionInfo", false);
|
||||||
mOptions.supportXPThemes = ini.GetBoolValue("Project", "SupportXPThemes", false);
|
mOptions.supportXPThemes = ini.GetBoolValue("Project", "SupportXPThemes", false);
|
||||||
mOptions.compilerSet = ini.GetLongValue("Project", "CompilerSet", pSettings->compilerSets().defaultIndex());
|
mOptions.compilerSet = ini.GetLongValue("Project", "CompilerSet", pSettings->compilerSets().defaultIndex());
|
||||||
|
@ -1453,9 +1453,9 @@ void Project::loadOptions(SimpleIni& ini)
|
||||||
mOptions.type = ProjectType::GUI;
|
mOptions.type = ProjectType::GUI;
|
||||||
|
|
||||||
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
|
mOptions.privateResource = fromByteArray(ini.GetValue("Project", "PrivateResource", ""));
|
||||||
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.resourceIncludes = fromByteArray(ini.GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.objFiles = fromByteArray(ini.GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.includes = fromByteArray(ini.GetValue("Project", "IncludeDirs", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.includes = fromByteArray(ini.GetValue("Project", "IncludeDirs", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "CompilerOptions", ""));
|
mOptions.compilerCmd = fromByteArray(ini.GetValue("Project", "CompilerOptions", ""));
|
||||||
mOptions.useGPP = ini.GetBoolValue("Project", "Use_GPP", false);
|
mOptions.useGPP = ini.GetBoolValue("Project", "Use_GPP", false);
|
||||||
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
|
mOptions.exeOutput = fromByteArray(ini.GetValue("Project", "ExeOutput", ""));
|
||||||
|
|
|
@ -113,10 +113,10 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
|
||||||
|
|
||||||
mOptions.icon = mIni->GetValue("Project", "Icon", "");
|
mOptions.icon = mIni->GetValue("Project", "Icon", "");
|
||||||
mOptions.type = static_cast<ProjectType>(mIni->GetLongValue("Project", "Type", 0)); // default = gui
|
mOptions.type = static_cast<ProjectType>(mIni->GetLongValue("Project", "Type", 0)); // default = gui
|
||||||
mOptions.objFiles = fromByteArray(mIni->GetValue("Project", "ObjFiles", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.objFiles = fromByteArray(mIni->GetValue("Project", "ObjFiles", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.includes = fromByteArray(mIni->GetValue("Project", "Includes", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.includes = fromByteArray(mIni->GetValue("Project", "Includes", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.libs = fromByteArray(mIni->GetValue("Project", "Libs", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.libs = fromByteArray(mIni->GetValue("Project", "Libs", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.resourceIncludes = fromByteArray(mIni->GetValue("Project", "ResourceIncludes", "")).split(";",Qt::SkipEmptyParts);
|
mOptions.resourceIncludes = fromByteArray(mIni->GetValue("Project", "ResourceIncludes", "")).split(";",QString::SkipEmptyParts);
|
||||||
mOptions.compilerCmd = fromByteArray(mIni->GetValue("Project", "Compiler", ""));
|
mOptions.compilerCmd = fromByteArray(mIni->GetValue("Project", "Compiler", ""));
|
||||||
mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", ""));
|
mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", ""));
|
||||||
mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker",""));
|
mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker",""));
|
||||||
|
|
|
@ -21,9 +21,9 @@ SynGutter::SynGutter(QObject *parent):
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
mFont = QFont("Courier New",10);
|
mFont = QFont("Courier New",10);
|
||||||
mColor= QColorConstants::Svg::lightgray;
|
mColor= Qt::lightGray;
|
||||||
mBorderColor = QColorConstants::Transparent;
|
mBorderColor = Qt::transparent;
|
||||||
mTextColor = QColorConstants::Svg::black;
|
mTextColor = Qt::black;
|
||||||
mShowLineNumbers = true;
|
mShowLineNumbers = true;
|
||||||
mDigitCount = 1;
|
mDigitCount = 1;
|
||||||
mLeadingZeros = false;
|
mLeadingZeros = false;
|
||||||
|
@ -36,8 +36,8 @@ SynGutter::SynGutter(QObject *parent):
|
||||||
mBorderStyle = SynGutterBorderStyle::Middle;
|
mBorderStyle = SynGutterBorderStyle::Middle;
|
||||||
mLineNumberStart = 1;
|
mLineNumberStart = 1;
|
||||||
mGradient = false;
|
mGradient = false;
|
||||||
mGradientStartColor = QColorConstants::Transparent;
|
mGradientStartColor = Qt::transparent;
|
||||||
mGradientEndColor = QColorConstants::Transparent;
|
mGradientEndColor = Qt::transparent;
|
||||||
mGradientSteps = 48;
|
mGradientSteps = 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,9 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
|
|
||||||
mForegroundColor=palette().color(QPalette::Text);
|
mForegroundColor=palette().color(QPalette::Text);
|
||||||
mBackgroundColor=palette().color(QPalette::Base);
|
mBackgroundColor=palette().color(QPalette::Base);
|
||||||
mCaretColor = QColorConstants::Red;
|
mCaretColor = Qt::red;
|
||||||
mCaretUseTextColor = false;
|
mCaretUseTextColor = false;
|
||||||
mActiveLineColor = QColorConstants::Svg::lightblue;
|
mActiveLineColor = Qt::blue;
|
||||||
mSelectedBackground = palette().color(QPalette::Highlight);
|
mSelectedBackground = palette().color(QPalette::Highlight);
|
||||||
mSelectedForeground = palette().color(QPalette::HighlightedText);
|
mSelectedForeground = palette().color(QPalette::HighlightedText);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
//fKbdHandler := TSynEditKbdHandler.Create;
|
//fKbdHandler := TSynEditKbdHandler.Create;
|
||||||
//fMarkList.OnChange := MarkListChange;
|
//fMarkList.OnChange := MarkListChange;
|
||||||
setDefaultKeystrokes();
|
setDefaultKeystrokes();
|
||||||
mRightEdgeColor = QColorConstants::Svg::silver;
|
mRightEdgeColor = Qt::lightGray;
|
||||||
|
|
||||||
/* IME input */
|
/* IME input */
|
||||||
mImeCount = 0;
|
mImeCount = 0;
|
||||||
|
@ -143,7 +143,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
//mScrollTimer->setInterval(100);
|
//mScrollTimer->setInterval(100);
|
||||||
connect(mScrollTimer, &QTimer::timeout,this, &SynEdit::onScrollTimeout);
|
connect(mScrollTimer, &QTimer::timeout,this, &SynEdit::onScrollTimeout);
|
||||||
|
|
||||||
mScrollHintColor = QColorConstants::Yellow;
|
mScrollHintColor = Qt::yellow;
|
||||||
mScrollHintFormat = SynScrollHintFormat::shfTopLineOnly;
|
mScrollHintFormat = SynScrollHintFormat::shfTopLineOnly;
|
||||||
|
|
||||||
mContentImage = std::make_shared<QImage>(clientWidth(),clientHeight(),QImage::Format_ARGB32);
|
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);
|
return std::ceil((int)(fontMetrics().horizontalAdvance(ch)) / (double)mCharWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
double SynEdit::dpiFactor() const
|
|
||||||
{
|
|
||||||
return fontMetrics().fontDpi() / 96.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SynEdit::showCaret()
|
void SynEdit::showCaret()
|
||||||
{
|
{
|
||||||
if (m_blinkTimerId==0)
|
if (m_blinkTimerId==0)
|
||||||
|
|
|
@ -212,7 +212,7 @@ public:
|
||||||
QString wordAtRowCol(const BufferCoord& XY);
|
QString wordAtRowCol(const BufferCoord& XY);
|
||||||
|
|
||||||
int charColumns(QChar ch) const;
|
int charColumns(QChar ch) const;
|
||||||
double dpiFactor() const;
|
|
||||||
bool isPointInSelection(const BufferCoord& Value) const;
|
bool isPointInSelection(const BufferCoord& Value) const;
|
||||||
BufferCoord nextWordPos();
|
BufferCoord nextWordPos();
|
||||||
BufferCoord nextWordPosEx(const BufferCoord& XY);
|
BufferCoord nextWordPosEx(const BufferCoord& XY);
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
SynEditStringList::SynEditStringList(SynEdit *pEdit, QObject *parent):
|
SynEditStringList::SynEditStringList(SynEdit *pEdit, QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
mEdit(pEdit)
|
mEdit(pEdit),
|
||||||
|
mMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
mAppendNewLineAtEOF = true;
|
mAppendNewLineAtEOF = true;
|
||||||
mFileEndingType = FileEndingType::Windows;
|
mFileEndingType = FileEndingType::Windows;
|
||||||
|
@ -364,7 +365,10 @@ void SynEditStringList::exchange(int Index1, int Index2)
|
||||||
ListIndexOutOfBounds(Index2);
|
ListIndexOutOfBounds(Index2);
|
||||||
}
|
}
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
mList.swapItemsAt(Index1,Index2);
|
PSynEditStringRec temp = mList[Index1];
|
||||||
|
mList[Index1]=mList[Index2];
|
||||||
|
mList[Index2]=temp;
|
||||||
|
//mList.swapItemsAt(Index1,Index2);
|
||||||
if (mIndexOfLongestLine == Index1) {
|
if (mIndexOfLongestLine == Index1) {
|
||||||
mIndexOfLongestLine = Index2;
|
mIndexOfLongestLine = Index2;
|
||||||
} else if (mIndexOfLongestLine == Index2) {
|
} else if (mIndexOfLongestLine == Index2) {
|
||||||
|
|
|
@ -142,7 +142,7 @@ private:
|
||||||
bool mAppendNewLineAtEOF;
|
bool mAppendNewLineAtEOF;
|
||||||
int mIndexOfLongestLine;
|
int mIndexOfLongestLine;
|
||||||
int mUpdateCount;
|
int mUpdateCount;
|
||||||
QRecursiveMutex mMutex;
|
QMutex mMutex;
|
||||||
|
|
||||||
int calculateLineColumns(int Index);
|
int calculateLineColumns(int Index);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QFlags>
|
#include <QFlags>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
enum class SynSelectionMode {smNormal, smLine, smColumn};
|
enum class SynSelectionMode {smNormal, smLine, smColumn};
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ SynScheme::SynScheme(QObject *parent):
|
||||||
mCaseSensitive(true)
|
mCaseSensitive(true)
|
||||||
{
|
{
|
||||||
mMarkerAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrMarker);
|
mMarkerAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrMarker);
|
||||||
mMarkerAttribute->setForeground(QColorConstants::Yellow);
|
mMarkerAttribute->setForeground(Qt::yellow);
|
||||||
mMarkerAttribute->setStyles(SynFontStyle::fsBold);
|
mMarkerAttribute->setStyles(SynFontStyle::fsBold);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ void Settings::Editor::doLoad()
|
||||||
mTabToSpaces = boolValue("tab_to_spaces",false);
|
mTabToSpaces = boolValue("tab_to_spaces",false);
|
||||||
mTabWidth = intValue("tab_width",4);
|
mTabWidth = intValue("tab_width",4);
|
||||||
mShowIndentLines = boolValue("show_indent_lines",true);
|
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);
|
mfillIndents = boolValue("fill_indents", false);
|
||||||
// caret
|
// caret
|
||||||
mEnhanceHomeKey = boolValue("enhance_home_key", true);
|
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)));
|
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)));
|
mCaretForOverwrite = static_cast<SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(SynEditCaretType::ctBlock)));
|
||||||
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
||||||
mCaretColor = colorValue("caret_color",QColorConstants::Svg::yellow);
|
mCaretColor = colorValue("caret_color",Qt::yellow);
|
||||||
|
|
||||||
//highlight
|
//highlight
|
||||||
mHighlightMathingBraces = boolValue("highlight_matching_braces",true);
|
mHighlightMathingBraces = boolValue("highlight_matching_braces",true);
|
||||||
|
@ -1189,7 +1189,7 @@ void Settings::Editor::doLoad()
|
||||||
//right edge
|
//right edge
|
||||||
mShowRightEdgeLine = boolValue("show_right_edge_line",false);
|
mShowRightEdgeLine = boolValue("show_right_edge_line",false);
|
||||||
mRightEdgeWidth = intValue("right_edge_width",80);
|
mRightEdgeWidth = intValue("right_edge_width",80);
|
||||||
mRightEdgeLineColor = colorValue("right_edge_line_color",QColorConstants::Svg::yellow);
|
mRightEdgeLineColor = colorValue("right_edge_line_color",Qt::yellow);
|
||||||
|
|
||||||
//Font
|
//Font
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
|
@ -109,11 +109,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="cbCopyWithFormatAs">
|
<widget class="QComboBox" name="cbCopyWithFormatAs" />
|
||||||
<property name="placeholderText">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_4">
|
<spacer name="horizontalSpacer_4">
|
||||||
|
|
|
@ -103,7 +103,7 @@ void ProjectGeneralWidget::doSave()
|
||||||
project->options().useGPP = ui->cbDefaultCpp->isChecked();
|
project->options().useGPP = ui->cbDefaultCpp->isChecked();
|
||||||
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
|
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
|
||||||
if (mIconPath.isEmpty()
|
if (mIconPath.isEmpty()
|
||||||
|| ui->lblICon->pixmap(Qt::ReturnByValue).isNull()) {
|
|| !ui->lblICon->pixmap() || ui->lblICon->pixmap()->isNull()) {
|
||||||
project->options().icon = "";
|
project->options().icon = "";
|
||||||
} else {
|
} else {
|
||||||
QString iconPath = changeFileExt(project->filename(),"ico");
|
QString iconPath = changeFileExt(project->filename(),"ico");
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class SettingsWidget;
|
class SettingsWidget;
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class AppTheme:public QObject {
|
class AppTheme:public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
#include "HighlighterManager.h"
|
#include "HighlighterManager.h"
|
||||||
#include "qsynedit/Constants.h"
|
#include "qsynedit/Constants.h"
|
||||||
|
|
||||||
TodoParser::TodoParser(QObject *parent) : QObject(parent)
|
TodoParser::TodoParser(QObject *parent) : QObject(parent),
|
||||||
|
mMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
mThread = nullptr;
|
mThread = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TodoThread* mThread;
|
TodoThread* mThread;
|
||||||
QRecursiveMutex mMutex;
|
QMutex mMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PTodoParser = std::shared_ptr<TodoParser>;
|
using PTodoParser = std::shared_ptr<TodoParser>;
|
||||||
|
|
|
@ -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
|
#ifdef Q_OS_WIN
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -582,7 +582,7 @@ void stringsToFile(const QStringList &list, const QString &fileName)
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
|
||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
for (QString s:list) {
|
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)) {
|
if (file.open(mode)) {
|
||||||
QTextStream ts(&file);
|
QTextStream ts(&file);
|
||||||
ts<<s<<Qt::endl;
|
ts<<s<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -998,3 +998,75 @@ float pixelToPoint(float pixel)
|
||||||
{
|
{
|
||||||
return pixel * 72 / qApp->desktop()->logicalDpiY();
|
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;
|
||||||
|
case SplitProcessCommandQuoteType::Single:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
current+=cmd[i];
|
||||||
|
break;
|
||||||
|
case '\'':
|
||||||
|
switch(quoteType) {
|
||||||
|
case SplitProcessCommandQuoteType::None:
|
||||||
|
quoteType = SplitProcessCommandQuoteType::Single;
|
||||||
|
break;
|
||||||
|
case SplitProcessCommandQuoteType::Double:
|
||||||
|
break;
|
||||||
|
case SplitProcessCommandQuoteType::Single:
|
||||||
|
quoteType = SplitProcessCommandQuoteType::None;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
current+=cmd[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();
|
int getNewFileNumber();
|
||||||
|
|
||||||
|
enum class SplitProcessCommandQuoteType {
|
||||||
|
None,
|
||||||
|
Single,
|
||||||
|
Double
|
||||||
|
};
|
||||||
|
|
||||||
|
QStringList splitProcessCommand(const QString& cmd);
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QString& value);
|
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;
|
class CppParser;
|
||||||
void resetCppParser(std::shared_ptr<CppParser> parser);
|
void resetCppParser(std::shared_ptr<CppParser> parser);
|
||||||
|
|
||||||
|
float desktopDpi();
|
||||||
float pointToPixel(float point);
|
float pointToPixel(float point);
|
||||||
float pixelToPoint(float pixel);
|
float pixelToPoint(float pixel);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
#include "../iconsmanager.h"
|
#include "../iconsmanager.h"
|
||||||
|
|
||||||
ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent)
|
ClassBrowserModel::ClassBrowserModel(QObject *parent):QAbstractItemModel(parent),
|
||||||
|
mMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
mRoot = new ClassBrowserNode();
|
mRoot = new ClassBrowserNode();
|
||||||
mRoot->parent = nullptr;
|
mRoot->parent = nullptr;
|
||||||
|
|
|
@ -73,7 +73,7 @@ private:
|
||||||
PCppParser mParser;
|
PCppParser mParser;
|
||||||
bool mUpdating;
|
bool mUpdating;
|
||||||
int mUpdateCount;
|
int mUpdateCount;
|
||||||
QRecursiveMutex mMutex;
|
QMutex mMutex;
|
||||||
QString mCurrentFile;
|
QString mCurrentFile;
|
||||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
CodeCompletionPopup::CodeCompletionPopup(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent),
|
||||||
|
mMutex(QMutex::Recursive)
|
||||||
{
|
{
|
||||||
setWindowFlags(Qt::Popup);
|
setWindowFlags(Qt::Popup);
|
||||||
mListView = new CodeCompletionListView(this);
|
mListView = new CodeCompletionListView(this);
|
||||||
|
|
|
@ -117,7 +117,7 @@ private:
|
||||||
QSet<QString> mAddedStatements;
|
QSet<QString> mAddedStatements;
|
||||||
QString mMemberPhrase;
|
QString mMemberPhrase;
|
||||||
QString mMemberOperator;
|
QString mMemberOperator;
|
||||||
QRecursiveMutex mMutex;
|
QMutex mMutex;
|
||||||
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mColors;
|
||||||
|
|
||||||
PCppParser mParser;
|
PCppParser mParser;
|
||||||
|
|
|
@ -25,7 +25,7 @@ ColorEdit::ColorEdit(QWidget *parent):QFrame(parent)
|
||||||
{
|
{
|
||||||
setFrameStyle(QFrame::Panel);
|
setFrameStyle(QFrame::Panel);
|
||||||
setLineWidth(1);
|
setLineWidth(1);
|
||||||
mColor = QColorConstants::Black;
|
mColor = Qt::black;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor ColorEdit::color()
|
QColor ColorEdit::color()
|
||||||
|
|
|
@ -86,13 +86,14 @@ static QString uniqueName(const QString &key, const QStyleOption *option, const
|
||||||
return tmp;
|
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));
|
painter->drawRect(rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding));
|
||||||
|
|
||||||
} else if (checkbox->state & State_On) {
|
} 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 = qMax<qreal>(penWidth, 0.13 * rect.height());
|
||||||
penWidth = qMin<qreal>(penWidth, 0.20 * rect.height());
|
penWidth = qMin<qreal>(penWidth, 0.20 * rect.height());
|
||||||
QPen checkPen = QPen(checkMarkColor, penWidth);
|
QPen checkPen = QPen(checkMarkColor, penWidth);
|
||||||
checkMarkColor.setAlpha(210);
|
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->setPen(checkPen);
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
|
|
||||||
|
@ -683,7 +686,7 @@ void DarkFusionStyle::drawPrimitive(PrimitiveElement elem, const QStyleOption *o
|
||||||
if (isFlat && !isDown) {
|
if (isFlat && !isDown) {
|
||||||
if (isDefault) {
|
if (isDefault) {
|
||||||
r = option->rect.adjusted(0, 1, 0, -1);
|
r = option->rect.adjusted(0, 1, 0, -1);
|
||||||
painter->setPen(QPen(QColorConstants::Svg::lightgray));
|
painter->setPen(QPen(Qt::lightGray));
|
||||||
const QLine lines[4] = {
|
const QLine lines[4] = {
|
||||||
QLine(QPoint(r.left() + 2, r.top()),
|
QLine(QPoint(r.left() + 2, r.top()),
|
||||||
QPoint(r.right() - 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) {
|
if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
|
||||||
painter->save();
|
painter->save();
|
||||||
int w = 0;
|
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()) {
|
if (!menuItem->text.isEmpty()) {
|
||||||
painter->setFont(menuItem->font);
|
painter->setFont(menuItem->font);
|
||||||
proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter,
|
proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter,
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
struct FunctionInfo {
|
struct FunctionInfo {
|
||||||
QString name;
|
QString name;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <QAbstractScrollArea>
|
#include <QAbstractScrollArea>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
struct ConsoleLine {
|
struct ConsoleLine {
|
||||||
QString text;
|
QString text;
|
||||||
|
|
Loading…
Reference in New Issue