Skip to content

Commit

Permalink
Consistent naming of DCP master
Browse files Browse the repository at this point in the history
  • Loading branch information
robbr48 committed Feb 12, 2021
1 parent 42ac92c commit 068fb9a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions HopsanGUI/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ void MainWindow::createActions()
mpNewDcpModelAction->setToolTip("Create new DCP model");
connect(mpNewDcpModelAction, SIGNAL(triggered()), mpModelHandler, SLOT(addNewDcpModel()));

mpStartDcpManagerAction = new QAction(QIcon(QString(ICONPATH) + "svg/Hopsan-StartDcpManager.svg"), tr("Simulate model as DCP manager"), this);
mpStartDcpManagerAction->setToolTip("Simulate model as DCP manager");
mpStartDcpMasterAction = new QAction(QIcon(QString(ICONPATH) + "svg/Hopsan-StartDcpManager.svg"), tr("Simulate model as DCP master"), this);
mpStartDcpMasterAction->setToolTip("Simulate model as DCP master");

mpStartDcpServerAction = new QAction(QIcon(QString(ICONPATH) + "svg/Hopsan-StartDcpServer.svg"), tr("Simulate model as DCP server"), this);
mpStartDcpServerAction->setToolTip("Simulate model as DCP server");
Expand Down Expand Up @@ -1190,7 +1190,7 @@ void MainWindow::createToolbars()
mpDcpToolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea | Qt::RightToolBarArea);
mpDcpToolBar->setAttribute(Qt::WA_MouseTracking);
mpDcpToolBar->addAction(mpNewDcpModelAction);
mpDcpToolBar->addAction(mpStartDcpManagerAction);
mpDcpToolBar->addAction(mpStartDcpMasterAction);
mpDcpToolBar->addAction(mpStartDcpServerAction);

//Tools toolbar, contains all tools used to modify the model
Expand Down Expand Up @@ -1465,7 +1465,7 @@ void MainWindow::updateToolBarsToNewTab()
mpLoadModelParametersAction->setEnabled(modelTab);
mpStartDcpServerAction->setEnabled(modelTab && !dcpTab);

mpStartDcpManagerAction->setEnabled(dcpTab);
mpStartDcpMasterAction->setEnabled(dcpTab);

