- 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
This commit is contained in:
Roy Qu 2022-04-25 21:48:04 +08:00
parent 2f61bd1f79
commit f16d015fdd
11 changed files with 36 additions and 20 deletions

View File

@ -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 Red Panda C++ Version 1.0.5
- enhancement: add autolink and project template for sqlite3 - enhancement: add autolink and project template for sqlite3
- enhancement: add sqlite3 lib to the gcc in distribution - enhancement: add sqlite3 lib to the gcc in distribution

View File

@ -285,7 +285,7 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding, bool checkSynta
{ {
QString result; QString result;
if (compilerSet()->autoAddCharsetParams() && encoding != ENCODING_ASCII if (compilerSet()->autoAddCharsetParams() && encoding != ENCODING_ASCII
&& compilerSet()->compilerType()!="Clang") { && compilerSet()->compilerType()!=COMPILER_CLANG) {
QString encodingName; QString encodingName;
QString execEncodingName; QString execEncodingName;
QString compilerSetExecCharset = compilerSet()->execCharset(); QString compilerSetExecCharset = compilerSet()->execCharset();

View File

@ -74,18 +74,6 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin
tr("No compiler set is configured.")+tr("Can't start debugging.")); tr("No compiler set is configured.")+tr("Can't start debugging."));
return; 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.")
+"<br />"
+tr("Strings in the program might be wrongly processed."));
}
{ {
QMutexLocker locker(&mCompileMutex); QMutexLocker locker(&mCompileMutex);
if (mCompiler!=nullptr) { if (mCompiler!=nullptr) {

View File

@ -1827,7 +1827,7 @@ void MainWindow::debug()
mDebugger->sendCommand("-gdb-set", "confirm off"); mDebugger->sendCommand("-gdb-set", "confirm off");
mDebugger->sendCommand("-gdb-set", "print repeats 0"); // don't repeat elements mDebugger->sendCommand("-gdb-set", "print repeats 0"); // don't repeat elements
mDebugger->sendCommand("-gdb-set", "print elements 0"); // don't limit 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()) { if (pSettings->debugger().useGDBServer()) {
mDebugger->sendCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort())); mDebugger->sendCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort()));
if (!debugInferiorhasBreakpoint()) { if (!debugInferiorhasBreakpoint()) {

View File

@ -279,7 +279,11 @@ PProjectUnit Project::newUnit(PProjectModelNode parentNode, const QString& custo
newUnit->node()->unitIndex = count; newUnit->node()->unitIndex = count;
//parentNode.Expand(True); //parentNode.Expand(True);
newUnit->setCompile(true); newUnit->setCompile(true);
if (getFileType(customFileName) == FileType::CSource) {
newUnit->setCompileCpp(false);
} else {
newUnit->setCompileCpp(mOptions.isCpp); newUnit->setCompileCpp(mOptions.isCpp);
}
newUnit->setLink(true); newUnit->setLink(true);
newUnit->setPriority(1000); newUnit->setPriority(1000);
newUnit->setOverrideBuildCmd(false); newUnit->setOverrideBuildCmd(false);
@ -758,7 +762,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
if (!mOptions.icon.isEmpty()) { if (!mOptions.icon.isEmpty()) {
QString originIcon = QFileInfo(aTemplate->fileName()).absoluteDir().absoluteFilePath(mOptions.icon); QString originIcon = QFileInfo(aTemplate->fileName()).absoluteDir().absoluteFilePath(mOptions.icon);
if (fileExists(originIcon)) { if (fileExists(originIcon)) {
QString destIcon = changeFileExt(mFilename,ICON_EXT); QString destIcon = QFileInfo(mFilename).absoluteDir().absoluteFilePath("app.ico");
QFile::copy(originIcon,destIcon); QFile::copy(originIcon,destIcon);
mOptions.icon = destIcon; mOptions.icon = destIcon;
} else { } else {

View File

@ -1950,7 +1950,7 @@ void Settings::CompilerSet::setProperties(const QString &binDir)
targetStr = "clang version "; targetStr = "clang version ";
delimPos1 = output.indexOf(targetStr); delimPos1 = output.indexOf(targetStr);
if (delimPos1>=0) { if (delimPos1>=0) {
mCompilerType = "Clang"; mCompilerType = COMPILER_CLANG;
delimPos1+=strlen(targetStr); delimPos1+=strlen(targetStr);
delimPos2 = delimPos1; delimPos2 = delimPos1;
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2])) while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
@ -1959,7 +1959,7 @@ void Settings::CompilerSet::setProperties(const QString &binDir)
mName = "Clang " + mVersion; mName = "Clang " + mVersion;
} else { } else {
mCompilerType = "GCC"; mCompilerType = COMPILER_GCC;
targetStr = "gcc version "; targetStr = "gcc version ";
delimPos1 = output.indexOf(targetStr); delimPos1 = output.indexOf(targetStr);
if (delimPos1<0) if (delimPos1<0)
@ -1987,9 +1987,17 @@ void Settings::CompilerSet::setProperties(const QString &binDir)
} else if (mType.contains("MSYS2")) { } else if (mType.contains("MSYS2")) {
mName = "MinGW-w64 GCC " + mVersion; mName = "MinGW-w64 GCC " + mVersion;
} else if (mType.contains("GCC")) { } else if (mType.contains("GCC")) {
#ifdef Q_OS_WIN
mName = "MinGW GCC " + mVersion; mName = "MinGW GCC " + mVersion;
#else
mName = "GCC " + mVersion;
#endif
} else { } else {
#ifdef Q_OS_WIN
mName = "MinGW GCC " + mVersion; mName = "MinGW GCC " + mVersion;
#else
mName = "GCC " + mVersion;
#endif
} }
} }
} }

