Commit 307442fc authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

KDevelop::QuickOpenFileSetInterface: use via Q_INTERFACES

parent b9f19711
...@@ -212,6 +212,7 @@ public: ...@@ -212,6 +212,7 @@ public:
bool KDEVPLATFORMLANGUAGE_EXPORT extractLineNumber(const QString& from, QString& path, uint& lineNumber); bool KDEVPLATFORMLANGUAGE_EXPORT extractLineNumber(const QString& from, QString& path, uint& lineNumber);
} }
Q_DECLARE_INTERFACE(KDevelop::QuickOpenFileSetInterface, "org.kdevelop.QuickOpenFileSetInterface")
Q_DECLARE_INTERFACE(KDevelop::QuickOpenEmbeddedWidgetInterface, "org.kdevelop.QuickOpenEmbeddedWidgetInterface") Q_DECLARE_INTERFACE(KDevelop::QuickOpenEmbeddedWidgetInterface, "org.kdevelop.QuickOpenEmbeddedWidgetInterface")
#endif #endif
...@@ -92,6 +92,8 @@ class BaseFileDataProvider ...@@ -92,6 +92,8 @@ class BaseFileDataProvider
, public KDevelop::QuickOpenFileSetInterface , public KDevelop::QuickOpenFileSetInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(KDevelop::QuickOpenFileSetInterface)
public: public:
BaseFileDataProvider(); BaseFileDataProvider();
void setFilterText(const QString& text) override; void setFilterText(const QString& text) override;
......
...@@ -118,7 +118,7 @@ void QuickOpenModel::enableProviders(const QStringList& _items, const QStringLis ...@@ -118,7 +118,7 @@ void QuickOpenModel::enableProviders(const QStringList& _items, const QStringLis
//We use 2 iterations here: In the first iteration, all providers that implement QuickOpenFileSetInterface are initialized, then the other ones. //We use 2 iterations here: In the first iteration, all providers that implement QuickOpenFileSetInterface are initialized, then the other ones.
//The reason is that the second group can refer to the first one. //The reason is that the second group can refer to the first one.
for (ProviderList::iterator it = m_providers.begin(); it != m_providers.end(); ++it) { for (ProviderList::iterator it = m_providers.begin(); it != m_providers.end(); ++it) {
if (!dynamic_cast<QuickOpenFileSetInterface*>((*it).provider)) { if (!qobject_cast<QuickOpenFileSetInterface*>((*it).provider)) {
continue; continue;
} }
qCDebug(PLUGIN_QUICKOPEN) << "comparing" << (*it).scopes << (*it).types; qCDebug(PLUGIN_QUICKOPEN) << "comparing" << (*it).scopes << (*it).types;
...@@ -136,7 +136,7 @@ void QuickOpenModel::enableProviders(const QStringList& _items, const QStringLis ...@@ -136,7 +136,7 @@ void QuickOpenModel::enableProviders(const QStringList& _items, const QStringLis
} }
for (ProviderList::iterator it = m_providers.begin(); it != m_providers.end(); ++it) { for (ProviderList::iterator it = m_providers.begin(); it != m_providers.end(); ++it) {
if (dynamic_cast<QuickOpenFileSetInterface*>((*it).provider)) { if (qobject_cast<QuickOpenFileSetInterface*>((*it).provider)) {
continue; continue;
} }
qCDebug(PLUGIN_QUICKOPEN) << "comparing" << (*it).scopes << (*it).types; qCDebug(PLUGIN_QUICKOPEN) << "comparing" << (*it).scopes << (*it).types;
...@@ -204,7 +204,7 @@ void QuickOpenModel::restart_internal(bool keepFilterText) ...@@ -204,7 +204,7 @@ void QuickOpenModel::restart_internal(bool keepFilterText)
} }
foreach (const ProviderEntry& provider, m_providers) { foreach (const ProviderEntry& provider, m_providers) {
if (!dynamic_cast<QuickOpenFileSetInterface*>(provider.provider)) { if (!qobject_cast<QuickOpenFileSetInterface*>(provider.provider)) {
continue; continue;
} }
...@@ -215,7 +215,7 @@ void QuickOpenModel::restart_internal(bool keepFilterText) ...@@ -215,7 +215,7 @@ void QuickOpenModel::restart_internal(bool keepFilterText)
} }
foreach (const ProviderEntry& provider, m_providers) { foreach (const ProviderEntry& provider, m_providers) {
if (dynamic_cast<QuickOpenFileSetInterface*>(provider.provider)) { if (qobject_cast<QuickOpenFileSetInterface*>(provider.provider)) {
continue; continue;
} }
...@@ -440,7 +440,7 @@ QSet<IndexedString> QuickOpenModel::fileSet() const ...@@ -440,7 +440,7 @@ QSet<IndexedString> QuickOpenModel::fileSet() const
QSet<IndexedString> merged; QSet<IndexedString> merged;
for (const ProviderEntry& provider : m_providers) { for (const ProviderEntry& provider : m_providers) {
if (m_enabledScopes.isEmpty() || !(m_enabledScopes & provider.scopes).isEmpty()) { if (m_enabledScopes.isEmpty() || !(m_enabledScopes & provider.scopes).isEmpty()) {
if (auto* iface = dynamic_cast<QuickOpenFileSetInterface*>(provider.provider)) { if (auto* iface = qobject_cast<QuickOpenFileSetInterface*>(provider.provider)) {
QSet<IndexedString> ifiles = iface->files(); QSet<IndexedString> ifiles = iface->files();
//qCDebug(PLUGIN_QUICKOPEN) << "got file-list with" << ifiles.count() << "entries from data-provider" << typeid(*iface).name(); //qCDebug(PLUGIN_QUICKOPEN) << "got file-list with" << ifiles.count() << "entries from data-provider" << typeid(*iface).name();
merged += ifiles; merged += ifiles;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment