File indexing completed on 2024-04-28 04:36:29

0001 /*
0002     SPDX-FileCopyrightText: 2007 Alexander Dymo <adymo@kdevelop.org>
0003     SPDX-FileCopyrightText: 2007 Kris Wong <kris.p.wong@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KDEVPLATFORM_ICORE_H
0009 #define KDEVPLATFORM_ICORE_H
0010 
0011 #include <QObject>
0012 #include "interfacesexport.h"
0013 
0014 #include "isessionlock.h"
0015 
0016 /**
0017  * The KDevelop namespace contains all classes provided by the KDevelop
0018  * platform libraries.
0019  */
0020 namespace KDevelop
0021 {
0022 
0023 class IUiController;
0024 class IPluginController;
0025 class IProjectController;
0026 class ILanguageController;
0027 class IDocumentController;
0028 class ISessionController;
0029 class IRunController;
0030 class ISourceFormatterController;
0031 class ISession;
0032 class ISelectionController;
0033 class IDocumentationController;
0034 class IDebugController;
0035 class IPartController;
0036 class IDashboardController;
0037 class ITestController;
0038 class IRuntimeController;
0039 
0040 /**
0041  * ICore is the container class for all the various objects in use by
0042  * KDevelop. If access is needed to a particular controller, then this class
0043  * should be used.
0044  *
0045  * ICore can provide the user with instances of the following things:
0046  * - the main window(s)
0047  *   - the document controller(s)
0048  * - the plugin controller
0049  * - the project controller
0050  * - the language controller
0051  * - the KPart manager
0052  *
0053  * When an object is provided to ICore so it can be used later, ICore
0054  * will take ownership of the object and upon application shutdown will take
0055  * responsibility for deleting the objects stored by ICore.
0056  */
0057 class KDEVPLATFORMINTERFACES_EXPORT ICore: public QObject
0058 {
0059     Q_OBJECT
0060     Q_PROPERTY(KDevelop::IProjectController* projectController READ projectController)
0061 
0062 public:
0063     ~ICore() override;
0064 
0065     /** @return the static ICore instance */
0066     static ICore *self();
0067 
0068     /** @return ui controller */
0069     virtual KDevelop::IUiController *uiController() = 0;
0070 
0071     /** @return plugin controller */
0072     virtual KDevelop::IPluginController *pluginController() = 0;
0073 
0074     /** @return project controller */
0075     virtual KDevelop::IProjectController *projectController() = 0;
0076 
0077     /** @return language controller */
0078     virtual KDevelop::ILanguageController *languageController() = 0;
0079 
0080     /** @return part manager */
0081     virtual KDevelop::IPartController *partController() = 0;
0082 
0083     /** @return document controller */
0084     virtual KDevelop::IDocumentController *documentController() = 0;
0085 
0086     /** @return run controller */
0087     virtual KDevelop::IRunController *runController() = 0;
0088 
0089     /** @return the active session */
0090     virtual KDevelop::ISession *activeSession() = 0;
0091 
0092     /** @return the session lock for the active session */
0093     virtual KDevelop::ISessionLock::Ptr activeSessionLock() = 0;
0094 
0095     /** @return the active session's temporary directory path */
0096     virtual QString sessionTemporaryDirectoryPath() const = 0;
0097 
0098     /** @return the sourceformatter controller */
0099     virtual KDevelop::ISourceFormatterController *sourceFormatterController() = 0;
0100 
0101     /** @return the selection controller */
0102     virtual KDevelop::ISelectionController* selectionController() = 0;
0103 
0104     /** @return the documentation controller */
0105     virtual KDevelop::IDocumentationController* documentationController() = 0;
0106 
0107     /** @return the debug controller */
0108     virtual KDevelop::IDebugController* debugController() = 0;
0109 
0110     /** @return the test controller */
0111     virtual KDevelop::ITestController* testController() = 0;
0112 
0113     /** @return the runtime controller */
0114     Q_SCRIPTABLE virtual KDevelop::IRuntimeController* runtimeController() = 0;
0115 
0116     /** @return true if the application is currently being shut down */
0117     virtual bool shuttingDown() const = 0;
0118 
0119 Q_SIGNALS:
0120     /** Emitted when the initialization of the core components has been completed */
0121     void initializationCompleted();
0122     /**
0123      * Emitted immediately before tearing down the session and UI.  Useful when performing any last minute
0124      * preparations such as saving settings.
0125      */
0126     void aboutToShutdown();
0127     /**
0128      * Emitted when the teardown of the core components has been completed.
0129      */
0130     void shutdownCompleted();
0131 
0132 protected:
0133     explicit ICore(QObject *parent = nullptr);
0134     static ICore *m_self;
0135 };
0136 
0137 }
0138 
0139 #endif