analyzerruncontrol.h 2.82 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
Mike McQuaid's avatar
Mike McQuaid committed
2
**
3
** Copyright (C) 2016 The Qt Company Ltd.
Mike McQuaid's avatar
Mike McQuaid committed
4
** Author: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
5
** Contact: https://www.qt.io/licensing/
Mike McQuaid's avatar
Mike McQuaid committed
6
**
hjk's avatar
hjk committed
7
** This file is part of Qt Creator.
Mike McQuaid's avatar
Mike McQuaid committed
8
**
hjk's avatar
hjk committed
9 10 11 12
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
13 14 15
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
Mike McQuaid's avatar
Mike McQuaid committed
16
**
17 18 19 20 21 22 23
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Mike McQuaid's avatar
Mike McQuaid committed
24
**
hjk's avatar
hjk committed
25
****************************************************************************/
Mike McQuaid's avatar
Mike McQuaid committed
26 27 28 29

#ifndef ANALYZERRUNCONTROL_H
#define ANALYZERRUNCONTROL_H

30
#include "analyzerstartparameters.h"
Mike McQuaid's avatar
Mike McQuaid committed
31 32

#include <projectexplorer/runconfiguration.h>
33
#include <projectexplorer/runnables.h>
Mike McQuaid's avatar
Mike McQuaid committed
34

35
#include <utils/outputformat.h>
Mike McQuaid's avatar
Mike McQuaid committed
36

37 38 39 40 41 42 43
namespace Analyzer {

/**
 * An AnalyzerRunControl instance handles the launch of an analyzation tool.
 *
 * It gets created for each launch and deleted when the launch is stopped or ended.
 */
hjk's avatar
hjk committed
44
class ANALYZER_EXPORT AnalyzerRunControl : public ProjectExplorer::RunControl
Mike McQuaid's avatar
Mike McQuaid committed
45 46 47 48
{
    Q_OBJECT

public:
hjk's avatar
hjk committed
49 50 51
    AnalyzerRunControl(ProjectExplorer::RunConfiguration *runConfiguration,
        Core::Id runMode);

52 53 54 55 56 57 58 59 60 61
    /// Start analyzation process.
    virtual bool startEngine() = 0;
    /// Trigger async stop of the analyzation process.
    virtual void stopEngine() = 0;

    /// Controller actions.
    virtual bool canPause() const { return false; }
    virtual void pause() {}
    virtual void unpause() {}

62
    const ProjectExplorer::StandardRunnable &runnable() const;
hjk's avatar
hjk committed
63
    const AnalyzerConnection &connection() const;
64 65

    virtual void notifyRemoteSetupDone(quint16) {}
66
    virtual void notifyRemoteFinished() {}
67

68
    // ProjectExplorer::RunControl
Mike McQuaid's avatar
Mike McQuaid committed
69 70 71 72
    void start();
    StopResult stop();
    bool isRunning() const;

73 74
public slots:
    virtual void logApplicationMessage(const QString &, Utils::OutputFormat) {}
Aurindam Jana's avatar
Aurindam Jana committed
75

Mike McQuaid's avatar
Mike McQuaid committed
76
private slots:
hjk's avatar
hjk committed
77
    void stopIt();
78
    void runControlFinished();
Mike McQuaid's avatar
Mike McQuaid committed
79

80 81
signals:
    /// Must be emitted when the engine is starting.
hjk's avatar
hjk committed
82
    void starting();
Mike McQuaid's avatar
Mike McQuaid committed
83 84

private:
85
    bool supportsReRunning() const { return false; }
86 87 88

protected:
    bool m_isRunning;
Mike McQuaid's avatar
Mike McQuaid committed
89 90 91 92
};
} // namespace Analyzer

#endif // ANALYZERRUNCONTROL_H