Skip to content

Commit

Permalink
Move the nfAPI and nfAPINoise settings to general page (#7171)
Browse files Browse the repository at this point in the history
* Move the nfAPI and nfAPINoise settings to general page

Fixes #6380

* Update users guide
  • Loading branch information
adeas31 committed Feb 17, 2021
1 parent c5c5e43 commit 81e07a0
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 53 deletions.
90 changes: 46 additions & 44 deletions OMEdit/OMEditLIB/Options/OptionsDialog.cpp
Expand Up @@ -214,6 +214,10 @@ void OptionsDialog::readGeneralSettings()
if (mpSettings->contains("createBackupFile")) {
mpGeneralSettingsPage->getCreateBackupFileCheckbox()->setChecked(mpSettings->value("createBackupFile").toBool());
}
// read nfAPINoise
if (mpSettings->contains("simulation/nfAPINoise")) {
mpGeneralSettingsPage->getDisplayNFAPIErrorsWarningsCheckBox()->setChecked(mpSettings->value("simulation/nfAPINoise").toBool());
}
// read library icon size
if (mpSettings->contains("libraryIconSize")) {
mpGeneralSettingsPage->getLibraryIconSizeSpinBox()->setValue(mpSettings->value("libraryIconSize").toInt());
Expand Down Expand Up @@ -257,6 +261,10 @@ void OptionsDialog::readGeneralSettings()
if (mpSettings->contains("replaceableSupport")) {
mpGeneralSettingsPage->setReplaceableSupport(mpSettings->value("replaceableSupport").toBool());
}
// read nfAPI
if (mpSettings->contains("simulation/nfAPI")) {
mpGeneralSettingsPage->getEnableNewInstantiationAPICheckBox()->setChecked(mpSettings->value("simulation/nfAPI").toBool());
}
}

//! Reads the Libraries section settings from omedit.ini
Expand Down Expand Up @@ -642,12 +650,6 @@ void OptionsDialog::readSimulationSettings()
if (mpSettings->contains("simulation/deleteEntireSimulationDirectory")) {
mpSimulationPage->getDeleteEntireSimulationDirectoryCheckBox()->setChecked(mpSettings->value("simulation/deleteEntireSimulationDirectory").toBool());
}
if (mpSettings->contains("simulation/nfAPI")) {
mpSimulationPage->getEnableNewInstantiationAPICheckBox()->setChecked(mpSettings->value("simulation/nfAPI").toBool());
}
if (mpSettings->contains("simulation/nfAPINoise")) {
mpSimulationPage->getDisplayNFAPIErrorsWarningsCheckBox()->setChecked(mpSettings->value("simulation/nfAPINoise").toBool());
}
if (mpSettings->contains("simulation/outputMode")) {
mpSimulationPage->setOutputMode(mpSettings->value("simulation/outputMode").toString());
}
Expand Down Expand Up @@ -1038,6 +1040,11 @@ void OptionsDialog::saveGeneralSettings()
mpSettings->setValue("activateAccessAnnotations", mpGeneralSettingsPage->getActivateAccessAnnotationsComboBox()->itemData(mpGeneralSettingsPage->getActivateAccessAnnotationsComboBox()->currentIndex()).toInt());
// save create backup file
mpSettings->setValue("createBackupFile", mpGeneralSettingsPage->getCreateBackupFileCheckbox()->isChecked());
// save nfAPINoise
mpSettings->setValue("simulation/nfAPINoise", mpGeneralSettingsPage->getDisplayNFAPIErrorsWarningsCheckBox()->isChecked());
if (mpGeneralSettingsPage->getDisplayNFAPIErrorsWarningsCheckBox()->isChecked()) {
MainWindow::instance()->getOMCProxy()->setCommandLineOptions("-d=nfAPINoise");
}
// save library icon size
mpSettings->setValue("libraryIconSize", mpGeneralSettingsPage->getLibraryIconSizeSpinBox()->value());
// save the max. text length to show on a library icon
Expand Down Expand Up @@ -1081,6 +1088,11 @@ void OptionsDialog::saveGeneralSettings()
MainWindow::instance()->updateRecentFileActionsAndList();
// save replaceable support
mpSettings->setValue("replaceableSupport", mpGeneralSettingsPage->getReplaceableSupport());
// save nfAPI
mpSettings->setValue("simulation/nfAPI", mpGeneralSettingsPage->getEnableNewInstantiationAPICheckBox()->isChecked());
if (mpGeneralSettingsPage->getEnableNewInstantiationAPICheckBox()->isChecked()) {
MainWindow::instance()->getOMCProxy()->setCommandLineOptions("-d=nfAPI");
}
}

