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

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_LAUNCHCONFIGURATIONPAGE_H
0008 #define KDEVPLATFORM_LAUNCHCONFIGURATIONPAGE_H
0009 
0010 #include "interfacesexport.h"
0011 
0012 #include <QWidget>
0013 
0014 class KConfigGroup;
0015 
0016 namespace KDevelop
0017 {
0018 
0019 class IProject;
0020     
0021 /**
0022  * Provides a configuration page for a launch configuration, the interface
0023  * allows the actual dialog to easily load/save the configuration and show some title/icon
0024  */
0025 class KDEVPLATFORMINTERFACES_EXPORT LaunchConfigurationPage : public QWidget
0026 {
0027 Q_OBJECT
0028 public:
0029     explicit LaunchConfigurationPage( QWidget* parent );
0030     /**
0031      * Allows the page to load values from an existing launch configuration
0032      * @param cfg the configuration to load from
0033      */
0034     virtual void loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* project = nullptr ) = 0;
0035     
0036     /**
0037      * Allows the page to save values to an existing launch configuration
0038      * @param cfg the configuration to save to
0039      */
0040     virtual void saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* project = nullptr ) const = 0;
0041     
0042     /**
0043      * A title for displaying in the GUI
0044      * @returns the title of the page
0045      */
0046     virtual QString title() const = 0;
0047     
0048     /**
0049      * an icon for the GUI
0050      * @returns an icon suitable for display in the GUI
0051      */
0052     virtual QIcon icon() const = 0;
0053 Q_SIGNALS:
0054     void changed();
0055 };
0056 
0057 /**
0058  * A simple factory class to create certain launch config pages
0059  * this is used to create config pages only when they're needed
0060  */
0061 class KDEVPLATFORMINTERFACES_EXPORT LaunchConfigurationPageFactory
0062 {
0063 public:
0064     virtual ~LaunchConfigurationPageFactory() {}
0065     /**
0066      * create a new launch config page widget using the given @p parent
0067      * @param parent the parent widget to be used
0068      * @returns a new launch config page
0069      */
0070     virtual LaunchConfigurationPage* createWidget( QWidget* parent ) = 0;
0071 };
0072 
0073 }
0074 
0075 #endif
0076