Skip to content

Commit

Permalink
Renamed TLMCoSimulationExperimentSettingDialog to MetaModelSimulation…
Browse files Browse the repository at this point in the history
…ParamsDialog.

Moved the update simulation params context menu to ModelWidget.
  • Loading branch information
adeas31 committed Mar 14, 2016
1 parent aca17d2 commit c6a2ce1
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 92 deletions.
30 changes: 0 additions & 30 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -202,8 +202,6 @@ MainWindow::MainWindow(QSplashScreen *pSplashScreen, bool debug, QWidget *parent
mpSimulationDialog = new SimulationDialog(this);
// Create TLM co-simulation dialog
mpTLMCoSimulationDialog = new TLMCoSimulationDialog(this);
// Create TLM co-simulation experiment setting dialog
mpTLMCoSimulationExperimentSettingDialog = new TLMCoSimulationExperimentSettingDialog(this);
// Create an object of PlotWindowContainer
mpPlotWindowContainer = new PlotWindowContainer(this);
// create an object of VariablesWidget
Expand Down Expand Up @@ -620,7 +618,6 @@ void MainWindow::beforeClosingMainWindow()
delete mpDebuggerMainWindow;
delete mpSimulationDialog;
delete mpTLMCoSimulationDialog;
delete mpTLMCoSimulationExperimentSettingDialog;
/* save the TransformationsWidget last window geometry and splitters state. */
QSettings *pSettings = OpenModelica::getApplicationSettings();
QHashIterator<QString, TransformationsWidget*> transformationsWidgets(mTransformationsWidgetHash);
Expand Down Expand Up @@ -957,16 +954,6 @@ void MainWindow::fetchInterfaceData(LibraryTreeItem *pLibraryTreeItem)
}
}

/*!
* \brief MainWindow::TLMCoSimulationExperimentSettings
* \param pLibraryTreeItem
* Showsthe TLM co-simulation experiment setting dialog.
*/
void MainWindow::TLMCoSimulationExperimentSettings(LibraryTreeItem *pLibraryTreeItem)
{
mpTLMCoSimulationExperimentSettingDialog->show(pLibraryTreeItem);
}

/*!
* \brief MainWindow::TLMSimulate
* \param pLibraryTreeItem
Expand Down Expand Up @@ -1987,19 +1974,6 @@ void MainWindow::exportToClipboard()
exportModelAsImage(true);
}

/*!
* \brief MainWindow::TLMCoSimulationExperimentSettings
* Slot activated when mpTLMCoSimulationExperimentSettingAction triggered signal is raised.
* Calls the function that opens the TLM Co-Simulation experiment setting dialog.
*/
void MainWindow::TLMCoSimulationExperimentSettings()
{
ModelWidget *pModelWidget = mpModelWidgetContainer->getCurrentModelWidget();
if (pModelWidget) {
TLMCoSimulationExperimentSettings(pModelWidget->getLibraryTreeItem());
}
}

