32 #include "ui_pluginview.h"
34 #include <QtCore/QDir>
35 #include <QHeaderView>
36 #include <QTreeWidgetItem>
63 using namespace ExtensionSystem;
75 p(new Internal::PluginViewPrivate)
78 QHeaderView *header = m_ui->pluginWidget->header();
79 header->setSectionResizeMode(0, QHeaderView::ResizeToContents);
80 header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
81 header->setSectionResizeMode(2, QHeaderView::ResizeToContents);
82 m_ui->pluginWidget->sortItems(1, Qt::AscendingOrder);
84 connect(p->manager, SIGNAL(pluginsChanged()),
this, SLOT(updateList()));
85 connect(m_ui->pluginWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
86 this, SLOT(selectPlugin(QTreeWidgetItem*)));
87 connect(m_ui->pluginWidget, SIGNAL(itemActivated(QTreeWidgetItem*,
int)),
88 this, SLOT(activatePlugin(QTreeWidgetItem*)));
108 if (!m_ui->pluginWidget->currentItem())
110 return m_ui->pluginWidget->currentItem()->data(0, Qt::UserRole).value<
PluginSpec *>();
113 void PluginView::updateList()
115 static QIcon okIcon(
":/extensionsystem/images/ok.png");
116 static QIcon errorIcon(
":/extensionsystem/images/error.png");
118 QTreeWidgetItem *currentItem =
nullptr;
121 QTreeWidgetItem *item =
new QTreeWidgetItem(QStringList()
126 << QDir::toNativeSeparators(spec->
filePath()));
127 item->setToolTip(4, QDir::toNativeSeparators(spec->
filePath()));
128 item->setIcon(0, spec->
hasError() ? errorIcon : okIcon);
129 item->setData(0, Qt::UserRole, qVariantFromValue(spec));
131 if (currPlugin == spec)
134 m_ui->pluginWidget->clear();
135 if (!items.isEmpty())
136 m_ui->pluginWidget->addTopLevelItems(items);
138 m_ui->pluginWidget->setCurrentItem(currentItem);
139 else if (!items.isEmpty())
140 m_ui->pluginWidget->setCurrentItem(items.first());
143 void PluginView::selectPlugin(QTreeWidgetItem *current)
151 void PluginView::activatePlugin(QTreeWidgetItem *item)
PluginSpec * currentPlugin() const
Widget that shows a list of all plugins and their state.
Core plugin system that manages the plugins, their life cycle and their registered objects...
QString compatVersion() const
void currentPluginChanged(ExtensionSystem::PluginSpec *spec)
Q_DECLARE_METATYPE(Core::Internal::MenuActionContainer *) using namespace Core
Contains the information of the plugins xml description file and information about the plugin's curre...
void pluginActivated(ExtensionSystem::PluginSpec *spec)