File indexing completed on 2024-04-28 04:38:39
0001 /* 0002 SPDX-FileCopyrightText: 2009 Andreas Pakulat <apaku@gmx.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_NATIVEAPPCONFIGTYPE_H 0008 #define KDEVPLATFORM_PLUGIN_NATIVEAPPCONFIGTYPE_H 0009 0010 #include <interfaces/launchconfigurationtype.h> 0011 #include <interfaces/launchconfigurationpage.h> 0012 #include <interfaces/ilauncher.h> 0013 #include <interfaces/ilaunchmode.h> 0014 0015 #include "ui_nativeappconfig.h" 0016 0017 //TODO: Split the page into two, one concerning executable/arguments/behaviour the other for dependencies 0018 0019 class NativeAppConfigPage : public KDevelop::LaunchConfigurationPage, Ui::NativeAppPage 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit NativeAppConfigPage( QWidget* parent ); 0024 void loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* project = nullptr ) override; 0025 void saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* project = nullptr ) const override; 0026 QString title() const override; 0027 QIcon icon() const override; 0028 private Q_SLOTS: 0029 void activateDeps( int ); 0030 }; 0031 0032 class NativeAppLauncher : public KDevelop::ILauncher 0033 { 0034 public: 0035 NativeAppLauncher(); 0036 QList< KDevelop::LaunchConfigurationPageFactory* > configPages() const override; 0037 QString description() const override; 0038 QString id() override; 0039 QString name() const override; 0040 KJob* start(const QString& launchMode, KDevelop::ILaunchConfiguration* cfg) override; 0041 QStringList supportedModes() const override; 0042 }; 0043 0044 class NativeAppPageFactory : public KDevelop::LaunchConfigurationPageFactory 0045 { 0046 public: 0047 NativeAppPageFactory(); 0048 KDevelop::LaunchConfigurationPage* createWidget(QWidget* parent) override; 0049 }; 0050 0051 /** 0052 * A specific configuration to start a launchable, this could be a native 0053 * compiled application, or some script file or byte-compiled file or something else 0054 * Provides access to the various configured information, as well as its type and a name 0055 */ 0056 class NativeAppConfigType : public KDevelop::LaunchConfigurationType 0057 { 0058 Q_OBJECT 0059 public: 0060 NativeAppConfigType(); 0061 ~NativeAppConfigType() override; 0062 0063 static QString sharedId(); 0064 0065 QString id() const override; 0066 QString name() const override; 0067 QList<KDevelop::LaunchConfigurationPageFactory*> configPages() const override; 0068 QIcon icon() const override; 0069 bool canLaunch( KDevelop::ProjectBaseItem* item ) const override; 0070 bool canLaunch( const QUrl& file ) const override; 0071 void configureLaunchFromItem ( KConfigGroup cfg, 0072 KDevelop::ProjectBaseItem* item ) const override; 0073 void configureLaunchFromCmdLineArguments ( KConfigGroup cfg, 0074 const QStringList& args ) const override; 0075 QMenu* launcherSuggestions() override; 0076 private: 0077 QList<KDevelop::LaunchConfigurationPageFactory*> factoryList; 0078 0079 public Q_SLOTS: 0080 void suggestionTriggered(); 0081 }; 0082 #endif 0083