/*!
* \brief MainWindow::fetchInterfaceData
* Slot activated when mpFetchInterfaceDataAction triggered signal is raised.
Expand Down Expand Up @@ -2842,10 +2816,6 @@ void MainWindow::createActions()
mpTLMCoSimulationAction->setStatusTip(Helper::tlmCoSimulationSetupTip);
mpTLMCoSimulationAction->setEnabled(false);
connect(mpTLMCoSimulationAction, SIGNAL(triggered()), SLOT(TLMSimulate()));
// Set TLM Co-Simulation experiment setting
mpTLMCoSimulationExperimentSettingAction = new QAction(Helper::tlmCoSimulationExperimentSetting, this);
mpTLMCoSimulationExperimentSettingAction->setStatusTip(Helper::tlmCoSimulationExperimentSettingTip);
connect(mpTLMCoSimulationExperimentSettingAction, SIGNAL(triggered()), SLOT(TLMCoSimulationExperimentSettings()));
}

//! Creates the menus
Expand Down
6 changes: 0 additions & 6 deletions OMEdit/OMEditGUI/MainWindow.h
Expand Up @@ -84,7 +84,6 @@ class DocumentationWidget;
class VariablesWidget;
class SimulationDialog;
class TLMCoSimulationDialog;
class TLMCoSimulationExperimentSettingDialog;
class PlotWindowContainer;
class ModelWidgetContainer;
class DebuggerMainWindow;
Expand Down Expand Up @@ -156,7 +155,6 @@ class MainWindow : public QMainWindow
QAction* getConnectModeAction();
QAction* getFetchInterfaceDataAction() {return mpFetchInterfaceDataAction;}
QAction* getTLMSimulationAction() {return mpTLMCoSimulationAction;}
QAction* getTLMCoSimulationExperimentSettingAction() {return mpTLMCoSimulationExperimentSettingAction;}
void addRecentFile(const QString &fileName, const QString &encoding);
void updateRecentFileActions();
void closeEvent(QCloseEvent *event);
Expand All @@ -176,7 +174,6 @@ class MainWindow : public QMainWindow
void exportModelFigaro(LibraryTreeItem *pLibraryTreeItem);
void fetchInterfaceData(LibraryTreeItem *pLibraryTreeItem);
void TLMSimulate(LibraryTreeItem *pLibraryTreeItem);
void TLMCoSimulationExperimentSettings(LibraryTreeItem *pLibraryTreeItem);
void exportModelToOMNotebook(LibraryTreeItem *pLibraryTreeItem);
void createOMNotebookTitleCell(LibraryTreeItem *pLibraryTreeItem, QDomDocument xmlDocument, QDomElement domElement);
void createOMNotebookImageCell(LibraryTreeItem *pLibraryTreeItem, QDomDocument xmlDocument, QDomElement domElement, QString filePath);
Expand Down Expand Up @@ -206,7 +203,6 @@ class MainWindow : public QMainWindow
QDockWidget *mpVariablesDockWidget;
SimulationDialog *mpSimulationDialog;
TLMCoSimulationDialog *mpTLMCoSimulationDialog;
TLMCoSimulationExperimentSettingDialog *mpTLMCoSimulationExperimentSettingDialog;
PlotWindowContainer *mpPlotWindowContainer;
QList<Qt::WindowStates> mPlotWindowsStatesList;
QList<QByteArray> mPlotWindowsGeometriesList;
Expand Down Expand Up @@ -318,7 +314,6 @@ class MainWindow : public QMainWindow
// TLM Simulation Action
QAction *mpFetchInterfaceDataAction;
QAction *mpTLMCoSimulationAction;
QAction *mpTLMCoSimulationExperimentSettingAction;
// Toolbars
QMenu *mpRecentFilesMenu;
QMenu *mpLibrariesMenu;
Expand Down Expand Up @@ -381,7 +376,6 @@ public slots:
void exportToClipboard();
void fetchInterfaceData();
void TLMSimulate();
void TLMCoSimulationExperimentSettings();
void openWorkingDirectory();
void openTerminal();
void openConfigurationOptions();
Expand Down
17 changes: 0 additions & 17 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -2271,10 +2271,6 @@ void LibraryTreeView::createActions()
mpTLMCoSimulationAction = new QAction(QIcon(":/Resources/icons/tlm-simulate.svg"), Helper::tlmCoSimulationSetup, this);
mpTLMCoSimulationAction->setStatusTip(Helper::tlmCoSimulationSetupTip);
connect(mpTLMCoSimulationAction, SIGNAL(triggered()), SLOT(TLMSimulate()));
// Set TLM Co-Simulation experiment setting
mpTLMCoSimulationExperimentSettingAction = new QAction(Helper::tlmCoSimulationExperimentSetting, this);
mpTLMCoSimulationExperimentSettingAction->setStatusTip(Helper::tlmCoSimulationExperimentSettingTip);
connect(mpTLMCoSimulationExperimentSettingAction, SIGNAL(triggered()), SLOT(TLMCoSimulationExperimentSetting()));
}

/*!
Expand Down Expand Up @@ -2411,7 +2407,6 @@ void LibraryTreeView::showContextMenu(QPoint point)
menu.addAction(mpUnloadMetaModelFileAction);
break;
case LibraryTreeItem::MetaModel:
menu.addAction(mpTLMCoSimulationExperimentSettingAction);
menu.addAction(mpFetchInterfaceDataAction);
menu.addAction(mpTLMCoSimulationAction);
menu.addSeparator();
Expand Down Expand Up @@ -2714,18 +2709,6 @@ void LibraryTreeView::updateBindings()
}
}

/*!
* \brief LibraryTreeView::TLMCoSimulate experiment setting
* Opens the TLM co-simulation experimet setting dialog for the selected LibraryTreeItem.
*/
void LibraryTreeView::TLMCoSimulationExperimentSetting()
{
LibraryTreeItem *pLibraryTreeItem = getSelectedLibraryTreeItem();
if (pLibraryTreeItem) {
mpLibraryWidget->getMainWindow()->TLMCoSimulationExperimentSettings(pLibraryTreeItem);
}
}

