1 /* 2 SPDX-FileCopyrightText: 2009 Andreas Pakulat <apaku@gmx.de> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7 #ifndef KDEVPLATFORM_PLUGIN_NATIVEAPPCONFIGTYPE_H 8 #define KDEVPLATFORM_PLUGIN_NATIVEAPPCONFIGTYPE_H 9 10 #include <interfaces/launchconfigurationtype.h> 11 #include <interfaces/launchconfigurationpage.h> 12 #include <interfaces/ilauncher.h> 13 #include <interfaces/ilaunchmode.h> 14 15 #include "ui_nativeappconfig.h" 16 17 //TODO: Split the page into two, one concerning executable/arguments/behaviour the other for dependencies 18 19 class NativeAppConfigPage : public KDevelop::LaunchConfigurationPage, Ui::NativeAppPage 20 { 21 Q_OBJECT 22 public: 23 explicit NativeAppConfigPage( QWidget* parent ); 24 void loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* project = nullptr ) override; 25 void saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* project = nullptr ) const override; 26 QString title() const override; 27 QIcon icon() const override; 28 private Q_SLOTS: 29 void activateDeps( int ); 30 }; 31 32 class NativeAppLauncher : public KDevelop::ILauncher 33 { 34 public: 35 NativeAppLauncher(); 36 QList< KDevelop::LaunchConfigurationPageFactory* > configPages() const override; 37 QString description() const override; 38 QString id() override; 39 QString name() const override; 40 KJob* start(const QString& launchMode, KDevelop::ILaunchConfiguration* cfg) override; 41 QStringList supportedModes() const override; 42 }; 43 44 class NativeAppPageFactory : public KDevelop::LaunchConfigurationPageFactory 45 { 46 public: 47 NativeAppPageFactory(); 48 KDevelop::LaunchConfigurationPage* createWidget(QWidget* parent) override; 49 }; 50 51 /** 52 * A specific configuration to start a launchable, this could be a native 53 * compiled application, or some script file or byte-compiled file or something else 54 * Provides access to the various configured information, as well as its type and a name 55 */ 56 class NativeAppConfigType : public KDevelop::LaunchConfigurationType 57 { 58 Q_OBJECT 59 public: 60 NativeAppConfigType(); 61 ~NativeAppConfigType() override; 62 63 static QString sharedId(); 64 65 QString id() const override; 66 QString name() const override; 67 QList<KDevelop::LaunchConfigurationPageFactory*> configPages() const override; 68 QIcon icon() const override; 69 bool canLaunch( KDevelop::ProjectBaseItem* item ) const override; 70 bool canLaunch( const QUrl& file ) const override; 71 void configureLaunchFromItem ( KConfigGroup cfg, 72 KDevelop::ProjectBaseItem* item ) const override; 73 void configureLaunchFromCmdLineArguments ( KConfigGroup cfg, 74 const QStringList& args ) const override; 75 QMenu* launcherSuggestions() override; 76 private: 77 QList<KDevelop::LaunchConfigurationPageFactory*> factoryList; 78 79 public Q_SLOTS: 80 void suggestionTriggered(); 81 }; 82 #endif 83 84