1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
/* This file is part of KDevelop
Copyright 2009 Andreas Pakulat <apaku@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KDEVPLATFORM_LAUNCHCONFIGURATIONTYPE_H
#define KDEVPLATFORM_LAUNCHCONFIGURATIONTYPE_H
#include "interfacesexport.h"
#include <QObject>
class QMenu;
class QIcon;
class QUrl;
class QStringList;
class KConfigGroup;
namespace KDevelop
{
class IProject;
class ILaunchConfiguration;
class ProjectBaseItem;
class ILauncher;
class LaunchConfigurationPageFactory;
class LaunchConfigurationTypePrivate;
/**
* Launch configuration types are used to be able to create
* new launch configurations. Each launch configuration has a
* specific type, which specifies which launchers can be used
* for the configuration as well as which config pages are needed
* to setup the launch configuration
*/
class KDEVPLATFORMINTERFACES_EXPORT LaunchConfigurationType : public QObject
{
Q_OBJECT
public:
LaunchConfigurationType();
~LaunchConfigurationType() override;
/**
* Provide a unique identifier for the type
* among other things this will be used to create a config group in launch
* configurations for the pages of this config type
* @returns a unique identifier for this launch configuration type
*/
virtual QString id() const = 0;
/**
* Provide a user visible name for the type
* @returns a translatable string for the type
*/
virtual QString name() const = 0;
/**
* Add @p starter to this configuration type
* @param starter the launcher that can start configurations of this type
*/
void addLauncher( ILauncher* starter );
/**
* remove @p starter from this configuration type
* @param starter the launcher that should not start configurations of this type
*/
void removeLauncher( ILauncher* starter );
/**
* Access all launchers that are usable with this type
* @returns a list of launchers that can be used with configurations of this type
*/
QList<ILauncher*> launchers() const;
/**
* Convenience method to access a launcher given its @p id
* @param id the id of the launcher to be found
* @returns the launcher with the given id or 0 if there's no such launcher in this configuration type
*/
ILauncher* launcherForId(const QString& id) const;
/**
* Provide a list of widgets to configure a launch configuration for this type
* @returns a list of factories to create config pages from.
*/
virtual QList<LaunchConfigurationPageFactory*> configPages() const = 0;
/**
* Provide an icon for this launch configuration type
* @returns an icon to be used for representing launch configurations of this type
*/
virtual QIcon icon() const = 0;
/**
* Check whether this launch configuration type can launch the given project item
* @param item the project tree item to test
* @returns true if this configuration type can launch the given item, false otherwise
*/
virtual bool canLaunch( KDevelop::ProjectBaseItem* item ) const = 0;
/**
* Configure the given launch configuration to execute the selected item
* @param config the configuration to setup
* @param item the item to launch
*/
virtual void configureLaunchFromItem( KConfigGroup config,
KDevelop::ProjectBaseItem* item ) const = 0;
/**
* Configure the given launch configuration to execute the selected item
* @param config the configuration to setup
* @param args argument list
*/
virtual void configureLaunchFromCmdLineArguments( KConfigGroup config,
const QStringList &args ) const = 0;
/**
* Check whether this launch configuration type can launch the given file
* @param file the file to test launchability
* @returns true if this configuration type can launch the given file, false otherwise
*/
virtual bool canLaunch( const QUrl& file ) const = 0;
/**
* Creates and returns a menu that will be added to the UI where the interface will be
* able to add any suggestion it needs, like default targets.
* Can be a nullptr if there are no suggestions.
* Caller takes ownership of the returned menu.
*/
virtual QMenu* launcherSuggestions() { return nullptr; }
Q_SIGNALS:
void signalAddLaunchConfiguration(KDevelop::ILaunchConfiguration* launch);
private:
const QScopedPointer<class LaunchConfigurationTypePrivate> d_ptr;
Q_DECLARE_PRIVATE(LaunchConfigurationType)
};
}
#endif
|