summaryrefslogtreecommitdiff
path: root/src/plugins/projectexplorer/itaskhandler.h
blob: e8164c0d19b97aa45a16f168c67985ac9edded9a (plain)
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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "projectexplorer_export.h"
#include "task.h"

#include <utils/id.h>

#include <QObject>
#include <QString>

QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE

namespace ProjectExplorer {

class PROJECTEXPLORER_EXPORT ITaskHandler : public QObject
{
    Q_OBJECT

public:
    explicit ITaskHandler(bool isMultiHandler = false);
    ~ITaskHandler() override;

    virtual bool isDefaultHandler() const { return false; }
    virtual bool canHandle(const Task &) const { return m_isMultiHandler; }
    virtual void handle(const Task &);       // Non-multi-handlers should implement this.
    virtual void handle(const Tasks &tasks); // Multi-handlers should implement this.
    virtual Utils::Id actionManagerId() const { return Utils::Id(); }
    virtual QAction *createAction(QObject *parent) const = 0;

    bool canHandle(const Tasks &tasks) const;

private:
    const bool m_isMultiHandler;
};

} // namespace ProjectExplorer