taskwindow.h 3.34 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3 4
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
7
**
hjk's avatar
hjk committed
8 9 10 11
** 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
12 13 14
** 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.
15
**
16 17 18 19 20 21 22
** 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.
con's avatar
con committed
23
**
hjk's avatar
hjk committed
24
****************************************************************************/
hjk's avatar
hjk committed
25

Tobias Hunger's avatar
Tobias Hunger committed
26
#pragma once
con's avatar
con committed
27

28
#include <coreplugin/id.h>
29
#include <coreplugin/ioutputpane.h>
con's avatar
con committed
30

31
QT_BEGIN_NAMESPACE
32
class QAction;
33
class QModelIndex;
34
class QPoint;
35
QT_END_NAMESPACE
con's avatar
con committed
36

37
namespace ProjectExplorer {
dt's avatar
dt committed
38
class TaskHub;
39
class Task;
dt's avatar
dt committed
40 41

namespace Internal {
42
class TaskWindowPrivate;
43

44
// Show issues (warnings or errors) and open the editor on click.
dt's avatar
dt committed
45
class TaskWindow : public Core::IOutputPane
con's avatar
con committed
46 47 48 49
{
    Q_OBJECT

public:
50
    TaskWindow();
Tobias Hunger's avatar
Tobias Hunger committed
51
    ~TaskWindow() override;
con's avatar
con committed
52

53 54
    void delayedInitialization();

55 56 57
    int taskCount(Core::Id category = Core::Id()) const;
    int warningTaskCount(Core::Id category = Core::Id()) const;
    int errorTaskCount(Core::Id category = Core::Id()) const;
58 59

    // IOutputPane
Tobias Hunger's avatar
Tobias Hunger committed
60 61
    QWidget *outputWidget(QWidget *) override;
    QList<QWidget *> toolBarWidgets() const override;
con's avatar
con committed
62

Tobias Hunger's avatar
Tobias Hunger committed
63 64 65 66
    QString displayName() const override { return tr("Issues"); }
    int priorityInStatusBar() const override;
    void clearContents() override;
    void visibilityChanged(bool visible) override;
con's avatar
con committed
67

Tobias Hunger's avatar
Tobias Hunger committed
68 69 70
    bool canFocus() const override;
    bool hasFocus() const override;
    void setFocus() override;
con's avatar
con committed
71

Tobias Hunger's avatar
Tobias Hunger committed
72 73 74 75 76
    bool canNavigate() const override;
    bool canNext() const override;
    bool canPrevious() const override;
    void goToNext() override;
    void goToPrev() override;
77

con's avatar
con committed
78 79
signals:
    void tasksChanged();
dt's avatar
dt committed
80
    void tasksCleared();
con's avatar
con committed
81

82
private:
83
    void addCategory(Core::Id categoryId, const QString &displayName, bool visible);
dt's avatar
dt committed
84 85
    void addTask(const ProjectExplorer::Task &task);
    void removeTask(const ProjectExplorer::Task &task);
86
    void updatedTaskFileName(unsigned int id, const QString &fileName);
87
    void updatedTaskLineNumber(unsigned int id, int line);
88
    void showTask(unsigned int id);
89
    void openTask(unsigned int id);
90 91
    void clearTasks(Core::Id categoryId);
    void setCategoryVisibility(Core::Id categoryId, bool visible);
92
    void currentChanged(const QModelIndex &index);
93 94
    void saveSettings();
    void loadSettings();
dt's avatar
dt committed
95

96
    void triggerDefaultHandler(const QModelIndex &index);
97
    void actionTriggered();
98
    void setShowWarnings(bool);
99
    void updateCategoriesMenu();
con's avatar
con committed
100 101 102

    int sizeHintForColumn(int column) const;

103
    TaskWindowPrivate *d;
con's avatar
con committed
104 105
};

dt's avatar
dt committed
106 107
} // namespace Internal
} // namespace ProjectExplorer