Commit d92aa726 authored by Jan Möbius's avatar Jan Möbius

Added Help function to scripting

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12678 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0ae7b69e
...@@ -250,7 +250,7 @@ Core::init() { ...@@ -250,7 +250,7 @@ Core::init() {
Qt::AlignBottom | Qt::AlignLeft , Qt::white); Qt::AlignBottom | Qt::AlignLeft , Qt::white);
} }
coreWidget_ = new CoreWidget(viewModes_ , plugins, coreSlots_); coreWidget_ = new CoreWidget(viewModes_ , plugins_, coreSlots_);
connect(coreWidget_, SIGNAL(clearAll()) , this, SLOT(clearAll())); connect(coreWidget_, SIGNAL(clearAll()) , this, SLOT(clearAll()));
connect(coreWidget_, SIGNAL(loadMenu()) , this, SLOT(loadObject())); connect(coreWidget_, SIGNAL(loadMenu()) , this, SLOT(loadObject()));
...@@ -434,6 +434,12 @@ Core::init() { ...@@ -434,6 +434,12 @@ Core::init() {
scriptEngine_.globalObject().setProperty("printToFile", printToFileFunc); scriptEngine_.globalObject().setProperty("printToFile", printToFileFunc);
scriptingFunctions_.push_back( "-.printToFile(QString,QString)" ); scriptingFunctions_.push_back( "-.printToFile(QString,QString)" );
// Register help function :
QScriptValue helpFunc = scriptEngine_.newFunction(helpFunction);
helpFunc.setProperty("core",scriptEngine_.newQObject(this));
scriptEngine_.globalObject().setProperty("help", helpFunc);
scriptingFunctions_.push_back( "-.help(QString)" );
// Register IdList Type to scripting Engine // Register IdList Type to scripting Engine
qScriptRegisterSequenceMetaType< IdList >(&scriptEngine_); qScriptRegisterSequenceMetaType< IdList >(&scriptEngine_);
...@@ -614,13 +620,13 @@ Core::init() { ...@@ -614,13 +620,13 @@ Core::init() {
Core::~Core() Core::~Core()
{ {
for ( uint i = 0 ; i < plugins.size() ; ++i ){ for ( uint i = 0 ; i < plugins_.size() ; ++i ){
BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugins[i].plugin); BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugins_[i].plugin);
// Dont call exit if we cannot get the Plugin // Dont call exit if we cannot get the Plugin
if ( basePlugin ) if ( basePlugin )
if ( checkSlot( plugins[i].plugin , "exit()" ) ) if ( checkSlot( plugins_[i].plugin , "exit()" ) )
QMetaObject::invokeMethod(plugins[i].plugin, "exit", Qt::DirectConnection); QMetaObject::invokeMethod(plugins_[i].plugin, "exit", Qt::DirectConnection);
} }
// Delete the objectRoot if it was constructed // Delete the objectRoot if it was constructed
...@@ -1076,11 +1082,11 @@ Core::writeOnExit() { ...@@ -1076,11 +1082,11 @@ Core::writeOnExit() {
} }
// Call exit for all plugins // Call exit for all plugins
for (uint i = 0 ; i < plugins.size() ; ++i) { for (uint i = 0 ; i < plugins_.size() ; ++i) {
BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugins[i].plugin); BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugins_[i].plugin);
if ( basePlugin ) if ( basePlugin )
if ( checkSlot( plugins[i].plugin , "exit()" ) ) if ( checkSlot( plugins_[i].plugin , "exit()" ) )
QMetaObject::invokeMethod(plugins[i].plugin, "exit", Qt::DirectConnection); QMetaObject::invokeMethod(plugins_[i].plugin, "exit", Qt::DirectConnection);
} }
} }
...@@ -1185,9 +1191,9 @@ void Core::slotSetSlotDescription(QString _slotName, QString _slotDescrip ...@@ -1185,9 +1191,9 @@ void Core::slotSetSlotDescription(QString _slotName, QString _slotDescrip
//find plugin //find plugin
PluginInfo* pluginInfo = 0; PluginInfo* pluginInfo = 0;
for (uint i=0; i < plugins.size(); i++) for (uint i=0; i < plugins_.size(); i++)
if (plugins[i].plugin == sender()) if (plugins_[i].plugin == sender())
pluginInfo = &plugins[i]; pluginInfo = &plugins_[i];
if (pluginInfo == 0){ if (pluginInfo == 0){
emit log(LOGERR, tr("Unable to set slot-description. Plugin not found!")); emit log(LOGERR, tr("Unable to set slot-description. Plugin not found!"));
...@@ -1263,9 +1269,9 @@ void Core::slotGetDescription(QString _function, QString& _fnDescript ...@@ -1263,9 +1269,9 @@ void Core::slotGetDescription(QString _function, QString& _fnDescript
//find plugin //find plugin
PluginInfo* pluginInfo = 0; PluginInfo* pluginInfo = 0;
for (uint i=0; i < plugins.size(); i++) for (uint i=0; i < plugins_.size(); i++)
if (plugins[i].rpcName == pluginName) if (plugins_[i].rpcName == pluginName)
pluginInfo = &plugins[i]; pluginInfo = &plugins_[i];
if (pluginInfo == 0){ if (pluginInfo == 0){
emit log(LOGERR, tr("Unable to get slot-description. Plugin not found!")); emit log(LOGERR, tr("Unable to get slot-description. Plugin not found!"));
...@@ -1395,13 +1401,13 @@ INIFile ini; ...@@ -1395,13 +1401,13 @@ INIFile ini;
ini.add_entry( "Core" , "VersionLinux" , OpenFlipper::Options::coreVersion() ); ini.add_entry( "Core" , "VersionLinux" , OpenFlipper::Options::coreVersion() );
//add pluginVersions //add pluginVersions
for (uint i=0; i < plugins.size(); i++){ for (uint i=0; i < plugins_.size(); i++){
ini.add_section( plugins[i].name ); ini.add_section( plugins_[i].name );
if ( OpenFlipper::Options::isWindows() ) if ( OpenFlipper::Options::isWindows() )
ini.add_entry( plugins[i].name , "VersionWindows" , plugins[i].version ); ini.add_entry( plugins_[i].name , "VersionWindows" , plugins_[i].version );
else else
ini.add_entry( plugins[i].name , "VersionLinux" , plugins[i].version ); ini.add_entry( plugins_[i].name , "VersionLinux" , plugins_[i].version );
} }
ini.disconnect(); ini.disconnect();
...@@ -1434,6 +1440,8 @@ void Core::setDescriptions(){ ...@@ -1434,6 +1440,8 @@ void Core::setDescriptions(){
this, SLOT(slotSetSlotDescription(QString,QString,QStringList,QStringList)) ); this, SLOT(slotSetSlotDescription(QString,QString,QStringList,QStringList)) );
emit slotSetSlotDescriptionGlobalFunction("printToFile(QString,QString)", tr("Print a message to a file"), QStringList(QString("Filename;Values").split(";")), QStringList(QString("Filename to print into;Arbitrary number of arguments").split(";"))); emit slotSetSlotDescriptionGlobalFunction("printToFile(QString,QString)", tr("Print a message to a file"), QStringList(QString("Filename;Values").split(";")), QStringList(QString("Filename to print into;Arbitrary number of arguments").split(";")));
emit slotSetSlotDescriptionGlobalFunction("help(QString)", tr("Print help about something"), QStringList("Help Entry"), QStringList("help about what?"));
emit setSlotDescription("deleteObject(int)", tr("Delete an object from the scene."), QStringList("ObjectId"), QStringList(tr("Id of the object to delete"))); emit setSlotDescription("deleteObject(int)", tr("Delete an object from the scene."), QStringList("ObjectId"), QStringList(tr("Id of the object to delete")));
emit setSlotDescription("updateView()", tr("Redraw the contents of the viewer."), QStringList(), QStringList()); emit setSlotDescription("updateView()", tr("Redraw the contents of the viewer."), QStringList(), QStringList());
......
...@@ -1104,9 +1104,12 @@ private slots: ...@@ -1104,9 +1104,12 @@ private slots:
* @{ */ * @{ */
//=========================================================================== //===========================================================================
public :
const std::vector<PluginInfo> plugins() const {return plugins_; };
private: private:
/// List of all loaded plugins /// List of all loaded plugins_
std::vector<PluginInfo> plugins; std::vector<PluginInfo> plugins_;
/// Index of Plugins toolbox widget /// Index of Plugins toolbox widget
int toolboxindex_; int toolboxindex_;
...@@ -1404,6 +1407,9 @@ QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine); ...@@ -1404,6 +1407,9 @@ QScriptValue myPrintFunction(QScriptContext *context, QScriptEngine *engine);
/// Special print function for sending output to a file /// Special print function for sending output to a file
QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine); QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine);
/// Function to print help about scripting functions
QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine);
//============================================================================= //=============================================================================
#endif // MVIEWWIDGET_HH defined #endif // MVIEWWIDGET_HH defined
//============================================================================= //=============================================================================
......
...@@ -378,12 +378,12 @@ void Core::slotCrossPluginConnect( QString _pluginName1, const char* _signal, QS ...@@ -378,12 +378,12 @@ void Core::slotCrossPluginConnect( QString _pluginName1, const char* _signal, QS
QObject* plugin1 = 0; QObject* plugin1 = 0;
QObject* plugin2 = 0; QObject* plugin2 = 0;
for ( int i = 0 ; i < (int)plugins.size(); ++i ) { for ( int i = 0 ; i < (int)plugins_.size(); ++i ) {
if ( plugins[i].rpcName == _pluginName1 ) { if ( plugins_[i].rpcName == _pluginName1 ) {
plugin1 = plugins[i].plugin; plugin1 = plugins_[i].plugin;
} }
if ( plugins[i].rpcName == _pluginName2 ) { if ( plugins_[i].rpcName == _pluginName2 ) {
plugin2 = plugins[i].plugin; plugin2 = plugins_[i].plugin;
} }
} }
......
...@@ -533,7 +533,7 @@ void Core::loadPlugins() ...@@ -533,7 +533,7 @@ void Core::loadPlugins()
emit pluginsInitialized(); emit pluginsInitialized();
emit log(LOGOUT,tr("Loaded %n Plugin(s)","",plugins.size()) ); emit log(LOGOUT,tr("Loaded %n Plugin(s)","",plugins_.size()) );
} }
/** @brief slot for loading Plugins /** @brief slot for loading Plugins
...@@ -631,7 +631,7 @@ void Core::slotShowPlugins(){ ...@@ -631,7 +631,7 @@ void Core::slotShowPlugins(){
while (ret == 0){ while (ret == 0){
PluginDialog* dialog = new PluginDialog(plugins, coreWidget_); PluginDialog* dialog = new PluginDialog(plugins_, coreWidget_);
//connect signals //connect signals
connect(dialog, SIGNAL(unloadPlugin(QString)), this, SLOT(unloadPlugin(QString))); connect(dialog, SIGNAL(unloadPlugin(QString)), this, SLOT(unloadPlugin(QString)));
...@@ -649,26 +649,26 @@ void Core::slotShowPlugins(){ ...@@ -649,26 +649,26 @@ void Core::slotShowPlugins(){
* @param name plugin name * @param name plugin name
*/ */
void Core::unloadPlugin(QString name){ void Core::unloadPlugin(QString name){
for (uint i=0; i < plugins.size(); i++) for (uint i=0; i < plugins_.size(); i++)
if (plugins[i].rpcName == name){ if (plugins_[i].rpcName == name){
if ( checkSlot( plugins[i].plugin , "exit()" ) ) if ( checkSlot( plugins_[i].plugin , "exit()" ) )
QMetaObject::invokeMethod(plugins[i].plugin, "exit", Qt::DirectConnection); QMetaObject::invokeMethod(plugins_[i].plugin, "exit", Qt::DirectConnection);
//remove toolbox widget //remove toolbox widget
QString name_nospace = name; QString name_nospace = name;
name_nospace.remove(" "); name_nospace.remove(" ");
if ( coreWidget_->viewModes_[0]->visibleToolboxes.contains(name_nospace) ) if ( coreWidget_->viewModes_[0]->visibleToolboxes.contains(name_nospace) )
coreWidget_->viewModes_[0]->visibleToolboxes.removeAt(coreWidget_->viewModes_[0]->visibleToolboxes.indexOf(name_nospace)); coreWidget_->viewModes_[0]->visibleToolboxes.removeAt(coreWidget_->viewModes_[0]->visibleToolboxes.indexOf(name_nospace));
for ( uint j = 0 ; j < plugins[i].toolboxWidgets.size() ; ++j ) for ( uint j = 0 ; j < plugins_[i].toolboxWidgets.size() ; ++j )
if (plugins[i].toolboxWidgets[j].second ){ if (plugins_[i].toolboxWidgets[j].second ){
plugins[i].toolboxWidgets[j].second->setVisible(false); plugins_[i].toolboxWidgets[j].second->setVisible(false);
delete plugins[i].toolboxWidgets[j].second; delete plugins_[i].toolboxWidgets[j].second;
if( plugins[i].toolboxIcons[j] != 0 ) if( plugins_[i].toolboxIcons[j] != 0 )
delete plugins[i].toolboxIcons[j]; delete plugins_[i].toolboxIcons[j];
} }
plugins.erase(plugins.begin() + i); plugins_.erase(plugins_.begin() + i);
emit log(LOGOUT,tr("Unloaded Plugin :\t\t %1").arg( name) ); emit log(LOGOUT,tr("Unloaded Plugin :\t\t %1").arg( name) );
...@@ -738,14 +738,14 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO ...@@ -738,14 +738,14 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
} }
//Check if plugin is already loaded //Check if plugin is already loaded
for (uint k=0; k < plugins.size(); k++){ for (uint k=0; k < plugins_.size(); k++){
QString name_nospace = basePlugin->name(); QString name_nospace = basePlugin->name();
name_nospace.remove(" "); name_nospace.remove(" ");
if (plugins[k].name == name_nospace){ if (plugins_[k].name == name_nospace){
if (silent || OpenFlipper::Options::nogui() ){ //dont load the plugin if (silent || OpenFlipper::Options::nogui() ){ //dont load the plugin
emit log(LOGWARN, tr("\t\t\t Already loaded from %1").arg( plugins[k].path) ); emit log(LOGWARN, tr("\t\t\t Already loaded from %1").arg( plugins_[k].path) );
emit log(LOGOUT,"================================================================================"); emit log(LOGOUT,"================================================================================");
return; return;
}else{ //ask the user }else{ //ask the user
...@@ -753,12 +753,12 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO ...@@ -753,12 +753,12 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
tr("Plugin already loaded"), tr("Plugin already loaded"),
tr("A Plugin with the same name was already loaded from %1.\n" tr("A Plugin with the same name was already loaded from %1.\n"
"You can only load the new plugin if you unload the existing one first.\n\n" "You can only load the new plugin if you unload the existing one first.\n\n"
"Do you want to unload the existing plugin first?").arg( plugins[k].path), "Do you want to unload the existing plugin first?").arg( plugins_[k].path),
QMessageBox::Yes|QMessageBox::No, QMessageBox::No); QMessageBox::Yes|QMessageBox::No, QMessageBox::No);
if (ret == QMessageBox::Yes) if (ret == QMessageBox::Yes)
unloadPlugin(plugins[k].name); unloadPlugin(plugins_[k].name);
else{ else{
emit log(LOGWARN, tr("\t\t\t Already loaded from %1.").arg( plugins[k].path)); emit log(LOGWARN, tr("\t\t\t Already loaded from %1.").arg( plugins_[k].path));
emit log(LOGOUT,"================================================================================"); emit log(LOGOUT,"================================================================================");
return; return;
} }
...@@ -2065,7 +2065,7 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO ...@@ -2065,7 +2065,7 @@ void Core::loadPlugin(QString filename, bool silent, QString& _licenseErrors, QO
//======================================================================================== //========================================================================================
//======================================================================================== //========================================================================================
plugins.push_back(info); plugins_.push_back(info);
// Initialize Plugin // Initialize Plugin
if ( basePlugin ) { if ( basePlugin ) {
......
...@@ -62,8 +62,8 @@ ...@@ -62,8 +62,8 @@
void Core::slotPluginExists( QString _pluginName , bool& _exists ) { void Core::slotPluginExists( QString _pluginName , bool& _exists ) {
for ( int i = 0 ; i < (int)plugins.size(); ++i ) { for ( int i = 0 ; i < (int)plugins_.size(); ++i ) {
if ( plugins[i].rpcName == _pluginName ) { if ( plugins_[i].rpcName == _pluginName ) {
_exists = true; _exists = true;
return; return;
} }
...@@ -76,8 +76,8 @@ void Core::slotFunctionExists( QString _pluginName , QString _functionName , boo ...@@ -76,8 +76,8 @@ void Core::slotFunctionExists( QString _pluginName , QString _functionName , boo
//Find plugin //Find plugin
int plugin = -1; int plugin = -1;
for ( int i = 0 ; i < (int)plugins.size(); ++i ) { for ( int i = 0 ; i < (int)plugins_.size(); ++i ) {
if ( plugins[i].rpcName == _pluginName ) { if ( plugins_[i].rpcName == _pluginName ) {
plugin = i; plugin = i;
break; break;
} }
...@@ -88,15 +88,15 @@ void Core::slotFunctionExists( QString _pluginName , QString _functionName , boo ...@@ -88,15 +88,15 @@ void Core::slotFunctionExists( QString _pluginName , QString _functionName , boo
return; return;
} }
_exists = plugins[plugin].rpcFunctions.contains(_functionName); _exists = plugins_[plugin].rpcFunctions.contains(_functionName);
} }
void Core::slotCall( QString _pluginName , QString _functionName , bool& _success ) { void Core::slotCall( QString _pluginName , QString _functionName , bool& _success ) {
//Find plugin //Find plugin
int plugin = -1; int plugin = -1;
for ( int i = 0 ; i < (int)plugins.size(); ++i ) { for ( int i = 0 ; i < (int)plugins_.size(); ++i ) {
if ( plugins[i].rpcName == _pluginName ) { if ( plugins_[i].rpcName == _pluginName ) {
plugin = i; plugin = i;
break; break;
} }
...@@ -108,7 +108,7 @@ void Core::slotCall( QString _pluginName , QString _functionName , bool& _succes ...@@ -108,7 +108,7 @@ void Core::slotCall( QString _pluginName , QString _functionName , bool& _succes
return; return;
} }
if ( !plugins[plugin].rpcFunctions.contains(_functionName) ) { if ( !plugins_[plugin].rpcFunctions.contains(_functionName) ) {
_success = false; _success = false;
emit log(LOGERR, tr("Unable to call function from Plugin : ") + _pluginName); emit log(LOGERR, tr("Unable to call function from Plugin : ") + _pluginName);
emit log(LOGERR, tr("Function ") + _functionName + tr(" not found!")); emit log(LOGERR, tr("Function ") + _functionName + tr(" not found!"));
......
...@@ -221,8 +221,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) { ...@@ -221,8 +221,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1; int id = -1;
// Find the plugin which added this Toolbox // Find the plugin which added this Toolbox
for ( uint i = 0 ; i < plugins.size(); ++i ) { for ( uint i = 0 ; i < plugins_.size(); ++i ) {
if ( plugins[i].plugin == sender() ) { if ( plugins_[i].plugin == sender() ) {
id = i; id = i;
break; break;
} }
...@@ -230,8 +230,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) { ...@@ -230,8 +230,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) {
// Find the scripting plugin because we assign this toolBox to it as we did not find the original sender // Find the scripting plugin because we assign this toolBox to it as we did not find the original sender
if ( id == -1 ) { if ( id == -1 ) {
for ( uint i = 0 ; i < plugins.size(); ++i ) { for ( uint i = 0 ; i < plugins_.size(); ++i ) {
if ( plugins[i].name == "Scripting" ) { if ( plugins_[i].name == "Scripting" ) {
id = i; id = i;
break; break;
} }
...@@ -244,8 +244,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) { ...@@ -244,8 +244,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget) {
} }
} }
plugins[id].toolboxWidgets.push_back( std::pair< QString,QWidget* >( _name , _widget) ); plugins_[id].toolboxWidgets.push_back( std::pair< QString,QWidget* >( _name , _widget) );
plugins[id].toolboxIcons.push_back( 0 ); plugins_[id].toolboxIcons.push_back( 0 );
// add widget name to viewMode 'all' // add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleToolboxes.contains(_name) ){ if ( !viewModes_[0]->visibleToolboxes.contains(_name) ){
...@@ -262,8 +262,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget, QIcon* _icon) { ...@@ -262,8 +262,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget, QIcon* _icon) {
int id = -1; int id = -1;
// Find the plugin which added this Toolbox // Find the plugin which added this Toolbox
for ( uint i = 0 ; i < plugins.size(); ++i ) { for ( uint i = 0 ; i < plugins_.size(); ++i ) {
if ( plugins[i].plugin == sender() ) { if ( plugins_[i].plugin == sender() ) {
id = i; id = i;
break; break;
} }
...@@ -271,8 +271,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget, QIcon* _icon) { ...@@ -271,8 +271,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget, QIcon* _icon) {
// Find the scripting plugin because we assign this toolBox to it as we did not find the original sender // Find the scripting plugin because we assign this toolBox to it as we did not find the original sender
if ( id == -1 ) { if ( id == -1 ) {
for ( uint i = 0 ; i < plugins.size(); ++i ) { for ( uint i = 0 ; i < plugins_.size(); ++i ) {
if ( plugins[i].name == "Scripting" ) { if ( plugins_[i].name == "Scripting" ) {
id = i; id = i;
break; break;
} }
...@@ -285,8 +285,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget, QIcon* _icon) { ...@@ -285,8 +285,8 @@ void Core::addToolbox(QString _name ,QWidget* _widget, QIcon* _icon) {
} }
} }
plugins[id].toolboxWidgets.push_back( std::pair< QString,QWidget* >( _name , _widget) ); plugins_[id].toolboxWidgets.push_back( std::pair< QString,QWidget* >( _name , _widget) );
plugins[id].toolboxIcons.push_back( _icon ); plugins_[id].toolboxIcons.push_back( _icon );
// add widget name to viewMode 'all' // add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleToolboxes.contains(_name) ){ if ( !viewModes_[0]->visibleToolboxes.contains(_name) ){
...@@ -352,3 +352,39 @@ QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine) ...@@ -352,3 +352,39 @@ QScriptValue printToFileFunction(QScriptContext *context, QScriptEngine *engine)
return engine->undefinedValue(); return engine->undefinedValue();
} }
QScriptValue helpFunction(QScriptContext *context, QScriptEngine *engine)
{
if ( context->argumentCount() != 1 ) {
context->throwError( QScriptContext::SyntaxError, "Error! helpFunction needs one argument" );
return engine->undefinedValue();
}
QString helpString = context->argument(0).toString();
// Get the corewidget poiter ( Set in Core.cc )
QScriptValue calleeData = context->callee().property("core");
Core *core = qobject_cast<Core*>(calleeData.toQObject());
const std::vector<PluginInfo> plugins = core->plugins();
for (unsigned int i=0; i < plugins.size(); i++) {
if (plugins[i].rpcName == helpString) {
core->scriptLogFunction( "=======================================================\n" );
core->scriptLogFunction( "Found Plugin \"" + plugins[i].name + "\" \n" );
core->scriptLogFunction( "Description: " + plugins[i].description + " \n");
core->scriptLogFunction( "=======================================================\n" );
core->scriptLogFunction( "Scripting functions: \n");
for ( int j = 0 ; j < plugins[i].rpcFunctions.size() ; ++j ) {
core->scriptLogFunction( plugins[i].rpcFunctions[j]+"\n");
}
core->scriptLogFunction( "\n\n");
}
}
return engine->undefinedValue();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment