| 19 | #include <iostream> |
| 20 | |
| 21 | AddCompilerWizard::AddCompilerWizard(QWidget *parent) : QWizard(parent), ui(new Ui::AddCompilerWizard) { |
| 22 | |
| 23 | setWizardStyle(ModernStyle); |
| 24 | |
| 25 | ui->setupUi(this); |
| 26 | ui->sourceFileExtensions->setValidator( |
| 27 | new QRegularExpressionValidator(QRegularExpression("(\\w+;)*\\w+"), this)); |
| 28 | ui->bytecodeFileExtensions->setValidator( |
| 29 | new QRegularExpressionValidator(QRegularExpression("(\\w+;)*\\w+"), this)); |
| 30 | ui->javaMemoryLimit->setValidator(new QIntValidator(64, 2048, this)); |
| 31 | |
| 32 | const auto setIfEmpty = [](QLineEdit *target, const QStringList &candidates) { |
| 33 | if (! target->text().isEmpty()) |
| 34 | return; |
| 35 | |
| 36 | for (const auto &candidate : candidates) { |
| 37 | const auto executable = QStandardPaths::findExecutable(candidate); |
| 38 | if (! executable.isEmpty()) { |
| 39 | target->setText(QDir::toNativeSeparators(executable)); |
| 40 | return; |
| 41 | } |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | setIfEmpty(ui->gccPath, {"gcc"}); |
| 46 | setIfEmpty(ui->gppPath, {"g++"}); |
| 47 | setIfEmpty(ui->fpcPath, {"fpc"}); |
| 48 | setIfEmpty(ui->javacPath, {"javac"}); |
| 49 | setIfEmpty(ui->javaPath, {"java"}); |
| 50 | setIfEmpty(ui->pythonPath, {"python"}); |
| 51 | connect(ui->typeSelect, qOverload<int>(&QComboBox::currentIndexChanged), this, |
| 52 | &AddCompilerWizard::compilerTypeChanged); |
| 53 | connect(ui->compilerSelectButton, &QToolButton::clicked, this, |
| 54 | &AddCompilerWizard::selectCompilerLocation); |
| 55 | connect(ui->interpreterSelectButton, &QToolButton::clicked, this, |
| 56 | &AddCompilerWizard::selectInterpreterLocation); |
| 57 | connect(ui->gccSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectGccPath); |
| 58 | connect(ui->gppSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectGppPath); |
| 59 | connect(ui->fpcSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectFpcPath); |
| 60 | connect(ui->fbcSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectFbcPath); |
| 61 | connect(ui->javacSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectJavacPath); |
| 62 | connect(ui->javaSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectJavaPath); |
| 63 | connect(ui->pythonSelectButton, &QToolButton::clicked, this, &AddCompilerWizard::selectPythonPath); |
| 64 | } |
| 65 | |
| 66 | AddCompilerWizard::~AddCompilerWizard() { delete ui; } |
| 67 |
nothing calls this directly
no outgoing calls
no test coverage detected