30 #include <QtCore/QCoreApplication>
32 using namespace ExtensionSystem;
33 using namespace ExtensionSystem::Internal;
40 QStringList
OptionsParser::parse(QStringList pluginOptions, QStringList pluginTests, QStringList pluginNoLoad)
42 checkForNoLoadOption(pluginNoLoad);
43 checkForTestOption(pluginTests);
44 checkForPluginOption(pluginOptions);
45 return m_errorStrings;
48 void OptionsParser::checkForTestOption(QStringList pluginTests)
50 if (pluginTests.length() == 1 && pluginTests.at(0).toLower() == QStringLiteral(
"all")) {
56 foreach (QString plugin, pluginTests) {
59 m_errorStrings.append(QCoreApplication::translate(
"PluginManager",
60 "Invalid test option, the plugin '%0' does not exist.").arg(plugin));
68 void OptionsParser::checkForNoLoadOption(QStringList pluginNoLoad)
70 foreach (QString plugin, pluginNoLoad) {
73 m_errorStrings.append(QCoreApplication::translate(
"PluginManager",
74 "Invalid no-load option, the plugin '%0' does not exist.").arg(plugin));
84 void OptionsParser::checkForPluginOption(QStringList pluginOptions)
86 foreach (QString option, pluginOptions) {
87 QString simplified = option.simplified().replace(
" ",
"");
90 if(option.contains(
"=")) {
91 if(simplified.split(
"=").length() != 2) {
92 m_errorStrings.append(QCoreApplication::translate((
"PluginManager"),
93 "Wrong plugin options syntax: %0").arg(option));
96 argument = simplified.split(
"=").at(0);
97 value = simplified.split(
"=").at(1);
102 bool requiresParameter;
105 m_errorStrings.append(QCoreApplication::translate(
"PluginManager",
106 "No Plugin was found for given argument: %0").arg(argument));
OptionsParser(PluginManagerPrivate *pmPrivate)
PluginSpec * pluginForOption(const QString &option, bool *requiresArgument) const
QList< PluginSpec * > testSpecs
QStringList parse(QStringList pluginOptions, QStringList pluginTests, QStringList pluginNoLoad)
void resolveDependencies()
void addArgument(const QString &argument)
Contains the information of the plugins xml description file and information about the plugin's curre...
PluginSpec * pluginByName(const QString &name) const
QList< PluginSpec * > pluginSpecs