forked from qt-creator/qt-creator
De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per "interesting" type. Current situation: - The global object pool does not scale well for looking up objects, as iteration plus qobject_cast typically iterates over all pooled objects. - User code that can use typed results from the object pool need to have access to the full type definition anyway, i.e. depend on the plugin of the target class anyway. The patch here solves the scaling problem is to have local type-specific pools to which objects register in their constructors and deregister in their destructors. This patch here does *not* change the ownership model of the pooled objects, however, it opens the possibility to change the ownership model per type (e.g. by not putting things into the global pool at all anymore and make the local pool 'owning') and the intent is to handle that in later patchs. Even without the follow-up patches this here is a performance improvement for the cases that access the local pools instead the global one, i.e. "practically all". Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -82,6 +82,8 @@ public:
|
|||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is useful for soft dependencies using pure interfaces.
|
||||||
template <typename T> static T *getObject()
|
template <typename T> static T *getObject()
|
||||||
{
|
{
|
||||||
QReadLocker lock(listLock());
|
QReadLocker lock(listLock());
|
||||||
|
@@ -204,6 +204,24 @@ QString PropertyInfo::toString() const
|
|||||||
return list.join('|');
|
return list.join('|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QList<CustomImportsProvider *> g_customImportProviders;
|
||||||
|
|
||||||
|
CustomImportsProvider::CustomImportsProvider(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
g_customImportProviders.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomImportsProvider::~CustomImportsProvider()
|
||||||
|
{
|
||||||
|
g_customImportProviders.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<CustomImportsProvider *> CustomImportsProvider::allProviders()
|
||||||
|
{
|
||||||
|
return g_customImportProviders;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
|
||||||
CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const QString &className,
|
CppComponentValue::CppComponentValue(FakeMetaObject::ConstPtr metaObject, const QString &className,
|
||||||
|
@@ -1127,8 +1127,11 @@ class QMLJS_EXPORT CustomImportsProvider : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CustomImportsProvider(QObject *parent = 0) : QObject(parent) {}
|
explicit CustomImportsProvider(QObject *parent = nullptr);
|
||||||
virtual ~CustomImportsProvider() {}
|
virtual ~CustomImportsProvider();
|
||||||
|
|
||||||
|
static const QList<CustomImportsProvider *> allProviders();
|
||||||
|
|
||||||
virtual QList<Import> imports(ValueOwner *valueOwner, const Document *context) const = 0;
|
virtual QList<Import> imports(ValueOwner *valueOwner, const Document *context) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -33,8 +33,6 @@
|
|||||||
#include "qmljsqrcparser.h"
|
#include "qmljsqrcparser.h"
|
||||||
#include "qmljsconstants.h"
|
#include "qmljsconstants.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
using namespace LanguageUtils;
|
using namespace LanguageUtils;
|
||||||
@@ -212,12 +210,9 @@ Context::ImportsPerDocument LinkPrivate::linkImports()
|
|||||||
Imports *imports = new Imports(valueOwner);
|
Imports *imports = new Imports(valueOwner);
|
||||||
|
|
||||||
// Add custom imports for the opened document
|
// Add custom imports for the opened document
|
||||||
if (ExtensionSystem::PluginManager::instance()) {
|
for (const auto &provider : CustomImportsProvider::allProviders())
|
||||||
auto providers = ExtensionSystem::PluginManager::getObjects<CustomImportsProvider>();
|
|
||||||
foreach (const auto &provider, providers)
|
|
||||||
foreach (const auto &import, provider->imports(valueOwner, document.data()))
|
foreach (const auto &import, provider->imports(valueOwner, document.data()))
|
||||||
importCache.insert(ImportCacheKey(import.info), import);
|
importCache.insert(ImportCacheKey(import.info), import);
|
||||||
}
|
|
||||||
|
|
||||||
populateImportedTypes(imports, document);
|
populateImportedTypes(imports, document);
|
||||||
importsPerDocument.insert(document.data(), QSharedPointer<Imports>(imports));
|
importsPerDocument.insert(document.data(), QSharedPointer<Imports>(imports));
|
||||||
|
@@ -41,8 +41,6 @@
|
|||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
@@ -92,6 +90,18 @@ static bool openXmlFile(QDomDocument &doc, const Utils::FileName &fileName);
|
|||||||
static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
static bool openManifest(ProjectExplorer::Target *target, QDomDocument &doc);
|
||||||
static int parseMinSdk(const QDomElement &manifestElem);
|
static int parseMinSdk(const QDomElement &manifestElem);
|
||||||
|
|
||||||
|
static QList<AndroidQtSupport *> g_androidQtSupportProviders;
|
||||||
|
|
||||||
|
AndroidQtSupport::AndroidQtSupport()
|
||||||
|
{
|
||||||
|
g_androidQtSupportProviders.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
AndroidQtSupport::~AndroidQtSupport()
|
||||||
|
{
|
||||||
|
g_androidQtSupportProviders.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
bool AndroidManager::supportsAndroid(const ProjectExplorer::Kit *kit)
|
bool AndroidManager::supportsAndroid(const ProjectExplorer::Kit *kit)
|
||||||
{
|
{
|
||||||
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
||||||
@@ -457,8 +467,7 @@ bool AndroidManager::checkForQt51Files(Utils::FileName fileName)
|
|||||||
|
|
||||||
AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *target)
|
AndroidQtSupport *AndroidManager::androidQtSupport(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
QList<AndroidQtSupport *> providerList = ExtensionSystem::PluginManager::getObjects<AndroidQtSupport>();
|
for (AndroidQtSupport *provider : g_androidQtSupportProviders) {
|
||||||
foreach (AndroidQtSupport *provider, providerList) {
|
|
||||||
if (provider->canHandle(target))
|
if (provider->canHandle(target))
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,10 @@ class ANDROID_EXPORT AndroidQtSupport : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
protected:
|
||||||
|
AndroidQtSupport();
|
||||||
|
~AndroidQtSupport();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum BuildType {
|
enum BuildType {
|
||||||
DebugBuild,
|
DebugBuild,
|
||||||
@@ -52,7 +56,6 @@ public:
|
|||||||
ReleaseBuildSigned
|
ReleaseBuildSigned
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
|
||||||
virtual bool canHandle(const ProjectExplorer::Target *target) const = 0;
|
virtual bool canHandle(const ProjectExplorer::Target *target) const = 0;
|
||||||
virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0;
|
virtual QStringList soLibSearchPath(const ProjectExplorer::Target *target) const = 0;
|
||||||
virtual QStringList androidExtraLibs(const ProjectExplorer::Target *target) const = 0;
|
virtual QStringList androidExtraLibs(const ProjectExplorer::Target *target) const = 0;
|
||||||
|
@@ -28,14 +28,24 @@
|
|||||||
#include "basefilewizardfactory.h"
|
#include "basefilewizardfactory.h"
|
||||||
#include "ifilewizardextension.h"
|
#include "ifilewizardextension.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
static QList<IFileWizardExtension *> g_fileWizardExtensions;
|
||||||
|
|
||||||
|
IFileWizardExtension::IFileWizardExtension()
|
||||||
|
{
|
||||||
|
g_fileWizardExtensions.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFileWizardExtension::~IFileWizardExtension()
|
||||||
|
{
|
||||||
|
g_fileWizardExtensions.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
BaseFileWizard::BaseFileWizard(const BaseFileWizardFactory *factory,
|
BaseFileWizard::BaseFileWizard(const BaseFileWizardFactory *factory,
|
||||||
const QVariantMap &extraValues,
|
const QVariantMap &extraValues,
|
||||||
QWidget *parent) :
|
QWidget *parent) :
|
||||||
@@ -43,19 +53,8 @@ BaseFileWizard::BaseFileWizard(const BaseFileWizardFactory *factory,
|
|||||||
m_extraValues(extraValues),
|
m_extraValues(extraValues),
|
||||||
m_factory(factory)
|
m_factory(factory)
|
||||||
{
|
{
|
||||||
// Compile extension pages, purge out unused ones
|
for (IFileWizardExtension *extension : g_fileWizardExtensions)
|
||||||
QList<IFileWizardExtension *> extensionList
|
m_extensionPages += extension->extensionPages(factory);
|
||||||
= ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
|
||||||
|
|
||||||
for (auto it = extensionList.begin(); it != extensionList.end(); ) {
|
|
||||||
const QList<QWizardPage *> extensionPages = (*it)->extensionPages(factory);
|
|
||||||
if (extensionPages.empty()) {
|
|
||||||
it = extensionList.erase(it);
|
|
||||||
} else {
|
|
||||||
m_extensionPages += extensionPages;
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_extensionPages.empty())
|
if (!m_extensionPages.empty())
|
||||||
m_firstExtensionPage = m_extensionPages.front();
|
m_firstExtensionPage = m_extensionPages.front();
|
||||||
@@ -67,9 +66,7 @@ void BaseFileWizard::initializePage(int id)
|
|||||||
if (page(id) == m_firstExtensionPage) {
|
if (page(id) == m_firstExtensionPage) {
|
||||||
generateFileList();
|
generateFileList();
|
||||||
|
|
||||||
QList<IFileWizardExtension *> extensionList
|
for (IFileWizardExtension *ex : g_fileWizardExtensions)
|
||||||
= ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
|
||||||
foreach (IFileWizardExtension *ex, extensionList)
|
|
||||||
ex->firstExtensionPageShown(m_files, m_extraValues);
|
ex->firstExtensionPageShown(m_files, m_extraValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,9 +96,7 @@ void BaseFileWizard::accept()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<IFileWizardExtension *> extensionList
|
for (IFileWizardExtension *ex : g_fileWizardExtensions) {
|
||||||
= ExtensionSystem::PluginManager::getObjects<IFileWizardExtension>();
|
|
||||||
foreach (IFileWizardExtension *ex, extensionList) {
|
|
||||||
for (int i = 0; i < m_files.count(); i++) {
|
for (int i = 0; i < m_files.count(); i++) {
|
||||||
ex->applyCodeStyle(&m_files[i]);
|
ex->applyCodeStyle(&m_files[i]);
|
||||||
}
|
}
|
||||||
@@ -116,7 +111,7 @@ void BaseFileWizard::accept()
|
|||||||
|
|
||||||
bool removeOpenProjectAttribute = false;
|
bool removeOpenProjectAttribute = false;
|
||||||
// Run the extensions
|
// Run the extensions
|
||||||
foreach (IFileWizardExtension *ex, extensionList) {
|
for (IFileWizardExtension *ex : g_fileWizardExtensions) {
|
||||||
bool remove;
|
bool remove;
|
||||||
if (!ex->processFiles(m_files, &remove, &errorMessage)) {
|
if (!ex->processFiles(m_files, &remove, &errorMessage)) {
|
||||||
if (!errorMessage.isEmpty())
|
if (!errorMessage.isEmpty())
|
||||||
|
@@ -135,6 +135,7 @@ QIcon Core::IOptionsPage::categoryIcon() const
|
|||||||
Sets \a categoryIcon as the category icon of the options page.
|
Sets \a categoryIcon as the category icon of the options page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static QList<Core::IOptionsPage *> g_optionsPages;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs an options page with the given \a parent.
|
Constructs an options page with the given \a parent.
|
||||||
@@ -143,7 +144,7 @@ Core::IOptionsPage::IOptionsPage(QObject *parent)
|
|||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_keywordsInitialized(false)
|
m_keywordsInitialized(false)
|
||||||
{
|
{
|
||||||
|
g_optionsPages.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -151,6 +152,12 @@ Core::IOptionsPage::IOptionsPage(QObject *parent)
|
|||||||
*/
|
*/
|
||||||
Core::IOptionsPage::~IOptionsPage()
|
Core::IOptionsPage::~IOptionsPage()
|
||||||
{
|
{
|
||||||
|
g_optionsPages.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<Core::IOptionsPage *> Core::IOptionsPage::allOptionsPages()
|
||||||
|
{
|
||||||
|
return g_optionsPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -183,6 +190,24 @@ bool Core::IOptionsPage::matches(const QString &searchKeyWord) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QList<Core::IOptionsPageProvider *> g_optionsPagesProviders;
|
||||||
|
|
||||||
|
Core::IOptionsPageProvider::IOptionsPageProvider(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
g_optionsPagesProviders.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::IOptionsPageProvider::~IOptionsPageProvider()
|
||||||
|
{
|
||||||
|
g_optionsPagesProviders.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<Core::IOptionsPageProvider *> Core::IOptionsPageProvider::allOptionsPagesProviders()
|
||||||
|
{
|
||||||
|
return g_optionsPagesProviders;
|
||||||
|
}
|
||||||
|
|
||||||
QIcon Core::IOptionsPageProvider::categoryIcon() const
|
QIcon Core::IOptionsPageProvider::categoryIcon() const
|
||||||
{
|
{
|
||||||
return QIcon(m_categoryIcon);
|
return QIcon(m_categoryIcon);
|
||||||
|
@@ -47,6 +47,8 @@ public:
|
|||||||
IOptionsPage(QObject *parent = 0);
|
IOptionsPage(QObject *parent = 0);
|
||||||
virtual ~IOptionsPage();
|
virtual ~IOptionsPage();
|
||||||
|
|
||||||
|
static const QList<IOptionsPage *> allOptionsPages();
|
||||||
|
|
||||||
Id id() const { return m_id; }
|
Id id() const { return m_id; }
|
||||||
QString displayName() const { return m_displayName; }
|
QString displayName() const { return m_displayName; }
|
||||||
Id category() const { return m_category; }
|
Id category() const { return m_category; }
|
||||||
@@ -88,7 +90,10 @@ class CORE_EXPORT IOptionsPageProvider : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IOptionsPageProvider(QObject *parent = 0) : QObject(parent) {}
|
IOptionsPageProvider(QObject *parent = nullptr);
|
||||||
|
~IOptionsPageProvider();
|
||||||
|
|
||||||
|
static const QList<IOptionsPageProvider *> allOptionsPagesProviders();
|
||||||
|
|
||||||
Id category() const { return m_category; }
|
Id category() const { return m_category; }
|
||||||
QString displayCategory() const { return m_displayCategory; }
|
QString displayCategory() const { return m_displayCategory; }
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/fancylineedit.h>
|
#include <utils/fancylineedit.h>
|
||||||
@@ -69,7 +68,7 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
|
|||||||
|
|
||||||
static inline QList<IOptionsPage*> sortedOptionsPages()
|
static inline QList<IOptionsPage*> sortedOptionsPages()
|
||||||
{
|
{
|
||||||
QList<IOptionsPage*> rc = ExtensionSystem::PluginManager::getObjects<IOptionsPage>();
|
QList<IOptionsPage*> rc = IOptionsPage::allOptionsPages();
|
||||||
std::stable_sort(rc.begin(), rc.end(), optionsPageLessThan);
|
std::stable_sort(rc.begin(), rc.end(), optionsPageLessThan);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -414,8 +413,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
|||||||
else
|
else
|
||||||
setWindowTitle(tr("Options"));
|
setWindowTitle(tr("Options"));
|
||||||
|
|
||||||
m_model->setPages(m_pages,
|
m_model->setPages(m_pages, IOptionsPageProvider::allOptionsPagesProviders());
|
||||||
ExtensionSystem::PluginManager::getObjects<IOptionsPageProvider>());
|
|
||||||
|
|
||||||
m_proxyModel->setSourceModel(m_model);
|
m_proxyModel->setSourceModel(m_model);
|
||||||
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||||
|
@@ -25,13 +25,23 @@
|
|||||||
|
|
||||||
#include "diffservice.h"
|
#include "diffservice.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
static DiffService *g_instance = nullptr;
|
||||||
|
|
||||||
|
DiffService::DiffService()
|
||||||
|
{
|
||||||
|
g_instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
DiffService::~DiffService()
|
||||||
|
{
|
||||||
|
g_instance = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
DiffService *DiffService::instance()
|
DiffService *DiffService::instance()
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<DiffService>();
|
return g_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Core
|
} // Core
|
||||||
|
@@ -38,7 +38,8 @@ class CORE_EXPORT DiffService
|
|||||||
public:
|
public:
|
||||||
static DiffService *instance();
|
static DiffService *instance();
|
||||||
|
|
||||||
virtual ~DiffService() {}
|
DiffService();
|
||||||
|
virtual ~DiffService();
|
||||||
|
|
||||||
virtual void diffFiles(const QString &leftFileName, const QString &rightFileName) = 0;
|
virtual void diffFiles(const QString &leftFileName, const QString &rightFileName) = 0;
|
||||||
virtual void diffModifiedFiles(const QStringList &fileNames) = 0;
|
virtual void diffModifiedFiles(const QStringList &fileNames) = 0;
|
||||||
|
@@ -711,24 +711,26 @@ bool DocumentManager::saveDocument(IDocument *document, const QString &fileName,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename FactoryType>
|
QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter = 0)
|
||||||
QSet<QString> filterStrings()
|
|
||||||
{
|
{
|
||||||
QSet<QString> filters;
|
QSet<QString> uniqueFilters;
|
||||||
for (FactoryType *factory : ExtensionSystem::PluginManager::getObjects<FactoryType>()) {
|
|
||||||
|
for (IEditorFactory *factory : IEditorFactory::allEditorFactories()) {
|
||||||
for (const QString &mt : factory->mimeTypes()) {
|
for (const QString &mt : factory->mimeTypes()) {
|
||||||
const QString filter = mimeTypeForName(mt).filterString();
|
const QString filter = mimeTypeForName(mt).filterString();
|
||||||
if (!filter.isEmpty())
|
if (!filter.isEmpty())
|
||||||
filters.insert(filter);
|
uniqueFilters.insert(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IDocumentFactory *factory : IDocumentFactory::allDocumentFactories()) {
|
||||||
|
for (const QString &mt : factory->mimeTypes()) {
|
||||||
|
const QString filter = mimeTypeForName(mt).filterString();
|
||||||
|
if (!filter.isEmpty())
|
||||||
|
uniqueFilters.insert(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter = 0)
|
|
||||||
{
|
|
||||||
const QSet<QString> uniqueFilters = filterStrings<IDocumentFactory>()
|
|
||||||
+ filterStrings<IEditorFactory>();
|
|
||||||
QStringList filters = uniqueFilters.toList();
|
QStringList filters = uniqueFilters.toList();
|
||||||
filters.sort();
|
filters.sort();
|
||||||
const QString allFiles = Utils::allFilesFilterString();
|
const QString allFiles = Utils::allFilesFilterString();
|
||||||
|
@@ -186,17 +186,6 @@ static void setFocusToEditorViewAndUnmaximizePanes(EditorView *view)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For something that has a 'QString id' (IEditorFactory
|
|
||||||
* or IExternalEditor), find the one matching a id. */
|
|
||||||
template <class EditorFactoryLike>
|
|
||||||
EditorFactoryLike *findById(Id id)
|
|
||||||
{
|
|
||||||
return ExtensionSystem::PluginManager::getObject<EditorFactoryLike>(
|
|
||||||
[&id](EditorFactoryLike *efl) {
|
|
||||||
return id == efl->id();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorManagerPrivate::EditorManagerPrivate(QObject *parent) :
|
EditorManagerPrivate::EditorManagerPrivate(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_revertToSavedAction(new QAction(EditorManager::tr("Revert to Saved"), this)),
|
m_revertToSavedAction(new QAction(EditorManager::tr("Revert to Saved"), this)),
|
||||||
@@ -606,7 +595,9 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (editorId.isValid()) {
|
if (editorId.isValid()) {
|
||||||
if (IEditorFactory *factory = findById<IEditorFactory>(editorId)) {
|
IEditorFactory *factory = Utils::findOrDefault(IEditorFactory::allEditorFactories(),
|
||||||
|
Utils::equal(&IEditorFactory::id, editorId));
|
||||||
|
if (factory) {
|
||||||
factories.removeOne(factory);
|
factories.removeOne(factory);
|
||||||
factories.push_front(factory);
|
factories.push_front(factory);
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1130,9 @@ EditorManager::EditorFactoryList EditorManagerPrivate::findFactories(Id editorId
|
|||||||
factories = EditorManager::editorFactories(mimeType, false);
|
factories = EditorManager::editorFactories(mimeType, false);
|
||||||
} else {
|
} else {
|
||||||
// Find by editor id
|
// Find by editor id
|
||||||
if (IEditorFactory *factory = findById<IEditorFactory>(editorId))
|
IEditorFactory *factory = Utils::findOrDefault(IEditorFactory::allEditorFactories(),
|
||||||
|
Utils::equal(&IEditorFactory::id, editorId));
|
||||||
|
if (factory)
|
||||||
factories.push_back(factory);
|
factories.push_back(factory);
|
||||||
}
|
}
|
||||||
if (factories.empty()) {
|
if (factories.empty()) {
|
||||||
@@ -2606,7 +2599,7 @@ EditorManager::EditorFactoryList
|
|||||||
EditorManager::editorFactories(const Utils::MimeType &mimeType, bool bestMatchOnly)
|
EditorManager::editorFactories(const Utils::MimeType &mimeType, bool bestMatchOnly)
|
||||||
{
|
{
|
||||||
EditorFactoryList rc;
|
EditorFactoryList rc;
|
||||||
const EditorFactoryList allFactories = ExtensionSystem::PluginManager::getObjects<IEditorFactory>();
|
const EditorFactoryList allFactories = IEditorFactory::allEditorFactories();
|
||||||
mimeTypeFactoryLookup(mimeType, allFactories, bestMatchOnly, &rc);
|
mimeTypeFactoryLookup(mimeType, allFactories, bestMatchOnly, &rc);
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
||||||
@@ -2617,7 +2610,7 @@ EditorManager::ExternalEditorList
|
|||||||
EditorManager::externalEditors(const Utils::MimeType &mimeType, bool bestMatchOnly)
|
EditorManager::externalEditors(const Utils::MimeType &mimeType, bool bestMatchOnly)
|
||||||
{
|
{
|
||||||
ExternalEditorList rc;
|
ExternalEditorList rc;
|
||||||
const ExternalEditorList allEditors = ExtensionSystem::PluginManager::getObjects<IExternalEditor>();
|
const ExternalEditorList allEditors = IExternalEditor::allExternalEditors();
|
||||||
mimeTypeFactoryLookup(mimeType, allEditors, bestMatchOnly, &rc);
|
mimeTypeFactoryLookup(mimeType, allEditors, bestMatchOnly, &rc);
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
||||||
@@ -2692,7 +2685,8 @@ bool EditorManager::isAutoSaveFile(const QString &fileName)
|
|||||||
|
|
||||||
bool EditorManager::openExternalEditor(const QString &fileName, Id editorId)
|
bool EditorManager::openExternalEditor(const QString &fileName, Id editorId)
|
||||||
{
|
{
|
||||||
IExternalEditor *ee = findById<IExternalEditor>(editorId);
|
IExternalEditor *ee = Utils::findOrDefault(IExternalEditor::allExternalEditors(),
|
||||||
|
Utils::equal(&IExternalEditor::id, editorId));
|
||||||
if (!ee)
|
if (!ee)
|
||||||
return false;
|
return false;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
|
@@ -27,9 +27,24 @@
|
|||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
Core::IEditorFactory::IEditorFactory(QObject *parent)
|
namespace Core {
|
||||||
|
|
||||||
|
static QList<IEditorFactory *> g_editorFactories;
|
||||||
|
|
||||||
|
IEditorFactory::IEditorFactory(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
g_editorFactories.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEditorFactory::~IEditorFactory()
|
||||||
|
{
|
||||||
|
g_editorFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IEditorFactory *> IEditorFactory::allEditorFactories()
|
||||||
|
{
|
||||||
|
return g_editorFactories;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Core
|
||||||
|
@@ -40,7 +40,11 @@ class CORE_EXPORT IEditorFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IEditorFactory(QObject *parent = 0);
|
IEditorFactory(QObject *parent = nullptr);
|
||||||
|
~IEditorFactory();
|
||||||
|
|
||||||
|
static const QList<IEditorFactory *> allEditorFactories();
|
||||||
|
|
||||||
QString displayName() const { return m_displayName; }
|
QString displayName() const { return m_displayName; }
|
||||||
void setDisplayName(const QString &displayName) { m_displayName = displayName; }
|
void setDisplayName(const QString &displayName) { m_displayName = displayName; }
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "iexternaleditor.h"
|
#include "iexternaleditor.h"
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Core::IExternalEditor
|
\class Core::IExternalEditor
|
||||||
\mainclass
|
\mainclass
|
||||||
@@ -50,3 +52,23 @@
|
|||||||
Opens the editor with \a fileName. Returns \c true on success or \c false
|
Opens the editor with \a fileName. Returns \c true on success or \c false
|
||||||
on failure along with the error in \a errorMessage.
|
on failure along with the error in \a errorMessage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static QList<IExternalEditor *> g_externalEditors;
|
||||||
|
|
||||||
|
IExternalEditor::IExternalEditor(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
g_externalEditors.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IExternalEditor::~IExternalEditor()
|
||||||
|
{
|
||||||
|
g_externalEditors.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IExternalEditor *> IExternalEditor::allExternalEditors()
|
||||||
|
{
|
||||||
|
return g_externalEditors;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Core
|
||||||
|
@@ -38,7 +38,10 @@ class CORE_EXPORT IExternalEditor : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IExternalEditor(QObject *parent = 0) : QObject(parent) {}
|
explicit IExternalEditor(QObject *parent = nullptr);
|
||||||
|
~IExternalEditor();
|
||||||
|
|
||||||
|
static const QList<IExternalEditor *> allExternalEditors();
|
||||||
|
|
||||||
virtual QStringList mimeTypes() const = 0;
|
virtual QStringList mimeTypes() const = 0;
|
||||||
virtual Id id() const = 0;
|
virtual Id id() const = 0;
|
||||||
|
@@ -202,13 +202,12 @@ static QString filterActionName(const IFindFilter *filter)
|
|||||||
|
|
||||||
void FindPrivate::setupFilterMenuItems()
|
void FindPrivate::setupFilterMenuItems()
|
||||||
{
|
{
|
||||||
QList<IFindFilter*> findInterfaces = ExtensionSystem::PluginManager::getObjects<IFindFilter>();
|
|
||||||
Command *cmd;
|
Command *cmd;
|
||||||
|
|
||||||
ActionContainer *mfindadvanced = ActionManager::actionContainer(Constants::M_FIND_ADVANCED);
|
ActionContainer *mfindadvanced = ActionManager::actionContainer(Constants::M_FIND_ADVANCED);
|
||||||
bool haveEnabledFilters = false;
|
bool haveEnabledFilters = false;
|
||||||
const Id base("FindFilter.");
|
const Id base("FindFilter.");
|
||||||
QList<IFindFilter *> sortedFilters = findInterfaces;
|
QList<IFindFilter *> sortedFilters = IFindFilter::allFindFilters();
|
||||||
Utils::sort(sortedFilters, &IFindFilter::displayName);
|
Utils::sort(sortedFilters, &IFindFilter::displayName);
|
||||||
foreach (IFindFilter *filter, sortedFilters) {
|
foreach (IFindFilter *filter, sortedFilters) {
|
||||||
QAction *action = new QAction(filterActionName(filter), this);
|
QAction *action = new QAction(filterActionName(filter), this);
|
||||||
|
@@ -36,8 +36,6 @@
|
|||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/findplaceholder.h>
|
#include <coreplugin/findplaceholder.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
@@ -727,10 +725,10 @@ void FindToolBar::hideAndResetFocus()
|
|||||||
|
|
||||||
FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const
|
FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const
|
||||||
{
|
{
|
||||||
QList<FindToolBarPlaceHolder*> placeholders = ExtensionSystem::PluginManager::getObjects<FindToolBarPlaceHolder>();
|
const QList<FindToolBarPlaceHolder*> placeholders = FindToolBarPlaceHolder::allFindToolbarPlaceHolders();
|
||||||
QWidget *candidate = QApplication::focusWidget();
|
QWidget *candidate = QApplication::focusWidget();
|
||||||
while (candidate) {
|
while (candidate) {
|
||||||
foreach (FindToolBarPlaceHolder *ph, placeholders) {
|
for (FindToolBarPlaceHolder *ph : placeholders) {
|
||||||
if (ph->owner() == candidate)
|
if (ph->owner() == candidate)
|
||||||
return ph;
|
return ph;
|
||||||
}
|
}
|
||||||
|
@@ -227,6 +227,23 @@
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
static QList<IFindFilter *> g_findFilters;
|
||||||
|
|
||||||
|
IFindFilter::IFindFilter()
|
||||||
|
{
|
||||||
|
g_findFilters.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFindFilter::~IFindFilter()
|
||||||
|
{
|
||||||
|
g_findFilters.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IFindFilter *> IFindFilter::allFindFilters()
|
||||||
|
{
|
||||||
|
return g_findFilters;
|
||||||
|
}
|
||||||
|
|
||||||
QKeySequence IFindFilter::defaultShortcut() const
|
QKeySequence IFindFilter::defaultShortcut() const
|
||||||
{
|
{
|
||||||
return QKeySequence();
|
return QKeySequence();
|
||||||
|
@@ -39,9 +39,12 @@ namespace Core {
|
|||||||
class CORE_EXPORT IFindFilter : public QObject
|
class CORE_EXPORT IFindFilter : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
|
||||||
|
|
||||||
virtual ~IFindFilter() {}
|
public:
|
||||||
|
IFindFilter();
|
||||||
|
virtual ~IFindFilter();
|
||||||
|
|
||||||
|
static const QList<IFindFilter *> allFindFilters();
|
||||||
|
|
||||||
virtual QString id() const = 0;
|
virtual QString id() const = 0;
|
||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
|
@@ -26,26 +26,26 @@
|
|||||||
#include "findplaceholder.h"
|
#include "findplaceholder.h"
|
||||||
#include "find/findtoolbar.h"
|
#include "find/findtoolbar.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
FindToolBarPlaceHolder *FindToolBarPlaceHolder::m_current = 0;
|
FindToolBarPlaceHolder *FindToolBarPlaceHolder::m_current = 0;
|
||||||
|
|
||||||
|
static QList<FindToolBarPlaceHolder *> g_findToolBarPlaceHolders;
|
||||||
|
|
||||||
FindToolBarPlaceHolder::FindToolBarPlaceHolder(QWidget *owner, QWidget *parent)
|
FindToolBarPlaceHolder::FindToolBarPlaceHolder(QWidget *owner, QWidget *parent)
|
||||||
: QWidget(parent), m_owner(owner), m_subWidget(0), m_lightColored(false)
|
: QWidget(parent), m_owner(owner), m_subWidget(0), m_lightColored(false)
|
||||||
{
|
{
|
||||||
|
g_findToolBarPlaceHolders.append(this);
|
||||||
setLayout(new QVBoxLayout);
|
setLayout(new QVBoxLayout);
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
|
||||||
layout()->setMargin(0);
|
layout()->setMargin(0);
|
||||||
ExtensionSystem::PluginManager::addObject(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FindToolBarPlaceHolder::~FindToolBarPlaceHolder()
|
FindToolBarPlaceHolder::~FindToolBarPlaceHolder()
|
||||||
{
|
{
|
||||||
ExtensionSystem::PluginManager::removeObject(this);
|
g_findToolBarPlaceHolders.removeOne(this);
|
||||||
if (m_subWidget) {
|
if (m_subWidget) {
|
||||||
m_subWidget->setVisible(false);
|
m_subWidget->setVisible(false);
|
||||||
m_subWidget->setParent(0);
|
m_subWidget->setParent(0);
|
||||||
@@ -54,6 +54,11 @@ FindToolBarPlaceHolder::~FindToolBarPlaceHolder()
|
|||||||
m_current = 0;
|
m_current = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QList<FindToolBarPlaceHolder *> FindToolBarPlaceHolder::allFindToolbarPlaceHolders()
|
||||||
|
{
|
||||||
|
return g_findToolBarPlaceHolders;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *FindToolBarPlaceHolder::owner() const
|
QWidget *FindToolBarPlaceHolder::owner() const
|
||||||
{
|
{
|
||||||
return m_owner;
|
return m_owner;
|
||||||
|
@@ -39,6 +39,9 @@ class CORE_EXPORT FindToolBarPlaceHolder : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit FindToolBarPlaceHolder(QWidget *owner, QWidget *parent = 0);
|
explicit FindToolBarPlaceHolder(QWidget *owner, QWidget *parent = 0);
|
||||||
~FindToolBarPlaceHolder();
|
~FindToolBarPlaceHolder();
|
||||||
|
|
||||||
|
static const QList<FindToolBarPlaceHolder *> allFindToolbarPlaceHolders();
|
||||||
|
|
||||||
QWidget *owner() const;
|
QWidget *owner() const;
|
||||||
bool isUsedByWidget(QWidget *widget);
|
bool isUsedByWidget(QWidget *widget);
|
||||||
|
|
||||||
|
@@ -29,6 +29,24 @@
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
static QList<IDocumentFactory *> g_documentFactories;
|
||||||
|
|
||||||
|
IDocumentFactory::IDocumentFactory(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
g_documentFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDocumentFactory::~IDocumentFactory()
|
||||||
|
{
|
||||||
|
g_documentFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IDocumentFactory *> IDocumentFactory::allDocumentFactories()
|
||||||
|
{
|
||||||
|
return g_documentFactories;
|
||||||
|
}
|
||||||
|
|
||||||
IDocument *IDocumentFactory::open(const QString &filename)
|
IDocument *IDocumentFactory::open(const QString &filename)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_opener, return 0);
|
QTC_ASSERT(m_opener, return 0);
|
||||||
|
@@ -41,7 +41,10 @@ class CORE_EXPORT IDocumentFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IDocumentFactory(QObject *parent = 0) : QObject(parent) {}
|
IDocumentFactory(QObject *parent = nullptr);
|
||||||
|
~IDocumentFactory();
|
||||||
|
|
||||||
|
static const QList<IDocumentFactory *> allDocumentFactories();
|
||||||
|
|
||||||
typedef std::function<IDocument *(const QString &fileName)> Opener;
|
typedef std::function<IDocument *(const QString &fileName)> Opener;
|
||||||
IDocument *open(const QString &filename);
|
IDocument *open(const QString &filename);
|
||||||
|
@@ -48,6 +48,10 @@ class CORE_EXPORT IFileWizardExtension : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
IFileWizardExtension();
|
||||||
|
~IFileWizardExtension();
|
||||||
|
static QList<IFileWizardExtension *> allFileWizardExtensions();
|
||||||
|
|
||||||
/* Return a list of pages to be added to the Wizard (empty list if not
|
/* Return a list of pages to be added to the Wizard (empty list if not
|
||||||
* applicable). */
|
* applicable). */
|
||||||
virtual QList<QWizardPage *> extensionPages(const IWizardFactory *wizard) = 0;
|
virtual QList<QWizardPage *> extensionPages(const IWizardFactory *wizard) = 0;
|
||||||
|
@@ -85,12 +85,25 @@
|
|||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
|
static QList<INavigationWidgetFactory *> g_navigationWidgetFactories;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Creates a \l{Core::NavigationViewFactory}.
|
Creates a \l{Core::NavigationViewFactory}.
|
||||||
*/
|
*/
|
||||||
INavigationWidgetFactory::INavigationWidgetFactory()
|
INavigationWidgetFactory::INavigationWidgetFactory()
|
||||||
: m_priority(0)
|
: m_priority(0)
|
||||||
{
|
{
|
||||||
|
g_navigationWidgetFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
INavigationWidgetFactory::~INavigationWidgetFactory()
|
||||||
|
{
|
||||||
|
g_navigationWidgetFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<INavigationWidgetFactory *> INavigationWidgetFactory::allNavigationFactories()
|
||||||
|
{
|
||||||
|
return g_navigationWidgetFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -53,6 +53,9 @@ class CORE_EXPORT INavigationWidgetFactory : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
INavigationWidgetFactory();
|
INavigationWidgetFactory();
|
||||||
|
~INavigationWidgetFactory();
|
||||||
|
|
||||||
|
static const QList<INavigationWidgetFactory *> allNavigationFactories();
|
||||||
|
|
||||||
void setDisplayName(const QString &displayName);
|
void setDisplayName(const QString &displayName);
|
||||||
void setPriority(int priority);
|
void setPriority(int priority);
|
||||||
|
@@ -42,7 +42,8 @@ class CORE_EXPORT IOutputPane : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IOutputPane(QObject *parent = 0) : QObject(parent) {}
|
IOutputPane(QObject *parent = nullptr);
|
||||||
|
~IOutputPane();
|
||||||
|
|
||||||
virtual QWidget *outputWidget(QWidget *parent) = 0;
|
virtual QWidget *outputWidget(QWidget *parent) = 0;
|
||||||
virtual QList<QWidget *> toolBarWidgets() const = 0;
|
virtual QList<QWidget *> toolBarWidgets() const = 0;
|
||||||
|
@@ -41,12 +41,21 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
static QList<IWelcomePage *> g_welcomePages;
|
||||||
|
|
||||||
|
const QList<IWelcomePage *> IWelcomePage::allWelcomePages()
|
||||||
|
{
|
||||||
|
return g_welcomePages;
|
||||||
|
}
|
||||||
|
|
||||||
IWelcomePage::IWelcomePage()
|
IWelcomePage::IWelcomePage()
|
||||||
{
|
{
|
||||||
|
g_welcomePages.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWelcomePage::~IWelcomePage()
|
IWelcomePage::~IWelcomePage()
|
||||||
{
|
{
|
||||||
|
g_welcomePages.removeOne(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QPalette buttonPalette(bool isActive, bool isCursorInside, bool forText)
|
static QPalette buttonPalette(bool isActive, bool isCursorInside, bool forText)
|
||||||
|
@@ -55,6 +55,8 @@ public:
|
|||||||
virtual int priority() const { return 0; }
|
virtual int priority() const { return 0; }
|
||||||
virtual Core::Id id() const = 0;
|
virtual Core::Id id() const = 0;
|
||||||
virtual QWidget *createWidget() const = 0;
|
virtual QWidget *createWidget() const = 0;
|
||||||
|
|
||||||
|
static const QList<IWelcomePage *> allWelcomePages();
|
||||||
};
|
};
|
||||||
|
|
||||||
class WelcomePageButtonPrivate;
|
class WelcomePageButtonPrivate;
|
||||||
|
@@ -48,12 +48,25 @@ using namespace Core;
|
|||||||
The filter is added to \uicontrol Tools > \uicontrol Locate.
|
The filter is added to \uicontrol Tools > \uicontrol Locate.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static QList<ILocatorFilter *> g_locatorFilters;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a locator filter with \a parent. Call from subclasses.
|
Constructs a locator filter with \a parent. Call from subclasses.
|
||||||
*/
|
*/
|
||||||
ILocatorFilter::ILocatorFilter(QObject *parent):
|
ILocatorFilter::ILocatorFilter(QObject *parent):
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
|
g_locatorFilters.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ILocatorFilter::~ILocatorFilter()
|
||||||
|
{
|
||||||
|
g_locatorFilters.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<ILocatorFilter *> ILocatorFilter::allLocatorFilters()
|
||||||
|
{
|
||||||
|
return g_locatorFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -107,8 +107,10 @@ class CORE_EXPORT ILocatorFilter : public QObject
|
|||||||
public:
|
public:
|
||||||
enum Priority {Highest = 0, High = 1, Medium = 2, Low = 3};
|
enum Priority {Highest = 0, High = 1, Medium = 2, Low = 3};
|
||||||
|
|
||||||
ILocatorFilter(QObject *parent = 0);
|
ILocatorFilter(QObject *parent = nullptr);
|
||||||
virtual ~ILocatorFilter() {}
|
virtual ~ILocatorFilter();
|
||||||
|
|
||||||
|
static const QList<ILocatorFilter *> allLocatorFilters();
|
||||||
|
|
||||||
Id id() const;
|
Id id() const;
|
||||||
Id actionId() const;
|
Id actionId() const;
|
||||||
|
@@ -139,7 +139,7 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *)
|
|||||||
|
|
||||||
void Locator::extensionsInitialized()
|
void Locator::extensionsInitialized()
|
||||||
{
|
{
|
||||||
m_filters = ExtensionSystem::PluginManager::getObjects<ILocatorFilter>();
|
m_filters = ILocatorFilter::allLocatorFilters();
|
||||||
Utils::sort(m_filters, [](const ILocatorFilter *first, const ILocatorFilter *second) -> bool {
|
Utils::sort(m_filters, [](const ILocatorFilter *first, const ILocatorFilter *second) -> bool {
|
||||||
if (first->priority() != second->priority())
|
if (first->priority() != second->priority())
|
||||||
return first->priority() < second->priority();
|
return first->priority() < second->priority();
|
||||||
|
@@ -341,8 +341,8 @@ void MainWindow::extensionsInitialized()
|
|||||||
m_statusBarManager->extensionsInitalized();
|
m_statusBarManager->extensionsInitalized();
|
||||||
OutputPaneManager::instance()->init();
|
OutputPaneManager::instance()->init();
|
||||||
m_vcsManager->extensionsInitialized();
|
m_vcsManager->extensionsInitialized();
|
||||||
m_leftNavigationWidget->setFactories(PluginManager::getObjects<INavigationWidgetFactory>());
|
m_leftNavigationWidget->setFactories(INavigationWidgetFactory::allNavigationFactories());
|
||||||
m_rightNavigationWidget->setFactories(PluginManager::getObjects<INavigationWidgetFactory>());
|
m_rightNavigationWidget->setFactories(INavigationWidgetFactory::allNavigationFactories());
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
updateContext();
|
updateContext();
|
||||||
@@ -808,7 +808,7 @@ IDocument *MainWindow::openFiles(const QStringList &fileNames,
|
|||||||
ICore::OpenFilesFlags flags,
|
ICore::OpenFilesFlags flags,
|
||||||
const QString &workingDirectory)
|
const QString &workingDirectory)
|
||||||
{
|
{
|
||||||
QList<IDocumentFactory*> documentFactories = PluginManager::getObjects<IDocumentFactory>();
|
const QList<IDocumentFactory*> documentFactories = IDocumentFactory::allDocumentFactories();
|
||||||
IDocument *res = nullptr;
|
IDocument *res = nullptr;
|
||||||
|
|
||||||
foreach (const QString &fileName, fileNames) {
|
foreach (const QString &fileName, fileNames) {
|
||||||
|
@@ -37,8 +37,6 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
@@ -66,6 +64,22 @@
|
|||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
// OutputPane
|
||||||
|
|
||||||
|
static QList<IOutputPane *> g_outputPanes;
|
||||||
|
|
||||||
|
IOutputPane::IOutputPane(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
g_outputPanes.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOutputPane::~IOutputPane()
|
||||||
|
{
|
||||||
|
g_outputPanes.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static char outputPaneSettingsKeyC[] = "OutputPaneVisibility";
|
static char outputPaneSettingsKeyC[] = "OutputPaneVisibility";
|
||||||
@@ -256,7 +270,7 @@ void OutputPaneManager::init()
|
|||||||
QFontMetrics titleFm = m_titleLabel->fontMetrics();
|
QFontMetrics titleFm = m_titleLabel->fontMetrics();
|
||||||
int minTitleWidth = 0;
|
int minTitleWidth = 0;
|
||||||
|
|
||||||
m_panes = ExtensionSystem::PluginManager::getObjects<IOutputPane>();
|
m_panes = g_outputPanes;
|
||||||
Utils::sort(m_panes, [](IOutputPane *p1, IOutputPane *p2) {
|
Utils::sort(m_panes, [](IOutputPane *p1, IOutputPane *p2) {
|
||||||
return p1->priorityInStatusBar() > p2->priorityInStatusBar();
|
return p1->priorityInStatusBar() > p2->priorityInStatusBar();
|
||||||
});
|
});
|
||||||
|
@@ -49,8 +49,6 @@ class CPPEDITOR_EXPORT CppQuickFixFactory: public TextEditor::QuickFixFactory
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CppQuickFixFactory() {}
|
|
||||||
|
|
||||||
void matchingOperations(const TextEditor::QuickFixInterface &interface,
|
void matchingOperations(const TextEditor::QuickFixInterface &interface,
|
||||||
TextEditor::QuickFixOperations &result);
|
TextEditor::QuickFixOperations &result);
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <cplusplus/ASTPath.h>
|
#include <cplusplus/ASTPath.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
@@ -59,10 +59,9 @@ IAssistProcessor *CppQuickFixAssistProvider::createProcessor() const
|
|||||||
|
|
||||||
QList<QuickFixFactory *> CppQuickFixAssistProvider::quickFixFactories() const
|
QList<QuickFixFactory *> CppQuickFixAssistProvider::quickFixFactories() const
|
||||||
{
|
{
|
||||||
QList<QuickFixFactory *> results;
|
return Utils::filtered(QuickFixFactory::allQuickFixFactories(), [](QuickFixFactory *f) {
|
||||||
foreach (CppQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<CppQuickFixFactory>())
|
return qobject_cast<CppQuickFixFactory *>(f) != nullptr;
|
||||||
results.append(f);
|
});
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
@@ -41,7 +41,6 @@
|
|||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <texteditor/textdocument.h>
|
#include <texteditor/textdocument.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <cplusplus/TranslationUnit.h>
|
#include <cplusplus/TranslationUnit.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
@@ -448,25 +447,22 @@ void RunAllQuickFixesTokenAction::run(CppEditorWidget *editorWidget)
|
|||||||
// Calling editorWidget->invokeAssist(QuickFix) would be not enough
|
// Calling editorWidget->invokeAssist(QuickFix) would be not enough
|
||||||
// since we also want to execute the ones that match.
|
// since we also want to execute the ones that match.
|
||||||
|
|
||||||
const QList<CppQuickFixFactory *> quickFixFactories
|
|
||||||
= ExtensionSystem::PluginManager::getObjects<CppQuickFixFactory>();
|
|
||||||
QVERIFY(!quickFixFactories.isEmpty());
|
|
||||||
|
|
||||||
CppQuickFixInterface qfi(editorWidget, ExplicitlyInvoked);
|
CppQuickFixInterface qfi(editorWidget, ExplicitlyInvoked);
|
||||||
// This guard is important since the Quick Fixes expect to get a non-empty path().
|
// This guard is important since the Quick Fixes expect to get a non-empty path().
|
||||||
if (qfi.path().isEmpty())
|
if (qfi.path().isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (CppQuickFixFactory *quickFixFactory, quickFixFactories) {
|
for (QuickFixFactory *quickFixFactory : QuickFixFactory::allQuickFixFactories()) {
|
||||||
|
if (auto cppQuickFixFactory = qobject_cast<CppQuickFixFactory *>(quickFixFactory)) {
|
||||||
QuickFixOperations operations;
|
QuickFixOperations operations;
|
||||||
// Some Quick Fixes pop up a dialog and are therefore inappropriate for this test.
|
// Some Quick Fixes pop up a dialog and are therefore inappropriate for this test.
|
||||||
// Where possible, use a guiless version of the factory.
|
// Where possible, use a guiless version of the factory.
|
||||||
if (qobject_cast<InsertVirtualMethods *>(quickFixFactory)) {
|
if (qobject_cast<InsertVirtualMethods *>(cppQuickFixFactory)) {
|
||||||
QScopedPointer<CppQuickFixFactory> factoryProducingGuiLessOperations;
|
QScopedPointer<CppQuickFixFactory> factoryProducingGuiLessOperations;
|
||||||
factoryProducingGuiLessOperations.reset(InsertVirtualMethods::createTestFactory());
|
factoryProducingGuiLessOperations.reset(InsertVirtualMethods::createTestFactory());
|
||||||
factoryProducingGuiLessOperations->match(qfi, operations);
|
factoryProducingGuiLessOperations->match(qfi, operations);
|
||||||
} else {
|
} else {
|
||||||
quickFixFactory->match(qfi, operations);
|
cppQuickFixFactory->match(qfi, operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QuickFixOperation::Ptr operation, operations) {
|
foreach (QuickFixOperation::Ptr operation, operations) {
|
||||||
@@ -478,6 +474,7 @@ void RunAllQuickFixesTokenAction::run(CppEditorWidget *editorWidget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class SwitchHeaderSourceFileAction : public TestActionsTestCase::AbstractAction
|
class SwitchHeaderSourceFileAction : public TestActionsTestCase::AbstractAction
|
||||||
{
|
{
|
||||||
|
@@ -123,10 +123,7 @@ TextEditor::Indenter *CppCodeStylePreferencesFactory::createIndenter() const
|
|||||||
|
|
||||||
TextEditor::SnippetProvider *CppCodeStylePreferencesFactory::snippetProvider() const
|
TextEditor::SnippetProvider *CppCodeStylePreferencesFactory::snippetProvider() const
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<TextEditor::SnippetProvider>(
|
return TextEditor::SnippetProvider::snippetProviderForGroupId(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID);
|
||||||
[](TextEditor::SnippetProvider *provider) {
|
|
||||||
return provider->groupId() == QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppCodeStylePreferencesFactory::previewText() const
|
QString CppCodeStylePreferencesFactory::previewText() const
|
||||||
|
@@ -493,10 +493,8 @@ void CppCodeStylePreferencesWidget::updatePreview()
|
|||||||
|
|
||||||
void CppCodeStylePreferencesWidget::decorateEditors(const FontSettings &fontSettings)
|
void CppCodeStylePreferencesWidget::decorateEditors(const FontSettings &fontSettings)
|
||||||
{
|
{
|
||||||
const SnippetProvider *provider = ExtensionSystem::PluginManager::getObject<SnippetProvider>(
|
const SnippetProvider *provider =
|
||||||
[](SnippetProvider *current) {
|
SnippetProvider::snippetProviderForGroupId(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID);
|
||||||
return current->groupId() == QLatin1String(CppEditor::Constants::CPP_SNIPPETS_GROUP_ID);
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (SnippetEditorWidget *editor, m_previews) {
|
foreach (SnippetEditorWidget *editor, m_previews) {
|
||||||
editor->textDocument()->setFontSettings(fontSettings);
|
editor->textDocument()->setFontSettings(fontSettings);
|
||||||
|
@@ -30,13 +30,15 @@
|
|||||||
#include "../editor/nimindenter.h"
|
#include "../editor/nimindenter.h"
|
||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
#include <texteditor/simplecodestylepreferences.h>
|
#include <texteditor/simplecodestylepreferences.h>
|
||||||
#include <texteditor/snippets/snippetprovider.h>
|
#include <texteditor/snippets/snippetprovider.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
|
|
||||||
|
using namespace TextEditor;
|
||||||
|
|
||||||
namespace Nim {
|
namespace Nim {
|
||||||
|
|
||||||
NimCodeStylePreferencesFactory::NimCodeStylePreferencesFactory()
|
NimCodeStylePreferencesFactory::NimCodeStylePreferencesFactory()
|
||||||
@@ -71,12 +73,9 @@ TextEditor::Indenter *NimCodeStylePreferencesFactory::createIndenter() const
|
|||||||
return new NimIndenter();
|
return new NimIndenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::SnippetProvider *NimCodeStylePreferencesFactory::snippetProvider() const
|
SnippetProvider *NimCodeStylePreferencesFactory::snippetProvider() const
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<TextEditor::SnippetProvider>(
|
return SnippetProvider::snippetProviderForGroupId(Nim::Constants::C_NIMSNIPPETSGROUP_ID);
|
||||||
[](TextEditor::SnippetProvider *provider) {
|
|
||||||
return provider->groupId() == Nim::Constants::C_NIMSNIPPETSGROUP_ID;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NimCodeStylePreferencesFactory::previewText() const
|
QString NimCodeStylePreferencesFactory::previewText() const
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/projectmacroexpander.h>
|
#include <projectexplorer/projectmacroexpander.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <coreplugin/idocument.h>
|
#include <coreplugin/idocument.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -318,6 +318,18 @@ void BuildConfiguration::prependCompilerPathToEnvironment(Kit *k, Utils::Environ
|
|||||||
// IBuildConfigurationFactory
|
// IBuildConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|
||||||
|
static QList<IBuildConfigurationFactory *> g_buildConfigurationFactories;
|
||||||
|
|
||||||
|
IBuildConfigurationFactory::IBuildConfigurationFactory()
|
||||||
|
{
|
||||||
|
g_buildConfigurationFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IBuildConfigurationFactory::~IBuildConfigurationFactory()
|
||||||
|
{
|
||||||
|
g_buildConfigurationFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
int IBuildConfigurationFactory::priority(const Target *parent) const
|
int IBuildConfigurationFactory::priority(const Target *parent) const
|
||||||
{
|
{
|
||||||
return canHandle(parent) ? 0 : -1;
|
return canHandle(parent) ? 0 : -1;
|
||||||
@@ -334,32 +346,26 @@ int IBuildConfigurationFactory::priority(const Kit *k, const QString &projectPat
|
|||||||
// restore
|
// restore
|
||||||
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
QList<IBuildConfigurationFactory *> factories
|
|
||||||
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>(
|
|
||||||
[&parent, map](IBuildConfigurationFactory *factory) {
|
|
||||||
return factory->canRestore(parent, map);
|
|
||||||
});
|
|
||||||
|
|
||||||
IBuildConfigurationFactory *factory = 0;
|
IBuildConfigurationFactory *factory = 0;
|
||||||
int priority = -1;
|
int priority = -1;
|
||||||
foreach (IBuildConfigurationFactory *i, factories) {
|
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
|
||||||
|
if (i->canRestore(parent, map)) {
|
||||||
int iPriority = i->priority(parent);
|
int iPriority = i->priority(parent);
|
||||||
if (iPriority > priority) {
|
if (iPriority > priority) {
|
||||||
factory = i;
|
factory = i;
|
||||||
priority = iPriority;
|
priority = iPriority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup
|
// setup
|
||||||
IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const QString &projectPath)
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const QString &projectPath)
|
||||||
{
|
{
|
||||||
QList<IBuildConfigurationFactory *> factories
|
|
||||||
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
|
|
||||||
IBuildConfigurationFactory *factory = 0;
|
IBuildConfigurationFactory *factory = 0;
|
||||||
int priority = -1;
|
int priority = -1;
|
||||||
foreach (IBuildConfigurationFactory *i, factories) {
|
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
|
||||||
int iPriority = i->priority(k, projectPath);
|
int iPriority = i->priority(k, projectPath);
|
||||||
if (iPriority > priority) {
|
if (iPriority > priority) {
|
||||||
factory = i;
|
factory = i;
|
||||||
@@ -372,11 +378,9 @@ IBuildConfigurationFactory *IBuildConfigurationFactory::find(const Kit *k, const
|
|||||||
// create
|
// create
|
||||||
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
|
IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
|
||||||
{
|
{
|
||||||
QList<IBuildConfigurationFactory *> factories
|
|
||||||
= ExtensionSystem::PluginManager::instance()->getObjects<IBuildConfigurationFactory>();
|
|
||||||
IBuildConfigurationFactory *factory = 0;
|
IBuildConfigurationFactory *factory = 0;
|
||||||
int priority = -1;
|
int priority = -1;
|
||||||
foreach (IBuildConfigurationFactory *i, factories) {
|
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
|
||||||
int iPriority = i->priority(parent);
|
int iPriority = i->priority(parent);
|
||||||
if (iPriority > priority) {
|
if (iPriority > priority) {
|
||||||
factory = i;
|
factory = i;
|
||||||
@@ -389,21 +393,17 @@ IBuildConfigurationFactory * IBuildConfigurationFactory::find(Target *parent)
|
|||||||
// clone
|
// clone
|
||||||
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, BuildConfiguration *bc)
|
IBuildConfigurationFactory *IBuildConfigurationFactory::find(Target *parent, BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
QList<IBuildConfigurationFactory *> factories
|
|
||||||
= ExtensionSystem::PluginManager::getObjects<IBuildConfigurationFactory>(
|
|
||||||
[&parent, &bc](IBuildConfigurationFactory *factory) {
|
|
||||||
return factory->canClone(parent, bc);
|
|
||||||
});
|
|
||||||
|
|
||||||
IBuildConfigurationFactory *factory = 0;
|
IBuildConfigurationFactory *factory = 0;
|
||||||
int priority = -1;
|
int priority = -1;
|
||||||
foreach (IBuildConfigurationFactory *i, factories) {
|
for (IBuildConfigurationFactory *i : g_buildConfigurationFactories) {
|
||||||
|
if (i->canClone(parent, bc)) {
|
||||||
int iPriority = i->priority(parent);
|
int iPriority = i->priority(parent);
|
||||||
if (iPriority > priority) {
|
if (iPriority > priority) {
|
||||||
factory = i;
|
factory = i;
|
||||||
priority = iPriority;
|
priority = iPriority;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -121,7 +121,8 @@ class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IBuildConfigurationFactory() = default;
|
IBuildConfigurationFactory();
|
||||||
|
~IBuildConfigurationFactory();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// The priority is negative if this factory can not create anything for the target.
|
// The priority is negative if this factory can not create anything for the target.
|
||||||
|
@@ -114,6 +114,8 @@ static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
static QList<BuildStepFactory *> g_buildStepFactories;
|
||||||
|
|
||||||
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
BuildStep::BuildStep(BuildStepList *bsl, Core::Id id) :
|
||||||
ProjectConfiguration(bsl, id)
|
ProjectConfiguration(bsl, id)
|
||||||
{
|
{
|
||||||
@@ -213,7 +215,19 @@ bool BuildStep::enabled() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildStepFactory::BuildStepFactory()
|
BuildStepFactory::BuildStepFactory()
|
||||||
{ }
|
{
|
||||||
|
g_buildStepFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildStepFactory::~BuildStepFactory()
|
||||||
|
{
|
||||||
|
g_buildStepFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<BuildStepFactory *> BuildStepFactory::allBuildStepFactories()
|
||||||
|
{
|
||||||
|
return g_buildStepFactories;
|
||||||
|
}
|
||||||
|
|
||||||
bool BuildStepFactory::canHandle(BuildStepList *bsl) const
|
bool BuildStepFactory::canHandle(BuildStepList *bsl) const
|
||||||
{
|
{
|
||||||
|
@@ -124,6 +124,9 @@ class PROJECTEXPLORER_EXPORT BuildStepFactory : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
BuildStepFactory();
|
BuildStepFactory();
|
||||||
|
~BuildStepFactory();
|
||||||
|
|
||||||
|
static const QList<BuildStepFactory *> allBuildStepFactories();
|
||||||
|
|
||||||
BuildStepInfo stepInfo() const;
|
BuildStepInfo stepInfo() const;
|
||||||
Core::Id stepId() const;
|
Core::Id stepId() const;
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -108,8 +107,7 @@ bool BuildStepList::fromMap(const QVariantMap &map)
|
|||||||
if (!ProjectConfiguration::fromMap(map))
|
if (!ProjectConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QList<BuildStepFactory *> factories
|
const QList<BuildStepFactory *> factories = BuildStepFactory::allBuildStepFactories();
|
||||||
= ExtensionSystem::PluginManager::getObjects<BuildStepFactory>();
|
|
||||||
|
|
||||||
int maxSteps = map.value(QString::fromLatin1(STEPS_COUNT_KEY), 0).toInt();
|
int maxSteps = map.value(QString::fromLatin1(STEPS_COUNT_KEY), 0).toInt();
|
||||||
for (int i = 0; i < maxSteps; ++i) {
|
for (int i = 0; i < maxSteps; ++i) {
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/coreicons.h>
|
#include <coreplugin/coreicons.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
@@ -288,8 +288,7 @@ void BuildStepListWidget::updateAddBuildStepMenu()
|
|||||||
{
|
{
|
||||||
QMap<QString, QPair<Core::Id, BuildStepFactory *> > map;
|
QMap<QString, QPair<Core::Id, BuildStepFactory *> > map;
|
||||||
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
|
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
|
||||||
QList<BuildStepFactory *> factories = ExtensionSystem::PluginManager::getObjects<BuildStepFactory>();
|
for (BuildStepFactory *factory : BuildStepFactory::allBuildStepFactories()) {
|
||||||
foreach (BuildStepFactory *factory, factories) {
|
|
||||||
if (factory->canHandle(m_buildStepList)) {
|
if (factory->canHandle(m_buildStepList)) {
|
||||||
const BuildStepInfo &info = factory->stepInfo();
|
const BuildStepInfo &info = factory->stepInfo();
|
||||||
if (info.flags & BuildStepInfo::Uncreatable)
|
if (info.flags & BuildStepInfo::Uncreatable)
|
||||||
|
@@ -65,6 +65,19 @@ bool enableLoadTemplateFiles()
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
static QList<ICustomWizardMetaFactory *> g_customWizardMetaFactories;
|
||||||
|
|
||||||
|
ICustomWizardMetaFactory::ICustomWizardMetaFactory(const QString &klass, Core::IWizardFactory::WizardKind kind) :
|
||||||
|
m_klass(klass), m_kind(kind)
|
||||||
|
{
|
||||||
|
g_customWizardMetaFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICustomWizardMetaFactory::~ICustomWizardMetaFactory()
|
||||||
|
{
|
||||||
|
g_customWizardMetaFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
/*!
|
/*!
|
||||||
\class ProjectExplorer::ICustomWizardFactory
|
\class ProjectExplorer::ICustomWizardFactory
|
||||||
@@ -338,7 +351,7 @@ CustomWizard::CustomWizardContextPtr CustomWizard::context() const
|
|||||||
|
|
||||||
CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizardParametersPtr &p)
|
CustomWizard *CustomWizard::createWizard(const CustomProjectWizard::CustomWizardParametersPtr &p)
|
||||||
{
|
{
|
||||||
ICustomWizardMetaFactory *factory = ExtensionSystem::PluginManager::getObject<ICustomWizardMetaFactory>(
|
ICustomWizardMetaFactory *factory = Utils::findOrDefault(g_customWizardMetaFactories,
|
||||||
[&p](ICustomWizardMetaFactory *factory) {
|
[&p](ICustomWizardMetaFactory *factory) {
|
||||||
return p->klass.isEmpty() ? (p->kind == factory->kind()) : (p->klass == factory->klass());
|
return p->klass.isEmpty() ? (p->kind == factory->kind()) : (p->klass == factory->klass());
|
||||||
});
|
});
|
||||||
|
@@ -55,9 +55,8 @@ class PROJECTEXPLORER_EXPORT ICustomWizardMetaFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ICustomWizardMetaFactory(const QString &klass, Core::IWizardFactory::WizardKind kind) :
|
ICustomWizardMetaFactory(const QString &klass, Core::IWizardFactory::WizardKind kind);
|
||||||
m_klass(klass), m_kind(kind)
|
~ICustomWizardMetaFactory();
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual CustomWizard *create() const = 0;
|
virtual CustomWizard *create() const = 0;
|
||||||
QString klass() const { return m_klass; }
|
QString klass() const { return m_klass; }
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -142,9 +140,22 @@ bool DeployConfiguration::isActive() const
|
|||||||
// DeployConfigurationFactory
|
// DeployConfigurationFactory
|
||||||
///
|
///
|
||||||
|
|
||||||
|
static QList<DeployConfigurationFactory *> g_deployConfigurationFactories;
|
||||||
|
|
||||||
DeployConfigurationFactory::DeployConfigurationFactory()
|
DeployConfigurationFactory::DeployConfigurationFactory()
|
||||||
{
|
{
|
||||||
setObjectName("DeployConfigurationFactory");
|
setObjectName("DeployConfigurationFactory");
|
||||||
|
g_deployConfigurationFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeployConfigurationFactory::~DeployConfigurationFactory()
|
||||||
|
{
|
||||||
|
g_deployConfigurationFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<DeployConfigurationFactory *> DeployConfigurationFactory::allDeployConfigurationFactories()
|
||||||
|
{
|
||||||
|
return g_deployConfigurationFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Core::Id> DeployConfigurationFactory::availableCreationIds(Target *parent) const
|
QList<Core::Id> DeployConfigurationFactory::availableCreationIds(Target *parent) const
|
||||||
@@ -256,7 +267,7 @@ bool DeployConfigurationFactory::canRestore(Target *parent, const QVariantMap &m
|
|||||||
|
|
||||||
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<DeployConfigurationFactory>(
|
return Utils::findOrDefault(g_deployConfigurationFactories,
|
||||||
[&parent, &map](DeployConfigurationFactory *factory) {
|
[&parent, &map](DeployConfigurationFactory *factory) {
|
||||||
return factory->canRestore(parent, map);
|
return factory->canRestore(parent, map);
|
||||||
});
|
});
|
||||||
@@ -264,7 +275,7 @@ DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, con
|
|||||||
|
|
||||||
QList<DeployConfigurationFactory *> DeployConfigurationFactory::find(Target *parent)
|
QList<DeployConfigurationFactory *> DeployConfigurationFactory::find(Target *parent)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>(
|
return Utils::filtered(g_deployConfigurationFactories,
|
||||||
[&parent](DeployConfigurationFactory *factory) {
|
[&parent](DeployConfigurationFactory *factory) {
|
||||||
return !factory->availableCreationIds(parent).isEmpty();
|
return !factory->availableCreationIds(parent).isEmpty();
|
||||||
});
|
});
|
||||||
@@ -272,7 +283,7 @@ QList<DeployConfigurationFactory *> DeployConfigurationFactory::find(Target *par
|
|||||||
|
|
||||||
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, DeployConfiguration *dc)
|
DeployConfigurationFactory *DeployConfigurationFactory::find(Target *parent, DeployConfiguration *dc)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<DeployConfigurationFactory>(
|
return Utils::findOrDefault(g_deployConfigurationFactories,
|
||||||
[&parent, &dc](DeployConfigurationFactory *factory) {
|
[&parent, &dc](DeployConfigurationFactory *factory) {
|
||||||
return factory->canClone(parent, dc);
|
return factory->canClone(parent, dc);
|
||||||
});
|
});
|
||||||
|
@@ -78,6 +78,9 @@ class PROJECTEXPLORER_EXPORT DeployConfigurationFactory : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DeployConfigurationFactory();
|
DeployConfigurationFactory();
|
||||||
|
~DeployConfigurationFactory();
|
||||||
|
|
||||||
|
static QList<DeployConfigurationFactory *> allDeployConfigurationFactories();
|
||||||
|
|
||||||
// used to show the list of possible additons to a target, returns a list of types
|
// used to show the list of possible additons to a target, returns a list of types
|
||||||
QList<Core::Id> availableCreationIds(Target *parent) const;
|
QList<Core::Id> availableCreationIds(Target *parent) const;
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/id.h>
|
#include <coreplugin/id.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -44,9 +42,7 @@ DeviceFactorySelectionDialog::DeviceFactorySelectionDialog(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start Wizard"));
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Start Wizard"));
|
||||||
|
|
||||||
const QList<IDeviceFactory *> &factories
|
for (const IDeviceFactory * const factory : IDeviceFactory::allDeviceFactories()) {
|
||||||
= ExtensionSystem::PluginManager::getObjects<IDeviceFactory>();
|
|
||||||
foreach (const IDeviceFactory * const factory, factories) {
|
|
||||||
if (!factory->canCreate())
|
if (!factory->canCreate())
|
||||||
continue;
|
continue;
|
||||||
foreach (Core::Id id, factory->availableCreationIds()) {
|
foreach (Core::Id id, factory->availableCreationIds()) {
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <ssh/sshhostkeydatabase.h>
|
#include <ssh/sshhostkeydatabase.h>
|
||||||
@@ -338,7 +338,7 @@ void DeviceManager::setDefaultDevice(Core::Id id)
|
|||||||
|
|
||||||
const IDeviceFactory *DeviceManager::restoreFactory(const QVariantMap &map)
|
const IDeviceFactory *DeviceManager::restoreFactory(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
IDeviceFactory *factory = ExtensionSystem::PluginManager::getObject<IDeviceFactory>(
|
IDeviceFactory *factory = Utils::findOrDefault(IDeviceFactory::allDeviceFactories(),
|
||||||
[&map](IDeviceFactory *factory) {
|
[&map](IDeviceFactory *factory) {
|
||||||
return factory->canRestore(map);
|
return factory->canRestore(map);
|
||||||
});
|
});
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
#include <projectexplorer/projectexplorericons.h>
|
#include <projectexplorer/projectexplorericons.h>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
@@ -111,10 +111,8 @@ void DeviceSettingsWidget::initGui()
|
|||||||
m_ui->configurationComboBox->setModel(m_deviceManagerModel);
|
m_ui->configurationComboBox->setModel(m_deviceManagerModel);
|
||||||
m_ui->nameLineEdit->setValidator(m_nameValidator);
|
m_ui->nameLineEdit->setValidator(m_nameValidator);
|
||||||
|
|
||||||
const QList<IDeviceFactory *> &factories
|
bool hasDeviceFactories = Utils::anyOf(IDeviceFactory::allDeviceFactories(),
|
||||||
= ExtensionSystem::PluginManager::getObjects<IDeviceFactory>();
|
&IDeviceFactory::canCreate);
|
||||||
|
|
||||||
bool hasDeviceFactories = Utils::anyOf(factories, &IDeviceFactory::canCreate);
|
|
||||||
|
|
||||||
m_ui->addConfigButton->setEnabled(hasDeviceFactories);
|
m_ui->addConfigButton->setEnabled(hasDeviceFactories);
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "idevicefactory.h"
|
#include "idevicefactory.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
@@ -83,15 +83,29 @@ bool IDeviceFactory::canCreate() const
|
|||||||
return !availableCreationIds().isEmpty();
|
return !availableCreationIds().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QList<IDeviceFactory *> g_deviceFactories;
|
||||||
|
|
||||||
IDeviceFactory *IDeviceFactory::find(Core::Id type)
|
IDeviceFactory *IDeviceFactory::find(Core::Id type)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<IDeviceFactory>(
|
return Utils::findOrDefault(g_deviceFactories,
|
||||||
[&type](IDeviceFactory *factory) {
|
[&type](IDeviceFactory *factory) {
|
||||||
return factory->availableCreationIds().contains(type);
|
return factory->availableCreationIds().contains(type);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
IDeviceFactory::IDeviceFactory(QObject *parent) : QObject(parent)
|
IDeviceFactory::IDeviceFactory(QObject *parent) : QObject(parent)
|
||||||
{ }
|
{
|
||||||
|
g_deviceFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDeviceFactory::~IDeviceFactory()
|
||||||
|
{
|
||||||
|
g_deviceFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IDeviceFactory *> IDeviceFactory::allDeviceFactories()
|
||||||
|
{
|
||||||
|
return g_deviceFactories;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -44,6 +44,8 @@ class PROJECTEXPLORER_EXPORT IDeviceFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
~IDeviceFactory();
|
||||||
|
static const QList<IDeviceFactory *> allDeviceFactories();
|
||||||
|
|
||||||
virtual QString displayNameForId(Core::Id type) const = 0;
|
virtual QString displayNameForId(Core::Id type) const = 0;
|
||||||
|
|
||||||
|
@@ -34,7 +34,11 @@ namespace ProjectExplorer {
|
|||||||
class PROJECTEXPLORER_EXPORT IPotentialKit : public QObject
|
class PROJECTEXPLORER_EXPORT IPotentialKit : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
IPotentialKit();
|
||||||
|
~IPotentialKit() override;
|
||||||
|
|
||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual void executeFromMenu() = 0;
|
virtual void executeFromMenu() = 0;
|
||||||
virtual QWidget *createWidget(QWidget *parent) const = 0;
|
virtual QWidget *createWidget(QWidget *parent) const = 0;
|
||||||
|
@@ -44,7 +44,8 @@ class PROJECTEXPLORER_EXPORT ITaskHandler : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ITaskHandler() { }
|
ITaskHandler();
|
||||||
|
~ITaskHandler() override;
|
||||||
|
|
||||||
virtual bool isDefaultHandler() const { return false; }
|
virtual bool isDefaultHandler() const { return false; }
|
||||||
virtual bool canHandle(const Task &) const = 0;
|
virtual bool canHandle(const Task &) const = 0;
|
||||||
|
@@ -32,8 +32,6 @@
|
|||||||
#include "osparser.h"
|
#include "osparser.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/icon.h>
|
#include <utils/icon.h>
|
||||||
@@ -369,7 +367,7 @@ Id Kit::id() const
|
|||||||
|
|
||||||
static QIcon iconForDeviceType(Core::Id deviceType)
|
static QIcon iconForDeviceType(Core::Id deviceType)
|
||||||
{
|
{
|
||||||
const IDeviceFactory *factory = ExtensionSystem::PluginManager::getObject<IDeviceFactory>(
|
const IDeviceFactory *factory = Utils::findOrDefault(IDeviceFactory::allDeviceFactories(),
|
||||||
[&deviceType](const IDeviceFactory *factory) {
|
[&deviceType](const IDeviceFactory *factory) {
|
||||||
return factory->availableCreationIds().contains(deviceType);
|
return factory->availableCreationIds().contains(deviceType);
|
||||||
});
|
});
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
|
|
||||||
|
#include "abi.h"
|
||||||
#include "devicesupport/desktopdevice.h"
|
#include "devicesupport/desktopdevice.h"
|
||||||
#include "devicesupport/devicemanager.h"
|
#include "devicesupport/devicemanager.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
@@ -33,8 +34,6 @@
|
|||||||
#include "toolchain.h"
|
#include "toolchain.h"
|
||||||
#include "toolchainmanager.h"
|
#include "toolchainmanager.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <projectexplorer/abi.h>
|
|
||||||
#include <ssh/sshconnection.h>
|
#include <ssh/sshconnection.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
@@ -566,7 +565,7 @@ KitInformation::ItemList DeviceTypeKitInformation::toUserOutput(const Kit *k) co
|
|||||||
Core::Id type = deviceTypeId(k);
|
Core::Id type = deviceTypeId(k);
|
||||||
QString typeDisplayName = tr("Unknown device type");
|
QString typeDisplayName = tr("Unknown device type");
|
||||||
if (type.isValid()) {
|
if (type.isValid()) {
|
||||||
IDeviceFactory *factory = ExtensionSystem::PluginManager::getObject<IDeviceFactory>(
|
IDeviceFactory *factory = Utils::findOrDefault(IDeviceFactory::allDeviceFactories(),
|
||||||
[&type](IDeviceFactory *factory) {
|
[&type](IDeviceFactory *factory) {
|
||||||
return factory->availableCreationIds().contains(type);
|
return factory->availableCreationIds().contains(type);
|
||||||
});
|
});
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/variablechooser.h>
|
#include <coreplugin/variablechooser.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fancylineedit.h>
|
#include <utils/fancylineedit.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
@@ -261,9 +261,7 @@ int ToolChainInformationConfigWidget::indexOf(QComboBox *cb, const ToolChain *tc
|
|||||||
DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *workingCopy, const KitInformation *ki) :
|
DeviceTypeInformationConfigWidget::DeviceTypeInformationConfigWidget(Kit *workingCopy, const KitInformation *ki) :
|
||||||
KitConfigWidget(workingCopy, ki), m_comboBox(new QComboBox)
|
KitConfigWidget(workingCopy, ki), m_comboBox(new QComboBox)
|
||||||
{
|
{
|
||||||
QList<IDeviceFactory *> factories
|
for (IDeviceFactory *factory : IDeviceFactory::allDeviceFactories()) {
|
||||||
= ExtensionSystem::PluginManager::getObjects<IDeviceFactory>();
|
|
||||||
foreach (IDeviceFactory *factory, factories) {
|
|
||||||
foreach (Id id, factory->availableCreationIds())
|
foreach (Id id, factory->availableCreationIds())
|
||||||
m_comboBox->addItem(factory->displayNameForId(id), id.toSetting());
|
m_comboBox->addItem(factory->displayNameForId(id), id.toSetting());
|
||||||
}
|
}
|
||||||
|
@@ -34,8 +34,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/persistentsettings.h>
|
#include <utils/persistentsettings.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
@@ -560,7 +558,7 @@ QSet<Id> KitFeatureProvider::availablePlatforms() const
|
|||||||
|
|
||||||
QString KitFeatureProvider::displayNameForPlatform(Id id) const
|
QString KitFeatureProvider::displayNameForPlatform(Id id) const
|
||||||
{
|
{
|
||||||
foreach (IDeviceFactory *f, ExtensionSystem::PluginManager::getObjects<IDeviceFactory>()) {
|
for (IDeviceFactory *f : IDeviceFactory::allDeviceFactories()) {
|
||||||
if (f->availableCreationIds().contains(id)) {
|
if (f->availableCreationIds().contains(id)) {
|
||||||
const QString dn = f->displayNameForId(id);
|
const QString dn = f->displayNameForId(id);
|
||||||
QTC_ASSERT(!dn.isEmpty(), continue);
|
QTC_ASSERT(!dn.isEmpty(), continue);
|
||||||
|
@@ -37,8 +37,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -374,11 +372,9 @@ bool ProjectImporter::hasKitWithTemporaryData(Core::Id id, const QVariant &data)
|
|||||||
static ProjectImporter::ToolChainData
|
static ProjectImporter::ToolChainData
|
||||||
createToolChains(const Utils::FileName &toolChainPath, const Core::Id &language)
|
createToolChains(const Utils::FileName &toolChainPath, const Core::Id &language)
|
||||||
{
|
{
|
||||||
const QList<ToolChainFactory *> factories
|
|
||||||
= ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
|
|
||||||
ProjectImporter::ToolChainData data;
|
ProjectImporter::ToolChainData data;
|
||||||
|
|
||||||
for (ToolChainFactory *factory : factories) {
|
for (ToolChainFactory *factory : ToolChainFactory::allToolChainFactories()) {
|
||||||
data.tcs = factory->autoDetect(toolChainPath, language);
|
data.tcs = factory->autoDetect(toolChainPath, language);
|
||||||
if (data.tcs.isEmpty())
|
if (data.tcs.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
@@ -36,8 +36,6 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/checkablemessagebox.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
#include <utils/outputformatter.h>
|
#include <utils/outputformatter.h>
|
||||||
@@ -432,9 +430,22 @@ Utils::OutputFormatter *RunConfiguration::createOutputFormatter() const
|
|||||||
Translates the types to names to display to the user.
|
Translates the types to names to display to the user.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static QList<IRunConfigurationFactory *> g_runConfigurationFactories;
|
||||||
|
|
||||||
IRunConfigurationFactory::IRunConfigurationFactory(QObject *parent) :
|
IRunConfigurationFactory::IRunConfigurationFactory(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
|
g_runConfigurationFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IRunConfigurationFactory::~IRunConfigurationFactory()
|
||||||
|
{
|
||||||
|
g_runConfigurationFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IRunConfigurationFactory *> IRunConfigurationFactory::allRunConfigurationFactories()
|
||||||
|
{
|
||||||
|
return g_runConfigurationFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<RunConfigurationCreationInfo>
|
QList<RunConfigurationCreationInfo>
|
||||||
@@ -556,7 +567,7 @@ RunConfiguration *IRunConfigurationFactory::clone(Target *parent, RunConfigurati
|
|||||||
|
|
||||||
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<IRunConfigurationFactory>(
|
return Utils::findOrDefault(g_runConfigurationFactories,
|
||||||
[&parent, &map](IRunConfigurationFactory *factory) {
|
[&parent, &map](IRunConfigurationFactory *factory) {
|
||||||
return factory->canRestore(parent, map);
|
return factory->canRestore(parent, map);
|
||||||
});
|
});
|
||||||
@@ -564,7 +575,7 @@ IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, const Q
|
|||||||
|
|
||||||
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConfiguration *rc)
|
IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConfiguration *rc)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<IRunConfigurationFactory>(
|
return Utils::findOrDefault(g_runConfigurationFactories,
|
||||||
[&parent, rc](IRunConfigurationFactory *factory) {
|
[&parent, rc](IRunConfigurationFactory *factory) {
|
||||||
return factory->canClone(parent, rc);
|
return factory->canClone(parent, rc);
|
||||||
});
|
});
|
||||||
@@ -572,7 +583,7 @@ IRunConfigurationFactory *IRunConfigurationFactory::find(Target *parent, RunConf
|
|||||||
|
|
||||||
QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
|
QList<IRunConfigurationFactory *> IRunConfigurationFactory::find(Target *parent)
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>(
|
return Utils::filtered(g_runConfigurationFactories,
|
||||||
[&parent](IRunConfigurationFactory *factory) {
|
[&parent](IRunConfigurationFactory *factory) {
|
||||||
return !factory->availableCreators(parent).isEmpty();
|
return !factory->availableCreators(parent).isEmpty();
|
||||||
});
|
});
|
||||||
|
@@ -295,6 +295,9 @@ class PROJECTEXPLORER_EXPORT IRunConfigurationFactory : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IRunConfigurationFactory(QObject *parent = nullptr);
|
explicit IRunConfigurationFactory(QObject *parent = nullptr);
|
||||||
|
~IRunConfigurationFactory();
|
||||||
|
|
||||||
|
static const QList<IRunConfigurationFactory *> allRunConfigurationFactories();
|
||||||
|
|
||||||
enum CreationMode {UserCreate, AutoCreate};
|
enum CreationMode {UserCreate, AutoCreate};
|
||||||
|
|
||||||
|
@@ -237,11 +237,8 @@ void RunSettingsWidget::aboutToShowAddMenu()
|
|||||||
connect(cloneAction, &QAction::triggered,
|
connect(cloneAction, &QAction::triggered,
|
||||||
this, &RunSettingsWidget::cloneRunConfiguration);
|
this, &RunSettingsWidget::cloneRunConfiguration);
|
||||||
}
|
}
|
||||||
const QList<IRunConfigurationFactory *> factories =
|
|
||||||
ExtensionSystem::PluginManager::getObjects<IRunConfigurationFactory>();
|
|
||||||
|
|
||||||
QList<QAction *> menuActions;
|
QList<QAction *> menuActions;
|
||||||
for (IRunConfigurationFactory *factory : factories) {
|
for (IRunConfigurationFactory *factory : IRunConfigurationFactory::allRunConfigurationFactories()) {
|
||||||
const QList<RunConfigurationCreationInfo> items = factory->availableCreators(m_target);
|
const QList<RunConfigurationCreationInfo> items = factory->availableCreators(m_target);
|
||||||
for (const RunConfigurationCreationInfo &item : items) {
|
for (const RunConfigurationCreationInfo &item : items) {
|
||||||
auto action = new QAction(item.displayName, m_addRunMenu);
|
auto action = new QAction(item.displayName, m_addRunMenu);
|
||||||
|
@@ -87,8 +87,6 @@ class TargetPrivate
|
|||||||
public:
|
public:
|
||||||
TargetPrivate(Kit *k);
|
TargetPrivate(Kit *k);
|
||||||
|
|
||||||
QList<DeployConfigurationFactory *> deployFactories() const;
|
|
||||||
|
|
||||||
bool m_isEnabled = true;
|
bool m_isEnabled = true;
|
||||||
QIcon m_overlayIcon;
|
QIcon m_overlayIcon;
|
||||||
|
|
||||||
@@ -109,11 +107,6 @@ TargetPrivate::TargetPrivate(Kit *k) :
|
|||||||
m_kit(k)
|
m_kit(k)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
QList<DeployConfigurationFactory *> TargetPrivate::deployFactories() const
|
|
||||||
{
|
|
||||||
return ExtensionSystem::PluginManager::getObjects<DeployConfigurationFactory>();
|
|
||||||
}
|
|
||||||
|
|
||||||
Target::Target(Project *project, Kit *k) :
|
Target::Target(Project *project, Kit *k) :
|
||||||
ProjectConfiguration(project, k->id()),
|
ProjectConfiguration(project, k->id()),
|
||||||
d(new TargetPrivate(k))
|
d(new TargetPrivate(k))
|
||||||
@@ -269,7 +262,7 @@ void Target::addDeployConfiguration(DeployConfiguration *dc)
|
|||||||
QTC_ASSERT(dc && !d->m_deployConfigurations.contains(dc), return);
|
QTC_ASSERT(dc && !d->m_deployConfigurations.contains(dc), return);
|
||||||
Q_ASSERT(dc->target() == this);
|
Q_ASSERT(dc->target() == this);
|
||||||
|
|
||||||
if (d->deployFactories().isEmpty())
|
if (DeployConfigurationFactory::allDeployConfigurationFactories().isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check that we don't have a configuration with the same displayName
|
// Check that we don't have a configuration with the same displayName
|
||||||
|
@@ -36,8 +36,9 @@
|
|||||||
#include "targetsetupwidget.h"
|
#include "targetsetupwidget.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <projectexplorer/ipotentialkit.h>
|
#include <projectexplorer/ipotentialkit.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
@@ -52,6 +53,19 @@
|
|||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
static QList<IPotentialKit *> g_potentialKits;
|
||||||
|
|
||||||
|
IPotentialKit::IPotentialKit()
|
||||||
|
{
|
||||||
|
g_potentialKits.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPotentialKit::~IPotentialKit()
|
||||||
|
{
|
||||||
|
g_potentialKits.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
static Utils::FileName importDirectory(const QString &projectPath)
|
static Utils::FileName importDirectory(const QString &projectPath)
|
||||||
{
|
{
|
||||||
@@ -183,9 +197,7 @@ TargetSetupPage::TargetSetupPage(QWidget *parent) :
|
|||||||
|
|
||||||
setTitle(tr("Kit Selection"));
|
setTitle(tr("Kit Selection"));
|
||||||
|
|
||||||
QList<IPotentialKit *> potentialKits =
|
for (IPotentialKit *pk : g_potentialKits)
|
||||||
ExtensionSystem::PluginManager::instance()->getObjects<IPotentialKit>();
|
|
||||||
foreach (IPotentialKit *pk, potentialKits)
|
|
||||||
if (pk->isEnabled())
|
if (pk->isEnabled())
|
||||||
m_potentialWidgets.append(pk->createWidget(this));
|
m_potentialWidgets.append(pk->createWidget(this));
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/itemviews.h>
|
#include <utils/itemviews.h>
|
||||||
@@ -56,6 +56,19 @@ const char SESSION_FILTER_WARNINGS[] = "TaskWindow.IncludeWarnings";
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
static QList<ITaskHandler *> g_taskHandlers;
|
||||||
|
|
||||||
|
ITaskHandler::ITaskHandler()
|
||||||
|
{
|
||||||
|
g_taskHandlers.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ITaskHandler::~ITaskHandler()
|
||||||
|
{
|
||||||
|
g_taskHandlers.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class TaskView : public Utils::ListView
|
class TaskView : public Utils::ListView
|
||||||
@@ -321,8 +334,7 @@ void TaskWindow::delayedInitialization()
|
|||||||
|
|
||||||
alreadyDone = true;
|
alreadyDone = true;
|
||||||
|
|
||||||
QList<ITaskHandler *> handlers = ExtensionSystem::PluginManager::getObjects<ITaskHandler>();
|
for (ITaskHandler *h : g_taskHandlers) {
|
||||||
foreach (ITaskHandler *h, handlers) {
|
|
||||||
if (h->isDefaultHandler() && !d->m_defaultHandler)
|
if (h->isDefaultHandler() && !d->m_defaultHandler)
|
||||||
d->m_defaultHandler = h;
|
d->m_defaultHandler = h;
|
||||||
|
|
||||||
|
@@ -322,6 +322,23 @@ QList<Task> ToolChain::validateKit(const Kit *) const
|
|||||||
Used by the tool chain manager to restore user-generated tool chains.
|
Used by the tool chain manager to restore user-generated tool chains.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static QList<ToolChainFactory *> g_toolChainFactories;
|
||||||
|
|
||||||
|
ToolChainFactory::ToolChainFactory()
|
||||||
|
{
|
||||||
|
g_toolChainFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChainFactory::~ToolChainFactory()
|
||||||
|
{
|
||||||
|
g_toolChainFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<ToolChainFactory *> ToolChainFactory::allToolChainFactories()
|
||||||
|
{
|
||||||
|
return g_toolChainFactories;
|
||||||
|
}
|
||||||
|
|
||||||
QList<ToolChain *> ToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
|
QList<ToolChain *> ToolChainFactory::autoDetect(const QList<ToolChain *> &alreadyKnown)
|
||||||
{
|
{
|
||||||
Q_UNUSED(alreadyKnown);
|
Q_UNUSED(alreadyKnown);
|
||||||
|
@@ -177,6 +177,11 @@ class PROJECTEXPLORER_EXPORT ToolChainFactory : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
ToolChainFactory();
|
||||||
|
~ToolChainFactory();
|
||||||
|
|
||||||
|
static const QList<ToolChainFactory *> allToolChainFactories();
|
||||||
|
|
||||||
QString displayName() const { return m_displayName; }
|
QString displayName() const { return m_displayName; }
|
||||||
|
|
||||||
virtual QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
|
virtual QList<ToolChain *> autoDetect(const QList<ToolChain *> &alreadyKnown);
|
||||||
|
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/persistentsettings.h>
|
#include <utils/persistentsettings.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -139,7 +137,7 @@ static QList<ToolChain *> restoreFromFile(const FileName &fileName)
|
|||||||
if (version < 1)
|
if (version < 1)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
QList<ToolChainFactory *> factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
|
const QList<ToolChainFactory *> factories = ToolChainFactory::allToolChainFactories();
|
||||||
|
|
||||||
int count = data.value(QLatin1String(TOOLCHAIN_COUNT_KEY), 0).toInt();
|
int count = data.value(QLatin1String(TOOLCHAIN_COUNT_KEY), 0).toInt();
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
@@ -150,7 +148,7 @@ static QList<ToolChain *> restoreFromFile(const FileName &fileName)
|
|||||||
const QVariantMap tcMap = data.value(key).toMap();
|
const QVariantMap tcMap = data.value(key).toMap();
|
||||||
|
|
||||||
bool restored = false;
|
bool restored = false;
|
||||||
foreach (ToolChainFactory *f, factories) {
|
for (ToolChainFactory *f : factories) {
|
||||||
if (f->canRestore(tcMap)) {
|
if (f->canRestore(tcMap)) {
|
||||||
if (ToolChain *tc = f->restore(tcMap)) {
|
if (ToolChain *tc = f->restore(tcMap)) {
|
||||||
result.append(tc);
|
result.append(tc);
|
||||||
@@ -172,9 +170,7 @@ static QList<ToolChain *> restoreFromFile(const FileName &fileName)
|
|||||||
static QList<ToolChain *> autoDetectToolChains(const QList<ToolChain *> alreadyKnownTcs)
|
static QList<ToolChain *> autoDetectToolChains(const QList<ToolChain *> alreadyKnownTcs)
|
||||||
{
|
{
|
||||||
QList<ToolChain *> result;
|
QList<ToolChain *> result;
|
||||||
const QList<ToolChainFactory *> factories
|
for (ToolChainFactory *f : ToolChainFactory::allToolChainFactories())
|
||||||
= ExtensionSystem::PluginManager::getObjects<ToolChainFactory>();
|
|
||||||
foreach (ToolChainFactory *f, factories)
|
|
||||||
result.append(f->autoDetect(alreadyKnownTcs));
|
result.append(f->autoDetect(alreadyKnownTcs));
|
||||||
|
|
||||||
// Remove invalid toolchains that might have sneaked in.
|
// Remove invalid toolchains that might have sneaked in.
|
||||||
|
@@ -110,7 +110,7 @@ class ToolChainOptionsWidget : public QWidget
|
|||||||
public:
|
public:
|
||||||
ToolChainOptionsWidget()
|
ToolChainOptionsWidget()
|
||||||
{
|
{
|
||||||
m_factories = ExtensionSystem::PluginManager::getObjects<ToolChainFactory>(
|
m_factories = Utils::filtered(ToolChainFactory::allToolChainFactories(),
|
||||||
[](ToolChainFactory *factory) { return factory->canCreate();});
|
[](ToolChainFactory *factory) { return factory->canCreate();});
|
||||||
|
|
||||||
m_model.setHeader({ToolChainOptionsPage::tr("Name"), ToolChainOptionsPage::tr("Type")});
|
m_model.setHeader({ToolChainOptionsPage::tr("Name"), ToolChainOptionsPage::tr("Type")});
|
||||||
|
@@ -39,6 +39,9 @@ class QBSPROJECTMANAGER_EXPORT PropertyProvider : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
PropertyProvider();
|
||||||
|
~PropertyProvider();
|
||||||
|
|
||||||
virtual bool canHandle(const ProjectExplorer::Kit *k) const = 0;
|
virtual bool canHandle(const ProjectExplorer::Kit *k) const = 0;
|
||||||
virtual QVariantMap properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const = 0;
|
virtual QVariantMap properties(const ProjectExplorer::Kit *k, const QVariantMap &defaultData) const = 0;
|
||||||
};
|
};
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <projectexplorer/kit.h>
|
#include <projectexplorer/kit.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
@@ -54,6 +54,19 @@ static QString qtcProfileGroup() { return QLatin1String("preferences.qtcreator.k
|
|||||||
static QString qtcProfilePrefix() { return qtcProfileGroup() + sep; }
|
static QString qtcProfilePrefix() { return qtcProfileGroup() + sep; }
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
|
|
||||||
|
static QList<PropertyProvider *> g_propertyProviders;
|
||||||
|
|
||||||
|
PropertyProvider::PropertyProvider()
|
||||||
|
{
|
||||||
|
g_propertyProviders.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
PropertyProvider::~PropertyProvider()
|
||||||
|
{
|
||||||
|
g_propertyProviders.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
qbs::Settings *QbsManager::m_settings = nullptr;
|
qbs::Settings *QbsManager::m_settings = nullptr;
|
||||||
@@ -200,8 +213,7 @@ void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
|
|||||||
|
|
||||||
// set up properties:
|
// set up properties:
|
||||||
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
|
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
|
||||||
QList<PropertyProvider *> providerList = ExtensionSystem::PluginManager::getObjects<PropertyProvider>();
|
for (PropertyProvider *provider : g_propertyProviders) {
|
||||||
foreach (PropertyProvider *provider, providerList) {
|
|
||||||
if (provider->canHandle(k))
|
if (provider->canHandle(k))
|
||||||
data = provider->properties(k, data);
|
data = provider->properties(k, data);
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "qmakerunconfigurationfactory.h"
|
#include "qmakerunconfigurationfactory.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
|
|
||||||
@@ -35,13 +35,15 @@ QmakeRunConfigurationFactory::QmakeRunConfigurationFactory(QObject *parent) :
|
|||||||
|
|
||||||
QmakeRunConfigurationFactory *QmakeRunConfigurationFactory::find(ProjectExplorer::Target *t)
|
QmakeRunConfigurationFactory *QmakeRunConfigurationFactory::find(ProjectExplorer::Target *t)
|
||||||
{
|
{
|
||||||
if (!t)
|
if (t) {
|
||||||
|
for (auto factory : IRunConfigurationFactory::allRunConfigurationFactories()) {
|
||||||
|
if (auto qmakeFactory = qobject_cast<QmakeRunConfigurationFactory *>(factory)) {
|
||||||
|
if (qmakeFactory->canHandle(t))
|
||||||
|
return qmakeFactory;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return ExtensionSystem::PluginManager::getObject<QmakeRunConfigurationFactory>(
|
|
||||||
[&t](QmakeRunConfigurationFactory *factory) {
|
|
||||||
return factory->canHandle(t);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmakeProjectManager
|
} // namespace QmakeProjectManager
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
//temp
|
//temp
|
||||||
#include "qmljsquickfix.h"
|
#include "qmljsquickfix.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
using namespace QmlJSTools;
|
using namespace QmlJSTools;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
@@ -85,10 +85,9 @@ IAssistProcessor *QmlJSQuickFixAssistProvider::createProcessor() const
|
|||||||
|
|
||||||
QList<QuickFixFactory *> QmlJSQuickFixAssistProvider::quickFixFactories() const
|
QList<QuickFixFactory *> QmlJSQuickFixAssistProvider::quickFixFactories() const
|
||||||
{
|
{
|
||||||
QList<QuickFixFactory *> results;
|
return Utils::filtered(QuickFixFactory::allQuickFixFactories(), [](QuickFixFactory *f) {
|
||||||
foreach (QmlJSQuickFixFactory *f, ExtensionSystem::PluginManager::getObjects<QmlJSQuickFixFactory>())
|
return qobject_cast<QmlJSQuickFixFactory *>(f) != nullptr;
|
||||||
results.append(f);
|
});
|
||||||
return results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlJSEditor
|
} // namespace QmlJSEditor
|
||||||
|
@@ -176,4 +176,22 @@ void BasicBundleProvider::mergeBundlesForKit(ProjectExplorer::Kit *kit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QList<IBundleProvider *> g_bundleProviders;
|
||||||
|
|
||||||
|
IBundleProvider::IBundleProvider(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
g_bundleProviders.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IBundleProvider::~IBundleProvider()
|
||||||
|
{
|
||||||
|
g_bundleProviders.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<IBundleProvider *> IBundleProvider::allBundleProviders()
|
||||||
|
{
|
||||||
|
return g_bundleProviders;
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace QmlJSTools
|
} // end namespace QmlJSTools
|
||||||
|
@@ -47,9 +47,10 @@ class QMLJSTOOLS_EXPORT IBundleProvider : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit IBundleProvider(QObject *parent = 0)
|
explicit IBundleProvider(QObject *parent = 0);
|
||||||
: QObject(parent)
|
~IBundleProvider();
|
||||||
{ }
|
|
||||||
|
static const QList<IBundleProvider *> allBundleProviders();
|
||||||
|
|
||||||
virtual void mergeBundlesForKit(ProjectExplorer::Kit *kit, QmlJS::QmlLanguageBundles &bundles
|
virtual void mergeBundlesForKit(ProjectExplorer::Kit *kit, QmlJS::QmlLanguageBundles &bundles
|
||||||
, const QHash<QString,QString> &replacements) = 0;
|
, const QHash<QString,QString> &replacements) = 0;
|
||||||
|
@@ -88,10 +88,8 @@ TextEditor::Indenter *QmlJSCodeStylePreferencesFactory::createIndenter() const
|
|||||||
|
|
||||||
TextEditor::SnippetProvider *QmlJSCodeStylePreferencesFactory::snippetProvider() const
|
TextEditor::SnippetProvider *QmlJSCodeStylePreferencesFactory::snippetProvider() const
|
||||||
{
|
{
|
||||||
return ExtensionSystem::PluginManager::getObject<TextEditor::SnippetProvider>(
|
return TextEditor::SnippetProvider::snippetProviderForGroupId
|
||||||
[](TextEditor::SnippetProvider *provider) {
|
(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID);
|
||||||
return provider->groupId() == QLatin1String(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlJSCodeStylePreferencesFactory::previewText() const
|
QString QmlJSCodeStylePreferencesFactory::previewText() const
|
||||||
|
@@ -80,13 +80,10 @@ void QmlJSCodeStylePreferencesWidget::setPreferences(ICodeStylePreferences *pref
|
|||||||
updatePreview();
|
updatePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QmlJSCodeStylePreferencesWidget::decorateEditor(const FontSettings &fontSettings)
|
void QmlJSCodeStylePreferencesWidget::decorateEditor(const FontSettings &fontSettings)
|
||||||
{
|
{
|
||||||
const SnippetProvider *provider = ExtensionSystem::PluginManager::getObject<SnippetProvider>(
|
const SnippetProvider *provider =
|
||||||
[](SnippetProvider *current) {
|
SnippetProvider::snippetProviderForGroupId(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID);
|
||||||
return current->groupId() == QLatin1String(QmlJSEditor::Constants::QML_SNIPPETS_GROUP_ID);
|
|
||||||
});
|
|
||||||
|
|
||||||
m_ui->previewTextEdit->textDocument()->setFontSettings(fontSettings);
|
m_ui->previewTextEdit->textDocument()->setFontSettings(fontSettings);
|
||||||
if (provider)
|
if (provider)
|
||||||
|
@@ -33,8 +33,9 @@
|
|||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
@@ -152,13 +153,9 @@ void setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo)
|
|||||||
replacements.insert(QLatin1String("$(QT_INSTALL_IMPORTS)"), projectInfo.qtImportsPath);
|
replacements.insert(QLatin1String("$(QT_INSTALL_IMPORTS)"), projectInfo.qtImportsPath);
|
||||||
replacements.insert(QLatin1String("$(QT_INSTALL_QML)"), projectInfo.qtQmlPath);
|
replacements.insert(QLatin1String("$(QT_INSTALL_QML)"), projectInfo.qtQmlPath);
|
||||||
|
|
||||||
QList<IBundleProvider *> bundleProviders =
|
for (IBundleProvider *bp : IBundleProvider::allBundleProviders())
|
||||||
ExtensionSystem::PluginManager::getObjects<IBundleProvider>();
|
|
||||||
|
|
||||||
foreach (IBundleProvider *bp, bundleProviders) {
|
|
||||||
if (bp)
|
|
||||||
bp->mergeBundlesForKit(activeKit, projectInfo.activeBundle, replacements);
|
bp->mergeBundlesForKit(activeKit, projectInfo.activeBundle, replacements);
|
||||||
}
|
|
||||||
projectInfo.extendedBundle = projectInfo.activeBundle;
|
projectInfo.extendedBundle = projectInfo.activeBundle;
|
||||||
|
|
||||||
if (projectInfo.project) {
|
if (projectInfo.project) {
|
||||||
@@ -167,8 +164,7 @@ void setupProjectInfoQmlBundles(ModelManagerInterface::ProjectInfo &projectInfo)
|
|||||||
currentKits.insert(t->kit());
|
currentKits.insert(t->kit());
|
||||||
currentKits.remove(activeKit);
|
currentKits.remove(activeKit);
|
||||||
foreach (Kit *kit, currentKits) {
|
foreach (Kit *kit, currentKits) {
|
||||||
foreach (IBundleProvider *bp, bundleProviders)
|
for (IBundleProvider *bp : IBundleProvider::allBundleProviders())
|
||||||
if (bp)
|
|
||||||
bp->mergeBundlesForKit(kit, projectInfo.extendedBundle, replacements);
|
bp->mergeBundlesForKit(kit, projectInfo.extendedBundle, replacements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,13 +36,22 @@
|
|||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
using namespace QtSupport::Internal;
|
using namespace QtSupport::Internal;
|
||||||
|
|
||||||
|
static QList<QtVersionFactory *> g_qtVersionFactories;
|
||||||
|
|
||||||
QtVersionFactory::QtVersionFactory(QObject *parent) :
|
QtVersionFactory::QtVersionFactory(QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
|
g_qtVersionFactories.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVersionFactory::~QtVersionFactory()
|
QtVersionFactory::~QtVersionFactory()
|
||||||
{
|
{
|
||||||
|
g_qtVersionFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<QtVersionFactory *> QtVersionFactory::allQtVersionFactories()
|
||||||
|
{
|
||||||
|
return g_qtVersionFactories;
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error)
|
BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileName &qmakePath, bool isAutoDetected, const QString &autoDetectionSource, QString *error)
|
||||||
@@ -62,7 +71,7 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
|||||||
ProFileEvaluator evaluator(&globals, &parser, &vfs, &msgHandler);
|
ProFileEvaluator evaluator(&globals, &parser, &vfs, &msgHandler);
|
||||||
evaluator.loadNamedSpec(mkspec.toString(), false);
|
evaluator.loadNamedSpec(mkspec.toString(), false);
|
||||||
|
|
||||||
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
QList<QtVersionFactory *> factories = g_qtVersionFactories;
|
||||||
Utils::sort(factories, [](const QtVersionFactory *l, const QtVersionFactory *r) {
|
Utils::sort(factories, [](const QtVersionFactory *l, const QtVersionFactory *r) {
|
||||||
return l->priority() > r->priority();
|
return l->priority() > r->priority();
|
||||||
});
|
});
|
||||||
|
@@ -49,6 +49,8 @@ public:
|
|||||||
explicit QtVersionFactory(QObject *parent = 0);
|
explicit QtVersionFactory(QObject *parent = 0);
|
||||||
~QtVersionFactory();
|
~QtVersionFactory();
|
||||||
|
|
||||||
|
static const QList<QtVersionFactory *> allQtVersionFactories();
|
||||||
|
|
||||||
virtual bool canRestore(const QString &type) = 0;
|
virtual bool canRestore(const QString &type) = 0;
|
||||||
virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data) = 0;
|
virtual BaseQtVersion *restore(const QString &type, const QVariantMap &data) = 0;
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ static bool restoreQtVersions()
|
|||||||
m_writer = new PersistentSettingsWriter(settingsFileName(QLatin1String(QTVERSION_FILENAME)),
|
m_writer = new PersistentSettingsWriter(settingsFileName(QLatin1String(QTVERSION_FILENAME)),
|
||||||
QLatin1String("QtCreatorQtVersions"));
|
QLatin1String("QtCreatorQtVersions"));
|
||||||
|
|
||||||
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
const QList<QtVersionFactory *> factories = QtVersionFactory::allQtVersionFactories();
|
||||||
|
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
FileName filename = settingsFileName(QLatin1String(QTVERSION_FILENAME));
|
FileName filename = settingsFileName(QLatin1String(QTVERSION_FILENAME));
|
||||||
@@ -208,7 +208,7 @@ static bool restoreQtVersions()
|
|||||||
const QString type = qtversionMap.value(QLatin1String(QTVERSION_TYPE_KEY)).toString();
|
const QString type = qtversionMap.value(QLatin1String(QTVERSION_TYPE_KEY)).toString();
|
||||||
|
|
||||||
bool restored = false;
|
bool restored = false;
|
||||||
foreach (QtVersionFactory *f, factories) {
|
for (QtVersionFactory *f : factories) {
|
||||||
if (f->canRestore(type)) {
|
if (f->canRestore(type)) {
|
||||||
if (BaseQtVersion *qtv = f->restore(type, qtversionMap)) {
|
if (BaseQtVersion *qtv = f->restore(type, qtversionMap)) {
|
||||||
if (m_versions.contains(qtv->uniqueId())) {
|
if (m_versions.contains(qtv->uniqueId())) {
|
||||||
@@ -249,7 +249,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
|
|||||||
QList<int> removed;
|
QList<int> removed;
|
||||||
QList<int> changed;
|
QList<int> changed;
|
||||||
|
|
||||||
QList<QtVersionFactory *> factories = ExtensionSystem::PluginManager::getObjects<QtVersionFactory>();
|
const QList<QtVersionFactory *> factories = QtVersionFactory::allQtVersionFactories();
|
||||||
PersistentSettingsReader reader;
|
PersistentSettingsReader reader;
|
||||||
QVariantMap data;
|
QVariantMap data;
|
||||||
if (reader.load(path))
|
if (reader.load(path))
|
||||||
|
@@ -46,9 +46,14 @@ public:
|
|||||||
virtual QVariantMap settings() const { return QVariantMap(); }
|
virtual QVariantMap settings() const { return QVariantMap(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TEXTEDITOR_EXPORT IOutlineWidgetFactory : public QObject {
|
class TEXTEDITOR_EXPORT IOutlineWidgetFactory : public QObject
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
IOutlineWidgetFactory();
|
||||||
|
~IOutlineWidgetFactory() override;
|
||||||
|
|
||||||
virtual bool supportsEditor(Core::IEditor *editor) const = 0;
|
virtual bool supportsEditor(Core::IEditor *editor) const = 0;
|
||||||
virtual IOutlineWidget *createWidget(Core::IEditor *editor) = 0;
|
virtual IOutlineWidget *createWidget(Core::IEditor *editor) = 0;
|
||||||
};
|
};
|
||||||
|
@@ -38,6 +38,19 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
|
static QList<IOutlineWidgetFactory *> g_outlineWidgetFactories;
|
||||||
|
|
||||||
|
IOutlineWidgetFactory::IOutlineWidgetFactory()
|
||||||
|
{
|
||||||
|
g_outlineWidgetFactories.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOutlineWidgetFactory::~IOutlineWidgetFactory()
|
||||||
|
{
|
||||||
|
g_outlineWidgetFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
||||||
@@ -153,7 +166,7 @@ void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor)
|
|||||||
IOutlineWidget *newWidget = 0;
|
IOutlineWidget *newWidget = 0;
|
||||||
|
|
||||||
if (editor) {
|
if (editor) {
|
||||||
foreach (IOutlineWidgetFactory *widgetFactory, m_factory->widgetFactories()) {
|
for (IOutlineWidgetFactory *widgetFactory : g_outlineWidgetFactories) {
|
||||||
if (widgetFactory->supportsEditor(editor)) {
|
if (widgetFactory->supportsEditor(editor)) {
|
||||||
newWidget = widgetFactory->createWidget(editor);
|
newWidget = widgetFactory->createWidget(editor);
|
||||||
break;
|
break;
|
||||||
@@ -189,16 +202,6 @@ OutlineFactory::OutlineFactory()
|
|||||||
setPriority(600);
|
setPriority(600);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<IOutlineWidgetFactory*> OutlineFactory::widgetFactories() const
|
|
||||||
{
|
|
||||||
return m_factories;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OutlineFactory::setWidgetFactories(QList<IOutlineWidgetFactory*> factories)
|
|
||||||
{
|
|
||||||
m_factories = factories;
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::NavigationView OutlineFactory::createWidget()
|
Core::NavigationView OutlineFactory::createWidget()
|
||||||
{
|
{
|
||||||
Core::NavigationView n;
|
Core::NavigationView n;
|
||||||
|
@@ -72,15 +72,10 @@ class OutlineFactory : public Core::INavigationWidgetFactory
|
|||||||
public:
|
public:
|
||||||
OutlineFactory();
|
OutlineFactory();
|
||||||
|
|
||||||
QList<IOutlineWidgetFactory*> widgetFactories() const;
|
|
||||||
void setWidgetFactories(QList<IOutlineWidgetFactory*> factories);
|
|
||||||
|
|
||||||
// from INavigationWidgetFactory
|
// from INavigationWidgetFactory
|
||||||
virtual Core::NavigationView createWidget();
|
virtual Core::NavigationView createWidget();
|
||||||
virtual void saveSettings(QSettings *settings, int position, QWidget *widget);
|
virtual void saveSettings(QSettings *settings, int position, QWidget *widget);
|
||||||
virtual void restoreSettings(QSettings *settings, int position, QWidget *widget);
|
virtual void restoreSettings(QSettings *settings, int position, QWidget *widget);
|
||||||
private:
|
|
||||||
QList<IOutlineWidgetFactory*> m_factories;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -56,11 +56,20 @@ void QuickFixOperation::setDescription(const QString &description)
|
|||||||
_description = description;
|
_description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QList<QuickFixFactory *> g_quickFixFactories;
|
||||||
|
|
||||||
QuickFixFactory::QuickFixFactory(QObject *parent)
|
QuickFixFactory::QuickFixFactory(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
|
g_quickFixFactories.append(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickFixFactory::~QuickFixFactory()
|
QuickFixFactory::~QuickFixFactory()
|
||||||
{
|
{
|
||||||
|
g_quickFixFactories.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const QList<QuickFixFactory *> QuickFixFactory::allQuickFixFactories()
|
||||||
|
{
|
||||||
|
return g_quickFixFactories;
|
||||||
}
|
}
|
||||||
|
@@ -114,6 +114,8 @@ public:
|
|||||||
QuickFixFactory(QObject *parent = 0);
|
QuickFixFactory(QObject *parent = 0);
|
||||||
~QuickFixFactory();
|
~QuickFixFactory();
|
||||||
|
|
||||||
|
static const QList<QuickFixFactory *> allQuickFixFactories();
|
||||||
|
|
||||||
virtual void matchingOperations(const QuickFixInterface &interface, QuickFixOperations &result) = 0;
|
virtual void matchingOperations(const QuickFixInterface &interface, QuickFixOperations &result) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -27,8 +27,33 @@
|
|||||||
|
|
||||||
#include "texteditorplugin.h"
|
#include "texteditorplugin.h"
|
||||||
|
|
||||||
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
|
static QList<SnippetProvider *> g_snippetProviders;
|
||||||
|
|
||||||
|
const QList<SnippetProvider *> SnippetProvider::snippetProviders()
|
||||||
|
{
|
||||||
|
return g_snippetProviders;
|
||||||
|
}
|
||||||
|
|
||||||
|
SnippetProvider *SnippetProvider::snippetProviderForGroupId(const QString &groupId)
|
||||||
|
{
|
||||||
|
return Utils::findOrDefault(g_snippetProviders,
|
||||||
|
Utils::equal(&SnippetProvider::groupId, groupId));
|
||||||
|
}
|
||||||
|
|
||||||
|
SnippetProvider::SnippetProvider()
|
||||||
|
{
|
||||||
|
g_snippetProviders.append(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
SnippetProvider::~SnippetProvider()
|
||||||
|
{
|
||||||
|
g_snippetProviders.removeOne(this);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\group Snippets
|
\group Snippets
|
||||||
\title Snippets for Editors
|
\title Snippets for Editors
|
||||||
|
@@ -41,6 +41,9 @@ class TEXTEDITOR_EXPORT SnippetProvider : public QObject
|
|||||||
public:
|
public:
|
||||||
using EditorDecorator = std::function<void(TextEditorWidget *)>;
|
using EditorDecorator = std::function<void(TextEditorWidget *)>;
|
||||||
|
|
||||||
|
static const QList<SnippetProvider *> snippetProviders();
|
||||||
|
static SnippetProvider *snippetProviderForGroupId(const QString &groupId);
|
||||||
|
|
||||||
static void registerGroup(const QString &groupId, const QString &displayName,
|
static void registerGroup(const QString &groupId, const QString &displayName,
|
||||||
EditorDecorator editorDecorator = EditorDecorator());
|
EditorDecorator editorDecorator = EditorDecorator());
|
||||||
|
|
||||||
@@ -51,7 +54,8 @@ public:
|
|||||||
void decorateEditor(TextEditorWidget *editor) const;
|
void decorateEditor(TextEditorWidget *editor) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SnippetProvider() = default;
|
SnippetProvider();
|
||||||
|
~SnippetProvider() override;
|
||||||
|
|
||||||
QString m_groupId;
|
QString m_groupId;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
|
@@ -409,9 +409,7 @@ int SnippetsCollection::groupIndex(const QString &groupId) const
|
|||||||
|
|
||||||
void SnippetsCollection::identifyGroups()
|
void SnippetsCollection::identifyGroups()
|
||||||
{
|
{
|
||||||
const QList<SnippetProvider *> &providers =
|
for (SnippetProvider *provider : SnippetProvider::snippetProviders()) {
|
||||||
ExtensionSystem::PluginManager::getObjects<SnippetProvider>();
|
|
||||||
foreach (SnippetProvider *provider, providers) {
|
|
||||||
const int groupIndex = m_groupIndexById.size();
|
const int groupIndex = m_groupIndexById.size();
|
||||||
m_groupIndexById.insert(provider->groupId(), groupIndex);
|
m_groupIndexById.insert(provider->groupId(), groupIndex);
|
||||||
m_snippets.resize(groupIndex + 1);
|
m_snippets.resize(groupIndex + 1);
|
||||||
|
@@ -328,9 +328,8 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
|
|||||||
{
|
{
|
||||||
m_ui.setupUi(w);
|
m_ui.setupUi(w);
|
||||||
|
|
||||||
const QList<SnippetProvider *> &providers =
|
const QList<SnippetProvider *> &providers = SnippetProvider::snippetProviders();
|
||||||
ExtensionSystem::PluginManager::getObjects<SnippetProvider>();
|
for (SnippetProvider *provider : providers) {
|
||||||
foreach (SnippetProvider *provider, providers) {
|
|
||||||
m_ui.groupCombo->addItem(provider->displayName(), provider->groupId());
|
m_ui.groupCombo->addItem(provider->displayName(), provider->groupId());
|
||||||
SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w);
|
SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w);
|
||||||
provider->decorateEditor(snippetEditor);
|
provider->decorateEditor(snippetEditor);
|
||||||
@@ -537,8 +536,7 @@ void SnippetsSettingsPagePrivate::setSnippetContent()
|
|||||||
|
|
||||||
void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings &fontSettings)
|
void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings &fontSettings)
|
||||||
{
|
{
|
||||||
const QList<SnippetProvider *> &providers =
|
const QList<SnippetProvider *> &providers = SnippetProvider::snippetProviders();
|
||||||
ExtensionSystem::PluginManager::getObjects<SnippetProvider>();
|
|
||||||
for (int i = 0; i < m_ui.groupCombo->count(); ++i) {
|
for (int i = 0; i < m_ui.groupCombo->count(); ++i) {
|
||||||
SnippetEditorWidget *snippetEditor = editorAt(i);
|
SnippetEditorWidget *snippetEditor = editorAt(i);
|
||||||
snippetEditor->textDocument()->setFontSettings(fontSettings);
|
snippetEditor->textDocument()->setFontSettings(fontSettings);
|
||||||
|
@@ -147,8 +147,6 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
|
|||||||
|
|
||||||
void TextEditorPlugin::extensionsInitialized()
|
void TextEditorPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
m_outlineFactory->setWidgetFactories(ExtensionSystem::PluginManager::getObjects<TextEditor::IOutlineWidgetFactory>());
|
|
||||||
|
|
||||||
connect(m_settings, &TextEditorSettings::fontSettingsChanged,
|
connect(m_settings, &TextEditorSettings::fontSettingsChanged,
|
||||||
this, &TextEditorPlugin::updateSearchResultsFont);
|
this, &TextEditorPlugin::updateSearchResultsFont);
|
||||||
|
|
||||||
|
@@ -83,10 +83,13 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
|
|||||||
|
|
||||||
VcsBaseEditor *VcsEditorFactory::createEditorById(const char *id)
|
VcsBaseEditor *VcsEditorFactory::createEditorById(const char *id)
|
||||||
{
|
{
|
||||||
auto factory = ExtensionSystem::PluginManager::getObject<VcsEditorFactory>(
|
for (IEditorFactory *factory : allEditorFactories()) {
|
||||||
[id](QObject *ob) { return ob->property("VcsEditorFactoryName").toByteArray() == id; });
|
if (auto vcsFactory = qobject_cast<VcsEditorFactory *>(factory)) {
|
||||||
QTC_ASSERT(factory, return 0);
|
if (vcsFactory->property("VcsEditorFactoryName").toByteArray() == id)
|
||||||
return qobject_cast<VcsBaseEditor *>(factory->createEditor());
|
return qobject_cast<VcsBaseEditor *>(factory->createEditor());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
@@ -343,8 +343,7 @@ void WelcomeMode::initPlugins()
|
|||||||
QSettings *settings = ICore::settings();
|
QSettings *settings = ICore::settings();
|
||||||
m_activePage = Id::fromSetting(settings->value(currentPageSettingsKeyC));
|
m_activePage = Id::fromSetting(settings->value(currentPageSettingsKeyC));
|
||||||
|
|
||||||
const QList<IWelcomePage *> availablePages = PluginManager::getObjects<IWelcomePage>();
|
for (IWelcomePage *page : IWelcomePage::allWelcomePages())
|
||||||
for (IWelcomePage *page : availablePages)
|
|
||||||
addPage(page);
|
addPage(page);
|
||||||
|
|
||||||
// make sure later added pages are made available too:
|
// make sure later added pages are made available too:
|
||||||
|
Reference in New Issue
Block a user