forked from qt-creator/qt-creator
Rename PluginSpec::isEnabled() into isEnabledInSettings
This is what it actually is. Change-Id: I2ea2e77edc3fd80eb1e25156edc7a59e86dfac9a Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
@@ -45,7 +45,7 @@ PluginErrorOverview::PluginErrorOverview(QWidget *parent) :
|
|||||||
|
|
||||||
foreach (PluginSpec *spec, PluginManager::plugins()) {
|
foreach (PluginSpec *spec, PluginManager::plugins()) {
|
||||||
// only show errors on startup if plugin is enabled.
|
// only show errors on startup if plugin is enabled.
|
||||||
if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) {
|
if (spec->hasError() && spec->isEnabledInSettings() && !spec->isDisabledIndirectly()) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(spec->name());
|
QListWidgetItem *item = new QListWidgetItem(spec->name());
|
||||||
item->setData(Qt::UserRole, qVariantFromValue(spec));
|
item->setData(Qt::UserRole, qVariantFromValue(spec));
|
||||||
m_ui->pluginList->addItem(item);
|
m_ui->pluginList->addItem(item);
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ bool PluginManager::hasError()
|
|||||||
{
|
{
|
||||||
foreach (PluginSpec *spec, plugins()) {
|
foreach (PluginSpec *spec, plugins()) {
|
||||||
// only show errors on startup if plugin is enabled.
|
// only show errors on startup if plugin is enabled.
|
||||||
if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly())
|
if (spec->hasError() && spec->isEnabledInSettings() && !spec->isDisabledIndirectly())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -882,9 +882,9 @@ void PluginManagerPrivate::writeSettings()
|
|||||||
QStringList tempDisabledPlugins;
|
QStringList tempDisabledPlugins;
|
||||||
QStringList tempForceEnabledPlugins;
|
QStringList tempForceEnabledPlugins;
|
||||||
foreach (PluginSpec *spec, pluginSpecs) {
|
foreach (PluginSpec *spec, pluginSpecs) {
|
||||||
if (!spec->isDisabledByDefault() && !spec->isEnabled())
|
if (!spec->isDisabledByDefault() && !spec->isEnabledInSettings())
|
||||||
tempDisabledPlugins.append(spec->name());
|
tempDisabledPlugins.append(spec->name());
|
||||||
if (spec->isDisabledByDefault() && spec->isEnabled())
|
if (spec->isDisabledByDefault() && spec->isEnabledInSettings())
|
||||||
tempForceEnabledPlugins.append(spec->name());
|
tempForceEnabledPlugins.append(spec->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1120,7 +1120,7 @@ void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destSt
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// don't load disabled plugins.
|
// don't load disabled plugins.
|
||||||
if ((spec->isDisabledIndirectly() || !spec->isEnabled()) && destState == PluginSpec::Loaded)
|
if ((spec->isDisabledIndirectly() || !spec->isEnabledInSettings()) && destState == PluginSpec::Loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (destState) {
|
switch (destState) {
|
||||||
|
|||||||
@@ -283,12 +283,15 @@ bool PluginSpec::isDisabledByDefault() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool PluginSpec::isEnabled() const
|
\fn bool PluginSpec::isEnabledInSettings() const
|
||||||
Returns if the plugin is loaded at startup. True by default - the user can change it from the Plugin settings.
|
Returns if the plugin should be loaded at startup. True by default
|
||||||
|
The user can change it from the Plugin settings.
|
||||||
|
Note: That this function returns true even if a plugin is disabled because
|
||||||
|
of a not loaded dependencies, or a error in loading.
|
||||||
*/
|
*/
|
||||||
bool PluginSpec::isEnabled() const
|
bool PluginSpec::isEnabledInSettings() const
|
||||||
{
|
{
|
||||||
return d->enabled;
|
return d->enabledInSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -468,7 +471,7 @@ PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec)
|
|||||||
:
|
:
|
||||||
experimental(false),
|
experimental(false),
|
||||||
disabledByDefault(false),
|
disabledByDefault(false),
|
||||||
enabled(true),
|
enabledInSettings(true),
|
||||||
disabledIndirectly(false),
|
disabledIndirectly(false),
|
||||||
plugin(0),
|
plugin(0),
|
||||||
state(PluginSpec::Invalid),
|
state(PluginSpec::Invalid),
|
||||||
@@ -528,7 +531,7 @@ bool PluginSpecPrivate::read(const QString &fileName)
|
|||||||
|
|
||||||
void PluginSpec::setEnabled(bool value)
|
void PluginSpec::setEnabled(bool value)
|
||||||
{
|
{
|
||||||
d->enabled = value;
|
d->enabledInSettings = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginSpec::setDisabledByDefault(bool value)
|
void PluginSpec::setDisabledByDefault(bool value)
|
||||||
@@ -616,7 +619,7 @@ void PluginSpecPrivate::readPluginSpec(QXmlStreamReader &reader)
|
|||||||
return;
|
return;
|
||||||
if (experimental)
|
if (experimental)
|
||||||
disabledByDefault = true;
|
disabledByDefault = true;
|
||||||
enabled = !disabledByDefault;
|
enabledInSettings = !disabledByDefault;
|
||||||
while (!reader.atEnd()) {
|
while (!reader.atEnd()) {
|
||||||
reader.readNext();
|
reader.readNext();
|
||||||
switch (reader.tokenType()) {
|
switch (reader.tokenType()) {
|
||||||
@@ -888,7 +891,7 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
|
|||||||
|
|
||||||
void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled()
|
void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled()
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabledInSettings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (disabledIndirectly)
|
if (disabledIndirectly)
|
||||||
@@ -900,7 +903,7 @@ void PluginSpecPrivate::disableIndirectlyIfDependencyDisabled()
|
|||||||
if (it.key().type == PluginDependency::Optional)
|
if (it.key().type == PluginDependency::Optional)
|
||||||
continue;
|
continue;
|
||||||
PluginSpec *dependencySpec = it.value();
|
PluginSpec *dependencySpec = it.value();
|
||||||
if (dependencySpec->isDisabledIndirectly() || !dependencySpec->isEnabled()) {
|
if (dependencySpec->isDisabledIndirectly() || !dependencySpec->isEnabledInSettings()) {
|
||||||
disabledIndirectly = true;
|
disabledIndirectly = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public:
|
|||||||
QString category() const;
|
QString category() const;
|
||||||
bool isExperimental() const;
|
bool isExperimental() const;
|
||||||
bool isDisabledByDefault() const;
|
bool isDisabledByDefault() const;
|
||||||
bool isEnabled() const;
|
bool isEnabledInSettings() const;
|
||||||
bool isDisabledIndirectly() const;
|
bool isDisabledIndirectly() const;
|
||||||
QList<PluginDependency> dependencies() const;
|
QList<PluginDependency> dependencies() const;
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
QString url;
|
QString url;
|
||||||
QString category;
|
QString category;
|
||||||
QList<PluginDependency> dependencies;
|
QList<PluginDependency> dependencies;
|
||||||
bool enabled;
|
bool enabledInSettings;
|
||||||
bool disabledIndirectly;
|
bool disabledIndirectly;
|
||||||
|
|
||||||
QString location;
|
QString location;
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ void PluginView::updateList()
|
|||||||
int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins)
|
int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &groupState, QList<PluginSpec*> plugins)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int loadCount = 0;
|
int checkedCount = 0;
|
||||||
|
|
||||||
for (int i = 0; i < plugins.length(); ++i) {
|
for (int i = 0; i < plugins.length(); ++i) {
|
||||||
PluginSpec *spec = plugins[i];
|
PluginSpec *spec = plugins[i];
|
||||||
@@ -212,9 +212,9 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr
|
|||||||
pluginItem->setData(0, Qt::UserRole, qVariantFromValue(spec));
|
pluginItem->setData(0, Qt::UserRole, qVariantFromValue(spec));
|
||||||
|
|
||||||
Qt::CheckState state = Qt::Unchecked;
|
Qt::CheckState state = Qt::Unchecked;
|
||||||
if (spec->isEnabled()) {
|
if (spec->isEnabledInSettings()) {
|
||||||
state = Qt::Checked;
|
state = Qt::Checked;
|
||||||
++loadCount;
|
++checkedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_whitelist.contains(spec->name())) {
|
if (!m_whitelist.contains(spec->name())) {
|
||||||
@@ -235,10 +235,10 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loadCount == plugins.length()) {
|
if (checkedCount == plugins.length()) {
|
||||||
groupState = Qt::Checked;
|
groupState = Qt::Checked;
|
||||||
ret |= ParsedAll;
|
ret |= ParsedAll;
|
||||||
} else if (loadCount == 0) {
|
} else if (checkedCount == 0) {
|
||||||
groupState = Qt::Unchecked;
|
groupState = Qt::Unchecked;
|
||||||
ret |= ParsedNone;
|
ret |= ParsedNone;
|
||||||
} else {
|
} else {
|
||||||
@@ -300,7 +300,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
|
|||||||
Qt::CheckState state = Qt::PartiallyChecked;
|
Qt::CheckState state = Qt::PartiallyChecked;
|
||||||
int loadCount = 0;
|
int loadCount = 0;
|
||||||
for (int i = 0; i < collection->plugins().length(); ++i) {
|
for (int i = 0; i < collection->plugins().length(); ++i) {
|
||||||
if (collection->plugins().at(i)->isEnabled())
|
if (collection->plugins().at(i)->isEnabledInSettings())
|
||||||
++loadCount;
|
++loadCount;
|
||||||
}
|
}
|
||||||
if (loadCount == collection->plugins().length())
|
if (loadCount == collection->plugins().length())
|
||||||
@@ -349,7 +349,7 @@ void PluginView::updatePluginDependencies()
|
|||||||
if (it.key().type == PluginDependency::Optional)
|
if (it.key().type == PluginDependency::Optional)
|
||||||
continue;
|
continue;
|
||||||
PluginSpec *depSpec = it.value();
|
PluginSpec *depSpec = it.value();
|
||||||
if (!depSpec->isEnabled() || depSpec->isDisabledIndirectly()) {
|
if (!depSpec->isEnabledInSettings() || depSpec->isDisabledIndirectly()) {
|
||||||
disableIndirectly = true;
|
disableIndirectly = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user