Skip to content

Commit

Permalink
Ask user to switch to new frontend on startup (#7461)
Browse files Browse the repository at this point in the history
* Ask user to switch to new frontend on startup

Fixes #7456

* Set omc options
  • Loading branch information
adeas31 committed May 12, 2021
1 parent 83d78e8 commit c910821
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions OMEdit/OMEditLIB/OMEditApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include "Util/Helper.h"
#include "MainWindow.h"
#include "Modeling/LibraryTreeWidget.h"
//! @todo Remove this once new frontend is used as default and old frontend is removed.
#include "Options/OptionsDialog.h"
#include "Simulation/TranslationFlagsWidget.h"

#include <locale.h>
#include <QMessageBox>
Expand Down Expand Up @@ -163,6 +166,28 @@ OMEditApplication::OMEditApplication(int &argc, char **argv, threadData_t* threa
pMainwindow->show();
// hide the splash screen
SplashScreen::instance()->finish(pMainwindow);
//! @todo Remove this once new frontend is used as default and old frontend is removed.
//! Fixes issue #7456
if (OptionsDialog::instance()->getSimulationPage()->getTranslationFlagsWidget()->getOldInstantiationCheckBox()->isChecked()) {
QMessageBox *pMessageBox = new QMessageBox;
pMessageBox->setWindowTitle(QString("%1 - %2").arg(Helper::applicationName, Helper::question));
pMessageBox->setIcon(QMessageBox::Question);
pMessageBox->setAttribute(Qt::WA_DeleteOnClose);
pMessageBox->setText(tr("You have enabled old frontend for code generation which is not recommended. Do you want to switch to new frontend?"));
pMessageBox->addButton(tr("Switch to new frontend"), QMessageBox::AcceptRole);
pMessageBox->addButton(tr("Keep using old frontend"), QMessageBox::RejectRole);
int answer = pMessageBox->exec();
switch (answer) {
case QMessageBox::AcceptRole:
OptionsDialog::instance()->getSimulationPage()->getTranslationFlagsWidget()->getOldInstantiationCheckBox()->setChecked(false);
Utilities::getApplicationSettings()->setValue("simulation/newInst", true);
OptionsDialog::instance()->saveSimulationSettings();
break;
case QMessageBox::RejectRole:
default:
break;
}
}
}
}

Expand Down

0 comments on commit c910821

Please sign in to comment.