| 307 | } |
| 308 | |
| 309 | auto AddTestCasesWizard::validateCurrentPage() -> bool { |
| 310 | if (currentId() == 0) { |
| 311 | if (ui->fullScore->text().isEmpty()) { |
| 312 | ui->fullScore->setFocus(); |
| 313 | QMessageBox::warning(this, tr("Error"), tr("Empty full score!"), QMessageBox::Close); |
| 314 | return false; |
| 315 | } |
| 316 | |
| 317 | if (ui->timeLimit->text().isEmpty()) { |
| 318 | ui->timeLimit->setFocus(); |
| 319 | QMessageBox::warning(this, tr("Error"), tr("Empty time limit!"), QMessageBox::Close); |
| 320 | return false; |
| 321 | } |
| 322 | |
| 323 | if (ui->memoryLimit->text().isEmpty()) { |
| 324 | ui->memoryLimit->setFocus(); |
| 325 | QMessageBox::warning(this, tr("Error"), tr("Empty memory limit!"), QMessageBox::Close); |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | return true; |
| 330 | } |
| 331 | |
| 332 | if (currentId() == 1) { |
| 333 | if (ui->inputFilesPattern->text().isEmpty()) { |
| 334 | ui->inputFilesPattern->setFocus(); |
| 335 | QMessageBox::warning(this, tr("Error"), tr("Empty input files pattern!"), QMessageBox::Close); |
| 336 | return false; |
| 337 | } |
| 338 | |
| 339 | if (ui->outputFilesPattern->text().isEmpty()) { |
| 340 | ui->outputFilesPattern->setFocus(); |
| 341 | QMessageBox::warning(this, tr("Error"), tr("Empty output files pattern!"), QMessageBox::Close); |
| 342 | return false; |
| 343 | } |
| 344 | |
| 345 | for (int i = 0; i < ui->argumentList->rowCount(); i++) { |
| 346 | if (inputFilesPattern.count(QString("<%1>").arg(i + 1)) > 1) { |
| 347 | ui->inputFilesPattern->setFocus(); |
| 348 | QMessageBox::warning( |
| 349 | this, tr("Error"), |
| 350 | tr("Argument <%1> appears more than once in input files pattern!").arg(i + 1), |
| 351 | QMessageBox::Close); |
| 352 | return false; |
| 353 | } |
| 354 | |
| 355 | if (outputFilesPattern.count(QString("<%1>").arg(i + 1)) > 1) { |
| 356 | ui->outputFilesPattern->setFocus(); |
| 357 | QMessageBox::warning( |
| 358 | this, tr("Error"), |
| 359 | tr("Argument <%1> appears more than once in output files pattern!").arg(i + 1), |
| 360 | QMessageBox::Close); |
| 361 | return false; |
| 362 | } |
| 363 | |
| 364 | QString regExp = ui->argumentList->item(i, 1)->text(); |
| 365 | if (! QRegularExpression(regExp).isValid()) { |
| 366 | ui->argumentList->setCurrentCell(i, 1); |
nothing calls this directly
no outgoing calls
no test coverage detected