/*!
* \brief LibraryTreeView::fetchInterfaceData
* Slot activated when mpFetchInterfaceDataAction triggered signal is raised.
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.h
Expand Up @@ -307,7 +307,6 @@ class LibraryTreeView : public QTreeView
QAction *mpUpdateBindingsAction;
QAction *mpFetchInterfaceDataAction;
QAction *mpTLMCoSimulationAction;
QAction *mpTLMCoSimulationExperimentSettingAction;
void createActions();
LibraryTreeItem* getSelectedLibraryTreeItem();
void libraryTreeItemExpanded(LibraryTreeItem* pLibraryTreeItem);
Expand Down Expand Up @@ -340,7 +339,6 @@ public slots:
void updateBindings();
void fetchInterfaceData();
void TLMSimulate();
void TLMCoSimulationExperimentSetting();
protected:
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void startDrag(Qt::DropActions supportedActions);
Expand Down
41 changes: 37 additions & 4 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -894,26 +894,44 @@ bool GraphicsView::hasAnnotation()
return false;
}

/*!
* \brief GraphicsView::addItem
* Adds the QGraphicsItem from GraphicsView
* \param pGraphicsItem
*/
void GraphicsView::addItem(QGraphicsItem *pGraphicsItem)
{
if (!scene()->items().contains(pGraphicsItem)) {
scene()->addItem(pGraphicsItem);
}
}

/*!
* \brief GraphicsView::removeItem
* Removes the QGraphicsItem from GraphicsView
* \param pGraphicsItem
*/
void GraphicsView::removeItem(QGraphicsItem *pGraphicsItem)
{
if (scene()->items().contains(pGraphicsItem)) {
scene()->removeItem(pGraphicsItem);
}
}

/*!
* \brief GraphicsView::createActions
* Creates the actions for the GraphicsView.
*/
void GraphicsView::createActions()
{
bool isSystemLibrary = mpModelWidget->getLibraryTreeItem()->isSystemLibrary();
// Graphics View Properties Action
mpPropertiesAction = new QAction(Helper::properties, this);
connect(mpPropertiesAction, SIGNAL(triggered()), SLOT(showGraphicsViewProperties()));
// Simulation Params Action
mpSimulationParamsAction = new QAction(Helper::simulationParams, this);
mpSimulationParamsAction->setStatusTip(Helper::simulationParamsTip);
connect(mpSimulationParamsAction, SIGNAL(triggered()), SLOT(showSimulationParamsDialog()));
// Actions for shapes and Components
// Manhattanize Action
mpManhattanizeAction = new QAction(tr("Manhattanize"), this);
Expand Down Expand Up @@ -1275,6 +1293,16 @@ void GraphicsView::showGraphicsViewProperties()
pGraphicsViewProperties->exec();
}

/*!
* \brief GraphicsView::showSimulationParamsDialog
* Opens the MetaModelSimulationParamsDialog.
*/
void GraphicsView::showSimulationParamsDialog()
{
MetaModelSimulationParamsDialog *pMetaModelSimulationParamsDialog = new MetaModelSimulationParamsDialog(this);
pMetaModelSimulationParamsDialog->exec();
}

