Commit c30b08ab authored by Dirk Wilden's avatar Dirk Wilden

added scripting function for setViewMode

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6333 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f869561c
......@@ -1188,49 +1188,6 @@ void Core::setDescriptions(){
}
void Core::addViewMode(QString _modeName, QString _toolboxList) {
QStringList list = _toolboxList.split(";");
coreWidget_->slotAddViewMode(_modeName,list);
}
void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1;
// Find the plugin which added this Toolbox
for ( uint i = 0 ; i < plugins.size(); ++i ) {
if ( plugins[i].plugin == sender() ) {
id = i;
break;
}
}
// Find the scripting plugin because we assign this toolBox to it as we did not find the original sender
if ( id == -1 ) {
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) );
// add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleWidgets.contains(_name) ){
viewModes_[0]->visibleWidgets << _name;
viewModes_[0]->visibleWidgets.sort();
}
}
void Core::slotDeleteObject( int _id ){
if ( _id == -1 )
......
......@@ -752,6 +752,9 @@ private:
*/
void createWidget(QString _objectName, QString _uiFilename);
/// Set the active ViewMode
void setViewMode(QString _viewMode);
private :
/// Core scripting engine
QScriptEngine scriptEngine_;
......
......@@ -103,6 +103,62 @@ void Core::createWidget(QString _objectName, QString _uiFilename) {
}
//-----------------------------------------------------------------------------
void Core::setViewMode(QString _viewMode){
if ( OpenFlipper::Options::gui() )
coreWidget_->setViewMode( _viewMode );
}
//-----------------------------------------------------------------------------
void Core::addViewMode(QString _modeName, QString _toolboxList) {
QStringList list = _toolboxList.split(";");
coreWidget_->slotAddViewMode(_modeName,list);
}
//-----------------------------------------------------------------------------
void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1;
// Find the plugin which added this Toolbox
for ( uint i = 0 ; i < plugins.size(); ++i ) {
if ( plugins[i].plugin == sender() ) {
id = i;
break;
}
}
// Find the scripting plugin because we assign this toolBox to it as we did not find the original sender
if ( id == -1 ) {
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) );
// add widget name to viewMode 'all'
if ( !viewModes_[0]->visibleWidgets.contains(_name) ){
viewModes_[0]->visibleWidgets << _name;
viewModes_[0]->visibleWidgets.sort();
}
setViewMode( OpenFlipper::Options::defaultToolboxMode() );
}
//=============================================================================
//== Script Special Functions =================================================
//=============================================================================
......
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