From f16d015fdda69452b12892186d3d104d343e965d Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 25 Apr 2022 21:48:04 +0800 Subject: [PATCH] - fix: gcc compiler set name is not correct in Linux - enhancement: hide add charset option when the currect compiler set is clang - enhancement: auto check the c project option in the new project dialog - change: use "app.ico" as default name for the project icon file - fix: c file should use CC to build in the auto generated makefile --- NEWS.md | 7 +++++++ RedPandaIDE/compiler/compiler.cpp | 2 +- RedPandaIDE/compiler/compilermanager.cpp | 12 ------------ RedPandaIDE/mainwindow.cpp | 2 +- RedPandaIDE/project.cpp | 8 ++++++-- RedPandaIDE/settings.cpp | 12 ++++++++++-- RedPandaIDE/settings.h | 2 ++ .../settingsdialog/compilersetoptionwidget.cpp | 7 +++++++ RedPandaIDE/settingsdialog/projectgeneralwidget.cpp | 2 +- RedPandaIDE/systemconsts.h | 1 - RedPandaIDE/widgets/newprojectdialog.cpp | 1 + 11 files changed, 36 insertions(+), 20 deletions(-) diff --git a/NEWS.md b/NEWS.md index 16fe6dcc..468b543d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +Red Panda C++ Version 1.0.6 + - fix: gcc compiler set name is not correct in Linux + - enhancement: hide add charset option when the currect compiler set is clang + - enhancement: auto check the c project option in the new project dialog + - change: use "app.ico" as default name for the project icon file + - fix: c file should use CC to build in the auto generated makefile + Red Panda C++ Version 1.0.5 - enhancement: add autolink and project template for sqlite3 - enhancement: add sqlite3 lib to the gcc in distribution diff --git a/RedPandaIDE/compiler/compiler.cpp b/RedPandaIDE/compiler/compiler.cpp index a8d44b47..5aba68b8 100644 --- a/RedPandaIDE/compiler/compiler.cpp +++ b/RedPandaIDE/compiler/compiler.cpp @@ -285,7 +285,7 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding, bool checkSynta { QString result; if (compilerSet()->autoAddCharsetParams() && encoding != ENCODING_ASCII - && compilerSet()->compilerType()!="Clang") { + && compilerSet()->compilerType()!=COMPILER_CLANG) { QString encodingName; QString execEncodingName; QString compilerSetExecCharset = compilerSet()->execCharset(); diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 60a3c7f9..465f0169 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -74,18 +74,6 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin tr("No compiler set is configured.")+tr("Can't start debugging.")); return; } - if (pSettings->compilerSets().defaultSet()->compilerType() == "Clang" - && ( - (encoding!= ENCODING_ASCII && encoding!=ENCODING_UTF8) - || (encoding == ENCODING_UTF8 - && pCharsetInfoManager->getDefaultSystemEncoding()!=ENCODING_UTF8) - )) { - QMessageBox::information(pMainWindow, - tr("Encoding not support"), - tr("Clang only support utf-8 encoding.") - +"
" - +tr("Strings in the program might be wrongly processed.")); - } { QMutexLocker locker(&mCompileMutex); if (mCompiler!=nullptr) { diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index b9ba0c8f..33ec1b26 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1827,7 +1827,7 @@ void MainWindow::debug() mDebugger->sendCommand("-gdb-set", "confirm off"); mDebugger->sendCommand("-gdb-set", "print repeats 0"); // don't repeat elements mDebugger->sendCommand("-gdb-set", "print elements 0"); // don't limit elements - mDebugger->sendCommand("-environment-cd", QString("\"%1\"").arg(excludeTrailingPathDelimiter(filePath))); // restore working directory + mDebugger->sendCommand("-environment-cd", QString("\"%1\"").arg(extractFileDir(filePath))); // restore working directory if (pSettings->debugger().useGDBServer()) { mDebugger->sendCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort())); if (!debugInferiorhasBreakpoint()) { diff --git a/RedPandaIDE/project.cpp b/RedPandaIDE/project.cpp index 76177e50..3138a57a 100644 --- a/RedPandaIDE/project.cpp +++ b/RedPandaIDE/project.cpp @@ -279,7 +279,11 @@ PProjectUnit Project::newUnit(PProjectModelNode parentNode, const QString& custo newUnit->node()->unitIndex = count; //parentNode.Expand(True); newUnit->setCompile(true); - newUnit->setCompileCpp(mOptions.isCpp); + if (getFileType(customFileName) == FileType::CSource) { + newUnit->setCompileCpp(false); + } else { + newUnit->setCompileCpp(mOptions.isCpp); + } newUnit->setLink(true); newUnit->setPriority(1000); newUnit->setOverrideBuildCmd(false); @@ -758,7 +762,7 @@ bool Project::assignTemplate(const std::shared_ptr aTemplate, b if (!mOptions.icon.isEmpty()) { QString originIcon = QFileInfo(aTemplate->fileName()).absoluteDir().absoluteFilePath(mOptions.icon); if (fileExists(originIcon)) { - QString destIcon = changeFileExt(mFilename,ICON_EXT); + QString destIcon = QFileInfo(mFilename).absoluteDir().absoluteFilePath("app.ico"); QFile::copy(originIcon,destIcon); mOptions.icon = destIcon; } else { diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 4468ec0f..ec903816 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1950,7 +1950,7 @@ void Settings::CompilerSet::setProperties(const QString &binDir) targetStr = "clang version "; delimPos1 = output.indexOf(targetStr); if (delimPos1>=0) { - mCompilerType = "Clang"; + mCompilerType = COMPILER_CLANG; delimPos1+=strlen(targetStr); delimPos2 = delimPos1; while (delimPos2chkAutoAddCharset->setEnabled(pSet->compilerType() != COMPILER_CLANG); + ui->chkAutoAddCharset->setVisible(pSet->compilerType() != COMPILER_CLANG); + ui->cbEncoding->setEnabled(pSet->compilerType() != COMPILER_CLANG); + ui->cbEncoding->setVisible(pSet->compilerType() != COMPILER_CLANG); + ui->cbEncodingDetails->setEnabled(pSet->compilerType() != COMPILER_CLANG); + ui->cbEncodingDetails->setVisible(pSet->compilerType() != COMPILER_CLANG); + ui->chkUseCustomCompilerParams->setChecked(pSet->useCustomCompileParams()); ui->txtCustomCompileParams->setPlainText(pSet->customCompileParams()); ui->txtCustomCompileParams->setEnabled(pSet->useCustomCompileParams()); diff --git a/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp b/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp index b295c82e..0daa933a 100644 --- a/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/projectgeneralwidget.cpp @@ -108,7 +108,7 @@ void ProjectGeneralWidget::doSave() || !ui->lbIcon->pixmap() || ui->lbIcon->pixmap()->isNull()) { project->options().icon = ""; } else { - QString iconPath = changeFileExt(project->filename(),"ico"); + QString iconPath = QFileInfo(project->filename()).absoluteDir().absoluteFilePath("app.ico"); if (iconPath!=mIconPath) { if (QFile(iconPath).exists()) { if (!QFile::remove(iconPath)) { diff --git a/RedPandaIDE/systemconsts.h b/RedPandaIDE/systemconsts.h index 8f9e75fb..667817f5 100644 --- a/RedPandaIDE/systemconsts.h +++ b/RedPandaIDE/systemconsts.h @@ -56,7 +56,6 @@ #define DEF_EXT "def" #define LIB_EXT "a" #define GCH_EXT "gch" -#define ICON_EXT "ico" #define TEMPLATE_EXT "template" #define DEV_INTERNAL_OPEN "$__DEV_INTERNAL_OPEN" #define DEV_LASTOPENS_FILE "lastopens.ini" diff --git a/RedPandaIDE/widgets/newprojectdialog.cpp b/RedPandaIDE/widgets/newprojectdialog.cpp index d52f47ff..db3c45ee 100644 --- a/RedPandaIDE/widgets/newprojectdialog.cpp +++ b/RedPandaIDE/widgets/newprojectdialog.cpp @@ -220,6 +220,7 @@ void NewProjectDialog::on_lstTemplates_currentItemChanged(QListWidgetItem *curre ui->rdCppProject->setChecked(true); } else { ui->rdCProject->setEnabled(true); + ui->rdCProject->setChecked(true); if (pSettings->editor().defaultFileCpp()) { ui->rdCppProject->setChecked(true); } else {