Skip to content

Commit

Permalink
Set the default compiler and allow resetting back to default
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Feb 8, 2019
1 parent f38b366 commit d66d325
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 10 additions & 2 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -359,8 +359,16 @@ void MainWindow::setUpMainWindow(threadData_t *threadData)
mpOMCProxy->setCommandLineOptions(QString("--simCodeTarget=%1").arg(OptionsDialog::instance()->getSimulationPage()->getTargetLanguageComboBox()->currentText()));
QString target = OptionsDialog::instance()->getSimulationPage()->getTargetBuildComboBox()->itemData(OptionsDialog::instance()->getSimulationPage()->getTargetBuildComboBox()->currentIndex()).toString();
mpOMCProxy->setCommandLineOptions(QString("--target=%1").arg(target));
mpOMCProxy->setCompiler(OptionsDialog::instance()->getSimulationPage()->getCompilerComboBox()->lineEdit()->text());
mpOMCProxy->setCXXCompiler(OptionsDialog::instance()->getSimulationPage()->getCXXCompilerComboBox()->lineEdit()->text());
QString compiler = OptionsDialog::instance()->getSimulationPage()->getCompilerComboBox()->lineEdit()->text();
if (compiler.isEmpty()) {
compiler = OptionsDialog::instance()->getSimulationPage()->getCompilerComboBox()->lineEdit()->placeholderText();
}
mpOMCProxy->setCompiler(compiler);
QString cxxCompiler = OptionsDialog::instance()->getSimulationPage()->getCXXCompilerComboBox()->lineEdit()->text();
if (cxxCompiler.isEmpty()) {
cxxCompiler = OptionsDialog::instance()->getSimulationPage()->getCXXCompilerComboBox()->lineEdit()->placeholderText();
}
mpOMCProxy->setCXXCompiler(cxxCompiler);
if (OptionsDialog::instance()->getSimulationPage()->getIgnoreCommandLineOptionsAnnotationCheckBox()->isChecked()) {
mpOMCProxy->setCommandLineOptions("--ignoreCommandLineOptionsAnnotation=true");
}
Expand Down
16 changes: 12 additions & 4 deletions OMEdit/OMEditGUI/Options/OptionsDialog.cpp
Expand Up @@ -1150,10 +1150,16 @@ void OptionsDialog::saveSimulationSettings()
// save compiler
QString compiler = mpSimulationPage->getCompilerComboBox()->lineEdit()->text();
mpSettings->setValue("simulation/compiler", compiler);
if (compiler.isEmpty()) {
compiler = mpSimulationPage->getCompilerComboBox()->lineEdit()->placeholderText();
}
MainWindow::instance()->getOMCProxy()->setCompiler(compiler);
// save cxxcompiler
QString cxxCompiler = mpSimulationPage->getCXXCompilerComboBox()->lineEdit()->text();
mpSettings->setValue("simulation/cxxCompiler", cxxCompiler);
if (cxxCompiler.isEmpty()) {
cxxCompiler = mpSimulationPage->getCXXCompilerComboBox()->lineEdit()->placeholderText();
}
MainWindow::instance()->getOMCProxy()->setCXXCompiler(cxxCompiler);
// save command line options ste manually by user. This will override above options.
if (MainWindow::instance()->getOMCProxy()->setCommandLineOptions(mpSimulationPage->getOMCCommandLineOptionsTextBox()->text())) {
Expand Down Expand Up @@ -3539,20 +3545,22 @@ SimulationPage::SimulationPage(OptionsDialog *pOptionsDialog)
mpCompilerLabel = new Label(tr("C Compiler:"));
mpCompilerComboBox = new QComboBox;
mpCompilerComboBox->setEditable(true);
mpCompilerComboBox->lineEdit()->setText(MainWindow::instance()->getOMCProxy()->getCompiler());
mpCompilerComboBox->addItem("");
mpCompilerComboBox->addItem("gcc");
#ifdef Q_OS_UNIX
mpCompilerComboBox->addItem("clang");
#endif
mpCompilerComboBox->lineEdit()->setPlaceholderText(MainWindow::instance()->getOMCProxy()->getCompiler());
// CXX Compiler
mpCXXCompilerLabel = new Label(tr("CXX Compiler:"));
mpCXXCompilerComboBox = new QComboBox;
mpCXXCompilerComboBox->setEditable(true);
mpCXXCompilerComboBox->lineEdit()->setText(MainWindow::instance()->getOMCProxy()->getCXXCompiler());
mpCXXCompilerComboBox->addItem("g++", "g++");
mpCXXCompilerComboBox->addItem("");
mpCXXCompilerComboBox->addItem("g++");
#ifdef Q_OS_UNIX
mpCXXCompilerComboBox->addItem("clang++", "clang++");
mpCXXCompilerComboBox->addItem("clang++");
#endif
mpCXXCompilerComboBox->lineEdit()->setPlaceholderText(MainWindow::instance()->getOMCProxy()->getCXXCompiler());
// OMC CommandLineOptions
mpOMCCommandLineOptionsLabel = new Label(QString("%1:").arg(Helper::OMCCommandLineOptions));
mpOMCCommandLineOptionsLabel->setToolTip(Helper::OMCCommandLineOptionsTip);
Expand Down

0 comments on commit d66d325

Please sign in to comment.