StelScriptMgr.cpp   StelScriptMgr.cpp 
skipping to change at line 52 skipping to change at line 52
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <QRegExp> #include <QRegExp>
#include <QSet> #include <QSet>
#include <QStringList> #include <QStringList>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QVariant> #include <QVariant>
#include <cmath> #include <cmath>
Q_DECLARE_METATYPE(Vec3f); Q_DECLARE_METATYPE(Vec3f)
QScriptValue vec3fToScriptValue(QScriptEngine *engine, const Vec3f& c) QScriptValue vec3fToScriptValue(QScriptEngine *engine, const Vec3f& c)
{ {
QScriptValue obj = engine->newObject(); QScriptValue obj = engine->newObject();
obj.setProperty("r", QScriptValue(engine, c[0])); obj.setProperty("r", QScriptValue(engine, c[0]));
obj.setProperty("g", QScriptValue(engine, c[1])); obj.setProperty("g", QScriptValue(engine, c[1]));
obj.setProperty("b", QScriptValue(engine, c[2])); obj.setProperty("b", QScriptValue(engine, c[2]));
return obj; return obj;
} }
skipping to change at line 99 skipping to change at line 99
// Constructor // Constructor
QScriptValue ctor = engine.newFunction(createVec3f); QScriptValue ctor = engine.newFunction(createVec3f);
engine.globalObject().setProperty("Vec3f", ctor); engine.globalObject().setProperty("Vec3f", ctor);
// Add the core object to access methods related to core // Add the core object to access methods related to core
mainAPI = new StelMainScriptAPI(this); mainAPI = new StelMainScriptAPI(this);
QScriptValue objectValue = engine.newQObject(mainAPI); QScriptValue objectValue = engine.newQObject(mainAPI);
engine.globalObject().setProperty("core", objectValue); engine.globalObject().setProperty("core", objectValue);
engine.evaluate("function mywait__(sleepDurationSec) {" engine.evaluate("function mywait__(sleepDurationSec) {"
"if (sleepDurationSec<0) return;" "if (sleepDurationSec<0) return;"
"var date = new Date();" "var date = new Date();"
"var curDate = null;" "var curDate = null;"
"do {curDate = new Date();}" "do {curDate = new Date();}"
" while(curDate-date < sleepDurat "while(curDate-date < sleepDurationSec*1000/scriptRa
ionSec*1000/scriptRateReadOnly);}"); teReadOnly);}");
engine.evaluate("core['wait'] = mywait__;"); engine.evaluate("core['wait'] = mywait__;");
engine.evaluate("function mywaitFor__(dt, spec) {if (!spec) spec=\"u engine.evaluate("function mywaitFor__(dt, spec) {"
tc\";" "if (!spec) spec=\"utc\";"
" var JD = core.jdFromDateString(dt, spec);" "var deltaJD = core.jdFromDateString(dt, spec) - cor
" var timeSpeed = core.getTimeRate();" e.getJDay();"
" if (timeSpeed == 0.) {core.debug(\"waitFor called with no ti "var timeSpeed = core.getTimeRate();"
me passing - would be infinite. not waiting!\"); return;}" "if (timeSpeed == 0.) {core.debug(\"waitFor called w
" if (timeSpeed > 0) {core.wait((JD-core.getJDay())*timeSpeed) ith no time passing - would be infinite. not waiting!\"); return;}"
;}" "var date = new Date();"
" else {core.wait((core.getJDay()-JD)*timeSpeed);}}"); "var curDate = null;"
"do {curDate = new Date();}"
"while(curDate-date < deltaJD*86400000/timeSpeed);}"
);
engine.evaluate("core['waitFor'] = mywaitFor__;"); engine.evaluate("core['waitFor'] = mywaitFor__;");
// Add other classes which we want to be directly accessible from sc ripts // Add other classes which we want to be directly accessible from sc ripts
if(StelSkyLayerMgr* smgr = GETSTELMODULE(StelSkyLayerMgr)) if(StelSkyLayerMgr* smgr = GETSTELMODULE(StelSkyLayerMgr))
objectValue = engine.newQObject(smgr); objectValue = engine.newQObject(smgr);
// For accessing star scale, twinkle etc. // For accessing star scale, twinkle etc.
objectValue = engine.newQObject(StelApp::getInstance().getCore()->ge tSkyDrawer()); objectValue = engine.newQObject(StelApp::getInstance().getCore()->ge tSkyDrawer());
engine.globalObject().setProperty("StelSkyDrawer", objectValue); engine.globalObject().setProperty("StelSkyDrawer", objectValue);
 End of changes. 3 change blocks. 
16 lines changed or deleted 20 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/