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(){ ...@@ -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("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()", "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("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("Object name,ui file").split(","),
QString("Name of the new widget in script,ui file to load").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; int id = -1;
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;
std::cerr << "Found" << std::endl;
break; break;
} }
} }
if ( id == -1 ) { if ( id == -1 ) {
std::cerr << "Unknown sender plugin when adding Toolbox!" << std::endl; for ( uint i = 0 ; i < plugins.size(); ++i ) {
return; 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) ); plugins[id].widgets.push_back( std::pair< QString,QWidget* >( _name , _widget) );
......
...@@ -401,9 +401,6 @@ private: ...@@ -401,9 +401,6 @@ private:
/// The current Toolbox item has changed /// The current Toolbox item has changed
// void slotToolboxSwitched(int _index); // void slotToolboxSwitched(int _index);
/// Add a Toolbox from a plugin
void slotAddToolbox(QString _name ,QWidget* _widget);
/// Slot adding empty object from Menu /// Slot adding empty object from Menu
void slotAddEmptyObjectMenu(); void slotAddEmptyObjectMenu();
...@@ -415,6 +412,11 @@ private: ...@@ -415,6 +412,11 @@ private:
/// Open Recent file /// Open Recent file
void slotRecentOpen(QAction* _action); void slotRecentOpen(QAction* _action);
public slots:
/// Add a Toolbox from a plugin or from scripting
void addToolbox(QString _name ,QWidget* _widget);
private : private :
......
...@@ -605,7 +605,7 @@ void Core::loadPlugin(QString filename, bool silent){ ...@@ -605,7 +605,7 @@ void Core::loadPlugin(QString filename, bool silent){
if ( checkSignal(plugin, "addToolbox(QString,QWidget*)")) if ( checkSignal(plugin, "addToolbox(QString,QWidget*)"))
connect(plugin, SIGNAL( 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