diff --git a/src/tools/ecode/plugins/pluginmanager.cpp b/src/tools/ecode/plugins/pluginmanager.cpp index 38d5c5df2..84a3abc10 100644 --- a/src/tools/ecode/plugins/pluginmanager.cpp +++ b/src/tools/ecode/plugins/pluginmanager.cpp @@ -137,9 +137,11 @@ class UIPluginManagerTable : public UITableView { public: UIPluginManagerTable() : UITableView() {} + std::function onModelEnabledChange; + std::function getCheckBoxFn( const ModelIndex& index, const PluginsModel* model ) { - return [index, model]( UIPushButton* but ) -> UITextView* { + return [index, model, this]( UIPushButton* but ) -> UITextView* { UICheckBox* chk = UICheckBox::New(); chk->setChecked( model->data( model->index( index.row(), PluginsModel::Enabled ) ).asBool() ); @@ -155,6 +157,8 @@ class UIPluginManagerTable : public UITableView { std::string id( model->data( model->index( index.row(), PluginsModel::Id ) ).asCStr() ); model->getManager()->setEnabled( id, checked ); + if ( onModelEnabledChange ) + onModelEnabledChange( id, checked ); } return 1; } ); @@ -237,6 +241,9 @@ UIWindow* UIPluginManager::New( UISceneNode* sceneNode, PluginManager* manager, prefs->setEnabled( manager->isEnabled( def->id ) && manager->get( def->id )->hasFileConfig() ); } ); + tv->onModelEnabledChange = [&, prefs, manager]( const std::string& id, bool enabled ) { + prefs->setEnabled( enabled && manager->get( id )->hasFileConfig() ); + }; win->center(); return win; }