if(gpFindWidget) {
gpFindWidget->setEnabled(modelTab || editorTab);
Expand Down
2 changes: 1 addition & 1 deletion HopsanGUI/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class MainWindow : public QMainWindow
QAction *mpMeasureSimulationTimeAction;
QAction *mpToggleHideAllDockAreasAction;
QAction *mpNewDcpModelAction;
QAction *mpStartDcpManagerAction;
QAction *mpStartDcpMasterAction;
QAction *mpStartDcpServerAction;

QAction *mpDebug1Action;
Expand Down
4 changes: 2 additions & 2 deletions HopsanGUI/ModelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ void ModelHandler::disconnectMainWindowConnections(ModelWidget *pModel)
disconnect(gpMainWindow, SIGNAL(simulateKeyPressed()), pModel, SLOT(simulate_nonblocking()));
disconnect(gpMainWindow->mpToggleRemoteCoreSimAction, SIGNAL(triggered(bool)), pModel, SLOT(setUseRemoteSimulation(bool)));
disconnect(gpMainWindow->mpStartDcpServerAction, SIGNAL(triggered()), pModel, SLOT(simulateDcpServer()));
disconnect(gpMainWindow->mpStartDcpManagerAction, SIGNAL(triggered()), pModel, SLOT(simulateDcpManager()));
disconnect(gpMainWindow->mpStartDcpMasterAction, SIGNAL(triggered()), pModel, SLOT(simulateDcpMaster()));
disconnect(gpMainWindow->mpSaveAction, SIGNAL(triggered()), pModel, SLOT(save()));
disconnect(gpMainWindow->mpSaveAsAction, SIGNAL(triggered()), pModel, SLOT(saveAs()));
disconnect(gpMainWindow->mpExportModelParametersAction, SIGNAL(triggered()), pModel, SLOT(exportModelParameters()));
Expand Down Expand Up @@ -755,7 +755,7 @@ void ModelHandler::connectMainWindowConnections(ModelWidget *pModel)
connect(gpMainWindow, SIGNAL(simulateKeyPressed()), pModel, SLOT(simulate_nonblocking()), Qt::UniqueConnection);
connect(gpMainWindow->mpToggleRemoteCoreSimAction, SIGNAL(triggered(bool)), pModel, SLOT(setUseRemoteSimulation(bool)), Qt::UniqueConnection);
connect(gpMainWindow->mpStartDcpServerAction, SIGNAL(triggered()), pModel, SLOT(simulateDcpServer()), Qt::UniqueConnection);
connect(gpMainWindow->mpStartDcpManagerAction, SIGNAL(triggered()), pModel, SLOT(simulateDcpManager()), Qt::UniqueConnection);
connect(gpMainWindow->mpStartDcpMasterAction, SIGNAL(triggered()), pModel, SLOT(simulateDcpMaster()), Qt::UniqueConnection);
connect(gpMainWindow->mpSaveAction, SIGNAL(triggered()), pModel, SLOT(save()), Qt::UniqueConnection);
connect(gpMainWindow->mpSaveAsAction, SIGNAL(triggered()), pModel, SLOT(saveAs()), Qt::UniqueConnection);
connect(gpMainWindow->mpExportModelParametersAction, SIGNAL(triggered()), pModel, SLOT(exportModelParameters()), Qt::UniqueConnection);
Expand Down
10 changes: 5 additions & 5 deletions HopsanGUI/SimulationThreadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ void SimulationThreadHandler::initSimulateFinalizeRemote(SharedRemoteCoreSimulat
}
#endif

void SimulationThreadHandler::initSimulateFinalizeDcpManager(SystemObject *pSystem, const QString &host, int port)
void SimulationThreadHandler::initSimulateFinalizeDcpMaster(SystemObject *pSystem, const QString &host, int port)
{
mvpSystems.clear();
mvpSystems.push_back(pSystem);
mpSimulationWorkerObject = new DCPManagerSimulationWorkerObject(pSystem, host, port, mStartT, mStopT);
mpSimulationWorkerObject = new DcpMasterSimulationWorkerObject(pSystem, host, port, mStartT, mStopT);
mpSimulationWorkerObject->setMessageHandler(mpMessageHandler);
initSimulateFinalizePrivate();
}
Expand Down Expand Up @@ -588,14 +588,14 @@ void DcpServerSimulationWorkerObject::initSimulateFinalize()
emit finalizeDone(true, timer.elapsed());
}

DCPManagerSimulationWorkerObject::DCPManagerSimulationWorkerObject(SystemObject *pSystem, const QString &host, int port, double startTime, double stopTime)
DcpMasterSimulationWorkerObject::DcpMasterSimulationWorkerObject(SystemObject *pSystem, const QString &host, int port, double startTime, double stopTime)
: mpSystem(pSystem), mHost(host), mPort(port)
{
mStartTime = startTime;
mStopTime = stopTime;
}