/*!
* \brief GraphicsView::manhattanizeItems
* Manhattanize the selected items by emitting GraphicsView::mouseManhattanize() SIGNAL.
Expand Down Expand Up @@ -1931,8 +1959,13 @@ void GraphicsView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(mpModelWidget->getModelWidgetContainer()->getMainWindow()->getExportToOMNotebookAction());
menu.addSeparator();
menu.addAction(mpModelWidget->getModelWidgetContainer()->getMainWindow()->getPrintModelAction());
menu.addSeparator();
menu.addAction(mpPropertiesAction);
if (mpModelWidget->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::Modelica) {
menu.addSeparator();
menu.addAction(mpPropertiesAction);
} else if (mpModelWidget->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::MetaModel) {
menu.addSeparator();
menu.addAction(mpSimulationParamsAction);
}
menu.exec(event->globalPos());
return; // return from it because at a time we only want one context menu.
}
Expand Down Expand Up @@ -4191,8 +4224,8 @@ void ModelWidgetContainer::currentModelWidgetChanged(QMdiSubWindow *pSubWindow)
getMainWindow()->getExportXMLAction()->setEnabled(enabled && modelica);
getMainWindow()->getExportFigaroAction()->setEnabled(enabled && modelica);
getMainWindow()->getExportToOMNotebookAction()->setEnabled(enabled && modelica);
getMainWindow()->getExportAsImageAction()->setEnabled(enabled && modelica);
getMainWindow()->getExportToClipboardAction()->setEnabled(enabled && modelica);
getMainWindow()->getExportAsImageAction()->setEnabled(enabled);
getMainWindow()->getExportToClipboardAction()->setEnabled(enabled);
getMainWindow()->getPrintModelAction()->setEnabled(enabled);
getMainWindow()->getFetchInterfaceDataAction()->setEnabled(enabled && metaModel);
getMainWindow()->getTLMSimulationAction()->setEnabled(enabled && metaModel);
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.h
Expand Up @@ -108,6 +108,7 @@ class GraphicsView : public QGraphicsView
TextAnnotation *mpTextShapeAnnotation;
BitmapAnnotation *mpBitmapShapeAnnotation;
QAction *mpPropertiesAction;
QAction *mpSimulationParamsAction;
QAction *mpManhattanizeAction;
QAction *mpDeleteAction;
QAction *mpBringToFrontAction;
Expand Down Expand Up @@ -254,6 +255,7 @@ public slots:
void clearSelection();
void addClassAnnotation(bool alwaysAdd = true);
void showGraphicsViewProperties();
void showSimulationParamsDialog();
void manhattanizeItems();
void deleteItems();
void duplicateItems();
Expand Down
44 changes: 21 additions & 23 deletions OMEdit/OMEditGUI/TLM/TLMCoSimulationDialog.cpp
Expand Up @@ -395,11 +395,18 @@ void TLMCoSimulationDialog::runTLMCoSimulation()
}
}

TLMCoSimulationExperimentSettingDialog::TLMCoSimulationExperimentSettingDialog(MainWindow *pMainWindow)
: QDialog(pMainWindow, Qt::WindowTitleHint)
/*!
* \brief MetaModelSimulationParamsDialog::MetaModelSimulationParamsDialog
* \param pGraphicsView
*/
MetaModelSimulationParamsDialog::MetaModelSimulationParamsDialog(GraphicsView *pGraphicsView)
: QDialog(pGraphicsView, Qt::WindowTitleHint)
{
mpMainWindow = pMainWindow;
setMinimumWidth(300);
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(QString("%1 - %2 - %3").arg(Helper::applicationName).arg(Helper::simulationParams)
.arg(pGraphicsView->getModelWidget()->getLibraryTreeItem()->getNameStructure()));
setMinimumWidth(400);
mpGraphicsView = pGraphicsView;
// CoSimulation Interval
mpStartTimeLabel = new Label(tr("Start Time:"));
mpStartTimeTextBox = new QLineEdit("0");
Expand Down Expand Up @@ -435,30 +442,21 @@ TLMCoSimulationExperimentSettingDialog::TLMCoSimulationExperimentSettingDialog(M
}

/*!
Reimplementation of QDialog::show method.
\param pLibraryTreeItem - pointer to LibraryTreeItem
*/
void TLMCoSimulationExperimentSettingDialog::show(LibraryTreeItem *pLibraryTreeItem)
{
mpLibraryTreeItem = pLibraryTreeItem;
setWindowTitle(QString("%1 - %2 - %3").arg(Helper::applicationName).arg(Helper::tlmCoSimulationExperimentSetting).arg(mpLibraryTreeItem->getNameStructure()));
setVisible(true);
}

/*!
Saves the TLM Co-Simulation experiment setting.
Slot activated when mpSave button clicked signal is raised.
*/
void TLMCoSimulationExperimentSettingDialog::saveExperimentSettings()
* \brief MetaModelSimulationParamsDialog::saveExperimentSettings
* Saves the Simulation Params setting.
* Slot activated when mpSave button clicked signal is raised.
*/
void MetaModelSimulationParamsDialog::saveExperimentSettings()
{

}

/*!
Saves the TLM Co-Simulation experiment setting and start the co-simulation.
Slot activated when mpSaveAndCoSimulateButton clicked signal is raised.
*/
void TLMCoSimulationExperimentSettingDialog::saveExperimentSettingsAndCoSimulate()
* \brief MetaModelSimulationParamsDialog::saveExperimentSettingsAndCoSimulate
* Saves the Simulation Params experiment setting and starts the co-simulation.
* Slot activated when mpSaveAndCoSimulateButton clicked signal is raised.
*/
void MetaModelSimulationParamsDialog::saveExperimentSettingsAndCoSimulate()
{

}
7 changes: 3 additions & 4 deletions OMEdit/OMEditGUI/TLM/TLMCoSimulationDialog.h
Expand Up @@ -97,14 +97,13 @@ private slots:
void runTLMCoSimulation();
};

