Commit 3319797d authored by con's avatar con

Some plugin spec property renaming.

parent 74005136
......@@ -623,13 +623,13 @@ void PluginManagerPrivate::writeSettings()
QSettings settings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("Nokia"), QLatin1String("QtCreator"));
QStringList notLoadedPlugins;
QStringList tempDisabledPlugins;
foreach(PluginSpec *spec, pluginSpecs) {
if (!spec->loadOnStartup())
notLoadedPlugins.append(spec->name());
if (!spec->isEnabled())
tempDisabledPlugins.append(spec->name());
}
settings.setValue(QLatin1String(C_IGNORED_PLUGINS), notLoadedPlugins);
settings.setValue(QLatin1String(C_IGNORED_PLUGINS), tempDisabledPlugins);
}
void PluginManagerPrivate::loadSettings()
......@@ -637,8 +637,7 @@ void PluginManagerPrivate::loadSettings()
const QSettings settings(QSettings::IniFormat, QSettings::UserScope,
QLatin1String("Nokia"), QLatin1String("QtCreator"));
notLoadedPlugins = settings.value(QLatin1String(C_IGNORED_PLUGINS)).toStringList();
disabledPlugins = settings.value(QLatin1String(C_IGNORED_PLUGINS)).toStringList();
}
void PluginManagerPrivate::stopAll()
......@@ -762,7 +761,7 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList<PluginSpec *> &queu
circularityCheckQueue.append(spec);
// check if we have the dependencies
if (spec->state() == PluginSpec::Invalid || spec->state() == PluginSpec::Read) {
if (!spec->d->ignoreOnStartup && spec->d->loadOnStartup) {
if (!spec->isDisabledByDependency() && spec->isEnabled()) {
spec->d->hasError = true;
spec->d->errorString += "\n";
spec->d->errorString += PluginManager::tr("Cannot load plugin because dependencies are not resolved");
......@@ -790,7 +789,7 @@ bool PluginManagerPrivate::loadQueue(PluginSpec *spec, QList<PluginSpec *> &queu
*/
void PluginManagerPrivate::loadPlugin(PluginSpec *spec, PluginSpec::State destState)
{
if (spec->hasError() || spec->ignoreOnStartup())
if (spec->hasError() || spec->isDisabledByDependency())
return;
switch (destState) {
......@@ -884,8 +883,8 @@ void PluginManagerPrivate::readPluginPaths()
collection = new PluginCollection(spec->category());
pluginCategories.insert(spec->category(), collection);
}
if (notLoadedPlugins.contains(spec->name()))
spec->setLoadOnStartup(false);
if (disabledPlugins.contains(spec->name()))
spec->setEnabled(false);
collection->addPlugin(spec);
pluginSpecs.append(spec);
......
......@@ -79,7 +79,7 @@ public:
QStringList pluginPaths;
QString extension;
QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ?
QStringList notLoadedPlugins;
QStringList disabledPlugins;
QStringList arguments;
QScopedPointer<QTime> m_profileTimer;
......
......@@ -240,14 +240,14 @@ QString PluginSpec::category() const
\fn bool PluginSpec::loadOnStartup() const
True if the plugin is loaded at startup. True by default - the user can change it from the Plugin settings.
*/
bool PluginSpec::loadOnStartup() const
bool PluginSpec::isEnabled() const
{
return d->loadOnStartup;
return d->enabled;
}
bool PluginSpec::ignoreOnStartup() const
bool PluginSpec::isDisabledByDependency() const
{
return d->ignoreOnStartup;
return d->disabledByDependency;
}
/*!
......@@ -437,8 +437,8 @@ namespace {
*/
PluginSpecPrivate::PluginSpecPrivate(PluginSpec *spec)
:
loadOnStartup(true),
ignoreOnStartup(false),
enabled(true),
disabledByDependency(false),
plugin(0),
state(PluginSpec::Invalid),
hasError(false),
......@@ -496,14 +496,9 @@ bool PluginSpecPrivate::read(const QString &fileName)
return true;
}
void PluginSpec::setLoadOnStartup(bool value)
void PluginSpec::setEnabled(bool value)
{
d->loadOnStartup = value;
}
void PluginSpec::setIgnoreOnStartup(bool value)
{
d->ignoreOnStartup = value;
d->enabled = value;
}
/*!
......@@ -797,8 +792,8 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
foreach (PluginSpec *spec, specs) {
if (spec->provides(dependency.name, dependency.version)) {
found = spec;
if (!spec->loadOnStartup() || spec->ignoreOnStartup())
ignoreOnStartup = true;
if (!spec->isEnabled() || spec->isDisabledByDependency())
disabledByDependency = true;
spec->addDependentPlugin(q);
......@@ -820,7 +815,7 @@ bool PluginSpecPrivate::resolveDependencies(const QList<PluginSpec *> &specs)
dependencySpecs = resolvedDependencies;
if (loadOnStartup && !ignoreOnStartup)
if (enabled && !disabledByDependency)
state = PluginSpec::Resolved;
return true;
......
......@@ -79,9 +79,9 @@ public:
QString description() const;
QString url() const;
QString category() const;
bool loadOnStartup() const;
bool isEnabled() const;
// true if loading was not done due to user unselecting this plugin or its dependencies
bool ignoreOnStartup() const;
bool isDisabledByDependency() const;
QList<PluginDependency> dependencies() const;
typedef QList<PluginArgumentDescription> PluginArgumentDescriptions;
......@@ -91,8 +91,7 @@ public:
QString location() const;
QString filePath() const;
void setLoadOnStartup(bool value);
void setIgnoreOnStartup(bool value);
void setEnabled(bool value);
QStringList arguments() const;
void setArguments(const QStringList &arguments);
......
......@@ -69,8 +69,8 @@ public:
QString url;
QString category;
QList<PluginDependency> dependencies;
bool loadOnStartup;
bool ignoreOnStartup;
bool enabled;
bool disabledByDependency;
QString location;
QString filePath;
......
......@@ -178,7 +178,7 @@ void PluginView::updateList()
defaultCollectionItem->setData(0, Qt::UserRole, qVariantFromValue(defaultCollection));
foreach (PluginSpec *spec, m_specToItem.keys())
toggleRelatedPlugins(spec, spec->loadOnStartup() && !spec->ignoreOnStartup());
toggleRelatedPlugins(spec, spec->isEnabled() && !spec->isDisabledByDependency());
m_ui->categoryWidget->clear();
if (!m_items.isEmpty()) {
......@@ -217,7 +217,7 @@ int PluginView::parsePluginSpecs(QTreeWidgetItem *parentItem, Qt::CheckState &gr
pluginItem->setData(0, Qt::UserRole, qVariantFromValue(spec));
Qt::CheckState state = Qt::Unchecked;
if (spec->loadOnStartup()) {
if (spec->isEnabled()) {
state = Qt::Checked;
++loadCount;
}
......@@ -300,7 +300,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
if (column == C_LOAD) {
spec->setLoadOnStartup(loadOnStartup);
spec->setEnabled(loadOnStartup);
toggleRelatedPlugins(spec, loadOnStartup);
if (item->parent()) {
......@@ -308,7 +308,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
Qt::CheckState state = Qt::PartiallyChecked;
int loadCount = 0;
for (int i = 0; i < collection->plugins().length(); ++i) {
if (collection->plugins().at(i)->loadOnStartup())
if (collection->plugins().at(i)->isEnabled())
++loadCount;
}
if (loadCount == collection->plugins().length())
......@@ -329,7 +329,7 @@ void PluginView::updatePluginSettings(QTreeWidgetItem *item, int column)
QTreeWidgetItem *child = m_specToItem.value(spec);
if (!m_whitelist.contains(spec->name())) {
spec->setLoadOnStartup(loadOnStartup);
spec->setEnabled(loadOnStartup);
Qt::CheckState state = (loadOnStartup ? Qt::Checked : Qt::Unchecked);
child->setData(C_LOAD, Qt::CheckStateRole, state);
toggleRelatedPlugins(spec, loadOnStartup);
......
......@@ -111,8 +111,8 @@ void PluginDialog::updateButtons()
if (selectedSpec) {
m_detailsButton->setEnabled(true);
m_errorDetailsButton->setEnabled(selectedSpec->hasError()
|| selectedSpec->ignoreOnStartup()
|| !selectedSpec->loadOnStartup());
|| selectedSpec->isDisabledByDependency()
|| !selectedSpec->isEnabled());
} else {
m_detailsButton->setEnabled(false);
m_errorDetailsButton->setEnabled(false);
......
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