2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
2011-04-13 08:42:33 +02:00
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2011-04-13 08:42:33 +02:00
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "pluginview.h"
|
|
|
|
|
#include "pluginview_p.h"
|
|
|
|
|
#include "pluginmanager.h"
|
|
|
|
|
#include "pluginspec.h"
|
2010-03-12 16:02:23 +01:00
|
|
|
#include "plugincollection.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "ui_pluginview.h"
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
|
|
|
|
#include <QHeaderView>
|
|
|
|
|
#include <QTreeWidgetItem>
|
|
|
|
|
#include <QPalette>
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include <QtDebug>
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\class ExtensionSystem::PluginView
|
|
|
|
|
\brief Widget that shows a list of all plugins and their state.
|
|
|
|
|
|
|
|
|
|
This can be embedded e.g. in a dialog in the application that
|
|
|
|
|
uses the plugin manager.
|
|
|
|
|
The class also provides notifications for interactions with the list.
|
|
|
|
|
|
|
|
|
|
\sa ExtensionSystem::PluginDetailsView
|
|
|
|
|
\sa ExtensionSystem::PluginErrorView
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void PluginView::currentPluginChanged(ExtensionSystem::PluginSpec *spec)
|
|
|
|
|
The current selection in the plugin list has changed to the
|
|
|
|
|
plugin corresponding to \a spec.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn void PluginView::pluginActivated(ExtensionSystem::PluginSpec *spec)
|
|
|
|
|
The plugin list entry corresponding to \a spec has been activated,
|
|
|
|
|
e.g. by a double-click.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using namespace ExtensionSystem;
|
|
|
|
|
|
2010-12-16 11:25:28 +01:00
|
|
|
Q_DECLARE_METATYPE(ExtensionSystem::PluginSpec*)
|
|
|
|
|
Q_DECLARE_METATYPE(ExtensionSystem::PluginCollection*)
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn PluginView::PluginView(PluginManager *manager, QWidget *parent)
|
|
|
|
|
Constructs a PluginView that gets the list of plugins from the
|
|
|
|
|
given plugin \a manager with a given \a parent widget.
|
|
|
|
|
*/
|
|
|
|
|
PluginView::PluginView(PluginManager *manager, QWidget *parent)
|
2010-01-29 21:33:57 +01:00
|
|
|
: QWidget(parent),
|
2008-12-02 12:01:29 +01:00
|
|
|
m_ui(new Internal::Ui::PluginView),
|
2010-03-12 16:02:23 +01:00
|
|
|
p(new Internal::PluginViewPrivate),
|
|
|
|
|
m_allowCheckStateUpdate(true),
|
|
|
|
|
C_LOAD(1)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
m_ui->setupUi(this);
|
2010-03-12 16:02:23 +01:00
|
|
|
QHeaderView *header = m_ui->categoryWidget->header();
|
2008-12-02 12:01:29 +01:00
|
|
|
header->setResizeMode(0, QHeaderView::ResizeToContents);
|
|
|
|
|
header->setResizeMode(2, QHeaderView::ResizeToContents);
|
2010-03-12 16:02:23 +01:00
|
|
|
|
|
|
|
|
m_okIcon = QIcon(QLatin1String(":/extensionsystem/images/ok.png"));
|
|
|
|
|
m_errorIcon = QIcon(QLatin1String(":/extensionsystem/images/error.png"));
|
|
|
|
|
m_notLoadedIcon = QIcon(QLatin1String(":/extensionsystem/images/notloaded.png"));
|
|
|
|
|
|
2010-03-12 16:12:57 +01:00
|
|
|
m_ui->categoryWidget->setColumnWidth(C_LOAD, 40);
|
|
|
|
|
|
2010-03-12 16:02:23 +01:00
|
|
|
// cannot disable these
|
|
|
|
|
m_whitelist << QString("Core") << QString("Locator")
|
|
|
|
|
<< QString("Find") << QString("TextEditor");
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
p->manager = manager;
|
|
|
|
|
connect(p->manager, SIGNAL(pluginsChanged()), this, SLOT(updateList()));
|
2010-03-12 16:02:23 +01:00
|
|
|
connect(m_ui->categoryWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(selectPlugin(QTreeWidgetItem*)));
|
2010-03-12 16:02:23 +01:00
|
|
|
connect(m_ui->categoryWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
|
2008-12-02 12:01:29 +01:00
|
|
|
this, SLOT(activatePlugin(QTreeWidgetItem*)));
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
updateList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn PluginView::~PluginView()
|
|
|
|
|
\internal
|
|
|
|
|
*/
|
|
|
|
|
PluginView::~PluginView()
|
|
|
|
|
{
|
|
|
|
|
delete p;
|
|
|
|
|
delete m_ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
\fn PluginSpec *PluginView::currentPlugin() const
|
|
|
|
|
Returns the current selection in the list of plugins.
|
|
|
|
|
*/
|
|
|
|
|
PluginSpec *PluginView::currentPlugin() const
|
|
|
|
|
{
|
2010-03-12 16:02:23 +01:00
|
|
|
if (!m_ui->categoryWidget->currentItem())
|
2008-12-02 12:01:29 +01:00
|
|
|
return 0;
|
2010-03-12 16:02:23 +01:00
|
|
|
if (!m_ui->categoryWidget->currentItem()->data(0, Qt::UserRole).isNull())
|
|
|
|
|
return m_ui->categoryWidget->currentItem()->data(0, Qt::UserRole).value<PluginSpec *>();
|
|
|
|
|
return 0;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PluginView::updateList()
|
|
|
|
|
{
|
2010-03-12 16:02:23 +01:00
|
|
|
connect(m_ui->categoryWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
|
|
|
|
|
this, SLOT(updatePluginSettings(QTreeWidgetItem*, int)));
|
|
|
|
|
|
|
|
|
|
PluginCollection *defaultCollection = 0;
|
|
|
|
|
foreach(PluginCollection *collection, p->manager->pluginCollections()) {
|
|
|
|
|
if (collection->name().isEmpty()) {
|
|
|
|
|
defaultCollection = collection;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// State, name, load, version, vendor.
|
|
|
|
|
QTreeWidgetItem *collectionItem = new QTreeWidgetItem(QStringList()
|
|
|
|
|
<< collection->name()
|
|
|
|
|
<< QString() // state
|
|
|
|
|
<< QString() // load
|
|
|
|
|
<< QString() // version
|
|
|
|
|
<< QString()); // vendor
|
|
|
|
|
m_items.append(collectionItem);
|
|
|
|
|
|
|
|
|
|
Qt::CheckState groupState = Qt::Unchecked;
|
2010-03-12 17:22:46 +01:00
|
|
|
int state = parsePluginSpecs(collectionItem, groupState, collection->plugins());
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-03-12 17:22:46 +01:00
|
|
|
collectionItem->setIcon(0, iconForState(state));
|
2010-03-12 16:02:23 +01:00
|
|
|
collectionItem->setData(C_LOAD, Qt::CheckStateRole, QVariant(groupState));
|
|
|
|
|
collectionItem->setToolTip(C_LOAD, tr("Load on Startup"));
|
|
|
|
|
collectionItem->setData(0, Qt::UserRole, qVariantFromValue(collection));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// add all non-categorized plugins into utilities. could also be added as root items
|
|
|
|
|
// but that makes the tree ugly.
|
|
|
|
|
QTreeWidgetItem *defaultCollectionItem = new QTreeWidgetItem(QStringList()
|
|
|
|
|
<< QString(tr("Utilities"))
|
|
|
|
|
<< QString()
|
|
|
|
|
<< QString()
|
|
|
|
|
<< QString()
|
|
|
|
|
<< QString());
|
|
|
|
|
|
|
|
|
|
m_items.append(defaultCollectionItem);
|
|
|
|
|
Qt::CheckState groupState = Qt::Unchecked;
|
2010-06-24 10:13:32 +10:00
|
|
|
int state = parsePluginSpecs(defaultCollectionItem, groupState, defaultCollection ? defaultCollection->plugins() : QList<PluginSpec *>());
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-03-12 17:22:46 +01:00
|
|
|
defaultCollectionItem->setIcon(0, iconForState(state));
|
2010-03-12 16:02:23 +01:00
|
|
|
defaultCollectionItem->setData(C_LOAD, Qt::CheckStateRole, QVariant(groupState));
|
|
|
|
|
defaultCollectionItem->setToolTip(C_LOAD, tr("Load on Startup"));
|
|
|
|
|
defaultCollectionItem->setData(0, Qt::UserRole, qVariantFromValue(defaultCollection));
|
|
|
|
|
|
2010-05-19 16:29:47 +02:00
|
|
|
updatePluginDependencies();
|
2010-03-12 16:02:23 +01:00
|
|
|
|
|
|
|
|
m_ui->categoryWidget->clear();
|
|
|
|
|
if (!m_items.isEmpty()) {
|
|
|
|
|
m_ui->categoryWidget->addTopLevelItems(m_items);
|
|
|
|
|
m_ui->categoryWidget->expandAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_ui->categoryWidget->sortItems(0, Qt::AscendingOrder);
|
|
|
|
|
if (m_ui->categoryWidget->topLevelItemCount())
|
|
|
|
|
m_ui->categoryWidget->setCurrentItem(m_ui->categoryWidget->topLevelItem(0));
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-12 17:22:46 +01:00
|
|
|
int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins)
|
2010-03-12 16:02:23 +01:00
|
|
|
{
|
2010-03-12 17:22:46 +01:00
|
|
|
int ret = 0;
|
2010-03-12 16:02:23 +01:00
|
|
|
int loadCount = 0;
|
2010-03-12 17:22:46 +01:00
|
|
|
|
2010-03-12 16:02:23 +01:00
|
|
|
for (int i = 0; i < plugins.length(); ++i) {
|
|
|
|
|
PluginSpec *spec = plugins[i];
|
|
|
|
|
if (spec->hasError())
|
2010-03-12 17:22:46 +01:00
|
|
|
ret |= ParsedWithErrors;
|
2010-03-12 16:02:23 +01:00
|
|
|
|
|
|
|
|
QTreeWidgetItem *pluginItem = new QTreeWidgetItem(QStringList()
|
2008-12-02 12:01:29 +01:00
|
|
|
<< spec->name()
|
2010-03-12 16:02:23 +01:00
|
|
|
<< QString() // load on startup
|
2010-02-10 10:47:34 +01:00
|
|
|
<< QString::fromLatin1("%1 (%2)").arg(spec->version(), spec->compatVersion())
|
2010-03-12 16:02:23 +01:00
|
|
|
<< spec->vendor());
|
|
|
|
|
|
|
|
|
|
pluginItem->setToolTip(0, QDir::toNativeSeparators(spec->filePath()));
|
|
|
|
|
bool ok = !spec->hasError();
|
2010-03-12 17:22:46 +01:00
|
|
|
QIcon icon = ok ? m_okIcon : m_errorIcon;
|
2010-03-12 16:02:23 +01:00
|
|
|
if (ok && (spec->state() != PluginSpec::Running))
|
|
|
|
|
icon = m_notLoadedIcon;
|
|
|
|
|
|
|
|
|
|
pluginItem->setIcon(0, icon);
|
|
|
|
|
pluginItem->setData(0, Qt::UserRole, qVariantFromValue(spec));
|
|
|
|
|
|
|
|
|
|
Qt::CheckState state = Qt::Unchecked;
|
2010-03-30 14:18:15 +02:00
|
|
|
if (spec->isEnabled()) {
|
2010-03-12 16:02:23 +01:00
|
|
|
state = Qt::Checked;
|
2010-03-12 17:22:46 +01:00
|
|
|
++loadCount;
|
|
|
|
|
}
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-06-07 10:25:39 +02:00
|
|
|
if (!m_whitelist.contains(spec->name())) {
|
2010-03-12 16:02:23 +01:00
|
|
|
pluginItem->setData(C_LOAD, Qt::CheckStateRole, state);
|
2010-06-07 10:25:39 +02:00
|
|
|
} else {
|
2010-03-12 16:02:23 +01:00
|
|
|
pluginItem->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked);
|
2010-06-07 10:25:39 +02:00
|
|
|
pluginItem->setFlags(Qt::ItemIsSelectable);
|
2010-03-12 16:02:23 +01:00
|
|
|
}
|
2010-06-07 10:25:39 +02:00
|
|
|
|
2010-03-12 16:02:23 +01:00
|
|
|
pluginItem->setToolTip(C_LOAD, tr("Load on Startup"));
|
|
|
|
|
|
|
|
|
|
m_specToItem.insert(spec, pluginItem);
|
|
|
|
|
|
|
|
|
|
if (parentItem)
|
|
|
|
|
parentItem->addChild(pluginItem);
|
|
|
|
|
else
|
|
|
|
|
m_items.append(pluginItem);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-03-12 17:22:46 +01:00
|
|
|
if (loadCount == plugins.length()) {
|
2010-03-12 16:02:23 +01:00
|
|
|
groupState = Qt::Checked;
|
2010-03-12 17:22:46 +01:00
|
|
|
ret |= ParsedAll;
|
|
|
|
|
} else if (loadCount == 0) {
|
2010-03-12 16:02:23 +01:00
|
|
|
groupState = Qt::Unchecked;
|
2010-03-12 17:22:46 +01:00
|
|
|
ret |= ParsedNone;
|
|
|
|
|
} else {
|
2010-03-12 16:02:23 +01:00
|
|
|
groupState = Qt::PartiallyChecked;
|
2010-03-12 17:22:46 +01:00
|
|
|
ret = ret | ParsedPartial;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QIcon PluginView::iconForState(int state)
|
|
|
|
|
{
|
|
|
|
|
if (state & ParsedWithErrors)
|
|
|
|
|
return m_errorIcon;
|
|
|
|
|
|
|
|
|
|
if (state & ParsedNone || state & ParsedPartial)
|
|
|
|
|
return m_notLoadedIcon;
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-03-12 17:22:46 +01:00
|
|
|
return m_okIcon;
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PluginView::selectPlugin(QTreeWidgetItem *current)
|
|
|
|
|
{
|
|
|
|
|
if (!current)
|
|
|
|
|
emit currentPluginChanged(0);
|
2010-03-12 16:02:23 +01:00
|
|
|
else if (current->data(0, Qt::UserRole).canConvert<PluginSpec*>())
|
2008-12-02 12:01:29 +01:00
|
|
|
emit currentPluginChanged(current->data(0, Qt::UserRole).value<PluginSpec *>());
|
2010-03-12 16:02:23 +01:00
|
|
|
else
|
|
|
|
|
emit currentPluginChanged(0);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PluginView::activatePlugin(QTreeWidgetItem *item)
|
|
|
|
|
{
|
2010-03-12 16:02:23 +01:00
|
|
|
if (item->data(0, Qt::UserRole).canConvert<PluginSpec*>()) {
|
|
|
|
|
emit pluginActivated(item->data(0, Qt::UserRole).value<PluginSpec *>());
|
|
|
|
|
} else
|
|
|
|
|
emit pluginActivated(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
|
|
|
|
|
{
|
|
|
|
|
if (!m_allowCheckStateUpdate)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
m_allowCheckStateUpdate = false;
|
|
|
|
|
|
|
|
|
|
bool loadOnStartup = item->data(C_LOAD, Qt::CheckStateRole).toBool();
|
|
|
|
|
|
|
|
|
|
if (item->data(0, Qt::UserRole).canConvert<PluginSpec*>()) {
|
|
|
|
|
PluginSpec *spec = item->data(0, Qt::UserRole).value<PluginSpec *>();
|
|
|
|
|
|
|
|
|
|
if (column == C_LOAD) {
|
|
|
|
|
|
2010-03-30 14:18:15 +02:00
|
|
|
spec->setEnabled(loadOnStartup);
|
2010-05-19 16:29:47 +02:00
|
|
|
updatePluginDependencies();
|
2010-03-12 16:02:23 +01:00
|
|
|
|
|
|
|
|
if (item->parent()) {
|
|
|
|
|
PluginCollection *collection = item->parent()->data(0, Qt::UserRole).value<PluginCollection *>();
|
|
|
|
|
Qt::CheckState state = Qt::PartiallyChecked;
|
|
|
|
|
int loadCount = 0;
|
|
|
|
|
for (int i = 0; i < collection->plugins().length(); ++i) {
|
2010-03-30 14:18:15 +02:00
|
|
|
if (collection->plugins().at(i)->isEnabled())
|
2010-03-12 16:02:23 +01:00
|
|
|
++loadCount;
|
|
|
|
|
}
|
|
|
|
|
if (loadCount == collection->plugins().length())
|
|
|
|
|
state = Qt::Checked;
|
|
|
|
|
else if (loadCount == 0)
|
|
|
|
|
state = Qt::Unchecked;
|
|
|
|
|
|
|
|
|
|
item->parent()->setData(C_LOAD, Qt::CheckStateRole, state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit pluginSettingsChanged(spec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
PluginCollection *collection = item->data(0, Qt::UserRole).value<PluginCollection *>();
|
|
|
|
|
for (int i = 0; i < collection->plugins().length(); ++i) {
|
|
|
|
|
PluginSpec *spec = collection->plugins().at(i);
|
|
|
|
|
QTreeWidgetItem *child = m_specToItem.value(spec);
|
|
|
|
|
|
|
|
|
|
if (!m_whitelist.contains(spec->name())) {
|
2010-03-30 14:18:15 +02:00
|
|
|
spec->setEnabled(loadOnStartup);
|
2010-03-12 16:02:23 +01:00
|
|
|
Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked);
|
|
|
|
|
child->setData(C_LOAD, Qt::CheckStateRole, state);
|
|
|
|
|
} else {
|
|
|
|
|
child->setData(C_LOAD, Qt::CheckStateRole, Qt::Checked);
|
2010-06-07 10:25:39 +02:00
|
|
|
child->setFlags(Qt::ItemIsSelectable);
|
2010-03-12 16:02:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2010-05-19 16:29:47 +02:00
|
|
|
updatePluginDependencies();
|
2010-03-12 16:02:23 +01:00
|
|
|
emit pluginSettingsChanged(collection->plugins().first());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_allowCheckStateUpdate = true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-19 16:29:47 +02:00
|
|
|
void PluginView::updatePluginDependencies()
|
2010-03-12 16:02:23 +01:00
|
|
|
{
|
2010-05-19 16:29:47 +02:00
|
|
|
foreach (PluginSpec *spec, PluginManager::instance()->loadQueue()) {
|
|
|
|
|
bool disableIndirectly = false;
|
2010-06-07 10:25:39 +02:00
|
|
|
if (m_whitelist.contains(spec->name()))
|
|
|
|
|
continue;
|
|
|
|
|
|
2011-01-11 14:01:08 +01:00
|
|
|
QHashIterator<PluginDependency, PluginSpec *> it(spec->dependencySpecs());
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
it.next();
|
|
|
|
|
if (it.key().type == PluginDependency::Optional)
|
|
|
|
|
continue;
|
|
|
|
|
PluginSpec *depSpec = it.value();
|
2010-05-19 16:29:47 +02:00
|
|
|
if (!depSpec->isEnabled() || depSpec->isDisabledIndirectly()) {
|
|
|
|
|
disableIndirectly = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-12 16:02:23 +01:00
|
|
|
QTreeWidgetItem *childItem = m_specToItem.value(spec);
|
2010-05-19 16:29:47 +02:00
|
|
|
childItem->setDisabled(disableIndirectly);
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-05-19 16:29:47 +02:00
|
|
|
if (disableIndirectly == spec->isDisabledIndirectly())
|
|
|
|
|
continue;
|
|
|
|
|
spec->setDisabledIndirectly(disableIndirectly);
|
2010-03-12 16:02:23 +01:00
|
|
|
|
2010-05-19 16:29:47 +02:00
|
|
|
if (childItem->parent() && !childItem->parent()->isExpanded())
|
|
|
|
|
childItem->parent()->setExpanded(true);
|
2010-03-12 16:02:23 +01:00
|
|
|
}
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|