// // strName is the header name, *including* the .sh // void AppState::OpenScriptHeader(std::string strName) { if (_pApp && _pScriptTemplate) { std::string fullPath = _resourceMap.GetIncludePath(strName); ScriptId scriptId(fullPath); if (!scriptId.IsNone()) { // If it's already open, just activate it. CMainFrame *pMainWnd = static_cast<CMainFrame*>(_pApp->m_pMainWnd); CScriptDocument *pDocAlready = pMainWnd->Tabs().ActivateScript(scriptId); if (pDocAlready == nullptr) { CScriptDocument *pDocument = static_cast<CScriptDocument*>(_pScriptTemplate->OpenDocumentFile(scriptId.GetFullPath().c_str(), TRUE)); if (pDocument) { pDocument->SetTitle(scriptId.GetFileNameOrig().c_str()); // Initialize the document somehow. pDocument->SetDependencyTracker(GetResourceMap().GetDependencyTracker()); } } } } }
void InterpreterContext::setMemberFloat (const std::string& id, const std::string& name, float value, bool global) { std::string scriptId (id); Locals& locals = getMemberLocals (scriptId, global); locals.mFloats[findLocalVariableIndex (scriptId, name, 'f')] = value; }
KWin::Script::Script(int id, QString scriptName, QString pluginName, QObject* parent) : AbstractScript(id, scriptName, pluginName, parent) , m_engine(new QScriptEngine(this)) , m_starting(false) , m_agent(new ScriptUnloaderAgent(this)) { QDBusConnection::sessionBus().registerObject('/' + QString::number(scriptId()), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables); }
float InterpreterContext::getMemberFloat (const std::string& id, const std::string& name, bool global) const { std::string scriptId (id); const Locals& locals = getMemberLocals (scriptId, global); return locals.mFloats[findLocalVariableIndex (scriptId, name, 'f')]; }
void InterpreterContext::setMemberFloat (const std::string& id, const std::string& name, float value, bool global) { std::string scriptId (id); Locals& locals = getMemberLocals (scriptId, global); int index = MWBase::Environment::get().getScriptManager()->getLocalIndex (scriptId, name, 'f'); locals.mFloats[index] = value; }
void QScriptDebuggerCodeWidgetPrivate::_q_onBreakpointEnableRequest(int lineNumber, bool enable) { QScriptDebuggerCodeViewInterface *view = qobject_cast<QScriptDebuggerCodeViewInterface*>(q_func()->sender()); qint64 sid = scriptId(view); int bpid = breakpointsModel->resolveBreakpoint(sid, lineNumber); if (bpid == -1) bpid = breakpointsModel->resolveBreakpoint(scriptsModel->scriptData(sid).fileName(), lineNumber); Q_ASSERT(bpid != -1); QScriptBreakpointData data = breakpointsModel->breakpointData(bpid); data.setEnabled(enable); breakpointsModel->setBreakpointData(bpid, data); }
int InterpreterContext::getMemberLong (const std::string& id, const std::string& name, bool global) const { std::string scriptId (id); const Locals& locals = getMemberLocals (scriptId, global); int index = MWBase::Environment::get().getScriptManager()->getLocalIndex ( scriptId, name, 'l'); return locals.mLongs[index]; }
KWin::Script::~Script() { QDBusConnection::sessionBus().unregisterObject(QStringLiteral("/") + QString::number(scriptId())); }