File indexing completed on 2024-04-28 04:37:25

0001 /*
0002     SPDX-FileCopyrightText: 2004 Alexander Dymo <adymo@kdevelop.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_SHELLEXTENSION_H
0008 #define KDEVPLATFORM_SHELLEXTENSION_H
0009 
0010 #include <QString>
0011 #include "shellexport.h"
0012 
0013 namespace KDevelop
0014 {
0015 
0016 /**Default area parameters collection.*/
0017 struct AreaParams {
0018     /**Unique name for the area.*/
0019     QString name;
0020     /**User-visible area title.*/
0021     QString title;
0022 };
0023 
0024 /**
0025 Shell extension.
0026 Provides application-dependent and shell-independent functionality.
0027 Shell uses extensions to perform application dependent actions.
0028 */
0029 class KDEVPLATFORMSHELL_EXPORT ShellExtension {
0030 public:
0031     virtual ~ShellExtension() {}
0032 
0033     /**Returns an instance of a shell. Subclasses must create an instance of a shell
0034     by themselves. For example they could provide static init() method like:
0035     @code
0036     static void init()
0037     {
0038         s_instance = new MyExtension();
0039     }
0040     @endcode*/
0041     static ShellExtension *getInstance();
0042 
0043     /**Reimplement to return the path to the executable that needs to be executed for new sessions.*/
0044     virtual QString executableFilePath() = 0;
0045 
0046     /**Reimplement to return the name of KXMLGUI resource file for an application.*/
0047     virtual QString xmlFile() = 0;
0048 
0049     /**Reimplement to return the name of the default ui area.*/
0050     virtual AreaParams defaultArea() = 0;
0051 
0052     /**Reimplement to return the filename extension for project files.*/
0053     virtual QString projectFileExtension() = 0;
0054 
0055     /**Reimplement to return the description for project files.*/
0056     virtual QString projectFileDescription() = 0;
0057 
0058     /**
0059      * Reimplement to return the list of plugins that should
0060      * loaded by default.
0061      * If an empty list is returned, instead the plugin metadata is fallen back to,
0062      * by reading the bool value KPlugin/EnabledByDefault (default: true).
0063      */
0064     virtual QStringList defaultPlugins() = 0;
0065 
0066 protected:
0067     ShellExtension();
0068     static ShellExtension *s_instance;
0069 };
0070 
0071 }
0072 #endif
0073