work save: auto link

This commit is contained in:
royqh1979@gmail.com 2021-09-04 14:06:48 +08:00
parent 3c4a2ac9d2
commit f0530d6737
7 changed files with 17 additions and 15 deletions

View File

@ -334,7 +334,7 @@ QString Compiler::getCppIncludeArguments()
return result;
}
QString Compiler::getLibraryArguments()
QString Compiler::getLibraryArguments(FileType fileType)
{
QString result;
@ -344,7 +344,8 @@ QString Compiler::getLibraryArguments()
//Add auto links
// is file and auto link enabled
{
if (fileType == FileType::CSource ||
fileType == FileType::CppSource){
Editor* editor = pMainWindow->editorList()->getEditor();
if (editor) {
PCppParser parser = editor->parser();
@ -359,12 +360,12 @@ QString Compiler::getLibraryArguments()
QApplication *app=dynamic_cast<QApplication*>(
QApplication::instance());
app->processEvents();
QSet<QString> parsedFiles;
result += parseFileIncludesForAutolink(
editor->filename(),
parsedFiles,
parser);
}
QSet<QString> parsedFiles;
result += parseFileIncludesForAutolink(
editor->filename(),
parsedFiles,
parser);
}
}
@ -461,7 +462,7 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
if (errorOccurred) {
switch (process.error()) {
case QProcess::FailedToStart:
throw CompileError(tr("The compiler process failed to start."));
throw CompileError(tr("The compiler process for '%1' failed to start.").arg(mFilename));
break;
case QProcess::Crashed:
if (!mStop)

View File

@ -49,7 +49,7 @@ protected:
virtual QString getCppCompileArguments(bool checkSyntax);
virtual QString getCIncludeArguments();
virtual QString getCppIncludeArguments();
virtual QString getLibraryArguments();
virtual QString getLibraryArguments(FileType fileType);
virtual QString parseFileIncludesForAutolink(
const QString& filename,
QSet<QString> parsedFiles,

View File

@ -61,7 +61,7 @@ bool FileCompiler::prepareForCompile()
default:
throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename));
}
mArguments += getLibraryArguments();
mArguments += getLibraryArguments(fileType);
if (!QFile(mCompiler).exists()) {
throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler));

View File

@ -50,7 +50,7 @@ bool StdinCompiler::prepareForCompile()
default:
throw CompileError(tr("Can't find the compiler for file %1").arg(mFilename));
}
mArguments += getLibraryArguments();
mArguments += getLibraryArguments(fileType);
if (!QFile(mCompiler).exists()) {
throw CompileError(tr("The Compiler '%1' doesn't exists!").arg(mCompiler));

View File

@ -498,6 +498,7 @@ QSet<QString> CppParser::getFileDirectIncludes(const QString &filename)
while (iter != fileIncludes->includeFiles.cend()) {
if (iter.value())
list.insert(iter.key());
iter++;
}
}
return list;

View File

@ -1242,7 +1242,7 @@ BufferCoord SynEdit::WordEndEx(const BufferCoord &XY)
// valid line?
if ((CY >= 1) && (CY <= mLines->count())) {
QString Line = mLines->getString(CY - 1);
if (CX <= Line.length()) {
if (CX <= Line.length() && CX-2>=0) {
if (isWordChar(Line[CX - 2]))
CX = StrScanForNonWordChar(Line, CX);
if (CX == 0)

View File

@ -1,9 +1,9 @@
[{
"header": "ege.h",
"links": ["-lgraphics -luuid -lmsimg32 -lgdi32 -limm32 -lole32 -loleaut32 -lwinmm -lgdiplus"]
"links": "-lgraphics -luuid -lmsimg32 -lgdi32 -limm32 -lole32 -loleaut32 -lwinmm -lgdiplus"
},
{
"header": "turtle.h",
"links": ["-lturtle"]
"links": "-lturtle"
}
]