- Retrieve sdcc predefined macros (hacking).
- Stop compiling if ihx file is not correct created. - Run/Debug/Generate assembly actions are correctly diabled.
This commit is contained in:
parent
eb1a219de6
commit
b16a85d033
|
@ -42,7 +42,7 @@ Compiler::Compiler(const QString &filename, bool silent, bool onlyCheckSyntax):
|
||||||
mOnlyCheckSyntax(onlyCheckSyntax),
|
mOnlyCheckSyntax(onlyCheckSyntax),
|
||||||
mFilename(filename),
|
mFilename(filename),
|
||||||
mRebuild(false),
|
mRebuild(false),
|
||||||
mParser()
|
mParserForFile()
|
||||||
{
|
{
|
||||||
getParserForFile(filename);
|
getParserForFile(filename);
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,8 @@ void Compiler::run()
|
||||||
timer.start();
|
timer.start();
|
||||||
runCommand(mCompiler, mArguments, mDirectory, pipedText());
|
runCommand(mCompiler, mArguments, mDirectory, pipedText());
|
||||||
for(int i=0;i<mExtraArgumentsList.count();i++) {
|
for(int i=0;i<mExtraArgumentsList.count();i++) {
|
||||||
|
if (!beforeRunExtraCommand(i))
|
||||||
|
break;
|
||||||
if (mExtraOutputFilesList[i].isEmpty()) {
|
if (mExtraOutputFilesList[i].isEmpty()) {
|
||||||
log(tr(" - Command: %1 %2").arg(extractFileName(mExtraCompilersList[i]),mExtraArgumentsList[i]));
|
log(tr(" - Command: %1 %2").arg(extractFileName(mExtraCompilersList[i]),mExtraArgumentsList[i]));
|
||||||
} else {
|
} else {
|
||||||
|
@ -215,6 +217,11 @@ QByteArray Compiler::pipedText()
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Compiler::beforeRunExtraCommand(int idx)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Compiler::processOutput(QString &line)
|
void Compiler::processOutput(QString &line)
|
||||||
{
|
{
|
||||||
if (line == COMPILE_PROCESS_END) {
|
if (line == COMPILE_PROCESS_END) {
|
||||||
|
@ -331,10 +338,10 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding,FileType fileTyp
|
||||||
// test if force utf8 from autolink infos
|
// test if force utf8 from autolink infos
|
||||||
if ((fileType == FileType::CSource ||
|
if ((fileType == FileType::CSource ||
|
||||||
fileType == FileType::CppSource) && pSettings->editor().enableAutolink()
|
fileType == FileType::CppSource) && pSettings->editor().enableAutolink()
|
||||||
&& mParser){
|
&& mParserForFile){
|
||||||
int waitCount = 0;
|
int waitCount = 0;
|
||||||
//wait parsing ends, at most 1 second
|
//wait parsing ends, at most 1 second
|
||||||
while(mParser->parsing()) {
|
while(mParserForFile->parsing()) {
|
||||||
if (waitCount>10)
|
if (waitCount>10)
|
||||||
break;
|
break;
|
||||||
waitCount++;
|
waitCount++;
|
||||||
|
@ -521,10 +528,10 @@ QString Compiler::getLibraryArguments(FileType fileType)
|
||||||
// is file and auto link enabled
|
// is file and auto link enabled
|
||||||
if (pSettings->editor().enableAutolink() && (fileType == FileType::CSource ||
|
if (pSettings->editor().enableAutolink() && (fileType == FileType::CSource ||
|
||||||
fileType == FileType::CppSource)
|
fileType == FileType::CppSource)
|
||||||
&& mParser){
|
&& mParserForFile){
|
||||||
int waitCount = 0;
|
int waitCount = 0;
|
||||||
//wait parsing ends, at most 1 second
|
//wait parsing ends, at most 1 second
|
||||||
while(mParser->parsing()) {
|
while(mParserForFile->parsing()) {
|
||||||
if (waitCount>10)
|
if (waitCount>10)
|
||||||
break;
|
break;
|
||||||
waitCount++;
|
waitCount++;
|
||||||
|
@ -608,7 +615,7 @@ QString Compiler::parseFileIncludesForAutolink(
|
||||||
if (autolink) {
|
if (autolink) {
|
||||||
result += ' '+autolink->linkOption;
|
result += ' '+autolink->linkOption;
|
||||||
}
|
}
|
||||||
QStringList includedFiles = mParser->getFileDirectIncludes(filename);
|
QStringList includedFiles = mParserForFile->getFileDirectIncludes(filename);
|
||||||
// log(QString("File %1 included:").arg(filename));
|
// log(QString("File %1 included:").arg(filename));
|
||||||
// for (int i=includedFiles.size()-1;i>=0;i--) {
|
// for (int i=includedFiles.size()-1;i>=0;i--) {
|
||||||
// QString includeFilename = includedFiles[i];
|
// QString includeFilename = includedFiles[i];
|
||||||
|
@ -634,7 +641,7 @@ bool Compiler::parseForceUTF8ForAutolink(const QString &filename, QSet<QString>
|
||||||
if (autolink && autolink->execUseUTF8) {
|
if (autolink && autolink->execUseUTF8) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
QStringList includedFiles = mParser->getFileDirectIncludes(filename);
|
QStringList includedFiles = mParserForFile->getFileDirectIncludes(filename);
|
||||||
// log(QString("File %1 included:").arg(filename));
|
// log(QString("File %1 included:").arg(filename));
|
||||||
// for (int i=includedFiles.size()-1;i>=0;i--) {
|
// for (int i=includedFiles.size()-1;i>=0;i--) {
|
||||||
// QString includeFilename = includedFiles[i];
|
// QString includeFilename = includedFiles[i];
|
||||||
|
@ -759,7 +766,7 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
|
||||||
|
|
||||||
PCppParser Compiler::parser() const
|
PCppParser Compiler::parser() const
|
||||||
{
|
{
|
||||||
return mParser;
|
return mParserForFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Compiler::getParserForFile(const QString &filename)
|
void Compiler::getParserForFile(const QString &filename)
|
||||||
|
@ -769,7 +776,7 @@ void Compiler::getParserForFile(const QString &filename)
|
||||||
fileType == FileType::CppSource){
|
fileType == FileType::CppSource){
|
||||||
Editor* editor = pMainWindow->editorList()->getOpenedEditorByFilename(filename);
|
Editor* editor = pMainWindow->editorList()->getOpenedEditorByFilename(filename);
|
||||||
if (editor && editor->parser()) {
|
if (editor && editor->parser()) {
|
||||||
mParser=editor->parser();
|
mParserForFile=editor->parser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@ protected:
|
||||||
virtual bool prepareForCompile() = 0;
|
virtual bool prepareForCompile() = 0;
|
||||||
virtual QByteArray pipedText();
|
virtual QByteArray pipedText();
|
||||||
virtual bool prepareForRebuild() = 0;
|
virtual bool prepareForRebuild() = 0;
|
||||||
|
virtual bool beforeRunExtraCommand(int idx);
|
||||||
virtual QString getCharsetArgument(const QByteArray& encoding, FileType fileType, bool onlyCheckSyntax);
|
virtual QString getCharsetArgument(const QByteArray& encoding, FileType fileType, bool onlyCheckSyntax);
|
||||||
virtual QString getCCompileArguments(bool checkSyntax);
|
virtual QString getCCompileArguments(bool checkSyntax);
|
||||||
virtual QString getCppCompileArguments(bool checkSyntax);
|
virtual QString getCppCompileArguments(bool checkSyntax);
|
||||||
|
@ -103,7 +104,7 @@ protected:
|
||||||
bool mRebuild;
|
bool mRebuild;
|
||||||
std::shared_ptr<Project> mProject;
|
std::shared_ptr<Project> mProject;
|
||||||
bool mSetLANG;
|
bool mSetLANG;
|
||||||
PCppParser mParser;
|
PCppParser mParserForFile;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mStop;
|
bool mStop;
|
||||||
|
|
|
@ -43,10 +43,10 @@ bool SDCCFileCompiler::prepareForCompile()
|
||||||
log(tr("- Filename: %1").arg(mFilename));
|
log(tr("- Filename: %1").arg(mFilename));
|
||||||
log(tr("- Compiler Set Name: %1").arg(compilerSet()->name()));
|
log(tr("- Compiler Set Name: %1").arg(compilerSet()->name()));
|
||||||
log("");
|
log("");
|
||||||
QString ihxFile = changeFileExt(mFilename,SDCC_IHX_SUFFIX);
|
mIhxFilename = changeFileExt(mFilename,SDCC_IHX_SUFFIX);
|
||||||
mOutputFile=changeFileExt(mFilename, compilerSet()->executableSuffix());
|
mOutputFile=changeFileExt(mFilename, compilerSet()->executableSuffix());
|
||||||
mArguments = QString(" \"%1\"").arg(mFilename);
|
mArguments = QString(" \"%1\"").arg(mFilename);
|
||||||
mArguments+=QString(" -o \"%1\"").arg(ihxFile);
|
mArguments+=QString(" -o \"%1\"").arg(mIhxFilename);
|
||||||
|
|
||||||
//remove the old file if it exists
|
//remove the old file if it exists
|
||||||
QFile outputFile(mOutputFile);
|
QFile outputFile(mOutputFile);
|
||||||
|
@ -75,7 +75,7 @@ bool SDCCFileCompiler::prepareForCompile()
|
||||||
}
|
}
|
||||||
mExtraCompilersList.append(packihx);
|
mExtraCompilersList.append(packihx);
|
||||||
QString args;
|
QString args;
|
||||||
args = QString(" \"%1\"").arg(ihxFile);
|
args = QString(" \"%1\"").arg(mIhxFilename);
|
||||||
mExtraArgumentsList.append(args);
|
mExtraArgumentsList.append(args);
|
||||||
mExtraOutputFilesList.append(mOutputFile);
|
mExtraOutputFilesList.append(mOutputFile);
|
||||||
} else if (compilerSet()->executableSuffix() == SDCC_BIN_SUFFIX) {
|
} else if (compilerSet()->executableSuffix() == SDCC_BIN_SUFFIX) {
|
||||||
|
@ -86,7 +86,7 @@ bool SDCCFileCompiler::prepareForCompile()
|
||||||
}
|
}
|
||||||
mExtraCompilersList.push_back(makebin);
|
mExtraCompilersList.push_back(makebin);
|
||||||
QString args;
|
QString args;
|
||||||
args = QString(" \"%1\"").arg(ihxFile);
|
args = QString(" \"%1\"").arg(mIhxFilename);
|
||||||
args+=QString(" \"%1\"").arg(mOutputFile);
|
args+=QString(" \"%1\"").arg(mOutputFile);
|
||||||
mExtraArgumentsList.push_back(args);
|
mExtraArgumentsList.push_back(args);
|
||||||
mExtraOutputFilesList.append("");
|
mExtraOutputFilesList.append("");
|
||||||
|
@ -109,6 +109,16 @@ bool SDCCFileCompiler::prepareForCompile()
|
||||||
log(tr("- %1 Compiler: %2").arg(strFileType).arg(mCompiler));
|
log(tr("- %1 Compiler: %2").arg(strFileType).arg(mCompiler));
|
||||||
log(tr("- Command: %1 %2").arg(extractFileName(mCompiler)).arg(mArguments));
|
log(tr("- Command: %1 %2").arg(extractFileName(mCompiler)).arg(mArguments));
|
||||||
mDirectory = extractFileDir(mFilename);
|
mDirectory = extractFileDir(mFilename);
|
||||||
|
mStartCompileTime = QDateTime::currentDateTime();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SDCCFileCompiler::beforeRunExtraCommand(int idx)
|
||||||
|
{
|
||||||
|
if (idx==0) {
|
||||||
|
QFileInfo file(mIhxFilename);
|
||||||
|
return file.exists() && (file.lastModified()>mStartCompileTime);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,13 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool prepareForCompile() override;
|
bool prepareForCompile() override;
|
||||||
|
bool beforeRunExtraCommand(int idx) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QByteArray mEncoding;
|
QByteArray mEncoding;
|
||||||
CppCompileType mCompileType;
|
CppCompileType mCompileType;
|
||||||
|
QDateTime mStartCompileTime;
|
||||||
|
QString mIhxFilename;
|
||||||
// Compiler interface
|
// Compiler interface
|
||||||
protected:
|
protected:
|
||||||
bool prepareForRebuild() override;
|
bool prepareForRebuild() override;
|
||||||
|
|
|
@ -5240,27 +5240,20 @@ void Editor::applySettings()
|
||||||
setRightEdge(0);
|
setRightEdge(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSettings->editor().enableCustomCTypeKeywords()) {
|
|
||||||
if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) {
|
if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) {
|
||||||
QSet<QString> set;
|
QSet<QString> set;
|
||||||
|
if (pSettings->editor().enableCustomCTypeKeywords()) {
|
||||||
foreach(const QString& s, pSettings->editor().customCTypeKeywords())
|
foreach(const QString& s, pSettings->editor().customCTypeKeywords())
|
||||||
set.insert(s);
|
set.insert(s);
|
||||||
((QSynedit::CppSyntaxer*)(syntaxer().get()))->setCustomTypeKeywords(set);
|
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_SDCC
|
#ifdef ENABLE_SDCC
|
||||||
} else if (!inProject() && pSettings->compilerSets().defaultSet()
|
if (!inProject() && pSettings->compilerSets().defaultSet()
|
||||||
&& pSettings->compilerSets().defaultSet()->compilerType()==CompilerType::SDCC) {
|
&& pSettings->compilerSets().defaultSet()->compilerType()==CompilerType::SDCC) {
|
||||||
if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) {
|
foreach(const QString& s, SDCCKeywords.keys())
|
||||||
QSet<QString> set;
|
|
||||||
foreach(const QString& s, pSettings->editor().customCTypeKeywords())
|
|
||||||
set.insert(s);
|
set.insert(s);
|
||||||
((QSynedit::CppSyntaxer*)(syntaxer().get()))->setCustomTypeKeywords(set);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
((QSynedit::CppSyntaxer*)(syntaxer().get()))->setCustomTypeKeywords(set);
|
||||||
if (syntaxer() && syntaxer()->language() == QSynedit::ProgrammingLanguage::CPP) {
|
|
||||||
((QSynedit::CppSyntaxer*)(syntaxer().get()))->setCustomTypeKeywords(QSet<QString>());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setUndoLimit(pSettings->editor().undoLimit());
|
this->setUndoLimit(pSettings->editor().undoLimit());
|
||||||
|
|
|
@ -718,19 +718,39 @@ void MainWindow::updateCompileActions(const Editor *e)
|
||||||
} else {
|
} else {
|
||||||
bool forProject=false;
|
bool forProject=false;
|
||||||
bool canRun = false;
|
bool canRun = false;
|
||||||
|
bool canDebug = false;
|
||||||
bool canCompile = false;
|
bool canCompile = false;
|
||||||
bool canGenerateAssembly=false;
|
bool canGenerateAssembly=false;
|
||||||
|
Settings::PCompilerSet set=pSettings->compilerSets().getSet(mCompilerSet->currentIndex());
|
||||||
|
if (set) {
|
||||||
if (e) {
|
if (e) {
|
||||||
if (!e->inProject()) {
|
if (!e->inProject()) {
|
||||||
FileType fileType = getFileType(e->filename());
|
FileType fileType = getFileType(e->filename());
|
||||||
if (fileType == FileType::CSource
|
switch(fileType) {
|
||||||
|| fileType == FileType::CppSource) {
|
case FileType::CSource:
|
||||||
canGenerateAssembly = true;
|
canCompile = set->canCompileC();
|
||||||
|
#ifdef ENABLE_SDCC
|
||||||
|
if (set->compilerType()!=CompilerType::SDCC)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
canGenerateAssembly = canCompile;
|
||||||
|
canRun = canCompile ;
|
||||||
|
}
|
||||||
|
canDebug = set->canDebug();
|
||||||
|
break;
|
||||||
|
case FileType::CppSource:
|
||||||
|
canCompile = set->canCompileCPP();
|
||||||
|
canGenerateAssembly = canCompile;
|
||||||
|
canRun = canCompile;
|
||||||
|
canDebug = set->canDebug();
|
||||||
|
break;
|
||||||
|
case FileType::GAS:
|
||||||
|
if (set->compilerType()==CompilerType::GCC) {
|
||||||
canCompile = true;
|
canCompile = true;
|
||||||
canRun = true;
|
canRun = canCompile;
|
||||||
} else if (fileType == FileType::GAS) {
|
canDebug = set->canDebug();
|
||||||
canCompile = true;
|
}
|
||||||
canRun = true;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
forProject = (mProject!=nullptr);
|
forProject = (mProject!=nullptr);
|
||||||
|
@ -742,6 +762,7 @@ void MainWindow::updateCompileActions(const Editor *e)
|
||||||
canCompile = true;
|
canCompile = true;
|
||||||
canRun = (mProject->options().type !=ProjectType::DynamicLib)
|
canRun = (mProject->options().type !=ProjectType::DynamicLib)
|
||||||
&& (mProject->options().type !=ProjectType::StaticLib);
|
&& (mProject->options().type !=ProjectType::StaticLib);
|
||||||
|
canDebug = set->canDebug() && canRun;
|
||||||
if (e) {
|
if (e) {
|
||||||
FileType fileType = getFileType(e->filename());
|
FileType fileType = getFileType(e->filename());
|
||||||
if (fileType == FileType::CSource
|
if (fileType == FileType::CSource
|
||||||
|
@ -750,11 +771,12 @@ void MainWindow::updateCompileActions(const Editor *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ui->actionCompile->setEnabled(canCompile);
|
ui->actionCompile->setEnabled(canCompile);
|
||||||
ui->actionRun->setEnabled(canRun);
|
ui->actionRun->setEnabled(canRun);
|
||||||
ui->actionRebuild->setEnabled(canCompile);
|
ui->actionRebuild->setEnabled(canCompile);
|
||||||
ui->actionGenerate_Assembly->setEnabled(canGenerateAssembly);
|
ui->actionGenerate_Assembly->setEnabled(canGenerateAssembly);
|
||||||
ui->actionDebug->setEnabled(canRun);
|
ui->actionDebug->setEnabled(canDebug);
|
||||||
mProblem_RunAllCases->setEnabled(canRun && mOJProblemModel.count()>0);
|
mProblem_RunAllCases->setEnabled(canRun && mOJProblemModel.count()>0);
|
||||||
}
|
}
|
||||||
if (!mDebugger->executing()) {
|
if (!mDebugger->executing()) {
|
||||||
|
|
|
@ -2346,6 +2346,7 @@ QStringList Settings::CompilerSet::defines(bool isCpp) {
|
||||||
#ifdef ENABLE_SDCC
|
#ifdef ENABLE_SDCC
|
||||||
if (mCompilerType==CompilerType::SDCC) {
|
if (mCompilerType==CompilerType::SDCC) {
|
||||||
arguments.append("c");
|
arguments.append("c");
|
||||||
|
arguments.append("-V");
|
||||||
key=SDCC_CMD_OPT_PROCESSOR;
|
key=SDCC_CMD_OPT_PROCESSOR;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
|
@ -2367,12 +2368,56 @@ QStringList Settings::CompilerSet::defines(bool isCpp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
arguments.append(NULL_FILE);
|
arguments.append(NULL_FILE);
|
||||||
//qDebug()<<arguments;
|
|
||||||
|
// QStringList args;
|
||||||
|
// args.append("-nostdinc");
|
||||||
|
// args.append("-Wall");
|
||||||
|
// args.append("-std=c11");
|
||||||
|
// args.append("--obj-ext=.rel");
|
||||||
|
// args.append("-d\"M\"");
|
||||||
|
// args.append("-E");
|
||||||
|
// args.append("-isystem");
|
||||||
|
// args.append("D:\\sdcc\\bin\\..\\include\\mcs51");
|
||||||
|
// args.append("-xc");
|
||||||
|
// args.append("NUL");
|
||||||
|
// QFileInfo info(findProgramInBinDirs("sdcpp.exe"));
|
||||||
|
// qDebug()<<"**"<<getCompilerOutput(info.absolutePath(),info.fileName(),args);
|
||||||
|
|
||||||
|
// qDebug()<<mCCompiler<<arguments;
|
||||||
QFileInfo ccompiler(mCCompiler);
|
QFileInfo ccompiler(mCCompiler);
|
||||||
QByteArray output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.fileName(),arguments);
|
QByteArray output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.fileName(),arguments);
|
||||||
// 'cpp.exe -dM -E -x c++ -std=c++17 NUL'
|
// 'cpp.exe -dM -E -x c++ -std=c++17 NUL'
|
||||||
|
// qDebug()<<"------------------";
|
||||||
|
// qDebug()<<output.split('\n');
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
#ifdef ENABLE_SDCC
|
||||||
|
if (mCompilerType==CompilerType::SDCC) {
|
||||||
|
QList<QByteArray> lines = output.split('\n');
|
||||||
|
QByteArray currentLine;
|
||||||
|
for (QByteArray& line:lines) {
|
||||||
|
QByteArray trimmedLine = line.trimmed();
|
||||||
|
if (trimmedLine.startsWith("+")) {
|
||||||
|
currentLine = line;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lines = currentLine.split(' ');
|
||||||
|
for (QByteArray& line:lines) {
|
||||||
|
QByteArray trimmedLine = line.trimmed();
|
||||||
|
if (trimmedLine.startsWith("-D")) {
|
||||||
|
trimmedLine = trimmedLine.mid(2);
|
||||||
|
if (trimmedLine.contains("=")) {
|
||||||
|
QList<QByteArray> items=trimmedLine.split('=');
|
||||||
|
result.append(QString("#define %1 %2").arg(items[0],items[1]));
|
||||||
|
} else {
|
||||||
|
result.append("#define "+trimmedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
QList<QByteArray> lines = output.split('\n');
|
QList<QByteArray> lines = output.split('\n');
|
||||||
for (QByteArray& line:lines) {
|
for (QByteArray& line:lines) {
|
||||||
QByteArray trimmedLine = line.trimmed();
|
QByteArray trimmedLine = line.trimmed();
|
||||||
|
@ -2380,6 +2425,7 @@ QStringList Settings::CompilerSet::defines(bool isCpp) {
|
||||||
result.append(trimmedLine);
|
result.append(trimmedLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2648,6 +2694,10 @@ bool Settings::CompilerSet::canCompileC() const
|
||||||
|
|
||||||
bool Settings::CompilerSet::canCompileCPP() const
|
bool Settings::CompilerSet::canCompileCPP() const
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_SDCC
|
||||||
|
if (mCompilerType==CompilerType::SDCC)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
return fileExists(mCppCompiler);
|
return fileExists(mCppCompiler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2658,6 +2708,10 @@ bool Settings::CompilerSet::canMake() const
|
||||||
|
|
||||||
bool Settings::CompilerSet::canDebug() const
|
bool Settings::CompilerSet::canDebug() const
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_SDCC
|
||||||
|
if (mCompilerType==CompilerType::SDCC)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
return fileExists(mDebugger);
|
return fileExists(mDebugger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2705,6 +2759,8 @@ QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const
|
||||||
{
|
{
|
||||||
QProcessEnvironment env;
|
QProcessEnvironment env;
|
||||||
env.insert("LANG","en");
|
env.insert("LANG","en");
|
||||||
|
QString path = binDir;
|
||||||
|
env.insert("PATH",path);
|
||||||
QByteArray result = runAndGetOutput(
|
QByteArray result = runAndGetOutput(
|
||||||
includeTrailingPathDelimiter(binDir)+binFile,
|
includeTrailingPathDelimiter(binDir)+binFile,
|
||||||
binDir,
|
binDir,
|
||||||
|
|
|
@ -135,7 +135,7 @@ void SettingsDialog::selectFirstWidget()
|
||||||
widgetIndex,
|
widgetIndex,
|
||||||
QItemSelectionModel::Select
|
QItemSelectionModel::Select
|
||||||
);
|
);
|
||||||
on_widgetsView_clicked(widgetIndex);
|
showWidget(widgetIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSettingsDialog SettingsDialog::optionDialog()
|
PSettingsDialog SettingsDialog::optionDialog()
|
||||||
|
@ -301,19 +301,13 @@ bool SettingsDialog::setCurrentWidget(const QString &widgetName, const QString &
|
||||||
QStandardItem* pWidgetItem = pGroupItem->child(i);
|
QStandardItem* pWidgetItem = pGroupItem->child(i);
|
||||||
if (pWidgetItem->text() == widgetName) {
|
if (pWidgetItem->text() == widgetName) {
|
||||||
ui->widgetsView->setCurrentIndex(pWidgetItem->index());
|
ui->widgetsView->setCurrentIndex(pWidgetItem->index());
|
||||||
on_widgetsView_clicked(pWidgetItem->index());
|
showWidget(pWidgetItem->index());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SettingsDialog::on_widgetsView_clicked(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
showWidget(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::widget_settings_changed(bool value)
|
void SettingsDialog::widget_settings_changed(bool value)
|
||||||
{
|
{
|
||||||
ui->btnApply->setEnabled(value);
|
ui->btnApply->setEnabled(value);
|
||||||
|
|
|
@ -58,7 +58,6 @@ private slots:
|
||||||
void widget_settings_changed(bool value);
|
void widget_settings_changed(bool value);
|
||||||
|
|
||||||
void onWidgetsViewCurrentChanged(const QModelIndex &index, const QModelIndex &previous);
|
void onWidgetsViewCurrentChanged(const QModelIndex &index, const QModelIndex &previous);
|
||||||
void on_widgetsView_clicked(const QModelIndex &index);
|
|
||||||
|
|
||||||
void on_btnCancel_pressed();
|
void on_btnCancel_pressed();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue