Skip to content

Commit

Permalink
Added button for calling MetaModelEditor::alignInterfaces function.
Browse files Browse the repository at this point in the history
Added AlignInterfacesDialog class.
SVG icons for simulation parameters and align interfaces.
  • Loading branch information
adeas31 committed Mar 26, 2016
1 parent 8d5d64f commit 373069e
Show file tree
Hide file tree
Showing 24 changed files with 484 additions and 72 deletions.
12 changes: 4 additions & 8 deletions OMEdit/OMEditGUI/Annotations/LineAnnotation.cpp
Expand Up @@ -1147,13 +1147,9 @@ CreateConnectionDialog::CreateConnectionDialog(GraphicsView *pGraphicsView, Line
setWindowTitle(QString(Helper::applicationName).append(" - ").append(Helper::createConnection));
setAttribute(Qt::WA_DeleteOnClose);
// heading
mpHeading = new Label(Helper::createConnection);
mpHeading->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpHeading->setAlignment(Qt::AlignTop);
mpHeading = Utilities::getHeadingLabel(Helper::createConnection);
// horizontal line
mpHorizontalLine = new QFrame();
mpHorizontalLine->setFrameShape(QFrame::HLine);
mpHorizontalLine->setFrameShadow(QFrame::Sunken);
mpHorizontalLine = Utilities::getHeadingLine();
// Start expandable connector treeview
mpStartExpandableConnectorTreeView = 0;
if ((!mpConnectionLineAnnotation->getStartComponent()->getParentComponent() && mpConnectionLineAnnotation->getStartComponent()->getRootParentComponent()->getLibraryTreeItem()->getRestriction() == StringHandler::ExpandableConnector) ||
Expand Down Expand Up @@ -1235,7 +1231,7 @@ CreateConnectionDialog::CreateConnectionDialog(GraphicsView *pGraphicsView, Line
// Create the buttons
mpOkButton = new QPushButton(Helper::ok);
mpOkButton->setAutoDefault(true);
connect(mpOkButton, SIGNAL(clicked()), SLOT(createArrayConnection()));
connect(mpOkButton, SIGNAL(clicked()), SLOT(createConnection()));
mpCancelButton = new QPushButton(Helper::cancel);
mpCancelButton->setAutoDefault(false);
connect(mpCancelButton, SIGNAL(clicked()), SLOT(reject()));
Expand Down Expand Up @@ -1470,7 +1466,7 @@ void CreateConnectionDialog::endConnectorChanged(const QModelIndex &current, con
* \brief ConnectionArray::createArrayConnection
* Slot activated when mpOkButton clicked SIGNAL is raised. Creates an array connection.
*/
void CreateConnectionDialog::createArrayConnection()
void CreateConnectionDialog::createConnection()
{
QString startComponentName, endComponentName;
// set start component name
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Annotations/LineAnnotation.h
Expand Up @@ -226,7 +226,7 @@ class CreateConnectionDialog : public QDialog
public slots:
void startConnectorChanged(const QModelIndex &current, const QModelIndex &previous);
void endConnectorChanged(const QModelIndex &current, const QModelIndex &previous);
void createArrayConnection();
void createConnection();
};

#endif // LINEANNOTATION_H
8 changes: 2 additions & 6 deletions OMEdit/OMEditGUI/Annotations/ShapePropertiesDialog.cpp
Expand Up @@ -56,13 +56,9 @@ ShapePropertiesDialog::ShapePropertiesDialog(ShapeAnnotation *pShapeAnnotation,
setWindowTitle(QString(Helper::applicationName).append(" - ").append(title).append(" ").append(Helper::properties));
setAttribute(Qt::WA_DeleteOnClose);
// heading label
mpShapePropertiesHeading = new Label(QString(title).append(" ").append(Helper::properties));
mpShapePropertiesHeading->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpShapePropertiesHeading->setAlignment(Qt::AlignTop);
mpShapePropertiesHeading = Utilities::getHeadingLabel(QString(title).append(" ").append(Helper::properties));
// set separator line
mHorizontalLine = new QFrame();
mHorizontalLine->setFrameShape(QFrame::HLine);
mHorizontalLine->setFrameShadow(QFrame::Sunken);
mHorizontalLine = Utilities::getHeadingLine();
// Transformations Group Box
mpTransformationGroupBox = new QGroupBox(tr("Transformation"));
mpOriginXLabel = new Label(Helper::originX);
Expand Down
16 changes: 4 additions & 12 deletions OMEdit/OMEditGUI/Component/ComponentProperties.cpp
Expand Up @@ -555,13 +555,9 @@ ComponentParameters::~ComponentParameters()
void ComponentParameters::setUpDialog()
{
// heading label
mpParametersHeading = new Label(Helper::parameters);
mpParametersHeading->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpParametersHeading->setAlignment(Qt::AlignTop);
mpParametersHeading = Utilities::getHeadingLabel(Helper::parameters);
// set separator line
mHorizontalLine = new QFrame();
mHorizontalLine->setFrameShape(QFrame::HLine);
mHorizontalLine->setFrameShadow(QFrame::Sunken);
mHorizontalLine = Utilities::getHeadingLine();
// parameters tab widget
mpParametersTabWidget = new QTabWidget;
// Component Group Box
Expand Down Expand Up @@ -1140,13 +1136,9 @@ ComponentAttributes::ComponentAttributes(Component *pComponent, MainWindow *pMai
void ComponentAttributes::setUpDialog()
{
// heading label
mpAttributesHeading = new Label(Helper::attributes);
mpAttributesHeading->setFont(QFont("", Helper::headingFontSize));
mpAttributesHeading->setAlignment(Qt::AlignTop);
mpAttributesHeading = Utilities::getHeadingLabel(Helper::attributes);
// set separator line
mHorizontalLine = new QFrame();
mHorizontalLine->setFrameShape(QFrame::HLine);
mHorizontalLine->setFrameShadow(QFrame::Sunken);
mHorizontalLine = Utilities::getHeadingLine();
// create Type Group Box
mpTypeGroupBox = new QGroupBox(Helper::type);
QGridLayout *pTypeGroupBoxLayout = new QGridLayout;
Expand Down
7 changes: 2 additions & 5 deletions OMEdit/OMEditGUI/CrashReport/CrashReportDialog.cpp
Expand Up @@ -50,12 +50,9 @@ CrashReportDialog::CrashReportDialog()
setWindowTitle(QString(Helper::applicationName).append(" - ").append(Helper::crashReport));
setAttribute(Qt::WA_DeleteOnClose);
// set heading
mpCrashReportHeading = new Label(Helper::crashReport);
mpCrashReportHeading->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpCrashReportHeading = Utilities::getHeadingLabel(Helper::crashReport);
// set separator line
mpHorizontalLine = new QFrame();
mpHorizontalLine->setFrameShape(QFrame::HLine);
mpHorizontalLine->setFrameShadow(QFrame::Sunken);
mpHorizontalLine = Utilities::getHeadingLine();
// Email label and textbox
mpEmailLabel = new Label(tr("Your Email (in case you want us to contact you regarding this error):"));
mpEmailTextBox = new QLineEdit;
Expand Down
20 changes: 10 additions & 10 deletions OMEdit/OMEditGUI/Editors/MetaModelEditor.cpp
Expand Up @@ -111,6 +111,16 @@ QDomElement MetaModelEditor::getSubModelsElement()
return QDomElement();
}

/*!
* \brief MetaModelEditor::getSubModels
* Returns the list of SubModel tags.
* \return
*/
QDomNodeList MetaModelEditor::getSubModels()
{
return mXmlDocument.elementsByTagName("SubModel");
}

/*!
* \brief MetaModelEditor::getConnectionsElement
* Returns the Connections element tag.
Expand All @@ -125,16 +135,6 @@ QDomElement MetaModelEditor::getConnectionsElement()
return QDomElement();
}

/*!
* \brief MetaModelEditor::getSubModels
* Returns the list of SubModel tags.
* \return
*/
QDomNodeList MetaModelEditor::getSubModels()
{
return mXmlDocument.elementsByTagName("SubModel");
}

/*!
* \brief MetaModelEditor::getConnections
* Returns the list of Connection tags.
Expand Down
7 changes: 2 additions & 5 deletions OMEdit/OMEditGUI/FMI/ImportFMUDialog.cpp
Expand Up @@ -55,12 +55,9 @@ ImportFMUDialog::ImportFMUDialog(MainWindow *pParent)
// set parent widget
mpMainWindow = pParent;
// set import heading
mpImportFMUHeading = new Label(Helper::importFMU);
mpImportFMUHeading->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpImportFMUHeading = Utilities::getHeadingLabel(Helper::importFMU);
// set separator line
mpHorizontalLine = new QFrame();
mpHorizontalLine->setFrameShape(QFrame::HLine);
mpHorizontalLine->setFrameShadow(QFrame::Sunken);
mpHorizontalLine = Utilities::getHeadingLine();
// create FMU File selection controls
mpFmuFileLabel = new Label(tr("FMU File:"));
mpFmuFileTextBox = new QLineEdit;
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/FMI/ImportFMUDialog.h
Expand Up @@ -47,8 +47,8 @@ class ImportFMUDialog : public QDialog
Q_OBJECT
public:
ImportFMUDialog(MainWindow *pParent = 0);
MainWindow *mpMainWindow;
private:
MainWindow *mpMainWindow;
Label *mpImportFMUHeading;
QFrame *mpHorizontalLine;
Label *mpFmuFileLabel;
Expand Down
10 changes: 10 additions & 0 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -2520,10 +2520,16 @@ void MainWindow::createActions()
mpExportToClipboardAction->setStatusTip(Helper::exportAsImageTip);
mpExportToClipboardAction->setEnabled(false);
connect(mpExportToClipboardAction, SIGNAL(triggered()), SLOT(exportToClipboard()));
// simulation parameters
mpSimulationParamsAction = new QAction(QIcon(":/Resources/icons/simulation-parameters.svg"), Helper::simulationParams, this);
mpSimulationParamsAction->setStatusTip(Helper::simulationParamsTip);
// fetch interface data
mpFetchInterfaceDataAction = new QAction(QIcon(":/Resources/icons/interface-data.svg"), Helper::fetchInterfaceData, this);
mpFetchInterfaceDataAction->setStatusTip(Helper::fetchInterfaceDataTip);
connect(mpFetchInterfaceDataAction, SIGNAL(triggered()), SLOT(fetchInterfaceData()));
// align interfaces
mpAlignInterfacesAction = new QAction(QIcon(":/Resources/icons/align-interfaces.svg"), Helper::alignInterfaces, this);
mpAlignInterfacesAction->setStatusTip(Helper::alignInterfacesTip);
// TLM simulate action
mpTLMCoSimulationAction = new QAction(QIcon(":/Resources/icons/tlm-simulate.svg"), Helper::tlmCoSimulationSetup, this);
mpTLMCoSimulationAction->setStatusTip(Helper::tlmCoSimulationSetupTip);
Expand Down Expand Up @@ -3002,7 +3008,11 @@ void MainWindow::createToolbars()
mpTLMSimulationToolbar->setObjectName("TLM Simulation Toolbar");
mpTLMSimulationToolbar->setAllowedAreas(Qt::TopToolBarArea);
// add actions to TLM Simulation Toolbar
mpTLMSimulationToolbar->addAction(mpSimulationParamsAction);
mpTLMSimulationToolbar->addSeparator();
mpTLMSimulationToolbar->addAction(mpFetchInterfaceDataAction);
mpTLMSimulationToolbar->addAction(mpAlignInterfacesAction);
mpTLMSimulationToolbar->addSeparator();
mpTLMSimulationToolbar->addAction(mpTLMCoSimulationAction);
}

Expand Down
4 changes: 4 additions & 0 deletions OMEdit/OMEditGUI/MainWindow.h
Expand Up @@ -158,7 +158,9 @@ class MainWindow : public QMainWindow
QAction* getConnectModeAction() {return mpConnectModeAction;}
QAction* getReSimulateModelAction() {return mpReSimulateModelAction;}
QAction* getReSimulateSetupAction() {return mpReSimulateSetupAction;}
QAction* getSimulationParamsAction() {return mpSimulationParamsAction;}
QAction* getFetchInterfaceDataAction() {return mpFetchInterfaceDataAction;}
QAction* getAlignInterfacesAction() {return mpAlignInterfacesAction;}
QAction* getTLMSimulationAction() {return mpTLMCoSimulationAction;}
void addRecentFile(const QString &fileName, const QString &encoding);
void updateRecentFileActions();
Expand Down Expand Up @@ -318,7 +320,9 @@ class MainWindow : public QMainWindow
QAction *mpExportAsImageAction;
QAction *mpExportToClipboardAction;
// TLM Simulation Action
QAction *mpSimulationParamsAction;
QAction *mpFetchInterfaceDataAction;
QAction *mpAlignInterfacesAction;
QAction *mpTLMCoSimulationAction;
// Toolbars
QMenu *mpRecentFilesMenu;
Expand Down
41 changes: 34 additions & 7 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -43,6 +43,7 @@
#include "ShapePropertiesDialog.h"
#include "ComponentProperties.h"
#include "Commands.h"
#include "FetchInterfaceDataDialog.h"

//! @class GraphicsScene
//! @brief The GraphicsScene class is a container for graphicsl components in a simulationmodel.
Expand Down Expand Up @@ -929,7 +930,7 @@ void GraphicsView::createActions()
mpPropertiesAction = new QAction(Helper::properties, this);
connect(mpPropertiesAction, SIGNAL(triggered()), SLOT(showGraphicsViewProperties()));
// Simulation Params Action
mpSimulationParamsAction = new QAction(Helper::simulationParams, this);
mpSimulationParamsAction = new QAction(QIcon(":/Resources/icons/simulation-parameters.svg"), Helper::simulationParams, this);
mpSimulationParamsAction->setStatusTip(Helper::simulationParamsTip);
connect(mpSimulationParamsAction, SIGNAL(triggered()), SLOT(showSimulationParamsDialog()));
// Actions for shapes and Components
Expand Down Expand Up @@ -2033,8 +2034,7 @@ WelcomePageWidget::WelcomePageWidget(MainWindow *parent)
mpPixmapLabel->setPixmap(pixmap.scaled(75, 72, Qt::KeepAspectRatio, Qt::SmoothTransformation));
mpPixmapLabel->setStyleSheet("background-color : transparent;");
// top frame heading
mpHeadingLabel = new Label(QString(Helper::applicationName).append(" - ").append(Helper::applicationIntroText));
mpHeadingLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpHeadingLabel = Utilities::getHeadingLabel(QString(Helper::applicationName).append(" - ").append(Helper::applicationIntroText));
mpHeadingLabel->setStyleSheet("background-color : transparent; color : white;");
#ifndef Q_OS_MAC
mpHeadingLabel->setGraphicsEffect(new QGraphicsDropShadowEffect);
Expand All @@ -2050,8 +2050,7 @@ WelcomePageWidget::WelcomePageWidget(MainWindow *parent)
mpRecentFilesFrame->setFrameShape(QFrame::StyledPanel);
mpRecentFilesFrame->setStyleSheet("QFrame{background-color: white;}");
// recent items list
mpRecentFilesLabel = new Label(tr("Recent Files"));
mpRecentFilesLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpRecentFilesLabel = Utilities::getHeadingLabel(tr("Recent Files"));
mpNoRecentFileLabel = new Label(tr("No recent files found."));
mpRecentItemsList = new QListWidget;
mpRecentItemsList->setObjectName("RecentItemsList");
Expand Down Expand Up @@ -2083,8 +2082,7 @@ WelcomePageWidget::WelcomePageWidget(MainWindow *parent)
if (!mpMainWindow->getOptionsDialog()->getGeneralSettingsPage()->getShowLatestNewsCheckBox()->isChecked())
mpLatestNewsFrame->setVisible(false);
// latest news
mpLatestNewsLabel = new Label(tr("Latest News"));
mpLatestNewsLabel->setFont(QFont(Helper::systemFontInfo.family(), Helper::headingFontSize));
mpLatestNewsLabel = Utilities::getHeadingLabel(tr("Latest News"));
mpNoLatestNewsLabel = new Label;
mpLatestNewsListWidget = new QListWidget;
mpLatestNewsListWidget->setObjectName("LatestNewsList");
Expand Down Expand Up @@ -3858,6 +3856,8 @@ ModelWidgetContainer::ModelWidgetContainer(MainWindow *pParent)
connect(mpMainWindow->getSaveAsAction(), SIGNAL(triggered()), SLOT(saveAsModelWidget()));
connect(mpMainWindow->getSaveTotalAction(), SIGNAL(triggered()), SLOT(saveTotalModelWidget()));
connect(mpMainWindow->getPrintModelAction(), SIGNAL(triggered()), SLOT(printModel()));
connect(mpMainWindow->getSimulationParamsAction(), SIGNAL(triggered()), SLOT(showSimulationParams()));
connect(mpMainWindow->getAlignInterfacesAction(), SIGNAL(triggered()), SLOT(alignInterfaces()));
}

void ModelWidgetContainer::addModelWidget(ModelWidget *pModelWidget, bool checkPreferedView)
Expand Down Expand Up @@ -4233,7 +4233,9 @@ void ModelWidgetContainer::currentModelWidgetChanged(QMdiSubWindow *pSubWindow)
getMainWindow()->getExportAsImageAction()->setEnabled(enabled);
getMainWindow()->getExportToClipboardAction()->setEnabled(enabled);
getMainWindow()->getPrintModelAction()->setEnabled(enabled);
getMainWindow()->getSimulationParamsAction()->setEnabled(enabled && metaModel);
getMainWindow()->getFetchInterfaceDataAction()->setEnabled(enabled && metaModel);
getMainWindow()->getAlignInterfacesAction()->setEnabled(enabled && metaModel);
getMainWindow()->getTLMSimulationAction()->setEnabled(enabled && metaModel);
/* disable the save actions if class is a system library class. */
if (pModelWidget) {
Expand Down Expand Up @@ -4356,3 +4358,28 @@ void ModelWidgetContainer::printModel()
}
#endif
}

/*!
* \brief ModelWidgetContainer::showSimulationParams
* Slot activated when MainWindow::mpSimulationParamsAction triggered SIGNAL is raised.
* Shows the MetaModelSimulationParamsDialog
*/
void ModelWidgetContainer::showSimulationParams()
{
if (ModelWidget *pModelWidget = getCurrentModelWidget()) {
pModelWidget->getDiagramGraphicsView()->showSimulationParamsDialog();
}
}

/*!
* \brief ModelWidgetContainer::alignInterfaces
* Slot activated when MainWindow::mpAlignInterfacesAction triggered SIGNAL is raised.
* Shows the AlignInterfacesDialog
*/
void ModelWidgetContainer::alignInterfaces()
{
if (ModelWidget *pModelWidget = getCurrentModelWidget()) {
AlignInterfacesDialog *pAlignInterfacesDialog = new AlignInterfacesDialog(pModelWidget);
pAlignInterfacesDialog->exec();
}
}
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.h
Expand Up @@ -455,6 +455,8 @@ public slots:
void saveAsModelWidget();
void saveTotalModelWidget();
void printModel();
void showSimulationParams();
void alignInterfaces();
};

#endif // MODELWIDGETCONTAINER_H

0 comments on commit 373069e

Please sign in to comment.