-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSIM.cpp
More file actions
33 lines (28 loc) · 900 Bytes
/
SIM.cpp
File metadata and controls
33 lines (28 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "SIM.h"
#include "UI.h"
#include <simPlusPlus-2/Lib.h>
#include "stubs.h"
SIM::SIM()
{
}
void SIM::notifyEvent(int handle, const QString &eventType, const QString &data)
{
ASSERT_THREAD(!UI);
QString xml(
QStringLiteral("<event origin='codeEditor' msg='%1' handle='%2' data='%3'/>")
.arg(eventType, QString::number(handle), data)
);
sim::eventNotification(xml.toStdString());
}
void SIM::openURL(const QString &url)
{
int stackHandle = sim::createStack();
QString s(QStringLiteral("require'simURLDrop'.openURL(\"%1\")@lua").arg(url));
sim::executeScriptString(sim::getScriptHandleEx(sim_scripttype_sandbox), s.toStdString(), stackHandle);
sim::releaseStack(stackHandle);
}
void SIM::onRequestSimulationStatus()
{
bool running = sim::getSimulationState() == sim_simulation_advancing_running;
emit simulationRunning(running);
}