Move wizard list generating helper methods to IWizard.

They don't have anything to do specifically with file wizards.
This commit is contained in:
con
2009-05-11 13:34:58 +02:00
parent fc78ae272b
commit 8457bd6861
6 changed files with 77 additions and 43 deletions

View File

@@ -151,11 +151,6 @@ public:
virtual QStringList runWizard(const QString &path, QWidget *parent);
// Utility to find all registered wizards
static QList<IWizard*> allWizards();
// Utility to find all registered wizards of a certain kind
static QList<IWizard*> findWizardsOfKind(Kind kind);
// Build a file name, adding the extension unless baseName already has one
static QString buildFileName(const QString &path, const QString &baseName, const QString &extension);
@@ -222,20 +217,6 @@ protected:
QString *errorMessage) const = 0;
};
/* A utility to find all wizards supporting a view mode and matching a predicate */
template <class Predicate>
QList<IWizard*> findWizards(Predicate predicate)
{
// Filter all wizards
const QList<IWizard*> allWizards = BaseFileWizard::allWizards();
QList<IWizard*> rc;
const QList<IWizard*>::const_iterator cend = allWizards.constEnd();
for (QList<IWizard*>::const_iterator it = allWizards.constBegin(); it != cend; ++it)
if (predicate(*(*it)))
rc.push_back(*it);
return rc;
}
} // namespace Core
#endif // BASEFILEWIZARD_H