//! Saves the Libraries section settings to omedit.ini
Expand Down Expand Up @@ -1334,16 +1346,6 @@ void OptionsDialog::saveGlobalSimulationSettings()
} else {
MainWindow::instance()->getOMCProxy()->setCommandLineOptions("+ignoreSimulationFlagsAnnotation=false");
}
// save nfAPI
mpSettings->setValue("simulation/nfAPI", mpSimulationPage->getEnableNewInstantiationAPICheckBox()->isChecked());
if (mpSimulationPage->getEnableNewInstantiationAPICheckBox()->isChecked()) {
MainWindow::instance()->getOMCProxy()->setCommandLineOptions("-d=nfAPI");
}
// save nfAPINoise
mpSettings->setValue("simulation/nfAPINoise", mpSimulationPage->getDisplayNFAPIErrorsWarningsCheckBox()->isChecked());
if (mpSimulationPage->getDisplayNFAPIErrorsWarningsCheckBox()->isChecked()) {
MainWindow::instance()->getOMCProxy()->setCommandLineOptions("-d=nfAPINoise");
}
}

//! Saves the Messages section settings to omedit.ini
Expand Down Expand Up @@ -1927,27 +1929,30 @@ GeneralSettingsPage::GeneralSettingsPage(OptionsDialog *pOptionsDialog)
// create backup file
mpCreateBackupFileCheckbox = new QCheckBox(tr("Create a model.bak-mo backup file when deleting a model."));
mpCreateBackupFileCheckbox->setChecked(true);
/* Display errors/warnings when new instantiation fails in evaluating graphical annotations */
mpDisplayNFAPIErrorsWarningsCheckBox = new QCheckBox(tr("Display errors/warnings when instantiating the graphical annotations"));
// set the layout of general settings group
QGridLayout *generalSettingsLayout = new QGridLayout;
generalSettingsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
generalSettingsLayout->addWidget(mpLanguageLabel, 0, 0);
generalSettingsLayout->addWidget(mpLanguageComboBox, 0, 1, 1, 2);
generalSettingsLayout->addWidget(mpWorkingDirectoryLabel, 1, 0);
generalSettingsLayout->addWidget(mpWorkingDirectoryTextBox, 1, 1);
generalSettingsLayout->addWidget(mpWorkingDirectoryBrowseButton, 1, 2);
generalSettingsLayout->addWidget(mpToolbarIconSizeLabel, 2, 0);
generalSettingsLayout->addWidget(mpToolbarIconSizeSpinBox, 2, 1, 1, 2);
generalSettingsLayout->addWidget(mpPreserveUserCustomizations, 3, 0, 1, 3);
generalSettingsLayout->addWidget(mpTerminalCommandLabel, 4, 0);
generalSettingsLayout->addWidget(mpTerminalCommandTextBox, 4, 1);
generalSettingsLayout->addWidget(mpTerminalCommandBrowseButton, 4, 2);
generalSettingsLayout->addWidget(mpTerminalCommandArgumentsLabel, 5, 0);
generalSettingsLayout->addWidget(mpTerminalCommandArgumentsTextBox, 5, 1, 1, 2);
generalSettingsLayout->addWidget(mpHideVariablesBrowserCheckBox, 6, 0, 1, 3);
generalSettingsLayout->addWidget(mpActivateAccessAnnotationsLabel, 7, 0);
generalSettingsLayout->addWidget(mpActivateAccessAnnotationsComboBox, 7, 1, 1, 2);
generalSettingsLayout->addWidget(mpCreateBackupFileCheckbox, 8, 0, 1, 3);
mpGeneralSettingsGroupBox->setLayout(generalSettingsLayout);
QGridLayout *pGeneralSettingsLayout = new QGridLayout;
pGeneralSettingsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
pGeneralSettingsLayout->addWidget(mpLanguageLabel, 0, 0);
pGeneralSettingsLayout->addWidget(mpLanguageComboBox, 0, 1, 1, 2);
pGeneralSettingsLayout->addWidget(mpWorkingDirectoryLabel, 1, 0);
pGeneralSettingsLayout->addWidget(mpWorkingDirectoryTextBox, 1, 1);
pGeneralSettingsLayout->addWidget(mpWorkingDirectoryBrowseButton, 1, 2);
pGeneralSettingsLayout->addWidget(mpToolbarIconSizeLabel, 2, 0);
pGeneralSettingsLayout->addWidget(mpToolbarIconSizeSpinBox, 2, 1, 1, 2);
pGeneralSettingsLayout->addWidget(mpPreserveUserCustomizations, 3, 0, 1, 3);
pGeneralSettingsLayout->addWidget(mpTerminalCommandLabel, 4, 0);
pGeneralSettingsLayout->addWidget(mpTerminalCommandTextBox, 4, 1);
pGeneralSettingsLayout->addWidget(mpTerminalCommandBrowseButton, 4, 2);
pGeneralSettingsLayout->addWidget(mpTerminalCommandArgumentsLabel, 5, 0);
pGeneralSettingsLayout->addWidget(mpTerminalCommandArgumentsTextBox, 5, 1, 1, 2);
pGeneralSettingsLayout->addWidget(mpHideVariablesBrowserCheckBox, 6, 0, 1, 3);
pGeneralSettingsLayout->addWidget(mpActivateAccessAnnotationsLabel, 7, 0);
pGeneralSettingsLayout->addWidget(mpActivateAccessAnnotationsComboBox, 7, 1, 1, 2);
pGeneralSettingsLayout->addWidget(mpCreateBackupFileCheckbox, 8, 0, 1, 3);
pGeneralSettingsLayout->addWidget(mpDisplayNFAPIErrorsWarningsCheckBox, 9, 0, 1, 3);
mpGeneralSettingsGroupBox->setLayout(pGeneralSettingsLayout);
// Libraries Browser group box
mpLibrariesBrowserGroupBox = new QGroupBox(tr("Libraries Browser"));
// library icon size
Expand Down Expand Up @@ -2033,10 +2038,15 @@ GeneralSettingsPage::GeneralSettingsPage(OptionsDialog *pOptionsDialog)
mpOptionalFeaturesGroupBox = new QGroupBox(tr("Optional Features"));
// handle replaceable support
mpReplaceableSupport = new QCheckBox(tr("Enable Replaceable Support *"));
//! @todo Remove this once we enable this bydefault in OMC.
/* Enable new instantiation use in OMC API */
mpEnableNewInstantiationAPICheckBox = new QCheckBox(tr("Enable new frontend use in the OMC API (faster GUI response)"));
mpEnableNewInstantiationAPICheckBox->setChecked(true);
// Optional Features Layout
QGridLayout *pOptionalFeaturesLayout = new QGridLayout;
pOptionalFeaturesLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
pOptionalFeaturesLayout->addWidget(mpReplaceableSupport, 0, 0);
pOptionalFeaturesLayout->addWidget(mpEnableNewInstantiationAPICheckBox, 1, 0);
mpOptionalFeaturesGroupBox->setLayout(pOptionalFeaturesLayout);
// set the layout
QVBoxLayout *pMainLayout = new QVBoxLayout;
Expand Down Expand Up @@ -3803,12 +3813,6 @@ SimulationPage::SimulationPage(OptionsDialog *pOptionsDialog)
mpIgnoreCommandLineOptionsAnnotationCheckBox = new QCheckBox(tr("Ignore __OpenModelica_commandLineOptions annotation"));
// ignore simulation flags annotation checkbox
mpIgnoreSimulationFlagsAnnotationCheckBox = new QCheckBox(tr("Ignore __OpenModelica_simulationFlags annotation"));
//! @todo Remove this once we enable this bydefault in OMC.
/* Enable new instantiation use in OMC API */
mpEnableNewInstantiationAPICheckBox = new QCheckBox(tr("Enable new frontend use in the OMC API (faster GUI response)"));
mpEnableNewInstantiationAPICheckBox->setChecked(true);
/* Display errors/warnings when new instantiation fails in evaluating graphical annotations */
mpDisplayNFAPIErrorsWarningsCheckBox = new QCheckBox(tr("Display errors/warnings when instantiating the graphical annotations"));
/* save class before simulation checkbox */
mpSaveClassBeforeSimulationCheckBox = new QCheckBox(tr("Save class before simulation"));
mpSaveClassBeforeSimulationCheckBox->setToolTip(tr("Disabling this will effect the debugger functionality."));
Expand Down Expand Up @@ -3872,8 +3876,6 @@ SimulationPage::SimulationPage(OptionsDialog *pOptionsDialog)
pSimulationLayout->addWidget(mpCXXCompilerComboBox, row++, 1);
pSimulationLayout->addWidget(mpIgnoreCommandLineOptionsAnnotationCheckBox, row++, 0, 1, 2);
pSimulationLayout->addWidget(mpIgnoreSimulationFlagsAnnotationCheckBox, row++, 0, 1, 2);
pSimulationLayout->addWidget(mpEnableNewInstantiationAPICheckBox, row++, 0, 1, 2);
pSimulationLayout->addWidget(mpDisplayNFAPIErrorsWarningsCheckBox, row++, 0, 1, 2);
pSimulationLayout->addWidget(mpSaveClassBeforeSimulationCheckBox, row++, 0, 1, 2);
pSimulationLayout->addWidget(mpSwitchToPlottingPerspectiveCheckBox, row++, 0, 1, 2);
pSimulationLayout->addWidget(mpCloseSimulationOutputWidgetsBeforeSimulationCheckBox, row++, 0, 1, 2);
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditLIB/Options/OptionsDialog.h
Expand Up @@ -235,6 +235,7 @@ class GeneralSettingsPage : public QWidget
QCheckBox* getHideVariablesBrowserCheckBox() {return mpHideVariablesBrowserCheckBox;}
QComboBox* getActivateAccessAnnotationsComboBox() {return mpActivateAccessAnnotationsComboBox;}
QCheckBox* getCreateBackupFileCheckbox() {return mpCreateBackupFileCheckbox;}
QCheckBox* getDisplayNFAPIErrorsWarningsCheckBox() {return mpDisplayNFAPIErrorsWarningsCheckBox;}
QSpinBox* getLibraryIconSizeSpinBox() {return mpLibraryIconSizeSpinBox;}
QSpinBox* getLibraryIconTextLengthSpinBox() {return mpLibraryIconTextLengthSpinBox;}
void setShowProtectedClasses(bool value) {mpShowProtectedClasses->setChecked(value);}
Expand All @@ -250,6 +251,7 @@ class GeneralSettingsPage : public QWidget
QSpinBox* getRecentFilesAndLatestNewsSizeSpinBox() {return mpRecentFilesAndLatestNewsSizeSpinBox;}
void setReplaceableSupport(bool value) {mpReplaceableSupport->setChecked(value);}
bool getReplaceableSupport() {return mpReplaceableSupport->isChecked();}
QCheckBox* getEnableNewInstantiationAPICheckBox() {return mpEnableNewInstantiationAPICheckBox;}
private:
OptionsDialog *mpOptionsDialog;
QGroupBox *mpGeneralSettingsGroupBox;
Expand All @@ -270,6 +272,7 @@ class GeneralSettingsPage : public QWidget
Label *mpActivateAccessAnnotationsLabel;
QComboBox *mpActivateAccessAnnotationsComboBox;
QCheckBox *mpCreateBackupFileCheckbox;
QCheckBox *mpDisplayNFAPIErrorsWarningsCheckBox;
QGroupBox *mpLibrariesBrowserGroupBox;
Label *mpLibraryIconSizeLabel;
QSpinBox *mpLibraryIconSizeSpinBox;
Expand All @@ -289,6 +292,7 @@ class GeneralSettingsPage : public QWidget
QSpinBox *mpRecentFilesAndLatestNewsSizeSpinBox;
QGroupBox *mpOptionalFeaturesGroupBox;
QCheckBox *mpReplaceableSupport;
QCheckBox *mpEnableNewInstantiationAPICheckBox;
public slots:
void selectWorkingDirectory();
void selectTerminalCommand();
Expand Down Expand Up @@ -605,8 +609,6 @@ class SimulationPage : public QWidget
QComboBox* getCXXCompilerComboBox() {return mpCXXCompilerComboBox;}
QCheckBox* getIgnoreCommandLineOptionsAnnotationCheckBox() {return mpIgnoreCommandLineOptionsAnnotationCheckBox;}
QCheckBox* getIgnoreSimulationFlagsAnnotationCheckBox() {return mpIgnoreSimulationFlagsAnnotationCheckBox;}
QCheckBox* getEnableNewInstantiationAPICheckBox() {return mpEnableNewInstantiationAPICheckBox;}
QCheckBox* getDisplayNFAPIErrorsWarningsCheckBox() {return mpDisplayNFAPIErrorsWarningsCheckBox;}
QCheckBox* getSaveClassBeforeSimulationCheckBox() {return mpSaveClassBeforeSimulationCheckBox;}
QCheckBox* getSwitchToPlottingPerspectiveCheckBox() {return mpSwitchToPlottingPerspectiveCheckBox;}
QCheckBox* getCloseSimulationOutputWidgetsBeforeSimulationCheckBox() {return mpCloseSimulationOutputWidgetsBeforeSimulationCheckBox;}
Expand All @@ -630,8 +632,6 @@ class SimulationPage : public QWidget
QComboBox *mpCXXCompilerComboBox;
QCheckBox *mpIgnoreCommandLineOptionsAnnotationCheckBox;
QCheckBox *mpIgnoreSimulationFlagsAnnotationCheckBox;
QCheckBox *mpEnableNewInstantiationAPICheckBox;
QCheckBox *mpDisplayNFAPIErrorsWarningsCheckBox;
QCheckBox *mpSaveClassBeforeSimulationCheckBox;
QCheckBox *mpSwitchToPlottingPerspectiveCheckBox;
QCheckBox *mpCloseSimulationOutputWidgetsBeforeSimulationCheckBox;
Expand Down
10 changes: 5 additions & 5 deletions doc/UsersGuide/source/omedit.rst
Expand Up @@ -1036,6 +1036,9 @@ General

- *Create a model.bak-mo backup file when deleting a model*

- *Display errors/warnings when instantiating the graphical annotations* - if true then the errors/warnings
are shown when using OMC API for graphical annotations.

- Libraries Browser

- *Library Icon Size* – Sets the size for library icons.
Expand Down Expand Up @@ -1068,6 +1071,8 @@ General

- *Enable replaceable support* - Enables/disables the replaceable support.

- *Enable new frontend use in OMC API (faster GUI response)* - if true then uses the new frontend in OMC API calls.

Libraries
~~~~~~~~~

Expand Down Expand Up @@ -1289,11 +1294,6 @@ Simulation
- *Ignore __OpenModelica_simulationFlags annotation* – if true then ignores the __OpenModelica_simulationFlags
annotation while running the simulation.

- *Enable new frontend use in OMC API (faster GUI response)* - if true then uses the new frontend in OMC API calls.

- *Display errors/warnings when instantiating the graphical annotations* - if true then the errors/warnings
are shown when using OMC API for graphical annotations.

- *Save class before simulation* – if true then always saves the class before running the simulation.

- *Switch to plotting perspective after simulation* – if true then GUI always switches to plotting
Expand Down

0 comments on commit 81e07a0

Please sign in to comment.