File indexing completed on 2024-05-12 04:38:07

0001 /*
0002     SPDX-FileCopyrightText: 2006 David Nolden <david.nolden.kde@art-master.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_IQUICKOPEN_H
0008 #define KDEVPLATFORM_IQUICKOPEN_H
0009 
0010 #include <QSet>
0011 
0012 #include <QLineEdit>
0013 
0014 #include <language/languageexport.h>
0015 
0016 class QStringList;
0017 
0018 namespace KDevelop {
0019 class QuickOpenDataProviderBase;
0020 class IndexedString;
0021 
0022 /**
0023  * Interface to quickopen
0024  */
0025 class KDEVPLATFORMLANGUAGE_EXPORT IQuickOpen
0026 {
0027 public:
0028     virtual ~IQuickOpen();
0029 
0030     /**
0031      * Shows the quickopen dialog with the entries of specified types
0032      * Default types are: Files, Functions, Classes
0033      * There might be other quick open providers with custom items.
0034      * Note, the item name has to be translated, for example i18n("Files") should be passed.
0035      */
0036     virtual void showQuickOpen(const QStringList& types) = 0;
0037 
0038     /**
0039      * Registers a new provider under a specified name.
0040      * There may be multiple providers with the same type/scope, they will be used simultaneously in that case.
0041      * type and scope will be shown in the GUI, so they should be translated.
0042      * @param scopes Different scopes supported by this data-provider, Examples: "Project", "Imports", etc.
0043      * @param type Types of the provided data, Examples: "Files", "Functions", "Classes", etc.
0044      * @param provider The provider. It does not need to be explicitly removed before its destruction.
0045      */
0046     virtual void registerProvider(const QStringList& scopes, const QStringList& type,
0047                                   QuickOpenDataProviderBase* provider) = 0;
0048 
0049     /**
0050      * Remove provider.
0051      * @param provider The provider to remove
0052      * @return Whether a provider was removed. If false, the provider was not attached.
0053      */
0054     virtual bool removeProvider(QuickOpenDataProviderBase* provider) = 0;
0055 
0056     /**
0057      * Queries a set of files merged from all active data-providers that implement QuickOpenFileSetInterface.
0058      * This should not be queried by data-providers that implement QuickOpenFileSetInterface during their
0059      * initialization(set() and enableData())
0060      */
0061     virtual QSet<KDevelop::IndexedString> fileSet() const = 0;
0062 
0063     enum QuickOpenType {
0064         Standard,
0065         Outline
0066     };
0067 
0068     virtual QLineEdit* createQuickOpenLine(const QStringList& scopes, const QStringList& types,
0069                                            QuickOpenType type = Standard) = 0;
0070 };
0071 }
0072 
0073 Q_DECLARE_INTERFACE(KDevelop::IQuickOpen, "org.kdevelop.IQuickOpen")
0074 
0075 #endif // KDEVPLATFORM_IQUICKOPEN_H