File: iruncontroller.h

package info (click to toggle)
kdevelop 4%3A24.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 71,888 kB
  • sloc: cpp: 290,869; python: 3,626; javascript: 3,518; sh: 1,316; ansic: 703; xml: 401; php: 95; lisp: 66; makefile: 31; sed: 12
file content (156 lines) | stat: -rw-r--r-- 4,949 bytes parent folder | download | duplicates (3)
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
/*
    SPDX-FileCopyrightText: 2007-2008 Hamish Rodda <rodda@kde.org>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef KDEVPLATFORM_IRUNCONTROLLER_H
#define KDEVPLATFORM_IRUNCONTROLLER_H

#include "interfacesexport.h"

#include <KJobTrackerInterface>

class KJob;

namespace KDevelop
{
class IProject;
class ILaunchMode;
class ILaunchConfiguration;
class LaunchConfigurationType;

/**
 * The main controller for running processes.
 */
class KDEVPLATFORMINTERFACES_EXPORT IRunController : public KJobTrackerInterface
{
    Q_OBJECT

public:
    ///Constructor.
    explicit IRunController(QObject *parent);

    /**
     * Interrogate the current managed jobs
     */
    virtual QList<KJob*> currentJobs() const = 0;

    /**
     * An enumeration of the possible states for the run controller.
     */
    enum State {
        Idle     /**< No processes are currently running */,
        Running  /**< processes are currently running */
    };
    Q_ENUM(State)

    /**
     * Get a list of all launch modes that the app knows
     * @returns a list of registered launch modes
     */
    virtual QList<ILaunchMode*> launchModes() const = 0;

    /**
     * Get a list of all available launch configurations
     */
    virtual QList<ILaunchConfiguration*> launchConfigurations() const = 0;

    /**
     * Get a specific launch mode based using its \a id
     * @param id the identifier of the launchmode to get
     * @returns launch mode for the given id or 0 if no such mode is known
     */
    virtual ILaunchMode* launchModeForId( const QString& id ) const = 0;
    
    /**
     * add @p mode to the list of registered launch modes
     * @param mode the mode to be registered
     */
    virtual void addLaunchMode( ILaunchMode* mode ) = 0;
    
    /**
     * remove @p mode from the list of registered launch modes
     * @param mode the mode to be unregistered
     */
    virtual void removeLaunchMode( ILaunchMode* mode ) = 0;

    /**
     * Get a list of all configuration types that are registered
     * @returns a list of run configuration types
     */
    virtual QList<LaunchConfigurationType*> launchConfigurationTypes() const = 0;

    
    /**
     * Adds @p type to the list of known run config types
     * @param type the new run configuration type
     */
    virtual void addConfigurationType( LaunchConfigurationType* type ) = 0;

    /**
     * Removes @p type from the list of known run config types
     * @param type run configuration type that should be removed
     */
    virtual void removeConfigurationType( LaunchConfigurationType* type ) = 0;
    
    /**
     * Executes the default launch in the given mode
     * @param runMode the launch mode to start with
     */
    virtual void executeDefaultLaunch( const QString& runMode ) = 0;

    virtual KJob* execute(const QString& launchMode, ILaunchConfiguration* launch) = 0;

    /**
     * tries to find a launch config type for the given @p id
     * @param id the id of the launch configuration type to search
     * @returns the launch configuration type if found, or 0 otherwise
     */
    virtual LaunchConfigurationType* launchConfigurationTypeForId( const QString& id ) = 0;
    
    /**
     * Creates a new launch configuration in the given project or in the session if no project
     * was provided using the given launch configuration type and launcher. The configuration 
     * is also added to the list of configurations in the runcontroller.
     * 
     * @param type the launch configuration type to be used for the new config
     * @param launcher the mode and id of the launcher to be used in the config
     * @param project the project in which the launch configuration should be stored
     * @param name the name of the new launch configuration, if this is empty a new default name will be generated
     * @returns a new launch configuration
     */
    virtual ILaunchConfiguration* createLaunchConfiguration( LaunchConfigurationType* type,
                                                             const QPair<QString,QString>& launcher,
                                                             KDevelop::IProject* project = nullptr,
                                                             const QString& name = QString() ) = 0;

    /// Opens a dialog to setup new launch configurations, or to change the existing ones.
    virtual void showConfigurationDialog() const = 0;

public Q_SLOTS:
    /**
     * Request for all running processes to be killed.
     */
    virtual void stopAllProcesses() = 0;

Q_SIGNALS:
    /**
     * Notify that the state of the run controller has changed to \a {state}.
     */
    void runStateChanged(State state);

    /**
     * Notify that a new job has been registered.
     */
    void jobRegistered(KJob* job);

    /**
     * Notify that a job has been unregistered.
     */
    void jobUnregistered(KJob* job);
};

}

#endif // KDEVPLATFORM_IRUNCONTROLLER_H