View File

@ -46,6 +46,8 @@
#define SETTING_EDITOR_DEFAULT_ENCODING "default_encoding" #define SETTING_EDITOR_DEFAULT_ENCODING "default_encoding"
#define SETTING_EDITOR_AUTO_INDENT "default_auto_indent" #define SETTING_EDITOR_AUTO_INDENT "default_auto_indent"
#define COMPILER_CLANG "Clang"
#define COMPILER_GCC "GCC"
extern const char ValueToChar[28]; extern const char ValueToChar[28];

View File

@ -124,6 +124,13 @@ void resetOptionTabs(Settings::PCompilerSet pSet,QTabWidget* pTab)
} }
static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) { static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) {
ui->chkAutoAddCharset->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->chkUseCustomCompilerParams->setChecked(pSet->useCustomCompileParams());
ui->txtCustomCompileParams->setPlainText(pSet->customCompileParams()); ui->txtCustomCompileParams->setPlainText(pSet->customCompileParams());
ui->txtCustomCompileParams->setEnabled(pSet->useCustomCompileParams()); ui->txtCustomCompileParams->setEnabled(pSet->useCustomCompileParams());

View File

@ -108,7 +108,7 @@ void ProjectGeneralWidget::doSave()
|| !ui->lbIcon->pixmap() || ui->lbIcon->pixmap()->isNull()) { || !ui->lbIcon->pixmap() || ui->lbIcon->pixmap()->isNull()) {
project->options().icon = ""; project->options().icon = "";
} else { } else {
QString iconPath = changeFileExt(project->filename(),"ico"); QString iconPath = QFileInfo(project->filename()).absoluteDir().absoluteFilePath("app.ico");
if (iconPath!=mIconPath) { if (iconPath!=mIconPath) {
if (QFile(iconPath).exists()) { if (QFile(iconPath).exists()) {
if (!QFile::remove(iconPath)) { if (!QFile::remove(iconPath)) {

View File

@ -56,7 +56,6 @@
#define DEF_EXT "def" #define DEF_EXT "def"
#define LIB_EXT "a" #define LIB_EXT "a"
#define GCH_EXT "gch" #define GCH_EXT "gch"
#define ICON_EXT "ico"
#define TEMPLATE_EXT "template" #define TEMPLATE_EXT "template"
#define DEV_INTERNAL_OPEN "$__DEV_INTERNAL_OPEN" #define DEV_INTERNAL_OPEN "$__DEV_INTERNAL_OPEN"
#define DEV_LASTOPENS_FILE "lastopens.ini" #define DEV_LASTOPENS_FILE "lastopens.ini"

View File

@ -220,6 +220,7 @@ void NewProjectDialog::on_lstTemplates_currentItemChanged(QListWidgetItem *curre
ui->rdCppProject->setChecked(true); ui->rdCppProject->setChecked(true);
} else { } else {
ui->rdCProject->setEnabled(true); ui->rdCProject->setEnabled(true);
ui->rdCProject->setChecked(true);
if (pSettings->editor().defaultFileCpp()) { if (pSettings->editor().defaultFileCpp()) {
ui->rdCppProject->setChecked(true); ui->rdCppProject->setChecked(true);
} else { } else {