forked from qt-creator/qt-creator
Core: Add a basic extension for the JsExpander
This adds a "Utils" object to the Js runtime offered by the JsExpander that adds some useful functions. Mostly file name mangling and finding preferred extension from the MIME type database. Change-Id: I907dae7f295167667ac2ae81461bbff16dc98ef4 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "jsexpander.h"
|
||||
|
||||
#include "corejsextensions.h"
|
||||
#include "variablemanager.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -43,7 +44,11 @@ namespace Internal {
|
||||
|
||||
class JsExpanderPrivate {
|
||||
public:
|
||||
JsExpanderPrivate() : m_utilsExtension(new UtilsJsExtension) { }
|
||||
~JsExpanderPrivate() { delete m_utilsExtension; }
|
||||
|
||||
QScriptEngine m_engine;
|
||||
UtilsJsExtension *m_utilsExtension;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
@@ -98,6 +103,8 @@ JsExpander::JsExpander()
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
registerQObjectForJs(QLatin1String("Util"), d->m_utilsExtension);
|
||||
}
|
||||
|
||||
JsExpander::~JsExpander()
|
||||
|
||||
Reference in New Issue
Block a user