- 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
- enhancement: add autolink and project template for sqlite3
- 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;
if (compilerSet()->autoAddCharsetParams() && encoding != ENCODING_ASCII
&& compilerSet()->compilerType()!="Clang") {
&& compilerSet()->compilerType()!=COMPILER_CLANG) {
QString encodingName;
QString execEncodingName;
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."));
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);
if (mCompiler!=nullptr) {

View File

@ -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()) {

View File

@ -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<ProjectTemplate> 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 {

View File

@ -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 (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
@ -1959,7 +1959,7 @@ void Settings::CompilerSet::setProperties(const QString &binDir)
mName = "Clang " + mVersion;
} else {
mCompilerType = "GCC";
mCompilerType = COMPILER_GCC;
targetStr = "gcc version ";
delimPos1 = output.indexOf(targetStr);
if (delimPos1<0)
@ -1987,9 +1987,17 @@ void Settings::CompilerSet::setProperties(const QString &binDir)
} else if (mType.contains("MSYS2")) {
mName = "MinGW-w64 GCC " + mVersion;
} else if (mType.contains("GCC")) {
#ifdef Q_OS_WIN
mName = "MinGW GCC " + mVersion;
#else
mName = "GCC " + mVersion;
#endif
} else {
#ifdef Q_OS_WIN
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_AUTO_INDENT "default_auto_indent"
#define COMPILER_CLANG "Clang"
#define COMPILER_GCC "GCC"
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) {
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->txtCustomCompileParams->setPlainText(pSet->customCompileParams());
ui->txtCustomCompileParams->setEnabled(pSet->useCustomCompileParams());

View File

@ -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)) {

View File

@ -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"

View File

@ -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 {