void DCPManagerSimulationWorkerObject::initSimulateFinalize()
void DcpMasterSimulationWorkerObject::initSimulateFinalize()
{
// Initializing
QTime timer;
Expand Down Expand Up @@ -646,7 +646,7 @@ void DCPManagerSimulationWorkerObject::initSimulateFinalize()

// Simulating
emit setProgressState(SimulationState::DcpMasterSimulate);
gpMessageHandler->addInfoMessage("Starting a DCP simulation as manager...");
gpMessageHandler->addInfoMessage("Starting a DCP simulation as master...");
pDcpMaster->start();
gpMessageHandler->addInfoMessage("DCP simulation finished!");
emit simulateDone(true, timer.elapsed());
Expand Down
10 changes: 5 additions & 5 deletions HopsanGUI/SimulationThreadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GUIMessageHandler;
#include "RemoteCoreAccess.h"
#endif

enum SimulationWorkeObjectEnumT {LocalSWO, RemoteSWO, DCPManagerSWO, DcpServerSWO};
enum SimulationWorkeObjectEnumT {LocalSWO, RemoteSWO, DCPMasterSWO, DcpServerSWO};
enum class SimulationState {Initialize, Simulate, RemoteSimulate, DcpMasterSimulate, DcpServerSimulate, Finalize, Done};

Q_DECLARE_METATYPE(SimulationState);
Expand Down Expand Up @@ -110,16 +110,16 @@ public slots:
};
#endif

class DCPManagerSimulationWorkerObject : public SimulationWorkerObjectBase
class DcpMasterSimulationWorkerObject : public SimulationWorkerObjectBase
{
Q_OBJECT
private:
SystemObject *mpSystem;
QString mHost;
int mPort;
public:
DCPManagerSimulationWorkerObject(SystemObject *pSystem, const QString &host, int port, double startTime, double stopTime);
int swoType() const {return DCPManagerSWO;}
DcpMasterSimulationWorkerObject(SystemObject *pSystem, const QString &host, int port, double startTime, double stopTime);
int swoType() const {return DCPMasterSWO;}

public slots:
void initSimulateFinalize();
Expand Down Expand Up @@ -228,7 +228,7 @@ protected slots:
#ifdef USEZMQ
void initSimulateFinalizeRemote(SharedRemoteCoreSimulationHandlerT pRCSH, QVector<RemoteResultVariable> *pRemoteResultVariables, double *pProgress);
#endif
void initSimulateFinalizeDcpManager(SystemObject *pSystem, const QString &host, int port);
void initSimulateFinalizeDcpMaster(SystemObject *pSystem, const QString &host, int port);
void initSimulateFinalizeDcpServer(SystemObject *pSystem, const QString &host, int port, const QString &targetFile);
void initSimulateFinalize(QVector<SystemObject*> vpSystems, const bool noChanges=false);
void initSimulateFinalize_blocking(QVector<SystemObject*> vpSystems, const bool noChanges=false);
Expand Down
4 changes: 2 additions & 2 deletions HopsanGUI/Widgets/ModelWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ bool ModelWidget::simulateDcpServer()
//! @todo fix return code
}

bool ModelWidget::simulateDcpManager()
bool ModelWidget::simulateDcpMaster()
{
// Save backup copy
if (!isSaved() && gpConfig->getBoolSetting(CFG_AUTOBACKUP))
Expand Down Expand Up @@ -789,7 +789,7 @@ bool ModelWidget::simulateDcpManager()
mpSimulationThreadHandler->setSimulationTimeVariables(mStartTime.toDouble(), mStopTime.toDouble(), mpToplevelSystem->getLogStartTime(), mpToplevelSystem->getNumberOfLogSamples());
mpSimulationThreadHandler->setProgressDilaogBehaviour(true, false);
mSimulationProgress=0;
mpSimulationThreadHandler->initSimulateFinalizeDcpManager(mpToplevelSystem, pHostLineEdit->text(), pPortSpinBox->value());
mpSimulationThreadHandler->initSimulateFinalizeDcpMaster(mpToplevelSystem, pHostLineEdit->text(), pPortSpinBox->value());

unlockSimulateMutex();

Expand Down
2 changes: 1 addition & 1 deletion HopsanGUI/Widgets/ModelWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public slots:
bool simulate_nonblocking();
bool simulate_blocking();
bool simulateDcpServer();
bool simulateDcpManager();
bool simulateDcpMaster();
void save();
void saveAs();
void exportModelParameters();
Expand Down

0 comments on commit 068fb9a

Please sign in to comment.