| 61 | } |
| 62 | |
| 63 | auto CompilerSettings::checkValid() -> bool { |
| 64 | const QList<Compiler *> &compilerList = editSettings->getCompilerList(); |
| 65 | QStringList compilerNames; |
| 66 | |
| 67 | for (auto *i : compilerList) { |
| 68 | compilerNames.append(i->getCompilerName()); |
| 69 | } |
| 70 | |
| 71 | // n^2? |
| 72 | for (int i = 0; i < compilerList.size(); i++) { |
| 73 | if (compilerNames.count(compilerNames[i]) > 1) { |
| 74 | ui->compilerList->setFocus(); |
| 75 | ui->compilerList->setCurrentRow(i); |
| 76 | QMessageBox::warning(this, tr("Error"), |
| 77 | tr("Compiler %1 appears more than once!").arg(compilerNames[i]), |
| 78 | QMessageBox::Close); |
| 79 | return false; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | for (int i = 0; i < compilerList.size(); i++) { |
| 84 | if (compilerList[i]->getCompilerName().isEmpty()) { |
| 85 | ui->compilerList->setCurrentRow(i); |
| 86 | ui->compilerName->setFocus(); |
| 87 | QMessageBox::warning(this, tr("Error"), tr("Empty compiler name!"), QMessageBox::Close); |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | if (compilerList[i]->getSourceExtensions().isEmpty()) { |
| 92 | ui->compilerList->setCurrentRow(i); |
| 93 | ui->sourceExtensions->setFocus(); |
| 94 | QMessageBox::warning(this, tr("Error"), tr("Empty source file extensions!"), QMessageBox::Close); |
| 95 | return false; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | void CompilerSettings::moveUpCompiler() { |
| 103 | int index = ui->compilerList->currentRow(); |
nothing calls this directly
no test coverage detected