Commit 0a9195a1 authored by hjk's avatar hjk

PluginSpec cosmetics

De-noise loops, use QVector for items bigger than a pointer.

Change-Id: Idae68dc51a02cb6df9bdf2d920ae2de99c7bde6c
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 27fd8d4e
......@@ -61,8 +61,6 @@ const char C_IGNORED_PLUGINS[] = "Plugins/Ignored";
const char C_FORCEENABLED_PLUGINS[] = "Plugins/ForceEnabled";
const int DELAYED_INITIALIZE_INTERVAL = 20; // ms
typedef QList<ExtensionSystem::PluginSpec *> PluginSpecSet;
enum { debugLeaks = 0 };
/*!
......@@ -669,16 +667,13 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d
void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation, int descriptionIndentation)
{
typedef PluginSpec::PluginArgumentDescriptions PluginArgumentDescriptions;
// Check plugins for options
const PluginSpecSet::const_iterator pcend = d->pluginSpecs.constEnd();
for (PluginSpecSet::const_iterator pit = d->pluginSpecs.constBegin(); pit != pcend; ++pit) {
const PluginArgumentDescriptions pargs = (*pit)->argumentDescriptions();
foreach (PluginSpec *ps, d->pluginSpecs) {
const PluginSpec::PluginArgumentDescriptions pargs = ps->argumentDescriptions();
if (!pargs.empty()) {
str << "\nPlugin: " << (*pit)->name() << '\n';
const PluginArgumentDescriptions::const_iterator acend = pargs.constEnd();
for (PluginArgumentDescriptions::const_iterator ait =pargs.constBegin(); ait != acend; ++ait)
formatOption(str, ait->name, ait->parameter, ait->description, optionIndentation, descriptionIndentation);
str << "\nPlugin: " << ps->name() << '\n';
foreach (PluginArgumentDescription pad, pargs)
formatOption(str, pad.name, pad.parameter, pad.description, optionIndentation, descriptionIndentation);
}
}
}
......@@ -688,11 +683,8 @@ void PluginManager::formatPluginOptions(QTextStream &str, int optionIndentation,
*/
void PluginManager::formatPluginVersions(QTextStream &str)
{
const PluginSpecSet::const_iterator cend = d->pluginSpecs.constEnd();
for (PluginSpecSet::const_iterator it = d->pluginSpecs.constBegin(); it != cend; ++it) {
const PluginSpec *ps = *it;
foreach (PluginSpec *ps, d->pluginSpecs)
str << " " << ps->name() << ' ' << ps->version() << ' ' << ps->description() << '\n';
}
}
/*!
......@@ -1300,18 +1292,13 @@ void PluginManagerPrivate::resolveDependencies()
PluginSpec *PluginManagerPrivate::pluginForOption(const QString &option, bool *requiresArgument) const
{
// Look in the plugins for an option
typedef PluginSpec::PluginArgumentDescriptions PluginArgumentDescriptions;
*requiresArgument = false;
const PluginSpecSet::const_iterator pcend = pluginSpecs.constEnd();
for (PluginSpecSet::const_iterator pit = pluginSpecs.constBegin(); pit != pcend; ++pit) {
PluginSpec *ps = *pit;
const PluginArgumentDescriptions pargs = ps->argumentDescriptions();
foreach (PluginSpec *ps, pluginSpecs) {
const PluginSpec::PluginArgumentDescriptions pargs = ps->argumentDescriptions();
if (!pargs.empty()) {
const PluginArgumentDescriptions::const_iterator acend = pargs.constEnd();
for (PluginArgumentDescriptions::const_iterator ait = pargs.constBegin(); ait != acend; ++ait) {
if (ait->name == option) {
*requiresArgument = !ait->parameter.isEmpty();
foreach (PluginArgumentDescription pad, pargs) {
if (pad.name == option) {
*requiresArgument = !pad.parameter.isEmpty();
return ps;
}
}
......
......@@ -332,7 +332,7 @@ bool PluginSpec::isForceDisabled() const
/*!
The plugin dependencies. This is valid after the PluginSpec::Read state is reached.
*/
QList<PluginDependency> PluginSpec::dependencies() const
QVector<PluginDependency> PluginSpec::dependencies() const
{
return d->dependencies;
}
......
......@@ -34,8 +34,8 @@
#include "extensionsystem_global.h"
#include <QString>
#include <QList>
#include <QHash>
#include <QVector>
QT_BEGIN_NAMESPACE
class QStringList;
......@@ -102,9 +102,9 @@ public:
bool isDisabledIndirectly() const;
bool isForceEnabled() const;
bool isForceDisabled() const;
QList<PluginDependency> dependencies() const;
QVector<PluginDependency> dependencies() const;
typedef QList<PluginArgumentDescription> PluginArgumentDescriptions;
typedef QVector<PluginArgumentDescription> PluginArgumentDescriptions;
PluginArgumentDescriptions argumentDescriptions() const;
// other information, valid after 'Read' state is reached
......
......@@ -39,6 +39,7 @@
#include <QPluginLoader>
#include <QRegExp>
#include <QStringList>
#include <QVector>
#include <QXmlStreamReader>
namespace ExtensionSystem {
......@@ -80,7 +81,7 @@ public:
QString url;
QString category;
QRegExp platformSpecification;
QList<PluginDependency> dependencies;
QVector<PluginDependency> dependencies;
bool enabledInSettings;
bool disabledIndirectly;
bool forceEnabled;
......
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