class TLMCoSimulationExperimentSettingDialog : public QDialog
class MetaModelSimulationParamsDialog : public QDialog
{
Q_OBJECT
public:
TLMCoSimulationExperimentSettingDialog(MainWindow *pMainWindow);
void show(LibraryTreeItem *pLibraryTreeItem);
MetaModelSimulationParamsDialog(GraphicsView *pGraphicsView);
private:
MainWindow *mpMainWindow;
GraphicsView *mpGraphicsView;
LibraryTreeItem *mpLibraryTreeItem;
Label *mpStartTimeLabel;
QLineEdit *mpStartTimeTextBox;
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/Util/Helper.cpp
Expand Up @@ -295,8 +295,8 @@ QString Helper::fetchInterfaceDataTip;
QString Helper::tlmCoSimulationSetup;
QString Helper::tlmCoSimulationSetupTip;
QString Helper::tlmCoSimulation;
QString Helper::tlmCoSimulationExperimentSetting;
QString Helper::tlmCoSimulationExperimentSettingTip;
QString Helper::simulationParams;
QString Helper::simulationParamsTip;
QString Helper::running;
QString Helper::finished;
QString Helper::newVariable;
Expand Down Expand Up @@ -493,8 +493,8 @@ void Helper::initHelperVariables()
Helper::tlmCoSimulationSetup = tr("TLM Co-Simulation Setup");
Helper::tlmCoSimulationSetupTip = tr("Opens the TLM co-simulation setup");
Helper::tlmCoSimulation = tr("TLM Co-Simulation");
Helper::tlmCoSimulationExperimentSetting = tr("Edit Experiment Setting");
Helper::tlmCoSimulationExperimentSettingTip = tr("Opens the TLM co-simulation experiment setting");
Helper::simulationParams = tr("Simulation Parameters");
Helper::simulationParamsTip = tr("Shows the Simulation Parameters dialog");
Helper::running = tr("Running");
Helper::finished = tr("Finished");
Helper::newVariable = tr("<New Variable>");
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Util/Helper.h
Expand Up @@ -302,8 +302,8 @@ class Helper : public QObject
static QString tlmCoSimulationSetup;
static QString tlmCoSimulationSetupTip;
static QString tlmCoSimulation;
static QString tlmCoSimulationExperimentSetting;
static QString tlmCoSimulationExperimentSettingTip;
static QString simulationParams;
static QString simulationParamsTip;
static QString running;
static QString finished;
static QString newVariable;
Expand Down

0 comments on commit c6a2ce1

Please sign in to comment.