Commit 6a1baf21 authored by Pierre Kraemer's avatar Pierre Kraemer

enable / disable plugin tabs wrt. selected view

parent 48969dd6
...@@ -79,8 +79,9 @@ public: ...@@ -79,8 +79,9 @@ public:
void addPluginDockTab(Plugin* plugin, QWidget* tabWidget, const QString& tabText); void addPluginDockTab(Plugin* plugin, QWidget* tabWidget, const QString& tabText);
void removePluginDockTab(Plugin* plugin, QWidget* tabWidget); void removePluginDockTab(Plugin* plugin, QWidget* tabWidget);
// void enablePluginTabWidgets(Plugin* plugin); private slots:
// void disablePluginTabWidgets(Plugin* plugin); void enablePluginTabWidgets(PluginInteraction* plugin);
void disablePluginTabWidgets(PluginInteraction* plugin);
/********************************************************* /*********************************************************
* MANAGE MAPS * MANAGE MAPS
......
...@@ -233,25 +233,21 @@ View* SCHNApps::getView(const QString& name) const ...@@ -233,25 +233,21 @@ View* SCHNApps::getView(const QString& name) const
void SCHNApps::setSelectedView(View* view) void SCHNApps::setSelectedView(View* view)
{ {
// if(m_selectedView) if(m_selectedView)
// { {
// const QList<Plugin*>& oldPlugins = m_currentView->getLinkedPlugins(); foreach(PluginInteraction* p, m_selectedView->getLinkedPlugins())
// foreach(Plugin* p, oldPlugins) disablePluginTabWidgets(p);
// disablePluginTabWidgets(p); disconnect(m_selectedView, SIGNAL(pluginLinked(PluginInteraction*)), this, SLOT(enablePluginTabWidgets(PluginInteraction*)));
disconnect(m_selectedView, SIGNAL(pluginUnlinked(PluginInteraction*)), this, SLOT(disablePluginTabWidgets(PluginInteraction*)));
// disconnect(m_currentView, SIGNAL(pluginLinked(Plugin*)), this, SLOT(enablePluginTabWidgets(Plugin*))); }
// disconnect(m_currentView, SIGNAL(pluginUnlinked(Plugin*)), this, SLOT(disablePluginTabWidgets(Plugin*)));
// }
View* oldSelected = m_selectedView; View* oldSelected = m_selectedView;
m_selectedView = view; m_selectedView = view;
// const QList<Plugin*>& newPlugins = m_currentView->getLinkedPlugins(); foreach(PluginInteraction* p, m_selectedView->getLinkedPlugins())
// foreach(Plugin* p, newPlugins) enablePluginTabWidgets(p);
// enablePluginTabWidgets(p); connect(m_selectedView, SIGNAL(pluginLinked(PluginInteraction*)), this, SLOT(enablePluginTabWidgets(PluginInteraction*)));
connect(m_selectedView, SIGNAL(pluginUnlinked(PluginInteraction*)), this, SLOT(disablePluginTabWidgets(PluginInteraction*)));
// connect(m_currentView, SIGNAL(pluginLinked(Plugin*)), this, SLOT(enablePluginTabWidgets(Plugin*)));
// connect(m_currentView, SIGNAL(pluginUnlinked(Plugin*)), this, SLOT(disablePluginTabWidgets(Plugin*)));
emit(selectedViewChanged(oldSelected, m_selectedView)); emit(selectedViewChanged(oldSelected, m_selectedView));
...@@ -436,27 +432,31 @@ void SCHNApps::removePluginDockTab(Plugin* plugin, QWidget *tabWidget) ...@@ -436,27 +432,31 @@ void SCHNApps::removePluginDockTab(Plugin* plugin, QWidget *tabWidget)
} }
} }
//void SCHNApps::enablePluginTabWidgets(Plugin* plugin) void SCHNApps::enablePluginTabWidgets(PluginInteraction* plugin)
//{ {
// int currentTab = m_dockTabWidget->currentIndex(); // int currentTab = m_dockTabWidget->currentIndex();
// const QList<QWidget*> tabWidgets = plugin->getTabWidgets(); if(m_pluginTabs.contains(plugin))
// foreach(QWidget* w, tabWidgets) {
// m_dockTabWidget->setTabEnabled(m_dockTabWidget->indexOf(w), true); foreach(QWidget* w, m_pluginTabs[plugin])
m_pluginDockTabWidget->setTabEnabled(m_pluginDockTabWidget->indexOf(w), true);
}
// m_dockTabWidget->setCurrentIndex(currentTab); // m_dockTabWidget->setCurrentIndex(currentTab);
//} }
//void SCHNApps::disablePluginTabWidgets(Plugin* plugin) void SCHNApps::disablePluginTabWidgets(PluginInteraction* plugin)
//{ {
// int currentTab = m_dockTabWidget->currentIndex(); // int currentTab = m_dockTabWidget->currentIndex();
// const QList<QWidget*> tabWidgets = plugin->getTabWidgets(); if(m_pluginTabs.contains(plugin))
// foreach(QWidget* w, tabWidgets) {
// m_dockTabWidget->setTabEnabled(m_dockTabWidget->indexOf(w), false); foreach(QWidget* w, m_pluginTabs[plugin])
m_pluginDockTabWidget->setTabEnabled(m_pluginDockTabWidget->indexOf(w), false);
}
// m_dockTabWidget->setCurrentIndex(currentTab); // m_dockTabWidget->setCurrentIndex(currentTab);
//} }
/********************************************************* /*********************************************************
* MANAGE MAPS * MANAGE MAPS
......
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