Commit 443825b7 authored by Jan Möbius's avatar Jan Möbius

Fix slot descriptions for core

make addToolbox slot scriptable

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5265 383ad7c9-94d9-4d36-a494-682f7c89f535
parent dbd1559a
......@@ -1126,27 +1126,40 @@ void Core::setDescriptions(){
emit setSlotDescription("loadObject()", "Show the dialog to load an object. (only works if GUI is available)",QStringList(), QStringList());
emit setSlotDescription("loadSettings()", "Show the dialog to load settings. (only works if GUI is available)",QStringList(), QStringList());
emit setSlotDescription("loadSettings(QString)", "load settings from file.",QStringList(), QStringList());
emit setSlotDescription("createWidget(QString,QString);", "Create a widget from an ui file",
emit setSlotDescription("createWidget(QString,QString)", "Create a widget from an ui file",
QString("Object name,ui file").split(","),
QString("Name of the new widget in script,ui file to load").split(","));
emit setSlotDescription("addToolbox(QString,QWidget*)", "Add a widget as a toolbox",
QString("Toolbox Entry name,Widget").split(","),
QString("Name of the new widget in the toolbox,Pointer to the new widget").split(","));
}
void Core::slotAddToolbox(QString _name ,QWidget* _widget) {
void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1;
for ( uint i = 0 ; i < plugins.size(); ++i ) {
if ( plugins[i].plugin == sender() ) {
id = i;
std::cerr << "Found" << std::endl;
break;
}
}
if ( id == -1 ) {
std::cerr << "Unknown sender plugin when adding Toolbox!" << std::endl;
return;
for ( uint i = 0 ; i < plugins.size(); ++i ) {
if ( plugins[i].name == "Scripting" ) {
id = i;
break;
}
}
if ( id == -1 ) {
std::cerr << "Unknown sender plugin when adding Toolbox!" << std::endl;
return;
}
}
plugins[id].widgets.push_back( std::pair< QString,QWidget* >( _name , _widget) );
......
......@@ -401,9 +401,6 @@ private:
/// The current Toolbox item has changed
// void slotToolboxSwitched(int _index);
/// Add a Toolbox from a plugin
void slotAddToolbox(QString _name ,QWidget* _widget);
/// Slot adding empty object from Menu
void slotAddEmptyObjectMenu();
......@@ -415,6 +412,11 @@ private:
/// Open Recent file
void slotRecentOpen(QAction* _action);
public slots:
/// Add a Toolbox from a plugin or from scripting
void addToolbox(QString _name ,QWidget* _widget);
private :
......
......@@ -605,7 +605,7 @@ void Core::loadPlugin(QString filename, bool silent){
if ( checkSignal(plugin, "addToolbox(QString,QWidget*)"))
connect(plugin, SIGNAL( addToolbox(QString,QWidget*) ),
this, SLOT( slotAddToolbox(QString,QWidget*) ),Qt::DirectConnection );
this, SLOT( addToolbox(QString,QWidget*) ),Qt::DirectConnection );
......
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