diff --git a/NEWS.md b/NEWS.md index 10c298be..b21fc8f1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -101,6 +101,7 @@ Red Panda C++ Version 2.27 - fix: "project name".exe.manifest is auto removed when build the project. - fix: "0x3.12p+1" is treadted as a plus expression when reformatting code. ( by 绣球135@qq ) - change: Don't turn on the code format option "indent class" by default. + - enhancement: Add compiler set by choose the executable. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp index 774bb74f..a3c84ec5 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.cpp @@ -344,7 +344,7 @@ void CompilerSetOptionWidget::on_btnAddBlankCompilerSet_clicked() void CompilerSetOptionWidget::on_btnAddCompilerSetByFolder_clicked() { - QString folder = QFileDialog::getExistingDirectory(this, tr("Compiler Set Folder")); + QString folder = QFileDialog::getExistingDirectory(this, tr("Compiler Folder")); int oldSize = pSettings->compilerSets().size(); if (!pSettings->compilerSets().addSets(folder)) { @@ -388,6 +388,7 @@ void CompilerSetOptionWidget::updateIcons(const QSize& /*size*/) { pIconsManager->setIcon(ui->btnFindCompilers, IconsManager::ACTION_EDIT_SEARCH); pIconsManager->setIcon(ui->btnAddCompilerSetByFolder, IconsManager::ACTION_FILE_OPEN_FOLDER); + pIconsManager->setIcon(ui->btnAddCompilerSetByFile, IconsManager::ACTION_FILE_LOCATE); pIconsManager->setIcon(ui->btnAddBlankCompilerSet, IconsManager::ACTION_MISC_ADD); pIconsManager->setIcon(ui->btnRemoveCompilerSet, IconsManager::ACTION_MISC_REMOVE); pIconsManager->setIcon(ui->btnRenameCompilerSet, IconsManager::ACTION_MISC_RENAME); @@ -496,3 +497,17 @@ void CompilerSetOptionWidget::on_btnChooseResourceCompiler_clicked() ui->txtResourceCompiler->setText(fileName); } + +void CompilerSetOptionWidget::on_btnAddCompilerSetByFile_clicked() +{ + QString file = QFileDialog::getOpenFileName(this, tr("Compiler")); + if (file.isEmpty()) + return; + QFileInfo fileInfo(file); + if (!fileInfo.isExecutable()) + return false; + if (!pSettings->compilerSets().addSets(fileInfo.absolutePath(), fileInfo.fileName())); + return; + doLoad(); +} + diff --git a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui index 9386f5c2..7bd9bf5e 100644 --- a/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui +++ b/RedPandaIDE/settingsdialog/compilersetoptionwidget.ui @@ -6,7 +6,7 @@ 0 0 - 892 + 1005 607 @@ -49,6 +49,13 @@ + + + + Add Compiler + + + @@ -508,6 +515,7 @@ cbCompilerSet btnFindCompilers btnAddCompilerSetByFolder + btnAddCompilerSetByFile btnAddBlankCompilerSet btnRenameCompilerSet btnRemoveCompilerSet